/* colour.css: where the brand colours go. Loaded last on every page, so every colour decision
   sits here and nowhere else.

   Three rules. The colours only ever appear together, as the gradient, never one at a time. Each
   element carries the gradient in one place: if the number is gradient, its squares stay plain; if
   the line is gradient, its nodes stay plain. And there is one light source, at the upper left:
   blocks run diagonally, long text at a shallow angle, lines along themselves. The glow follows the
   same light, neutral platinum on the upper left and cool steel on the lower right.

   Set --a on an element for its angle, then paint with linear-gradient(var(--a) var(--in,), var(--stops)).
   --stops and the glow are the bright values on black and darker inks on light bands, where every
   stop passes 4.5:1, so one rule works on both grounds.

   Buttons, headings and body text stay out of it. The main button carries the sparkle's colours
   instead, the one hue on the page at more than speck size, so it stays the strongest thing on the
   screen (see The primary button, below). The serif's headings on white take navy ink, the one
   other hue, and only as the colour of the letters (see Navy ink, below). */
:root {
  /* the serif's ink on white: deep navy, 17.2:1. Never a fill, a border or any other text */
  --serif-ink: #0b1b33;
  /* the wordmark's own left-to-right fade (threealpha-silver.svg), bright "three" to the steel alpha:
     the accent phrase of a section heading and nothing else. Lowest stop 4.75:1 on steel black */
  --logo-fade: #e9eef5, #dde2eb 25%, #b4bac5 50%, #878e9a 75%, #767c86;
  /* the same sweep on white: silver can't carry text on white, so the stops go graphite — the dark
     end of the silver family — every one past 4.5:1. The dip inverts: lightest in the middle. */
  --ink-yellow: #313438;
  --ink-sage: #40454c;
  --ink-sky: #4c5259;
  --ink-coral: #41464c;
  --ink-pink: #31373f;
  --stops: var(--alpha-yellow), var(--alpha-sage) 28%, var(--alpha-sky) 52%, var(--alpha-coral) 78%, var(--alpha-pink);
  /* the gradient at low strength, for a cover with no picture yet */
  --wash: linear-gradient(135deg,
    color-mix(in srgb, var(--alpha-yellow) 24%, transparent),
    color-mix(in srgb, var(--alpha-sky) 24%, transparent) 52%,
    color-mix(in srgb, var(--alpha-pink) 24%, transparent));
  --glow-warm: color-mix(in srgb, var(--alpha-yellow) 38%, transparent);
  --glow-cool: color-mix(in srgb, var(--alpha-pink) 38%, transparent);
  --glow-text: drop-shadow(-2px -1px 9px var(--glow-warm)) drop-shadow(2px 1px 9px var(--glow-cool));
  --glow-small: drop-shadow(0 0 2px color-mix(in srgb, var(--alpha-sky) 26%, transparent));
  --glow-box: -3px -2px 12px var(--glow-warm), 3px 2px 12px var(--glow-cool);
  /* product-mockup accents: four steps of the silver family, no hue, so the screens sit inside the
     black/white/silver system like everything else. Each keeps one job, told apart by lightness, not
     colour; the "done" state stays near-white. Meaning is carried by position, shape and label. */
  --mk-pass: #eff3f9;  /* near-white: the live / primary / done mark */
  --mk-ref: #d8dce2;   /* light silver: data and reference marks */
  --mk-warn: #9ea4ac;  /* mid silver: attention */
  --mk-cat: #c9cdd3;   /* silver: category marks */
  --mk-err: #9ea4ac;   /* mid silver: a problem, with its shape and label carrying the meaning */
  /* the sparkle's six specks, as rgb channels: the one exception to no hue, at speck size and in the primary button's ring */
  --speck-1: 245 197 24;
  --speck-2: 96 176 192;
  --speck-3: 255 255 255;
  --speck-4: 240 96 192;
  --speck-5: 160 192 112;
  --speck-6: 224 96 112;
  /* the primary button's ring, read here so it keeps the bright specks on every band: it sits against
     its own near-black fill, so the deeper specks on .band-light would only dull it. White is left out,
     because it reads as a gap. It mirrors so hover can slide it to its reverse, and blends in sRGB:
     OKLCH would take teal to coral through violet, a colour the sparkle doesn't have. */
  --ring: linear-gradient(90deg,
    rgb(var(--speck-1)), rgb(var(--speck-5)) 12.5%, rgb(var(--speck-2)) 25%, rgb(var(--speck-6)) 37.5%,
    rgb(var(--speck-4)) 50%,
    rgb(var(--speck-6)) 62.5%, rgb(var(--speck-2)) 75%, rgb(var(--speck-5)) 87.5%, rgb(var(--speck-1)));
}
.band-light {
  /* deeper on white, each past 3:1, with graphite for the speck that would vanish */
  --speck-1: 138 100 0;
  --speck-2: 14 116 134;
  --speck-3: 64 69 75;
  --speck-4: 176 36 128;
  --speck-5: 78 116 40;
  --speck-6: 186 48 68;
  /* the ink wordmark has no fade, so on white the fade mirrors it: navy into mid steel, lowest 5.54:1 */
  --logo-fade: var(--serif-ink), #2c333d 35%, #4a515b 70%, #626973;
  --stops: var(--ink-yellow), var(--ink-sage) 28%, var(--ink-sky) 52%, var(--ink-coral) 78%, var(--ink-pink);
  --glow-warm: color-mix(in srgb, var(--ink-yellow) 24%, transparent);
  --glow-cool: color-mix(in srgb, var(--ink-pink) 24%, transparent);
  --glow-text: drop-shadow(-2px -1px 7px var(--glow-warm)) drop-shadow(2px 1px 7px var(--glow-cool));
  --glow-small: drop-shadow(0 0 2px color-mix(in srgb, var(--ink-sky) 18%, transparent));
  --glow-box: -3px -2px 10px var(--glow-warm), 3px 2px 10px var(--glow-cool);
}
/* dark stops turn muddy where they blend in sRGB, so light bands blend in OKLCH where it is supported */
@supports (background: linear-gradient(in oklch, red, blue)) {
  .band-light { --in: in oklch; }
}
/* a dark ground inside a white band takes the values on black back (system.css, .ground-dark) */
.ground-dark {
  --speck-1: 245 197 24;
  --speck-2: 96 176 192;
  --speck-3: 255 255 255;
  --speck-4: 240 96 192;
  --speck-5: 160 192 112;
  --speck-6: 224 96 112;
  --stops: var(--alpha-yellow), var(--alpha-sage) 28%, var(--alpha-sky) 52%, var(--alpha-coral) 78%, var(--alpha-pink);
  --in: ;
  --glow-warm: color-mix(in srgb, var(--alpha-yellow) 38%, transparent);
  --glow-cool: color-mix(in srgb, var(--alpha-pink) 38%, transparent);
}

