/*
 * Peanut Media design tokens: the single source for colors, type, spacing and radii.
 * Values from audit/brand.md (sections 5 to 8 and 12). Other brands derive from this
 * file and change only the brand color, accents and logo.
 */

@layer reset, tokens, base, layout, components, blocks, templates, motion, utilities;

/*
 * Fonts (docs/design/fonts.md): Trirong for headings (Thin 100 and its italic
 * only), Montserrat for body and UI (one variable file per subset, weights 100
 * to 900, no italic). Both SIL OFL, self-hosted from Google Fonts latin and
 * latin-ext subsets (never the Google CDN). Their @font-face rules are printed
 * in the head by site/snippets/fonts.php, so each file URL carries its version
 * (a stylesheet cannot version the files it names). The "Fallback" faces below
 * are the system fonts resized to the web fonts metrics so the swap moves
 * nothing; they name no file and stay here.
 */

/* Metric-matched fallbacks (docs/design/fonts.md, docs/design/perf-fonts.md).
   Georgia stands in for Trirong and Arial for Montserrat while the woff2 files
   load, resized so the site's text breaks into the same lines at the same
   height and the swap moves nothing:
   - one face per weight in use, because each weight has its own widths: the
     Trirong faces mirror the web font (100 and 100 italic, the only weights
     the site loads; the italic on Georgia Italic); the Montserrat
     faces cover the variable range in bands around 200, 400, 500, 600 and
     700 (Arial Bold from 550 up);
   - each weight is split by unicode-range into capitals (plus digits for
     Montserrat) and everything else, because the capitals of both web fonts
     are much narrower, relative to the system font, than their lowercase
     (uppercase labels, nav and buttons would otherwise run 5 to 10% wide);
   - size-adjust is the width of the site's own text in the web font over the
     same text in the system font, measured in Chrome per face and class;
   - ascent and descent are Trirong's hhea 1200/534 and Montserrat's typo
     968/251 (units per em 1000) divided by that size-adjust; line gap 0. */
@font-face {
  font-family: "Trirong Fallback";
  src: local("Georgia");
  font-weight: 100;
  font-style: normal;
  unicode-range: U+0000-0040, U+005B-10FFFF;
  size-adjust: 98.43%;
  ascent-override: 121.92%;
  descent-override: 54.25%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Trirong Fallback";
  src: local("Georgia");
  font-weight: 100;
  font-style: normal;
  unicode-range: U+0041-005A;
  size-adjust: 94.73%;
  ascent-override: 126.68%;
  descent-override: 56.37%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Trirong Fallback";
  src: local("Georgia Italic"), local("Georgia-Italic");
  font-weight: 100;
  font-style: italic;
  unicode-range: U+0000-0040, U+005B-10FFFF;
  size-adjust: 92.44%;
  ascent-override: 129.81%;
  descent-override: 57.77%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Trirong Fallback";
  src: local("Georgia Italic"), local("Georgia-Italic");
  font-weight: 100;
  font-style: italic;
  unicode-range: U+0041-005A;
  size-adjust: 88.76%;
  ascent-override: 135.19%;
  descent-override: 60.16%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 100 299;
  font-style: normal;
  unicode-range: U+0000-002F, U+003A-0040, U+005B-10FFFF;
  size-adjust: 111.19%;
  ascent-override: 87.06%;
  descent-override: 22.57%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 100 299;
  font-style: normal;
  unicode-range: U+0030-0039, U+0041-005A;
  size-adjust: 100.70%;
  ascent-override: 96.12%;
  descent-override: 24.92%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 300 449;
  font-style: normal;
  unicode-range: U+0000-002F, U+003A-0040, U+005B-10FFFF;
  size-adjust: 113.17%;
  ascent-override: 85.53%;
  descent-override: 22.18%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 300 449;
  font-style: normal;
  unicode-range: U+0030-0039, U+0041-005A;
  size-adjust: 103.15%;
  ascent-override: 93.85%;
  descent-override: 24.33%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 450 549;
  font-style: normal;
  unicode-range: U+0000-002F, U+003A-0040, U+005B-10FFFF;
  size-adjust: 114.88%;
  ascent-override: 84.26%;
  descent-override: 21.85%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("ArialMT");
  font-weight: 450 549;
  font-style: normal;
  unicode-range: U+0030-0039, U+0041-005A;
  size-adjust: 103.80%;
  ascent-override: 93.25%;
  descent-override: 24.18%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 550 649;
  font-style: normal;
  unicode-range: U+0000-002F, U+003A-0040, U+005B-10FFFF;
  size-adjust: 108.69%;
  ascent-override: 89.06%;
  descent-override: 23.09%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 550 649;
  font-style: normal;
  unicode-range: U+0030-0039, U+0041-005A;
  size-adjust: 104.27%;
  ascent-override: 92.84%;
  descent-override: 24.07%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 650 900;
  font-style: normal;
  unicode-range: U+0000-002F, U+003A-0040, U+005B-10FFFF;
  size-adjust: 110.00%;
  ascent-override: 88.00%;
  descent-override: 22.82%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 650 900;
  font-style: normal;
  unicode-range: U+0030-0039, U+0041-005A;
  size-adjust: 104.32%;
  ascent-override: 92.79%;
  descent-override: 24.06%;
  line-gap-override: 0%;
}

