/* ===========================================================================
   tokens.css — design tokens, transcribed from build spec §3
   ---------------------------------------------------------------------------
   Source of truth: amyinsvg.cargo.site, fetched 10 Sep 2026.
   This is a MIGRATION, not a redesign. Every value below was captured from the
   live Cargo site before the subscription lapsed. Do not "improve" them.

   Every color and font reference in main.css points at a custom property
   defined here. Nothing is hardcoded — swapping a value should be a one-line
   change in this file and nowhere else.
   =========================================================================== */

/* 2026-11-23 FONT PREVIEW, option A — not approved.
   Switzer (body/UI) from Fontshare: ITF Free Font License, CDN only, never
   commit the files (same rule as General Sans). Geist Mono (labels) from
   Google Fonts for the preview only: SIL OFL 1.1, so if kept it gets
   self-hosted like DM Mono and this second import goes.
   @import is used so the preview is one place to revert; it is slower than
   <link> in the head, which is what the final version should use.
   To revert: delete these two lines and restore --font-ui / --font-mono. */
@import url("https://api.fontshare.com/v2/css?f[]=switzer@400,401,500,501,600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600&display=swap");

:root {
  /* --- Color ------------------------------------------------------------
     Sampled from screenshots, including a magnified crop of the Info section
     where the type was large enough to give flat, unantialiased fills.
     Spec §3 marks these as confirmed — build against them directly.        */

  --c-frame:      #F2E8B3;  /* outer border field */
  --c-surface:    #F5F1E5;  /* content field */
  --c-ink:        #131313;  /* body and display text */
  /* 2026-11-23 TRIAL: plum brightened at Amy's request so it reads as a
     color. The Cargo value #592B43 was 10:1 on cream but only 1.64:1
     against the ink, so at label sizes it read as black. #8F2D6E is 6.7:1 on
     cream and 6.1:1 on the yellow (AA for any size) and 2.45:1 against ink.
     The old value is kept as --c-link-deep for hover/pressed states. */
  --c-link:       #8F2D6E;  /* links — the only chromatic accent ("plum") */
  --c-link-deep:  #592B43;  /* original Cargo plum, now the darker state */
  --c-rule:       #939189;  /* hairline */

  /* Third ink color: secondary text, one step back from black.
     Used by Subtitle Italic, Tag/Metadata and Teaser caption.
     Confirmed by sampling — not a placeholder. (An earlier build note called
     this provisional; that note was stale and the spec was right.)          */
  --c-ink-mute:   #606060;  /* secondary text */

  /* --- Type families ----------------------------------------------------
     Four families, per spec §4. Loading strategy differs by license — see
     the @font-face block and the Fontshare <link> comment in main.css.

     Monument Grotesk is deliberately absent. Dinamo's license excludes
     storing the files on publicly available servers, and this repo is public.
     Both styles that used it (Heading 2, Caption) fold into DM Mono per §4.  */

  --font-display: "General Sans", "Helvetica Neue", Arial, sans-serif;
  --font-ui:      "Switzer", "Inter Tight", "Helvetica Neue", Arial, sans-serif;   /* preview A; was "Inter Tight" first */
  --font-serif:   "Instrument Serif", Georgia, serif;
  --font-mono:    "Geist Mono", "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;   /* preview A; was "DM Mono" first */

  /* --- Type scale --------------------------------------------------------
     rem, transcribed from Cargo's Text Styles panel. All 17 styles.
     --t-hero and --t-h1 are the fixed upper bounds; both are clamped at
     point of use in main.css (§4: 8.25rem = 132px overflows a phone).       */

  --t-hero:        8.25rem;
  --t-h1:          4rem;
  --t-h2:          2.5rem;   /* 2026-11-23: was 2rem in DM Mono; now the case
                                study title in the display face */
  --t-pullquote:   1.625rem;
  --t-project:     1.75rem;   /* 2026-11-23: was 1.375rem; body moved to 1rem, so
                                 titles step up to keep a 1.75x ratio */
  /* Back to §4's captured value. It was briefly overridden to 0.94rem while
     this style was (wrongly) carrying the project descriptions; those are now
     Bodycopy per the type hierarchy audit, so the override had no basis left.
     .t-teaser is currently UNUSED — kept because §4 says to build all 17
     styles, and the next case study will likely want it. */
  --t-teaser:      1.35rem;
  /* 17.8px. The header ↓ carries .t-nav, so it moves with the nav links
     rather than being sized separately — they are one group.
     Still smaller than --t-brandmark (19.8px); that gap is deliberate. */
  --t-nav:         1.1125rem;
  --t-caption:     1.1rem;
  --t-subtitle:    1.1rem;
  --t-body-lg:     1.125rem;  /* 2026-11-23: was 1.05rem; case study reading size */
  --t-cta:         1.05rem;
  --t-tag:         0.825rem;   /* was 0.95 — discipline labels, all 3 blocks */
  /* 2026-11-23 TRIAL: body raised from 0.875rem (14px) to the 16px reading
     floor, and Currently folded into it — the 14px / 15.04px near-miss was
     two sizes doing one job. */
  --t-currently:   1rem;
  --t-body:        1rem;
  /* DELIBERATE DIVERGENCE FROM THE SOURCE — do not "correct" this.
     §4 of the spec records Brand Mark at 0.8rem, and the Cargo site renders
     it that way. It is 1.2375rem here at Amy's request. SIZE ONLY: the weight
     stays 600 and the tracking stays 0.04em, which are what distinguish it
     from the nav links beside it.

     It was briefly matched exactly to Nav Link (both 1.3rem). That match is
     now DELIBERATELY BROKEN — the brand mark sits 1px larger than the nav.
     Do not "correct" the two back into agreement.

     NOTE: both --header-h formulas below derive from this value. */
  --t-brandmark:   1.2375rem;   /* 19.8px */
  --t-label:       0.875rem;  /* 2026-11-23: was 0.7rem (11.2px) tracked caps;
                                 sentence case needs the extra size */

  /* --- Layout -----------------------------------------------------------
     SUPERSEDES §3 of the build spec. The spec described the yellow as an
     inset frame around one content field. It is not: yellow is the PAGE
     BACKGROUND, and the cream areas are separate stacked blocks in a centered
     column with the page showing through the gaps between them. A stack of
     cards on a colored page, not one field with sections inside it.

     --frame-inset and --field-pad are deliberately gone. They encoded the
     wrong model; nothing should reference them.

     Two nested layers, from Cargo's own Local Page Settings:

       .page   width 50% of viewport, centered          ("Width 50")
       .block  cream, inset inside the page            ("Inset 3")
               -> 4.1% of page width each side leaves the cream at
                  45.9% of the viewport, which is the measured figure
                  (45.8 / 45.9 / 45.9 / 46.1 across four screenshots).

     NOTE on the correction's own token sketch: it suggested a single
     --column-width: 46%. That cannot express the inset — the 50% page and the
     45.9% cream are two different edges, and the gap between them is what
     produces the yellow down each side. Hence two values, not one.          */

  --page-width:   50%;     /* of viewport, centered */
  --block-inset:  4.1%;    /* of page width, each side -> cream at 45.9%vw */
  --block-pad:    4.1%;    /* of page width — Cargo "Padding 3", which is the
                              same unit value as Inset 3, so the same
                              computed figure. Inferred from that equality,
                              not separately measured. */

  /* Uniform yellow gap between blocks. Expressed against the PAGE width:
     8.54% of the page == 9.3% of the cream block's own width, which is the
     measured ratio (142px against a 1530px column, identical in all three
     multi-block screenshots). The correction says "9.3% of column width";
     the arithmetic only lands on 142px if "column" means the cream, so that
     is the reading used here.                                              */
  --block-gap:    8.54%;

  /* The header-to-hero gap, deliberately SEPARATE from --block-gap so tuning
     it does not shrink every other gap on the page. Half of --block-gap as a
     starting point; this is a visual call and will want tuning.

     This only moves the hero, it does not resize it: .hero's height stays
     locked to the full --block-gap-abs (see main.css). Both of the block's
     edges rise by the same amount, so the hero no longer ends at the fold and
     a yellow band sits at the bottom of the first screen. That is the
     expected result, not a bug — the gaps between blocks are yellow anyway. */
  --header-gap:   4.27%;

  /* Absolute twin of --block-gap, for use inside height calc().
     --block-gap is a percentage of the page's INLINE size; a percentage
     inside a height calculation would resolve against the block axis and be
     wrong. 8.54% of a 50%-wide page == 4.27% of the viewport.              */
  --block-gap-abs: 4.27vw;

  /* Header height, derived rather than guessed. The header is one line of the
     tallest style it contains (Nav Link, 1.3rem x 1.3 line-height) plus its
     vertical padding. Deterministic from the tokens, so the hero can subtract
     it without JS. Verified against the rendered height at 1440px (67px).   */
  /* One row: padding + the TALLEST line in the header. That is now the brand
     mark (1.2375rem), not the nav (1.175rem) — they are no longer equal, and
     the brand mark is the larger of the two. */
  --header-h: calc(var(--stack-sm) * 2 + 1.2375rem * 1.3);

  /* Project block rhythm. Every gap reduced by 2.5x from the previous set,
     which rendered 48 / 55 / 27 / 60 and read uniformly too airy.

     MEASUREMENT BASIS — worth knowing before touching these again. Amy's
     readings of this page run consistently ~2.5x the rendered CSS pixels
     (her reading of the previous build was 119 / 121 / 73 / 147 where it
     measured 48 / 55 / 27 / 60). So the figures quoted in briefs are in that
     inflated basis, and the RATIOS are the reliable part, not the absolutes.
     A uniform 0.4x was checked against all four and lands every ratio exactly
     on the source's 48 : 55 : 27 : 60, so one multiplier was enough here even
     though the brief warned it might not be.

     The asymmetry is deliberate and must survive any future change: the gap
     ABOVE the image stays ~2x the one below (2.04 here), which ties the image
     to its link rather than letting the link float between image and Next. */
  --project-title-gap: 1.2rem;     /* title row -> description, 19.2px */
  --media-above:       1.375rem;   /* description -> image,     22px   */
  --media-below:       0.675rem;   /* image -> View Case Study,  10.8px */
  --project-next-gap:  1.5rem;     /* View Case Study -> ↓ Next, 24px  */

  --measure:      68ch;
  --stack-sm:     1.25rem;
  --stack-md:     2.5rem;
  --stack-lg:     4rem;

  /* Info block rhythm — measured from Cargo. TWO scales, not one uniform
     rhythm, because spacing is what encodes grouping here.

     The fix for "Currently sits too close to IG" is the RATIO, not the
     absolute gap: when the space above a label and the space below it are
     similar, the label attaches upward to the previous group instead of down
     to its own value. At ~1 : 3.5 each label reads as belonging to the value
     beneath it, and neither gap has to be unusual.

       label -> its value        16px   1x
       value -> next label       57px   3.5x
       email -> IG (same group)  17px   1x
       before the CTA group     119px   7x
       CTA label -> Let's talk   40px   2.5x   (= --stack-md exactly) */
  --stack-pair:   0.9rem;    /* label to its value */
  --stack-group:  3.2rem;    /* between groups, ~3.5x pair */
  --stack-break:  6.5rem;    /* before the CTA group */
}

