/* ==========================================================================
   CYR brand foundation, shared by CYR Management and CYR Garage.
   Source of truth: the CYR Management design system ("Instrument grade").
   Link this file first, then build every component from the variables below.
   Never hard-code a hex value outside this file.
   ========================================================================== */

/* ---------- Fonts (self-hosted; paths are relative to this file) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 400 900; font-stretch: 100% 125%; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/geist-mono-latin-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
/* Fallbacks sized to Archivo's measured widths, so text doesn't reflow when the font arrives. */
@font-face { font-family: "Archivo Fallback"; src: local("Arial"), local("ArialMT"); size-adjust: 99%; }
@font-face { font-family: "Archivo Display Fallback"; src: local("Arial Black"), local("Arial-Black"); size-adjust: 113%; }

/* ---------- Tokens ---------- */
:root {
  /* Colour: one neutral range from steel to paper, one accent. */
  --steel: #121A1F;          /* deepest dark ground: hero, call to action */
  --gunmetal: #1F2A30;       /* brand primary; second dark ground; text on light */
  --gunmetal-raised: #26333A;/* panels and fields on dark */
  --graphite: #3C474E;       /* dividers on dark; secondary text on light */
  --slate: #5E6A71;          /* secondary linework on dark; never text */
  --aluminium: #9AA3A8;      /* secondary text on dark; secondary linework on light */
  --hairline: #C4C9CB;       /* primary linework on dark; dividers on light */
  --concrete: #E8E9E6;       /* light ground; body text on dark */
  --paper: #F4F5F2;          /* brightest text on dark */
  --floor-line: #F4C21B;     /* the single accent: logo slash, primary button, one mark per diagram */
  --on-floor-line: #1F2A30;  /* text on floor-line fills */
  --error: #F2B8B5;          /* form errors on dark */

  /* Type families */
  --font-display: "Archivo", "Archivo Display Fallback", "Helvetica Neue", Helvetica, sans-serif;
  --font-body: "Archivo", "Archivo Fallback", "Helvetica Neue", Helvetica, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Type scale (phone to desktop). Display faces use font-stretch: 125%. */
  --fs-punch: clamp(52px, 10.5vw, 152px);
  --fs-display: clamp(44px, 6.6vw, 96px);
  --fs-heading: clamp(34px, 3.9vw, 56px);
  --fs-sub: clamp(22px, 1.95vw, 28px);
  --fs-lead: clamp(18px, 1.46vw, 21px);
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-label: 12px;
  --lh-punch: .88; --lh-display: .92; --lh-heading: 1; --lh-sub: 1.1; --lh-lead: 1.5; --lh-body: 1.65;
  --tr-punch: -.04em; --tr-display: -.035em; --tr-heading: -.025em; --tr-sub: -.015em; --tr-label: .08em;

  /* Space: deliberately uneven steps */
  --s-1: 4px; --s-2: 8px; --s-3: 16px; --s-4: 24px; --s-5: 40px; --s-6: 64px; --s-7: 96px; --s-8: 120px; --s-9: 160px;

  /* Grid */
  --max: 1440px;
  --margin: 20px;
  --gutter: 16px;

  /* Shape, cut, motion */
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px;
  --cut: .052em;                       /* the wordmark's cut: 5.2% of the font size */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --dur: 700ms;

  /* Roles. Components use these, never the raw neutrals, so a section only has to
     declare its ground (dark by default, .light for light) and everything follows. */
  --ground: var(--gunmetal);
  --text-strong: var(--paper);
  --text: var(--concrete);
  --text-muted: var(--aluminium);
  --rule: var(--graphite);
  --line: var(--hairline);
  --line-soft: var(--slate);

  color-scheme: dark;
}
@media (min-width: 768px) { :root { --margin: 48px; --gutter: 24px; } }