/* ---------- Gradient text ----------
   Each piece shrinks to its own width so it carries the whole sweep, not one slice of it. */
.h-section .section-label,
#stats .stat-value,
.fact-figure,
.faq-groups .faq-topic,
.blog-badge,
.post-row:has(.post-cover img:not([hidden])) .post-category,
.case-card:has(.case-media img:not([hidden])) .case-metric,
.case-card:has(.case-media img:not([hidden])):not(:has(.case-metric)) .case-category,
.case-hero-metric-value,
.breadcrumb-item [aria-current],
.related-item:hover .related-name {
  --a: 100deg; /* short, wide text: nearly flat, or only the corners would change */
  width: fit-content;
  background-image: linear-gradient(var(--a) var(--in,), var(--stops));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: var(--glow-small);
}
#stats .stat-value { --a: 135deg; display: inline-block; filter: none; } /* tall figures can take the full diagonal */
.fact-figure { --a: 135deg; filter: none; } /* a service page's fact: the stat style */
#stats .section-label { filter: none; }
.related-item:hover .related-name,
.case-hero-metric-value { --a: 104deg; filter: var(--glow-text); }
.case-card:has(.case-media img:not([hidden])) .case-metric { --a: 104deg; } /* keeps the small glow: the wide one smudges at this size on white */
.case-hero-metric-value { padding-bottom: .15em; margin-bottom: -.15em; } /* the sweep stops at the box, and this line height leaves the descenders below it */

/* labels are block-level, so they centre by margin once they fit their text */
.h-section .section-label { margin-inline: auto; }
.section-header.is-left .section-label,
.page-header .section-label,
.brief .section-label,
.svc-fit .section-label,
.contact-next .section-label { margin-inline: 0; }

