/* ============================================================================
   MGNTION — TOKENS
   The whole system lives here. Nothing below invents a value.
   ========================================================================= */

:root {
  /* ---- SURFACE ------------------------------------------------------- */
  --void:        #050505;   /* the gates between acts — true black          */
  --ink:         #0A0908;   /* page ground — almost black, warmed           */
  --ink-2:       #0F0E0C;   /* raised panels                                */
  --ink-3:       #16140F;   /* hairline fills                               */

  /* ---- TEXT ---------------------------------------------------------- */
  --warm:        #F2EDE3;   /* primary — warm white, never #FFF             */
  --warm-2:      #B8B2A6;   /* secondary                                    */
  /* Tertiary. Lifted until it clears 4.5:1 on every ground the site paints,
     not just the page black — the lightest is FrenLoop's Voidcore tint
     #1A1726, where it lands at 4.6:1. */
  --warm-3:      #868279;
  --warm-4:      #3A3733;   /* rules & ornament ONLY. Never text: 1.7:1.    */

  /* ---- ACCENT -------------------------------------------------------- */
  --gold:        #C9A227;   /* excellence. used like a signature.           */
  --gold-lift:   #E8CE7E;   /* hover / highlight only                       */
  --gold-deep:   #6B5514;
  --red:         #9E1B1B;   /* energy. used like an alarm.                  */
  --red-lift:    #C1272D;   /* large display type only, 3.5:1               */
  /* The same red, lifted just far enough to clear 4.5:1 on the near-black
     grounds. Small text, mono labels and button copy use this; fills, rules
     and oversized display type keep --red-lift, which reads deeper. */
  --red-text:    #DC4A44;

  /* ---- RULES --------------------------------------------------------- */
  --rule:        rgba(242,237,227,0.10);
  --rule-soft:   rgba(242,237,227,0.055);
  --rule-gold:   rgba(201,162,39,0.34);

  /* ---- TYPE FAMILIES -------------------------------------------------- */
  --f-display:   'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-editorial: 'Instrument Serif', Georgia, serif;
  --f-mono:      'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --f-body:      'Archivo', 'Helvetica Neue', Arial, sans-serif;

  /* per-locale overrides are set on [data-lang] below */

  /* ---- OPTICAL CORRECTION PER SCRIPT ---------------------------------- */
  /* Latin caps, Hebrew and Arabic do not share an x-height or a rhythm.
     These three knobs retune the whole page instead of hard-coding sizes. */
  --script-scale:      1;      /* display size multiplier                   */
  --script-leading:    0.86;   /* display line-height                       */
  --script-track:      -0.035em;/* display tracking                         */
  --script-body-scale: 1;
  --script-body-lead:  1.55;
  --display-weight:    800;

  /* ---- TYPE SCALE ----------------------------------------------------- */
  /* fluid, viewport-driven, then multiplied by the script correction */
  --t-mega:  calc(clamp(3.6rem, 13.2vw, 15.5rem) * var(--script-scale));
  --t-hero:  calc(clamp(3.0rem, 10.5vw, 12.0rem) * var(--script-scale));
  --t-act:   calc(clamp(2.6rem,  8.6vw,  9.5rem) * var(--script-scale));
  --t-xl:    calc(clamp(2.0rem,  5.2vw,  5.4rem) * var(--script-scale));
  --t-lg:    calc(clamp(1.5rem,  3.0vw,  2.7rem) * var(--script-scale));
  --t-md:    calc(clamp(1.15rem, 1.5vw, 1.45rem) * var(--script-body-scale));
  --t-bd:    calc(clamp(1.0rem, 1.05vw, 1.13rem) * var(--script-body-scale));
  --t-sm:    calc(0.82rem * var(--script-body-scale));
  --t-xs:    calc(0.68rem * var(--script-body-scale));

  /* ---- SPACE ---------------------------------------------------------- */
  --gut:     clamp(1.25rem, 4vw, 4.5rem);   /* page gutter                  */
  --s-1: 0.5rem;  --s-2: 1rem;   --s-3: 1.75rem; --s-4: 3rem;
  --s-5: 5rem;    --s-6: 8rem;   --s-7: 13rem;   --s-8: 21rem;
  --act-pad: clamp(6rem, 16vh, 14rem);

  /* ---- MOTION --------------------------------------------------------- */
  /* Nothing bounces. Nothing floats. Everything decelerates like mass.     */
  --e-out:   cubic-bezier(0.16, 1, 0.30, 1);      /* the reveal curve       */
  --e-inout: cubic-bezier(0.76, 0, 0.24, 1);      /* the transition curve   */
  --e-mask:  cubic-bezier(0.22, 1, 0.36, 1);      /* the mask curve         */

  --d-fast:  360ms;
  --d-mid:   720ms;
  --d-slow:  1100ms;
  --d-heavy: 1600ms;
  --stagger: 78ms;

  /* ---- LAYOUT --------------------------------------------------------- */
  --max:     1680px;
  --nav-h:   68px;
  --logical-start: left;   /* flipped by [dir=rtl] */
  --logical-end:   right;
}

/* ============================================================================
   PER-SCRIPT TYPOGRAPHY
   Each language gets its own families AND its own optical retune.
   ========================================================================= */

[data-lang='en'] {
  --f-display:  'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-body:     'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --script-scale: 1;
  --script-leading: 0.855;
  --script-track: -0.038em;
  --script-body-lead: 1.58;
  --display-weight: 800;
}

/* Hebrew: no ascender/descender variety, so it reads larger at the same px.
   Pull the display size down, open the leading, release the tracking. */
[data-lang='he'] {
  --f-display:  'Heebo', 'Archivo', sans-serif;
  --f-body:     'Assistant', 'Heebo', sans-serif;
  --f-editorial:'Heebo', Georgia, serif;
  --script-scale: 0.90;
  --script-leading: 0.95;
  --script-track: -0.022em;
  --script-body-scale: 1.05;
  --script-body-lead: 1.66;
  --display-weight: 900;
}

/* Arabic: connected script with real ascenders and deep descenders.
   Needs the most vertical room of the three and no negative tracking, ever. */
[data-lang='ar'] {
  --f-display:  'Noto Kufi Arabic', 'IBM Plex Sans Arabic', sans-serif;
  --f-body:     'IBM Plex Sans Arabic', sans-serif;
  --f-editorial:'IBM Plex Sans Arabic', serif;
  --script-scale: 0.82;
  --script-leading: 1.24;
  --script-track: 0;
  --script-body-scale: 1.02;
  --script-body-lead: 1.85;
  --display-weight: 800;
}

/* Latin product names, codes and specs stay Latin inside RTL text. */
.lat { font-family: var(--f-display); direction: ltr; unicode-bidi: isolate; }
.mono, .lat-mono { font-family: var(--f-mono); direction: ltr; unicode-bidi: isolate; }

[dir='rtl'] { --logical-start: right; --logical-end: left; }

/* ---- REDUCED MOTION -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --d-fast: 1ms; --d-mid: 1ms; --d-slow: 1ms; --d-heavy: 1ms; --stagger: 0ms;
  }
}
