/* ==========================================================================
   TIKI DESIGN SYSTEM — BASE
   Reset, typography, focus behaviour, layout primitives, utilities.
   Loads after tiki-tokens.css and after Bootstrap.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Offset in-page anchors by the sticky header so a jump target is not
     hidden underneath it. */
  scroll-padding-top: calc(var(--tiki-header-height) + var(--tiki-space-4));
}

body {
  margin: 0;
  background: var(--tiki-bg);
  color: var(--tiki-text);
  font-family: var(--tiki-font-sans);
  font-size: var(--tiki-text-md);
  line-height: var(--tiki-leading-normal);
  font-weight: var(--tiki-weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  /* Guards against a single long word (an untranslated slug, a URL in
     user content) forcing a horizontal scrollbar on 320px screens. */
  overflow-wrap: break-word;
}

img,
svg,
video { max-width: 100%; height: auto; display: block; }

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--tiki-space-3);
  color: var(--tiki-text-strong);
  font-weight: var(--tiki-weight-bold);
  line-height: var(--tiki-leading-tight);
  letter-spacing: var(--tiki-tracking-tight);
}

h1, .tiki-h1 { font-size: var(--tiki-text-3xl); }
h2, .tiki-h2 { font-size: var(--tiki-text-2xl); }
h3, .tiki-h3 { font-size: var(--tiki-text-xl); }
h4, .tiki-h4 { font-size: var(--tiki-text-lg); }
h5, .tiki-h5 { font-size: var(--tiki-text-md); }
h6, .tiki-h6 { font-size: var(--tiki-text-sm); }

p { margin: 0 0 var(--tiki-space-4); }
p:last-child { margin-bottom: 0; }

/* Display sizes — the editorial voice of the public site.
   clamp() lets the hero scale continuously instead of stepping at
   breakpoints, which is what keeps 360px and 1440px both looking composed. */
.tiki-display {
  font-size: clamp(2.25rem, 6.2vw, var(--tiki-text-6xl));
  font-weight: var(--tiki-weight-extra);
  line-height: 1.02;
  letter-spacing: var(--tiki-tracking-tighter);
  color: var(--tiki-text-strong);
  margin: 0;
}

.tiki-display-sm {
  font-size: clamp(1.75rem, 4vw, var(--tiki-text-4xl));
  font-weight: var(--tiki-weight-extra);
  line-height: 1.08;
  letter-spacing: var(--tiki-tracking-tighter);
  margin: 0;
}

.tiki-lead {
  font-size: var(--tiki-text-lg);
  line-height: var(--tiki-leading-relaxed);
  color: var(--tiki-text-muted);
  font-weight: var(--tiki-weight-regular);
}

.tiki-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--tiki-space-2);
  font-size: var(--tiki-text-xs);
  font-weight: var(--tiki-weight-bold);
  letter-spacing: var(--tiki-tracking-caps);
  text-transform: uppercase;
  color: var(--tiki-accent);
  margin-bottom: var(--tiki-space-3);
}

.tiki-muted   { color: var(--tiki-text-muted); }
.tiki-subtle  { color: var(--tiki-text-subtle); }
.tiki-strong  { color: var(--tiki-text-strong); font-weight: var(--tiki-weight-semibold); }
.tiki-num     { font-variant-numeric: tabular-nums; }

a {
  color: var(--tiki-accent-hover);
  text-decoration: none;
  transition: color var(--tiki-duration-fast) var(--tiki-ease);
}
a:hover { color: var(--tiki-accent-active); }

/* --------------------------------------------------------------------------
   Focus
   A visible focus ring is not optional. :focus-visible keeps it off for
   mouse users while guaranteeing it for keyboard users.
   -------------------------------------------------------------------------- */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--tiki-accent);
  outline-offset: 2px;
  border-radius: var(--tiki-radius-xs);
}

.tiki-skip-link {
  position: absolute;
  /* Logical, not `left`: in Arabic the first thing a keyboard user reaches
     should appear where reading starts, which is the right-hand edge. */
  inset-inline-start: var(--tiki-space-4);
  top: -100px;
  z-index: var(--tiki-z-toast);
  padding: var(--tiki-space-3) var(--tiki-space-5);
  background: var(--tiki-navy-800);
  color: var(--tiki-white);
  border-radius: var(--tiki-radius-sm);
  font-weight: var(--tiki-weight-semibold);
  transition: top var(--tiki-duration-base) var(--tiki-ease);
}
.tiki-skip-link:focus { top: var(--tiki-space-4); color: var(--tiki-white); }

.tiki-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.tiki-container {
  width: 100%;
  max-width: var(--tiki-container);
  margin-inline: auto;
  padding-inline: var(--tiki-gutter);
}
.tiki-container--wide   { max-width: var(--tiki-container-wide); }
.tiki-container--narrow { max-width: var(--tiki-container-narrow); }

.tiki-section { padding-block: var(--tiki-section-y); }
.tiki-section--tight { padding-block: calc(var(--tiki-section-y) * 0.6); }
.tiki-section--subtle { background: var(--tiki-bg-subtle); }

/* ==========================================================================
   Dark band
   --------------------------------------------------------------------------
   A page that is white from top to bottom has no rhythm; the eye has nothing
   to measure distance by and every section reads as the same weight.

   Used once per page at most, and earned rather than decorative: it marks
   the one rail whose content is genuinely urgent. Navy carries it, because
   the palette's rule is that coral means "do this" — a coral band would
   shout with nothing to act on.
   ========================================================================== */