/* ---------- Heading first tone ----------
   On black a section heading opens in the wordmark's brightest stop; on white the navy rule below wins. */
.section-heading, .cta-band-heading, .hero-title { color: #e9eef5; }

/* ---------- Navy ink ----------
   Fraunces on a white band is written in navy, like a fountain pen, while the sans (h3, body, labels)
   stays steel. Dark bands keep white: navy can't show there. The main button keeps its steel-black
   fill, so it is still the strongest thing on the band. */
.band-light :is(.section-heading, .claim-phrase, .svc-statement, .topic-name, .post-title, .post-related-title, .contact-sent-title, .contact-intro-title, .letter-body, .prose :is(h2, h3, h4, blockquote, .prose-quote)),
#clients .section-intro {
  color: var(--serif-ink);
  -webkit-text-fill-color: currentColor;
}

/* ---------- Heading accent ----------
   A section heading, and the home hero's headline, opens in one solid tone and ends in its italic accent phrase (marked *like this*
   in the copy, core/headings.py), filled with the wordmark's fade, the way the logo runs from bright
   "three" to the steel alpha. Fraunces italic even in the sans closing call, like the hero's rotating
   words. The fill is set here because the band rules above give the heading a solid fill the <em>
   would inherit. Each wrapped line restarts the fade. Print and forced colours fall back to the
   heading's own tone (below). */