@layer tokens {
  :root {
    /* Colors: every color the site uses is a token here; components never
       write a hex or rgb() value. The brand colors plus white (ink, cream,
       mint, coral, butter and the gold family; yellow is retired, Christina,
       2026-10-25). Text is ink on light and white on ink. Butter is the only
       solid gold-family color for bands, cards and large sections; gold soft
       is for small marks (icon circles, hubs, dots, rings and 1px lines);
       satin cream and satin gold are gradient stops only. There is no dark
       gold and no gold text (Christina's gold review and the owner's
       decision, 2026-10-25). */
    --color-ink: #1A1818;
    --color-paper: #F7F6F2;      /* cream: alternate section background (Christina, 2026-10-25) */
    --color-white: #FFFFFF;
    --color-brand: #B8E3D7;      /* mint: main brand color, used as a background with ink text */
    --color-accent-2: #FFA788;   /* coral (was called peach) */
    --color-butter: #EDE0BA;     /* muted butter: the one solid gold-family fill (FAQ bands, cards, large sections, pills); the warm end of the brand gradient. Ink on it 13.4:1 */
    --color-gold-soft: #E1CB9B;  /* soft gold (was #D5BA7D): small marks only (icon circles, diagram hubs and dots, the title marker, rings and 1px lines) and a Satin Gold stop. Ink on it 11.1:1; on cream it is 1.5:1, so its shapes are decoration or carry an ink outline */
    --color-gold-satin: #CDB17A; /* the warm end of Satin Gold, a gradient stop only. Ink on it 8.6:1 */
    --color-satin-cream: #F2ECDE;/* the light start of Satin Gold, a gradient stop only. Ink on it 15.0:1 */
    --color-muted: var(--color-ink);  /* secondary text: the design system has no grey, so ink */
    /* Ink soft (Christina's type and spacing entry, item 1, 2026-11-30): paragraph
       text on white and paper (cream) sections only (site.css, "Paragraphs").
       #3d3d3d, written as its channel so the paragraph rule can lift ink to it
       while light text on a dark panel keeps its own color. On white 10.9:1, on
       cream 10.1:1 (AA and AAA). */
    --ink-soft-channel: 61;
    --color-ink-soft: rgb(var(--ink-soft-channel) var(--ink-soft-channel) var(--ink-soft-channel));
    --color-line: var(--color-ink);
    --focus-ring: var(--color-ink);
    /* The pale tints are now their brand color (no tints in the palette) */
    --color-mint-pale: var(--color-brand);
    --color-peach-pale: var(--color-accent-2);
    /* Gradients stay gradients: same angle and stops, each stop the nearest
       brand color; the warm end is butter (design system, 2026-10-25) */
    --gradient-wash: linear-gradient(90deg, var(--color-brand) 0%, var(--color-paper) 45%, var(--color-peach-pale) 72%, var(--color-butter) 100%);
    /* Satin Gold (Christina, 2026-10-25): the gold accent's gradient sections
       (Network, Site Insight), warm light through cream, the gold only toward
       the end; a grain goes with it (blocks.css, "Satin Gold") */
    --gradient-satin-gold: linear-gradient(115deg, var(--color-satin-cream) 0%, var(--color-butter) 55%, var(--color-gold-soft) 85%, var(--color-gold-satin) 100%);
    /* The soft wash (design system, 2026-10-25): the proposal template's
       gradient and its gradient-only tints, never a flat fill or text. On the
       home closing band (design review #55) and, through --gradient-hero, on
       every page's hero. Mint leads like the old site's band: brand mint at
       the corner, held to 38% before the blush (design review #52) */
    --color-wash-mint: #CAE4DA;
    --color-wash-blush: #E8D6CF;
    --color-wash-butter: #ECDFB5;
    --gradient-home-wash: linear-gradient(115deg, var(--color-brand) 0%, var(--color-wash-mint) 38%, var(--color-wash-blush) 72%, var(--color-wash-butter) 100%);
    /* The hero rule (Christina, 2026-10-26): every page's top section (hero
       block, page header, contact, booking, thank-you, legal, error and blog
       heads) takes the home hero's soft wash (site.css, "Hero rule"). The
       tier pages and guides keep their own wash; case study heroes are solid
       ink. Change this one token to change every hero at once */
    --gradient-hero: var(--gradient-home-wash);

    /* On ink sections (design system): paragraphs, labels and 1px lines */
    --color-on-ink-text: rgb(255 255 255 / 0.72);
    --color-on-ink-label: rgb(255 255 255 / 0.65);
    --color-on-ink-line: rgb(255 255 255 / 0.28);
    --color-on-ink-text-strong: rgb(255 255 255 / 0.78);
    --color-on-ink-line-strong: rgb(255 255 255 / 0.55);
    --color-on-ink-scrollbar: rgb(255 255 255 / 0.4);
    --color-on-ink-line-faint: rgb(255 255 255 / 0.2);
    --color-on-ink-border-faint: rgb(255 255 255 / 0.14);
    --color-on-ink-fill: rgb(255 255 255 / 0.06);

    /* Ink and mint at an alpha, for tracks, faint borders, glows and shadows */
    --color-ink-line-faint: rgb(26 24 24 / 0.14);
    --color-ink-track: rgb(26 24 24 / 0.18);
    --color-shadow-device: rgb(26 24 24 / 0.3);
    --color-shadow-card: rgb(26 24 24 / 0.32);
    --color-shadow-header: rgb(26 24 24 / 0.35);
    --color-shadow-sticky: rgb(26 24 24 / 0.3);
    --color-shadow-photo: rgb(26 24 24 / 0.55);
    --color-shadow-deep: rgb(0 0 0 / 0.55);
    --color-brand-glow: rgb(184 227 215 / 0.32);
    --color-brand-glow-strong: rgb(184 227 215 / 0.8);
    --color-brand-clear: rgb(184 227 215 / 0);
    --color-mask-opaque: #000;   /* mask images: only the alpha counts */

    /* Grain for every gold surface (blocks.css), like printed paper: inline SVG fractal
       noise (no file, no request; the CSP allows data: images) at base
       frequency 0.65 for visible specks, multiplied in at 0.22 */
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    --grain-opacity: 0.22;

    /* Page accent (docs/design/components.md, "Accent colors"): the color a
       page's components lean on. Brand mint by default; a page's "Accent color"
       field puts .has-accent.accent--{mint|peach|gold} on <main>. The pale
       tint is the light end of that page's gradient wash. --accent fills
       (discs, captions, pills, blocks); --accent-mark, where a scope sets
       it, colors the marks (icon circles, the title marker, diagram hubs,
       rules): use it as var(--accent-mark, var(--accent)). Only the gold
       accent sets it, since gold is a mark color and butter its fill. */
    --accent: var(--color-brand);
    --accent-pale: var(--color-mint-pale);

    /* Type: only these two stacks are used anywhere (docs/design/fonts.md) */
    --font-heading: "Trirong", "Trirong Fallback", Georgia, serif;
    --font-body: "Montserrat", "Montserrat Fallback", Arial, sans-serif;

    /* Heading weights: Trirong Thin (100) and its italic everywhere, the only
       Trirong files the site loads (owner decision 2026-10-24, design
       system). The three tokens stay so every rule keeps naming its role. */
    --weight-display: 100;      /* h1, h2, hero, CTA band, large quotes */
    --weight-heading: 100;      /* h3, h4 */
    --weight-heading-sm: 100;   /* titles, ledes and labels in the heading face */

    /* 1.25 scale from the old site: 16, 20, 25, 31, 40, 50, 62 */
    --step--1: 0.8125rem;   /* 13px: labels, buttons, eyebrows */
    --step-0: 1rem;         /* 16px: body on desktop, and text that keeps 16px everywhere */
    --step-1: 1.25rem;      /* 20px: lead, small headings */
    --step-2: 1.5625rem;    /* 25px: h4 */
    --step-3: clamp(1.625rem, 1.3rem + 1.2vw, 1.9375rem);  /* 26 to 31px: h3 */
    --step-4: clamp(2rem, 1.6rem + 1.6vw, 2.5rem);         /* 32 to 40px: h2 */
    --step-5: clamp(2.25rem, 1.7rem + 2.4vw, 3.125rem);    /* 36 to 50px: h1 */
    --step-6: clamp(2.5rem, 1.6rem + 3.6vw, 3.875rem);     /* 40 to 62px: display */

    /* Type and spacing (Christina's entry, 2026-11-30; final home pass part 2).
       Each item changes in one place here. The home hero keeps its type and
       spacing as built: the "home hero" scope at the end of this layer sets
       the earlier values back on it. */

    /* Item 4: h1, h2 and the display titles tight; h3 and h4 at 1.15 */
    --leading-tight: 1.1;
    --leading-heading: 1.15;
    --leading-body: 1.7;        /* design system body line height (unchanged) */
    /* Item 1: paragraph body text 15px at every width (owner, 2026-12-01: 15px
       chosen over 14px; the 48rem step to 16px is gone). Buttons, labels,
       eyebrows and form fields set their own sizes; form fields and footer
       links keep 16px (--step-0). The prose of blog posts and guides is 15px
       on phones and 16px from 48rem (--text-article). */
    --text-body: 0.9375rem;
    --text-article: 0.9375rem;  /* 16px from 48rem, below */
    --tracking-caps: 0.16em;    /* caps labels; Montserrat capitals are wide, so less air than the old 0.2em */
    /* Item 6: the serif titles that were --step-1 (FAQ questions, icon card,
       step and timeline titles, h5, h6), and the lead */
    --step-title: 1.45rem;
    --text-lead: clamp(1.15rem, 2vw, 1.45rem);
    --leading-lead: 1.5;
    /* Item 8: the italic word in a display heading is underlined */
    --em-underline: 1px;
    --em-underline-offset: 0.14em;
    /* Item 9: labels (caps labels and lists, testimonial meta, the hero trust
       line, signatures, embed durations). Buttons and the site menu keep theirs */
    --label-size: 0.6875rem;
    --label-weight: 600;
    --label-tracking: 0.18em;
    /* Item 10: the heaviest weight anywhere (strong, b, names, titles) */
    --weight-strong: 600;

    /* Spacing: 8, 16, 24, 32, 48, 64, 96, 128 */
    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --space-5: 3rem;
    --space-6: 4rem;
    --space-7: 6rem;
    --space-8: 8rem;
    /* Item 2: section padding, 72px top and 80px bottom on phones, 112px and
       120px from 64rem (below). --section-pad is the top value, for the rules
       that only need one (article and legal bottoms, bands that reach into
       the padding) */
    --section-pad-top: 4.5rem;
    --section-pad-bottom: 5rem;
    --section-pad: var(--section-pad-top);
    /* Item 3: the space under a section's head (head, title, intro, the logos
       eyebrow, every block head): 48px on phones, 72px from 64rem */
    --space-head: 3rem;
    /* Item 7: heading to intro inside a section head and a hero body */
    --space-intro: 1.75rem;
    /* Text rhythm (design review 2026-10-22): a caps label sits above the
       heading it introduces (item 7: 28px), and 12px above body text it
       introduces (#13, 2026-10-24); a heading's lead paragraph starts 40px
       below it */
    --space-label: 1.75rem;
    --space-label-text: 0.75rem;
    --space-lead: 2.5rem;
    /* Item 11: paragraph to paragraph in prose on landing pages (articles keep
       --space-3), card, icon card and step padding, the grid gap */
    --space-para: 1rem;
    --pad-card: clamp(1.5rem, 3vw, 2.5rem);
    --grid-gap: 1.5rem;

    /* Layout (item 5): text sections and ordinary card rows 1040px; the blocks
       designed wide keep 1200px through --container-wide (site.css, "Wide
       blocks": the header and its mega menu, the footer, the content
       calculator, case study showcases, comparison and price tables, the
       services hub's hero map, the location maps, the home hero) */
    --container: 65rem;      /* 1040px */
    --container-wide: 75rem; /* 1200px */
    --measure: 38rem;        /* 608px text column: about 75 characters per line in Montserrat 16px */
    --gutter: clamp(1.5rem, 4vw, 2.5rem);
    --gutter-hero: clamp(1.25rem, 4vw, 1.5rem); /* heroes keep their designed gutter (site.css, Wide blocks) */
    --header-height: 5rem;

    /* Shape */
    --radius-sm: 0.875rem;   /* 14px: cards, testimonials */
    --radius-lg: 1.75rem;    /* 28px: hero images, step cards */
    --radius-pill: 300px;
    --border: 1px solid var(--color-line);
    --shadow-hard: 6px 6px 0 var(--color-ink);
    /* A bar that sticks over the page (the case study section nav): soft, but
       clearly there (design review #77) */
    --shadow-sticky: 0 0.75rem 1.5rem -0.5rem var(--color-shadow-sticky);

    /* Button (consumed by the shared base button; design system "Buttons",
       2026-10-24: one size for every button and variant) */
    --btn-radius: 0;
    --btn-font-size: 0.75rem;           /* 12px */
    --btn-weight: 500;
    --btn-tracking: 0.18em;
    --btn-padding: 0.875rem 1.375rem;   /* 14px 22px: about 44px tall */
    --btn-gap: 0.625rem;                /* 10px between the label and the arrow */
    --btn-arrow: 1.25em;                /* 15px arrow at the 12px label */

    /* Pill (study cards, industry list, tier tags): one style everywhere,
       Montserrat caps at the label weight, never bold (design review #38, #53) */
    --pill-font-size: 0.75rem;          /* 12px */
    --pill-weight: 500;
    --pill-tracking: 0.08em;

    /* Motion */
    --ease: ease-in-out;
    --duration: 0.4s;
  }

  /* Item 2 and 3 from 64rem: section padding 112px and 120px, 72px under heads */
  @media (min-width: 64rem) {
    :root {
      --section-pad-top: 7rem;
      --section-pad-bottom: 7.5rem;
      --space-head: 4.5rem;
    }
  }

  /* The blog's and guides' prose: 15px on phones, 16px from 48rem */
  @media (min-width: 48rem) {
    :root {
      --text-article: var(--step-0);
    }
  }

  /* The home hero keeps its type and spacing as built (the owner's note on
     Christina's entry; hero B, on / since the switch, 2026-12-01): the values
     before 2026-11-30, set back on the hero section only. Its body text stays
     14px on phones and 16px from 48rem. */
  .template-home .block-hero {
    --container: var(--container-wide);
    --gutter: clamp(1.25rem, 4vw, 1.5rem);
    --section-pad-top: clamp(var(--space-6), 8vw, var(--space-7));
    --section-pad-bottom: clamp(var(--space-6), 8vw, var(--space-7));
    --leading-tight: 1.15;
    --leading-heading: 1.2;
    --text-body: 0.875rem;
    --text-lead: var(--step-1);
    --leading-lead: 1.4;
    --space-intro: var(--space-3);
    --space-label: 1.5625rem;
    --label-tracking: var(--tracking-caps);
  }

  @media (min-width: 48rem) {
    .template-home .block-hero {
      --text-body: var(--step-0);
    }
  }

  /* Accent scopes, set on <main> by site/snippets/layout.php. Ink text on
     every accent passes AA: ink on mint 12.6:1, on coral 9.4:1, on butter
     13.4:1, on cream 15.0:1 (the pale tints are now the accent itself); ink
     line icons on a gold circle 4.7:1. */
  .accent--mint {
    --accent: var(--color-brand);
    --accent-pale: var(--color-mint-pale);
  }

  .accent--peach {
    --accent: var(--color-accent-2);
    --accent-pale: var(--color-peach-pale);
  }

  /* Gold (was yellow; the Network page and Site Insight): butter fills,
     soft gold marks (icon circles, hubs, the title marker, the statement
     rule), Satin Gold on the gradient sections (blocks.css) */
  .accent--gold {
    --accent: var(--color-butter);
    --accent-pale: var(--color-butter);
    --accent-mark: var(--color-gold-soft);
    /* Accent-colored numerals and marks on ink sections: white here (butter
       and gold are never text), read as var(--accent-on-ink, var(--accent)) */
    --accent-on-ink: var(--color-white);
  }
}
