/* Aurora (decision MO1, 3 Dec 2026): hero "aurora", cards "glass", projects "rail" and motion "scroll".
   Loaded only by a style that uses one of them (layouts/base.njk). Colours come from the tokens, so a client's own
   palette carries straight through. Motion is tied to the visitor's own scrolling, never plays by itself, never loops,
   and runs only where the browser supports scroll animations and the visitor has not asked for less motion:
   without them the page is still and complete. Text keeps its contrast at every step (no fades to transparent). */

/* ---------- Hero: a glow of the brand's colours, a lit sphere, the picture in a tilted glass frame ---------- */
.hero--aurora { position: relative; overflow: clip; isolation: isolate; }
.hero--aurora::before {
  /* Pinned to the hero's own edges: its top-left corner never moves when the hero's height changes (layout shift). */
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background:
    radial-gradient(38% 42% at 18% 28%, color-mix(in oklab, var(--color-primary) 34%, transparent), transparent 72%),
    radial-gradient(32% 38% at 88% 18%, color-mix(in oklab, var(--color-accent) 24%, transparent), transparent 72%),
    radial-gradient(46% 40% at 62% 96%, color-mix(in oklab, var(--color-primary) 20%, transparent), transparent 72%);
}
.hero--aurora .hero__inner { gap: var(--space-12); }
/* The title's measure is set in ch only on wide screens, where the picture beside it sets the row's height: a ch is the
   width of the font's "0", which changes when the web font replaces its fallback, and on a phone that would move the page. */
.hero--aurora .hero__title { font-size: var(--text-h1-size); text-wrap: balance; }
/* Readex Pro's Arabic letters stand taller than its Latin: Arabic headings get more room between lines. This file loads
   only for an Aurora-based site, so the rule stays with the style. */
:lang(ar) :is(h1, h2, h3, .hero__title, .cta-band__title) { line-height: var(--text-h3-line); }
.hero--aurora .hero__lede { text-wrap: pretty; }
.hero--aurora .hero__media { position: relative; perspective: 1400px; }
.hero--aurora .hero__media img {
  aspect-ratio: 4 / 3; object-fit: cover;
  border: var(--border-1) solid color-mix(in oklab, var(--color-ink) 16%, transparent);
  box-shadow: var(--shadow-2);
}
/* The sphere: one radial light, no picture file, sitting behind the frame. */
.hero--aurora .hero__media::before {
  content: ""; position: absolute; z-index: -1; inline-size: 44%; aspect-ratio: 1; inset-inline-start: -16%; inset-block-end: -14%;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 32% 28%,
    color-mix(in oklab, var(--color-primary-strong) 40%, var(--color-ink)) 0 3%,
    var(--color-primary-strong) 12%, var(--color-primary) 34%,
    color-mix(in oklab, var(--color-primary) 45%, var(--color-surface-100)) 62%,
    var(--color-surface-100) 100%);
}
.hero--aurora .hero__media::after {
  content: ""; position: absolute; z-index: -1; inline-size: 14%; aspect-ratio: 1; inset-inline-end: -5%; inset-block-start: -7%;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--color-accent) 55%, var(--color-ink)) 0 4%, var(--color-accent) 30%, color-mix(in oklab, var(--color-accent) 30%, var(--color-surface-100)) 75%);
}
/* On a phone the business name is set smaller: Readex Pro is a wide face, and a long name at heading size would push
   the menu button onto a second line, then pull it back when the font arrives (layout shift; Promise line 2). */
@media (max-width: 30rem) {
  .brand { font-size: var(--text-body-size); line-height: var(--text-body-line); }
}
/* On a phone the framed picture comes first, so when the heading font arrives and the text re-wraps, little on screen
   sits below the text to be pushed. */
@media (max-width: 47.99rem) {
  .hero--aurora .hero__media { order: -1; }
}
@media (min-width: 48rem) {
  .hero--aurora .hero__inner { grid-template-columns: 6fr 5fr; }
  .hero--aurora .hero__title { max-inline-size: 18ch; }
  .hero--aurora .hero__media img { aspect-ratio: 4 / 5; transform: rotateY(-9deg) rotateX(4deg); transform-origin: 30% 50%; }
  [dir="rtl"] .hero--aurora .hero__media img { transform: rotateY(9deg) rotateX(4deg); transform-origin: 70% 50%; }
}

/* ---------- Glass cards: a lit top edge on a clear panel; the brand's glow on hover ---------- */
[data-cards="glass"] .card {
  background: linear-gradient(180deg, color-mix(in oklab, var(--color-ink) 7%, var(--color-surface-100)), var(--color-surface-100) 70%);
  border-color: color-mix(in oklab, var(--color-ink) 12%, transparent);
}
[data-cards="glass"] .section--alt .card {
  background: linear-gradient(180deg, color-mix(in oklab, var(--color-ink) 7%, var(--color-surface-200)), var(--color-surface-200) 70%);
}
[data-cards="glass"] .card:hover {
  border-color: color-mix(in oklab, var(--color-primary) 55%, transparent);
  box-shadow: var(--shadow-2);
}