:is(.section-heading, .cta-band-heading, .hero-title) .heading-accent {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 360;
  letter-spacing: -.01em;
  padding-right: .08em;
  background: linear-gradient(90deg, var(--logo-fade));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
/* ---------- Form errors ----------
   What needs fixing takes the sparkle's coral speck, the one speck that reads as a warning, at the
   band's own value: 186 48 68 on white (about 5.8:1), the bright speck on black. It is declared on both
   grounds because a custom property resolves where it is written. Colour is never the only signal:
   every error keeps its "Fix:" message, tied to the control by aria-describedby. */
:root, .band-light { --error: rgb(var(--speck-6)); }
.field.has-error .field-control, /* .field: past .band-white :is(.field-control, .pill span), which counts as .pill span */
.field.has-error .field-control:hover,
.pills[aria-invalid="true"] .pill span { border-color: var(--error); }
.field.has-error .field-control:focus-visible { outline-color: var(--error); }
.has-error .field-select::after { background: var(--error); }
.field .field-error, .form-alert { color: var(--error); } /* .field: past .band-light p */
.form-alert p { color: var(--color--white); }

/* ---------- Gradient lines: each runs along itself, with nothing under it ---------- */
.method-step::after {
  --a: 180deg;
  background: linear-gradient(var(--a) var(--in,), var(--stops));
}

/* the home services line, as the plain rule that stands in for the drawn one */
.topics::before { --a: 180deg; background: linear-gradient(var(--a) var(--in,), var(--stops)); }
@media (min-width: 992px) { .topics--rail::before { --a: 90deg; } } /* lines run along themselves */

/* the same line on a white band: the stops go graphite and the hairlines go ink */
.band-white .topics-sweep-1 { stop-color: var(--ink-yellow); }
.band-white .topics-sweep-2 { stop-color: var(--ink-sage); }
.band-white .topics-sweep-3 { stop-color: var(--ink-sky); }
.band-white .topics-sweep-4 { stop-color: var(--ink-coral); }
.band-white .topics-sweep-5 { stop-color: var(--ink-pink); }
.band-white .topics-track { stroke: var(--line-dark); }
.band-white .topics-branch { stroke: var(--line-dark-strong); }
.band-white .topics-end::before { background: var(--band-light-bg); }
.band-white .topics.is-armed .topic:not(.is-on) .topic-node,
.band-white .topics.is-armed .topic:not(.is-on) .brief-row::before { border-color: var(--line-dark-strong); }

/* ---------- The primary button ----------
   Near-black on every band, inside a ring of the sparkle's colours. The ring is twice the button's
   width, so it shows yellow to pink at rest and slides to pink to yellow on hover. */
.hero-cta-primary {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--band-light-text) 0 0) padding-box,
    var(--ring) 0 0 / 200% 100% border-box;
  color: #fff;
}
.hero-cta-primary:hover { background-position: 0 0, 100% 0; color: #fff; }

/* ---------- The why pulse ----------
   The ring's five colours in its order, as a hairline that only exists while a pillar is hovered.
   Read from the band, not --ring: it has no dark fill behind it, so white needs the deeper specks. */
.branch-sweep-1 { stop-color: rgb(var(--speck-1)); }
.branch-sweep-2 { stop-color: rgb(var(--speck-5)); }
.branch-sweep-3 { stop-color: rgb(var(--speck-2)); }
.branch-sweep-4 { stop-color: rgb(var(--speck-6)); }
.branch-sweep-5 { stop-color: rgb(var(--speck-4)); }
/* the ring it lands in: the same colours round a circle, masked down to the border so it stays hollow */
.branch-node::before {
  border-color: transparent;
  background: conic-gradient(rgb(var(--speck-1)), rgb(var(--speck-5)), rgb(var(--speck-2)), rgb(var(--speck-6)), rgb(var(--speck-4)), rgb(var(--speck-1))) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

/* ---------- Gradient fills ---------- */
.claim-node.is-end,
.branches.is-on .branch-node,
.branches:not(.is-armed) .branch-node {
  --a: 150deg;
  border-color: transparent;
  background: linear-gradient(var(--a) var(--in,), var(--stops)) border-box;
}
/* the Alpha Method's lead dot: the silver sweep, like the other gradient dots. An SVG circle, so the
   gradient is a <linearGradient> diagrams.js adds to the field, and SVG stops can't read --stops */
.method-field .method-alpha { fill: url(#method-alpha-grad); }
.method-stop-1 { stop-color: var(--alpha-yellow); }
.method-stop-2 { stop-color: var(--alpha-sage); }
.method-stop-3 { stop-color: var(--alpha-sky); }
.method-stop-4 { stop-color: var(--alpha-coral); }
.method-stop-5 { stop-color: var(--alpha-pink); }
.voice-avatar {
  --a: 135deg;
  background: linear-gradient(var(--a) var(--in,), var(--stops));
  box-shadow: var(--glow-box);
  color: #05090f;
}
/* meters are the one place the silver sweep appears inside a mockup; the fill level, not a hue, shows state */
.mockup .mk-meter i { --a: 90deg; background: linear-gradient(var(--a) var(--in,), var(--stops)); }

/* a cover with no picture shows the wash; a picture takes over and the metric, or the label on a card with no metric, carries the colour */
.h-section .case-media, .h-section .post-cover { background: var(--wash), var(--color--gray-1); }

/* gradient text can't print or survive forced colours, so it falls back to plain text */
@media print {
  .h-section .section-label, #stats .stat-value, .fact-figure, .faq-groups .faq-topic, .blog-badge,
  .post-category, .case-category, .case-metric, .case-hero-metric-value, .breadcrumb-item [aria-current],
  :is(.section-heading, .cta-band-heading, .hero-title) .heading-accent {
    background: none; filter: none; -webkit-text-fill-color: currentColor;
  }
  .hero-cta-primary { background: none; border-color: currentColor; color: #000; } /* print drops the fill, and white text with it */
}
@media (forced-colors: active) {
  .h-section .section-label, #stats .stat-value, .fact-figure, .faq-groups .faq-topic, .blog-badge,
  .post-category, .case-category, .case-metric, .case-hero-metric-value, .breadcrumb-item [aria-current],
  :is(.section-heading, .cta-band-heading, .hero-title) .heading-accent {
    background: none; filter: none; -webkit-text-fill-color: currentColor;
  }
  .hero-cta-primary { background: none; border-color: currentColor; }
}

/* ---------- The decision diagrams' sweep ----------
   The one line that tells a decision diagram's story (decide.css and the decide/ partials) carries the sweep
   through an SVG gradient, whose stops can't read --stops. The band is always dark, so the bright stops. */
.decide-stop-1 { stop-color: var(--alpha-yellow); }
.decide-stop-2 { stop-color: var(--alpha-sage); }
.decide-stop-3 { stop-color: var(--alpha-sky); }
.decide-stop-4 { stop-color: var(--alpha-coral); }
.decide-stop-5 { stop-color: var(--alpha-pink); }