/* ---------------------------------------------------------------------------
   Mobile — from Cargo's Mobile Settings panel, not from breakpoint guesswork.
   "Maximize Page Width" is ON, so the 50% column does NOT hold on small
   screens: the page goes full width with reduced padding. A literal 50% at
   375px would leave a ~170px column, which is unusable.

   A small inset is kept rather than dropped to zero, so the yellow still
   shows down both sides and in the gaps. Losing it would erase the model.

   "Padding Offset 30%" is ambiguous between "reduce BY 30%" and "reduce TO
   30%". Reducing TO 30% gives ~4.6px gutters at 375px, which fails the
   readability floor, so this is the "reduce by 30%" reading: 4.1% * 0.7.
   Tuned visually, as the correction directs for the mobile mechanics.
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --page-width:  100%;   /* Maximize Page Width */
    --block-inset: 2%;
    --block-pad:   2.9%;

    /* Page is full width here, so the gap is 8.54% of the viewport. */
    --block-gap-abs: 8.54vw;

    /* The header is forced to two rows on mobile (see .site-header), which
       makes its height deterministic across the whole breakpoint instead of
       depending on where the nav happens to wrap: padding + brand mark line
       + row gap + nav line. Verified against the rendered 119px at 375px.  */
  }
}

/* ---------------------------------------------------------------------------
   Header stacking breakpoint — WIDER than the mobile breakpoint above, and
   for a different reason.

   Raising the brand mark from 0.8rem to 1.3rem made it too wide to share a
   row with the nav and the ↓ in a column that is only 45.9% of the viewport.
   Measured: one row fits at 1250px and wraps at 1200px. Left to wrap on its
   own, the header silently grew from 67px to 114px, --header-h no longer
   matched reality, and the hero was pushed down far enough to put the
   bottom-aligned name below the fold — measured at 1000, 900, 800 and 780.

   So below 1300px (threshold plus headroom, because the fallback fonts are
   wider than the webfonts when the CDN is blocked) the header uses the same
   deterministic TWO-ROW layout as mobile: brand mark on its own row, nav and
   cue on the next. --header-h is the two-row formula here, in rem, so it
   stays correct in both the 100% and the 115% root-size regimes.

   This is why the value is defined here and not in the mobile block: the
   stacking range is bigger than the Maximize-Page-Width range.
   --------------------------------------------------------------------------- */
@media (max-width: 1300px) {
  :root {
    /* brand row + nav row. Two explicit terms, not a doubled constant, so it
       stays legible as what it is. */
    /* brand row (1.2375rem) + nav row (1.1125rem). The two terms differ —
       do not collapse them back. The one-row formula above keys off the
       BRAND MARK because it is the taller of the two, so it is unaffected by
       nav-size changes; this one is not. */
    --header-h: calc(var(--stack-sm) * 3 + 1.2375rem * 1.3 + 1.1125rem * 1.3);
  }
}
