/* ==========================================================================
   LOOPS DESIGN TOKENS
   Source of truth for every value in the site. Nothing outside this file
   declares a colour, a radius, a duration or a type step.

   Light is the base. Dark redefines the same token names, once under
   prefers-color-scheme for viewers on system, and once under
   [data-theme="dark"] so an explicit toggle wins in both directions.

   Mirrors: DESIGN.md tables, and the Loops Color / Loops Scale variable
   collections in Figma. Change all three in one commit.
   ========================================================================== */

/* Geist is self-hosted from /fonts. The CSP in staticwebapp.config.json sets
   font-src 'self', so the Google Fonts import this file shipped with would be
   blocked in production. Weights are 400 and 500 only, per DESIGN.md. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light;
  interpolate-size: allow-keywords;   /* lets an FAQ panel animate to height auto */

  /* ---- surfaces ---- */
  --canvas:      #FAF9F6;
  --surface:     #FFFFFF;
  --inset:       #F2F0EB;
  --rule:        #E5E2DA;
  --rule-2:      #D2CEC4;

  /* ---- text ---- */
  --ink:         #0B0B0A;
  --ink-2:       #57554F;
  --ink-3:       #6E6C65;   /* Figma ink/500 */
  --on-ink:      #FAF9F6;

  /* ---- action. Ink, never a hue. ---- */
  --ink-hover:   #2A2926;

  /* ---- accent. Five permitted uses, see CLAUDE.md. ---- */
  --accent:      #0B7A6B;
  --accent-wash: #E4F0ED;
  --accent-deep: #095F54; /* the hero cycle's outcome figure: accent, dark enough for display text on the wash */
  --accent-edge: #0B7A6B4D; /* Figma color/accent-edge, verdigris 30%. The panel dot texture, nothing else */


  /* ---- verdicts. Pills and verdict rows only. ---- */
  --miss:        #B3402F;
  --partial:     #8A6512;

  /* ---- type ---- */
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-display-xl: 56px;  --leading-display-xl: 0.96;  --tracking-display-xl: -2.24px;
  --text-display-l:  42px;  --leading-display-l:  1.00;  --tracking-display-l:  -1.13px;
  --text-heading-l:  32px;  --leading-heading-l:  1.15;  --tracking-heading-l:  -0.64px;
  --text-heading-m:  24px;  --leading-heading-m:  1.19;  --tracking-heading-m:  -0.29px;
  --text-heading-s:  20px;  --leading-heading-s:  1.20;  --tracking-heading-s:  -0.22px;
  --text-subheading: 18px;  --leading-subheading: 1.20;  --tracking-subheading: -0.18px;
  --text-body-l:     16px;  --leading-body-l:     1.33;  --tracking-body-l:     -0.18px;
  --text-body-m:     14px;  --leading-body-m:     1.50;  --tracking-body-m:     -0.14px;
  --text-label:      14px;  --leading-label:      1.25;  --tracking-label:      -0.14px;
  --text-label-sm:   13px;   /* Small button label, from the v2 button spec */
  --text-label-lg:   15px;   /* Large button label, from the v2 button spec */
  --text-caption:    12px;  --leading-caption:    1.20;  --tracking-caption:     0.12px;
  --text-mono:       12px;  --leading-mono:       1.30;  --tracking-mono:        0px;
  --leading-prose:   1.6;   /* long-form reading: a blog post's body, never UI copy */
  --text-eyebrow:    10px;  --leading-eyebrow:    1.20;  --tracking-eyebrow:     2px;

  /* ---- space ---- */
  --space-2:  2px;   --space-4:  4px;   --space-6:  6px;   --space-8:  8px;   --space-10: 10px;
  --space-12: 12px;  --space-16: 16px;  --space-20: 20px;  --space-24: 24px;
  --space-32: 32px;  --space-40: 40px;  --space-64: 64px;

  /* ---- radius. Anything you act on is square. ---- */
  --r-button: 0px;
  --r-input:  0px;
  --r-icon:   4px;
  --r-tag:    4px;
  --r-card:   0px;    /* cards and panels are square: max radius is 4 */
  --r-media:  0px;    /* video and image panels butt against the frame rules */

  /* ---- layout ---- */
  --max:    1400px;   /* Figma layout/max */
  --nav-h:  58px;     /* the sticky nav row; the hero fills the viewport below it */

  /* ---- control heights. A scale of its own, separate from spacing.
     Figma Loops Scale control/sm, control/md, control/lg. ---- */
  --btn-h-sm: 36px;   /* dense rows, the nav action */
  --btn-h-md: 44px;   /* the default; clears the 44px touch target */
  --btn-h-lg: 52px;   /* the hero primary and the closing CTA only */
  --faq-row-h: 68px;  /* an FAQ question row, minimum */
  --gutter: clamp(20px, 4vw, 44px);
  --bay:    clamp(40px, 4.5vw, 64px);
  /* Vertical rhythm. Every section's top and bottom padding, and the opening
     block of every page. Both scale with --bay, so they stay in step with it. */
  --sec-y:  calc(var(--bay) * 1.5);   /* 60 to 96: a section */
  --hero-y: calc(var(--bay) * 1.25);  /* 50 to 80: a page's opening block */

  /* ---- measure. The only text max-widths. ---- */
  --measure-lead:    54ch;
  --measure-body:    66ch;
  --measure-caption: 28ch;

  /* ---- motion. Every animated thing reads from here (DESIGN.md, Motion).
     Durations climb with the size of the thing that moves; easings are
     chosen by intent. ---- */
  --dur-fast:  150ms;   /* hover, focus, colour                   */
  --dur-base:  240ms;   /* state change, accordion, small moves   */
  --dur-enter: 600ms;   /* an element arriving                    */
  --dur-land:  720ms;   /* a large surface arriving               */

  --ease-standard: cubic-bezier(.2, 0, 0, 1);     /* state changes            */
  --ease-enter:    cubic-bezier(.65, 0, .35, 1);  /* in-out, the house curve  */
  --ease-exit:     cubic-bezier(.4, 0, 1, 1);     /* leaving, accelerates     */

  --step:       100ms;  /* stagger cadence, uniform               */
  --step-tight: 60ms;   /* dense lists and table rows             */

  --travel:    28px;    /* default entry travel                   */
  --travel-sm: 16px;    /* labels, small rows                     */
  --travel-lg: 48px;    /* section-scale blocks                   */
  --zoom-from: 1.06;    /* large surfaces land by scale, not travel */

  --dur-breathe: 2400ms; /* one breath of an ambient live dot: slow enough to read as idle */

  --step-dot:   30ms;   /* dots in flight: a cadence dense enough for a swarm; 12 of them cap at 360ms */

  --decode-char: 300ms; /* one character settling                 */
  --decode-step: 40ms;  /* between characters                     */

  /* legacy names. The transition layer reads these and is correct as it
     stands, so their values do not move during the rollout. */
  --fast: var(--dur-fast);
  --base: var(--dur-base);
  --slow: 640ms;        /* figures counting up                    */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ticker: 40s;   /* one loop of the partner logo ticker; the only continuous motion */

  /* ---- hero cycle geometry. Every height in the graphic derives from these
     three, so the collapse maths stays honest (DESIGN.md, Hero Cycle). ---- */
  --areaH:  447px;   /* with this site's 123px of chrome, the card is the reference's 740 x 570 */
  --fieldH: 200px;
  --rulesH: 292px;
}
@media (max-width: 640px) {
  :root { --areaH: 392px; --fieldH: 130px; --rulesH: 238px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas:      #0A0A09;
    --surface:     #121211;
    --inset:       #1B1B19;
    --rule:        #242421;
    --rule-2:      #3A3A35;
    --ink:         #FAF9F6;
    --ink-2:       #B4B4B2;
    --ink-3:       #868684;
    --on-ink:      #0B0B0A;
    --ink-hover:   #E5E2DA;
    --accent:      #45DCC4;
    --accent-wash: #0C2320;
    --accent-deep: #7BDCCB;
    --accent-edge: #45DCC43D; /* verdigris 24% */
    --miss:        #E08877;
    --partial:     #D8B45E;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas:      #0A0A09;
  --surface:     #121211;
  --inset:       #1B1B19;
  --rule:        #242421;
  --rule-2:      #3A3A35;
  --ink:         #FAF9F6;
  --ink-2:       #B4B4B2;
  --ink-3:       #868684;
  --on-ink:      #0B0B0A;
  --ink-hover:   #E5E2DA;
  --accent:      #45DCC4;
  --accent-wash: #0C2320;
  --accent-deep: #7BDCCB;
  --accent-edge: #45DCC43D; /* verdigris 24% */
  --miss:        #E08877;
  --partial:     #D8B45E;
}

/* ==========================================================================
   BASE
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-body-l);
  line-height: var(--leading-body-l);
  letter-spacing: var(--tracking-body-l);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

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

/* Two entry primitives. Each fires once and ends visible. Nothing in this
   codebase may bind opacity or transform to scroll progress.
   rise: text, labels, rows, buttons.
   land: the hero surface only (the graded call card, an industry page's
   hero figure). It settles from a slight oversize toward its top edge.
   Everything below the hero rises: cards, media and panels included.
   ui.js holds the below-the-fold ones at their first frame until they
   intersect, and drops will-change on animationend. */
.rise, .reveal {
  animation: rise var(--dur-enter) var(--ease-enter) both;
  animation-delay: var(--d, 0ms);
}
.land {
  animation: land var(--dur-land) var(--ease-enter) both;
  animation-delay: var(--d, 0ms);
  transform-origin: 50% 40%;
}
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, var(--travel), 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes land {
  from { opacity: 0; transform: scale(var(--zoom-from)) translate3d(0, var(--travel-sm), 0); }
  to   { opacity: 1; transform: scale(1) translate3d(0, 0, 0); }
}

/* A page's opening block rises on load: DESIGN.md, Motion, at the
   --step cadence. It is CSS only, so it needs no script and always ends
   visible. The home hero has its own sequence in home.css. */
@media (prefers-reduced-motion: no-preference) {
  :is(.post-head, .blog-head, .doc, .ihero .hero-copy, .page-404) > :nth-child(-n+6) {
    animation: rise var(--dur-enter) var(--ease-enter) both;
    --travel: var(--travel-sm);
  }
  :is(.post-head, .blog-head, .doc, .ihero .hero-copy, .page-404) > :nth-child(2) { animation-delay: var(--step); }
  :is(.post-head, .blog-head, .doc, .ihero .hero-copy, .page-404) > :nth-child(3) { animation-delay: calc(var(--step) * 2); }
  :is(.post-head, .blog-head, .doc, .ihero .hero-copy, .page-404) > :nth-child(4) { animation-delay: calc(var(--step) * 3); }
  :is(.post-head, .blog-head, .doc, .ihero .hero-copy, .page-404) > :nth-child(5) { animation-delay: calc(var(--step) * 4); }
  :is(.post-head, .blog-head, .doc, .ihero .hero-copy, .page-404) > :nth-child(6) { animation-delay: calc(var(--step) * 5); }
  /* a post's cover rises after the opening block */
  .post-head + .post-cover {
    animation: rise var(--dur-enter) var(--ease-enter) both;
    animation-delay: calc(var(--step) * 4);
  }
  /* the hero surface beside an industry page's opening block lands after it;
     land is for hero surfaces only */
  .ihero .hero-media > figure {
    animation: land var(--dur-land) var(--ease-enter) both;
    animation-delay: calc(var(--step) * 4);
    transform-origin: 50% 40%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  /* entries do not wait out their stagger either */
  .rise, .reveal, .land { animation: none; }
}

/* ==========================================================================
   TAILWIND v4
   Delete this block if the project does not use Tailwind.
   ========================================================================== */

@theme {
  --color-canvas:      var(--canvas);
  --color-surface:     var(--surface);
  --color-inset:       var(--inset);
  --color-rule:        var(--rule);
  --color-rule-strong: var(--rule-2);
  --color-ink:         var(--ink);
  --color-ink-hover:   var(--ink-hover);
  --color-ink-2:       var(--ink-2);
  --color-ink-3:       var(--ink-3);
  --color-on-ink:      var(--on-ink);
  --color-accent:      var(--accent);
  --color-accent-wash: var(--accent-wash);
  --color-accent-edge: var(--accent-edge);
  --color-miss:        var(--miss);
  --color-partial:     var(--partial);

  --font-sans: var(--sans);
  --font-mono: var(--mono);

  --text-display-xl: var(--text-display-xl);
  --text-display-l:  var(--text-display-l);
  --text-heading-l:  var(--text-heading-l);
  --text-heading-m:  var(--text-heading-m);
  --text-heading-s:  var(--text-heading-s);
  --text-subheading: var(--text-subheading);
  --text-body-l:     var(--text-body-l);
  --text-body-m:     var(--text-body-m);
  --text-caption:    var(--text-caption);
  --text-eyebrow:    var(--text-eyebrow);

  --radius-button: var(--r-button);
  --radius-input:  var(--r-input);
  --radius-icon:   var(--r-icon);
  --radius-tag:    var(--r-tag);
  --radius-card:   var(--r-card);
  --radius-media:  var(--r-media);

  --ease-loops: var(--ease);
}