.tiki-section--dark {
  background: var(--tiki-navy-900);
  color: var(--tiki-navy-100);
}
.tiki-section--dark .tiki-section-head__title { color: var(--tiki-white); }
.tiki-section--dark .tiki-section-head__sub   { color: var(--tiki-navy-300); }
.tiki-section--dark .tiki-eyebrow             { color: var(--tiki-coral-400); }

.tiki-section--dark .tiki-section-head__link {
  color: var(--tiki-white);
  border-color: rgba(255, 255, 255, 0.22);
}
.tiki-section--dark .tiki-section-head__link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.38);
}

/* Cards keep their own light surface: inverting them too would turn the
   band into a second theme to maintain, and the covers would lose contrast
   against it. */

/* Section header: title left, "voir tout" right, aligned on the baseline. */
.tiki-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--tiki-space-4);
  margin-bottom: var(--tiki-space-6);
}
.tiki-section-head__title {
  margin: 0;
  font-size: var(--tiki-display-sm);
  font-weight: var(--tiki-weight-extra);
  line-height: var(--tiki-leading-tight);
  letter-spacing: var(--tiki-tracking-tight);
}
[lang="ar"] .tiki-section-head__title { letter-spacing: 0; line-height: var(--tiki-leading-snug); }
.tiki-section-head__sub {
  margin: var(--tiki-space-1) 0 0;
  color: var(--tiki-text-muted);
  font-size: var(--tiki-text-md);
}
.tiki-section-head__link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--tiki-space-1);
  font-size: var(--tiki-text-sm);
  font-weight: var(--tiki-weight-semibold);
  color: var(--tiki-text-muted);
  white-space: nowrap;
}
.tiki-section-head__link:hover { color: var(--tiki-accent); }
.tiki-section-head__link .tiki-icon {
  transition: transform var(--tiki-duration-fast) var(--tiki-ease);
}
.tiki-section-head__link:hover .tiki-icon { transform: translateX(3px); }

/* Responsive card grid. auto-fill + minmax means the column count follows
   the available width instead of a breakpoint ladder. */
.tiki-grid {
  display: grid;
  gap: var(--tiki-space-6) var(--tiki-space-5);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tiki-grid--2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.tiki-grid--4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Horizontal scroll rail used for card sections on small screens.
   Scroll snapping makes it feel deliberate rather than like an overflow bug. */
.tiki-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: var(--tiki-space-5);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-block-end: var(--tiki-space-2);
  /* Bleed to the viewport edge so cards run off-screen instead of stopping
     at a container edge, which reads as "there is more". */
  margin-inline: calc(var(--tiki-gutter) * -1);
  padding-inline: var(--tiki-gutter);
  scrollbar-width: thin;
}
.tiki-rail > * { scroll-snap-align: start; }
.tiki-rail::-webkit-scrollbar { height: 6px; }
.tiki-rail::-webkit-scrollbar-thumb {
  background: var(--tiki-slate-300);
  border-radius: var(--tiki-radius-pill);
}
.tiki-rail::-webkit-scrollbar-track { background: transparent; }

@media (min-width: 992px) {
  /* Above lg the rail becomes a normal grid — no horizontal scrolling on
     desktop, where it would be an anti-pattern. */
  .tiki-rail--desktop-grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, 1fr);
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

.tiki-stack   { display: flex; flex-direction: column; gap: var(--tiki-space-4); }
.tiki-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tiki-space-2); }
.tiki-divider { height: 1px; background: var(--tiki-border); border: 0; margin-block: var(--tiki-space-6); }

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */
.tiki-icon {
  width: 1.125em;
  height: 1.125em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}
.tiki-icon--sm { width: 1em;    height: 1em; }
.tiki-icon--lg { width: 1.5em;  height: 1.5em; }
.tiki-icon--xl { width: 2rem;   height: 2rem; }
.tiki-icon--filled { fill: currentColor; stroke: none; }

/* --------------------------------------------------------------------------
   Utilities (only what is genuinely reused; Bootstrap covers the rest)
   -------------------------------------------------------------------------- */
.tiki-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Multi-line clamp — keeps card titles to a fixed height so a grid row
   does not stagger when one title is longer than the others. */
.tiki-clamp-1,
.tiki-clamp-2,
.tiki-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tiki-clamp-1 { -webkit-line-clamp: 1; }
.tiki-clamp-2 { -webkit-line-clamp: 2; }
.tiki-clamp-3 { -webkit-line-clamp: 3; }

.tiki-no-scroll { overflow: hidden; }

/* --------------------------------------------------------------------------
   Responsive rhythm
   Sections and gutters tighten as the viewport narrows, so a phone does not
   waste a third of the screen on vertical padding.
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  :root { --tiki-section-y: 3.25rem; }
}

@media (max-width: 575.98px) {
  :root {
    --tiki-section-y: 2.5rem;
    --tiki-gutter: 1rem;
  }

  .tiki-section-head { align-items: flex-start; }
  .tiki-section-head__title { font-size: var(--tiki-text-xl); }
  .tiki-grid { grid-template-columns: 1fr; gap: var(--tiki-space-4); }
}

/* Touch targets: 44px is the accessibility floor for a tappable control. */
@media (pointer: coarse) {
  .tiki-btn,
  .tiki-icon-btn,
  .tiki-nav__link { min-height: 44px; }
}

/* --------------------------------------------------------------------------
   Print — used for tickets and invoices
   -------------------------------------------------------------------------- */
@media print {
  .tiki-header,
  .tiki-footer,
  .tiki-no-print { display: none !important; }

  body { background: #fff; color: #000; }
  .tiki-card { box-shadow: none; border: 1px solid #ccc; }
}