/* ---------- Rail: the work in one row that scrolls sideways, each picture tall ---------- */
/* The rail reaches into the page's side margin, where the pictures fade out, so a picture cut by the edge reads as
   "more this way" while the first one at rest lines up with the text. */
.projects--rail {
  grid-template-columns: none;
  margin-inline: calc(var(--space-4) * -1); padding-inline: var(--space-4); scroll-padding-inline: var(--space-4);
  mask-image: linear-gradient(to right, transparent, var(--color-ink) var(--space-4), var(--color-ink) calc(100% - var(--space-4)), transparent);
  grid-auto-flow: column; grid-auto-columns: min(82%, 24rem);
  gap: var(--space-6); overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-block: var(--space-1) var(--space-4); scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--color-ink) 30%, transparent) transparent;
}
.projects--rail > li { scroll-snap-align: start; }
.projects--rail img {
  aspect-ratio: 4 / 5;
  border: var(--border-1) solid color-mix(in oklab, var(--color-ink) 12%, transparent);
}
.projects--rail:focus-visible { outline: var(--focus-ring) solid var(--color-primary); outline-offset: var(--space-1); border-radius: var(--radius-card); }

/* ---------- Motion "scroll": the page tells its story as the visitor scrolls ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Reasons stack: each one holds near the top while the next slides over it (wide screens; phones keep a plain list). */
  @media (min-width: 48rem) {
    [data-motion="scroll"] .statements { grid-template-columns: 1fr; gap: var(--space-8); max-inline-size: 48rem; }
    [data-motion="scroll"] .statements li {
      position: sticky; inset-block-start: calc(var(--space-8) + var(--stack, 0) * 1.25rem);
      background: linear-gradient(180deg, color-mix(in oklab, var(--color-ink) 7%, var(--color-surface-200)), var(--color-surface-200) 75%);
      border: var(--border-1) solid color-mix(in oklab, var(--color-ink) 12%, transparent);
      border-radius: var(--radius-card); padding: var(--space-8); box-shadow: var(--shadow-2);
    }
    [data-motion="scroll"] .section:not(.section--alt) .statements li {
      background: linear-gradient(180deg, color-mix(in oklab, var(--color-ink) 7%, var(--color-surface-100)), var(--color-surface-100) 75%);
    }
    [data-motion="scroll"] .statements li:nth-child(2) { --stack: 1; }
    [data-motion="scroll"] .statements li:nth-child(3) { --stack: 2; }
    [data-motion="scroll"] .statements li:nth-child(4) { --stack: 3; }
    [data-motion="scroll"] .statements li:nth-child(n + 5) { --stack: 4; }
  }

  @supports (animation-timeline: view()) {
    /* The glow drifts and the framed picture straightens as the page leaves the opening. */
    [data-motion="scroll"] .hero--aurora::before { animation: aurora-glow both; animation-timeline: scroll(root); animation-range: 0 100vh; }
    @keyframes aurora-glow { to { translate: 0 14%; scale: 1.08; } }
    @media (min-width: 48rem) {
      [data-motion="scroll"] .hero--aurora .hero__media img { animation: aurora-straighten both; animation-timeline: scroll(root); animation-range: 0 80vh; }
      @keyframes aurora-straighten { to { transform: rotateY(0deg) rotateX(0deg) translateY(-1.5rem); } }
      [data-motion="scroll"] .hero--aurora .hero__media::before { animation: aurora-orb both; animation-timeline: scroll(root); animation-range: 0 80vh; }
      @keyframes aurora-orb { to { translate: -12% 18%; } }
      [dir="rtl"][data-motion="scroll"] .hero--aurora .hero__media::before { animation-name: aurora-orb-rtl; }
      @keyframes aurora-orb-rtl { to { translate: 12% 18%; } }
    }

    /* A section's lede lights up from the muted text colour to full as it comes into view (both pass contrast). */
    [data-motion="scroll"] .section-head .lede,
    [data-motion="scroll"] .statements p { animation: aurora-light both; animation-timeline: view(); animation-range: entry 10% cover 45%; }
    @keyframes aurora-light { from { color: var(--color-ink-muted); } to { color: var(--color-ink); } }

    /* Cards rise into place as they arrive. */
    [data-motion="scroll"] .card-grid > li { animation: aurora-rise both; animation-timeline: view(); animation-range: entry 0% entry 90%; }
    @keyframes aurora-rise { from { transform: translateY(2.5rem) scale(0.96); } }

    /* The rail moves sideways while the page scrolls down; it still scrolls by touch, wheel or keys. */
    [data-motion="scroll"] .projects--rail { view-timeline: --aurora-rail block; }
    [data-motion="scroll"] .projects--rail > li { animation: aurora-rail both; animation-timeline: --aurora-rail; animation-range: entry 0% exit 100%; }
    @keyframes aurora-rail { from { transform: translateX(12%); } to { transform: translateX(-12%); } }
    [dir="rtl"][data-motion="scroll"] .projects--rail > li { animation-name: aurora-rail-rtl; }
    @keyframes aurora-rail-rtl { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
  }
}