/* Light sections: sections alternate dark and light for contrast. */
.light {
  --ground: var(--concrete);
  --text-strong: var(--gunmetal); --text: var(--gunmetal); --text-muted: var(--graphite);
  --rule: var(--hairline); --line: var(--gunmetal); --line-soft: var(--aluminium);
  background: var(--ground); color: var(--text);
}
.dark { background: var(--ground); color: var(--text); }
.dark-deep { --ground: var(--steel); background: var(--ground); color: var(--text); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font-family: var(--font-body); font-size: var(--fs-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip;
}
/* Milled grain: fixed, faint, never on a scrolling layer. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p, h1, h2, h3, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; font-stretch: 125%; text-wrap: balance; color: var(--text-strong); }
:focus-visible { outline: 2px solid var(--floor-line); outline-offset: 3px; }
.light :focus-visible { outline-color: var(--gunmetal); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.frame { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: var(--margin); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); }

/* Type roles */
.t-punch { font-family: var(--font-display); font-weight: 900; font-stretch: 125%; font-size: var(--fs-punch); line-height: var(--lh-punch); letter-spacing: var(--tr-punch); }
.t-display { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--tr-display); }
.t-heading { font-size: var(--fs-heading); line-height: var(--lh-heading); letter-spacing: var(--tr-heading); }
.t-sub { font-family: var(--font-display); font-weight: 800; font-stretch: 125%; font-size: var(--fs-sub); line-height: var(--lh-sub); letter-spacing: var(--tr-sub); color: var(--text-strong); }
.t-lead { font-size: var(--fs-lead); line-height: var(--lh-lead); }
.t-muted { color: var(--text-muted); }
.label { font-family: var(--font-mono); font-size: var(--fs-label); line-height: 1.2; font-weight: 500; letter-spacing: var(--tr-label); text-transform: uppercase; color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Wordmark: the cut CYR with the Floor Line slash ----------
   Set the size with font-size on .wordmark. Minimum 80px wide; below that use the monogram.
   The cut is always painted in the ground colour of the section it sits on. */
.wordmark { display: inline-flex; flex-direction: column; gap: .1em; text-decoration: none; color: var(--text-strong); }
.wordmark .wm { display: flex; align-items: center; }
.wordmark .letters { position: relative; }
.wordmark .letters span { display: block; font-family: var(--font-display); font-weight: 900; font-stretch: 125%; letter-spacing: -.02em; line-height: .8; }
.wordmark .cut { position: absolute; left: -.04em; right: -.04em; top: 47%; height: var(--cut); background: var(--ground); }
.wordmark .slash { width: .256em; height: var(--cut); margin-left: .144em; margin-top: .03em; background: var(--floor-line); transform: skewX(-28deg); }
.wordmark .desc { font-family: var(--font-body); font-size: .093em; font-weight: 600; font-stretch: 112.5%; letter-spacing: .5em; line-height: 1; }

/* The cut on any type: wrap a word in .cut-word to mark it as removed. */
.cut-word { position: relative; display: inline-block; }
.cut-word::after { content: ""; position: absolute; left: -.04em; right: -.04em; top: 52%; height: .1em; margin-top: -.05em; background: var(--ground); }

/* ---------- Buttons and links ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 24px;
  border: 0; border-radius: var(--radius-sm); font: inherit; font-size: 16px; font-weight: 600; font-stretch: 112.5%;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .3s var(--ease), background-image .3s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn .tick { width: 18px; height: 3px; background: currentColor; transform: skewX(-28deg); transition: width .4s var(--ease); }
.btn:hover .tick { width: 30px; }
.btn-primary { background: var(--floor-line); color: var(--on-floor-line); }
.btn-primary:hover { background-image: linear-gradient(rgba(31, 42, 48, .1), rgba(31, 42, 48, .1)); }
.btn-ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-soft); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--line); }
.link-line { position: relative; font-weight: 600; font-stretch: 112.5%; text-decoration: none; padding-bottom: 4px; box-shadow: inset 0 -1px 0 var(--line-soft); }
.link-line::after { content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%; background: var(--text); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.link-line:hover::after { transform: scaleX(1); }

/* ---------- Blueprint linework (inline SVG diagrams) ---------- */
.bp { overflow: visible; }
.bp .ln { fill: none; stroke: var(--line); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.bp .ln-2 { fill: none; stroke: var(--line-soft); stroke-width: 1; }
.bp .dash { stroke-dasharray: 3 4; }
.bp .hot { fill: none; stroke: var(--floor-line); stroke-width: 1.75; }
.bp .hot-fill { fill: var(--floor-line); }
.bp text { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; fill: var(--text-muted); text-transform: uppercase; }
