/* ============================================================================
   CRHS Enterprises — RED BUREAU design system (editorial/technical
   constructivism). Tokens + components for the corporate site.
   Palette is WCAG-AA across all text pairs; Bureau Red is an accent (never the
   only signal) and never small body text. No inline styles — CSP nonce model.
   ============================================================================ */

/* ---- Self-hosted webfonts (latin subset, woff2, font-display:swap) ---------
   Archivo Expanded = the Archivo variable family pinned to the 125% width axis.
   Only weights actually rendered are fetched (unused @font-face = no download). */
@font-face {
  font-family: 'Archivo Expanded';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 125%;
  font-display: swap;
  src: url('/assets/fonts/archivo-expanded.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/inter-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/inter-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Palette */
  --paper: #f7f5f0;        /* canvas */
  --carbon: #141414;       /* ink / headings / blocks */
  --red: #c8102e;          /* the single load-bearing accent (<=10% of pixels) */
  --red-ink: #a50d26;      /* red on paper for small text (AA) */
  --slate: #3a4452;        /* body / captions (ties to current brand) */
  --hairline: #d9d5cc;     /* grid / frames */
  --plate: #0f1115;        /* dark schematic bands */
  --paper-dim: #ece9e1;    /* subtle fills */

  /* Type */
  --font-display: 'Archivo Expanded', 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* Scale */
  --maxw: 1140px;
  --gap: 24px;
  --pad: clamp(20px, 5vw, 64px);

  --shadow: 0 1px 0 var(--hairline);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--slate);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--red-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Prose links must be distinguishable by more than colour (WCAG link-in-text-block). */
p a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }

/* Visible keyboard focus across all interactive elements (a11y). */
a:focus-visible,
.btn:focus-visible,
.nav-toggle:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.section--dark a:focus-visible { outline-color: #fff; }

/* ---- Layout ---------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
.section { padding-block: clamp(48px, 8vw, 104px); position: relative; }
.section--dark { background: var(--plate); color: #d7d9de; }
.section--dim { background: var(--paper-dim); }

/* Mono section index down the left margin (decorative; hidden on small) */
.index-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--slate);
  opacity: 0.7;
}

/* ---- Typography ------------------------------------------------------------ */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 0.98;
  color: var(--carbon);
  margin: 0;
}
h1.display { font-size: clamp(2.6rem, 7vw, 5rem); }
h2.display { font-size: clamp(1.9rem, 4.5vw, 3.1rem); }
h3.display { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
.display .red { color: var(--red); }

.lede { font-size: clamp(1.05rem, 1.7vw, 1.3rem); color: var(--slate); max-width: 60ch; }
.section--dark .lede { color: #d7d9de; }
.section--dark .display { color: var(--paper); }
.section--dark .kicker { color: #b9c0c9; }
.stack-top { margin-top: 36px; }
.btn-row { margin-top: 22px; }

.mono { font-family: var(--font-mono); }
.kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
/* 48px red kicker bar above section headings */
.kicker-bar::before {
  content: "";
  display: inline-block;
  width: 48px;
  height: 4px;
  background: var(--red);
  vertical-align: middle;
  margin-right: 14px;
}

/* ---- Masthead -------------------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(120%) blur(6px);
  border-bottom: 1px solid var(--hairline);
}
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; color: var(--carbon); font-size: 1.05rem; }
.wordmark .tick { width: 12px; height: 12px; background: var(--red); display: inline-block; }
.nav { display: flex; gap: clamp(14px, 2.4vw, 30px); }
.nav a { font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--red-ink); text-decoration: none; }
.nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--red); }

/* Mobile nav toggle (hamburger). Hidden on desktop; the .nav row collapses
   into a dropdown panel below the bar at narrow widths. */
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 40px;
  background: transparent; border: 2px solid var(--carbon);
  color: var(--carbon); cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    box-shadow: 0 8px 16px rgba(20, 20, 20, 0.06);
    padding: 4px var(--pad) 14px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 13px 2px; border-bottom: 1px solid var(--hairline); font-size: 0.9rem; }
  .nav a:last-child { border-bottom: 0; }
  .nav a[aria-current="page"] { box-shadow: none; color: var(--red-ink); }
}

/* ---- Hero ------------------------------------------------------------------ */
.hero { position: relative; overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: clamp(24px, 5vw, 56px); align-items: center; }
.hero__art { position: relative; }
.hero__art .notch { position: absolute; top: 0; right: 0; width: 0; height: 0; border-top: 40px solid var(--red); border-left: 40px solid transparent; }
/* one governing red diagonal slash, top-right of the hero */
.hero__slash { position: absolute; top: -10%; right: -6%; width: 46%; height: 120%; background: repeating-linear-gradient(135deg, transparent 0 22px, rgba(200,16,46,0.06) 22px 24px); transform: skewX(-8deg); pointer-events: none; z-index: 0; }
.hero .wrap > * { position: relative; z-index: 1; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.86rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 13px 22px; border: 2px solid var(--carbon); cursor: pointer;
}
.btn--fill { background: var(--carbon); color: var(--paper); }
.btn--fill:hover { background: var(--red); border-color: var(--red); text-decoration: none; color: #fff; }
.btn--ghost { background: transparent; color: var(--carbon); }
.btn--ghost:hover { border-color: var(--red); color: var(--red-ink); text-decoration: none; }
.section--dark .btn--ghost { color: var(--paper); border-color: var(--paper); }

/* ---- Stat rail ------------------------------------------------------------- */
.stat-rail { display: flex; flex-wrap: wrap; gap: 0; margin-top: 36px; border-top: 1px solid var(--hairline); }
.stat { padding: 14px 22px 14px 0; margin-right: 22px; border-right: 1px solid var(--hairline); }
.stat:last-child { border-right: 0; }
.stat__num { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--carbon); line-height: 1; }
.stat__lab { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate); margin-top: 6px; }

/* ---- Proof strip ----------------------------------------------------------- */
.proof { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.proof__cell { background: var(--paper); padding: 22px; }
.proof__num { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 3vw, 2.3rem); color: var(--red); line-height: 1; }
.proof__lab { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); margin-top: 8px; }

/* ---- FIG plate (the signature exhibit frame) ------------------------------- */
.plate { border: 1px solid var(--hairline); background: var(--paper); position: relative; }
.plate__cap { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.plate__fig { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; color: var(--red-ink); text-transform: uppercase; }
.plate__cap::after { content: ""; flex: 1; height: 2px; background: var(--red); opacity: 0.85; }
.plate__body { padding: 20px; }

/* ---- Pillar cards ---------------------------------------------------------- */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.pillar { background: var(--paper); border: 1px solid var(--hairline); border-top: 4px solid var(--red); padding: 22px; display: flex; flex-direction: column; }
.pillar__k { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.08em; color: var(--slate); text-transform: uppercase; }
.pillar h3 { margin: 10px 0 8px; }
.pillar p { margin: 0 0 16px; font-size: 0.98rem; }
.pillar__metric { font-family: var(--font-display); font-weight: 800; color: var(--carbon); font-size: 1.3rem; margin-top: auto; }
.pillar__more { margin-top: 12px; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; }

/* ---- Offer section (the value prop) ---------------------------------------- */
.offer-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: clamp(24px, 4vw, 48px); margin-top: 28px; align-items: start; }
.offer-copy p { margin: 0 0 16px; }
.offer-copy p:last-child { margin-bottom: 0; }
.offer-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 14px; }
.offer-list li { position: relative; padding-left: 26px; font-size: 0.98rem; color: var(--slate); }
.offer-list li::before { content: ""; position: absolute; left: 0; top: 7px; width: 12px; height: 12px; background: var(--red); }

/* ---- Credentials list (operator) ------------------------------------------ */
.creds { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 28px; }
.creds li { position: relative; padding-left: 20px; font-family: var(--font-mono); font-size: 0.84rem; letter-spacing: 0.02em; }
.creds li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; background: var(--red); }

/* ---- Work page: flagship sub-exhibits (on dark) --------------------------- */
.subex { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-top: 32px; }
.subex__card { background: #15181d; border: 1px solid #2a2f38; border-top: 4px solid var(--red); padding: 22px; display: flex; flex-direction: column; }
.subex__fig { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: #b9c0c9; text-transform: uppercase; }
.subex__card h3 { margin: 10px 0 0; color: var(--paper); }
.subex__metric { font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.5; color: #e7e9ee; border-left: 3px solid var(--red); padding-left: 12px; margin: 14px 0; }
.subex__card p:last-child { margin: 0; color: #d7d9de; font-size: 0.94rem; }

/* ---- Work page: topology blueprint ---------------------------------------- */
.topo { margin: 32px 0 4px; }
.topo svg { border: 1px solid #3a4150; display: block; width: 100%; height: auto; }
.topo figcaption { font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.55; color: #b9c0c9; margin-top: 14px; max-width: 86ch; }

/* ---- Work page: exhibit grid (FIG plates) --------------------------------- */
.exhibits { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); margin-top: 24px; }
.plate.reveal { height: 100%; }
.plate__body h3 { margin: 0 0 10px; }
.plate__body > p { margin: 0; font-size: 0.96rem; }
.exhibit__metric { font-family: var(--font-mono); font-size: 0.83rem; line-height: 1.5; color: var(--carbon); border-left: 3px solid var(--red); padding-left: 12px; margin: 14px 0 0; }
.exhibit__repo { display: inline-block; margin-top: 14px; font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.02em; color: var(--slate); }
.exhibit-group { margin-top: 30px; }

/* ---- Contact fineprint ---------------------------------------------------- */
.fineprint { font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.8; color: var(--slate); margin-top: 26px; }
.fineprint a { color: var(--slate); }
.fineprint a:hover { color: var(--red-ink); }

/* ---- About: portrait + role line + patent table --------------------------- */
.hero--top .wrap { align-items: start; }
.portrait { position: relative; max-width: 360px; margin: 0 auto; }
.portrait img { display: block; width: 100%; height: auto; border: 1px solid var(--hairline); position: relative; z-index: 1; }
.portrait::before { content: ""; position: absolute; top: -14px; right: -14px; width: 72px; height: 72px; background: var(--red); z-index: 0; }
.role-line { font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.04em; color: var(--slate); margin: 8px 0 20px; text-transform: uppercase; }

.patents { list-style: none; margin: 28px 0 0; padding: 0; counter-reset: pat; border-top: 1px solid var(--hairline); }
.patent { display: grid; grid-template-columns: 2.4rem 1fr; column-gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--hairline); }
.patent::before { counter-increment: pat; content: counter(pat, decimal-leading-zero); grid-column: 1; grid-row: span 3; font-family: var(--font-mono); color: var(--red); font-size: 0.85rem; }
.patent__id { grid-column: 2; font-family: var(--font-mono); font-size: 0.82rem; text-decoration: underline; text-underline-offset: 2px; }
.patent__title { grid-column: 2; font-size: 1rem; color: var(--carbon); margin: 5px 0; }
.patent__meta { grid-column: 2; font-family: var(--font-mono); font-size: 0.74rem; color: var(--slate); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- Diagonal section divider --------------------------------------------- */
.divider-slash { height: 0; border-bottom: 4px solid var(--red); transform: skewY(-1.2deg); transform-origin: left; margin-block: 8px; }

/* ---- CTA slab -------------------------------------------------------------- */
.slab { background: var(--carbon); color: var(--paper); position: relative; overflow: hidden; }
.slab .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.slab h2 { color: var(--paper); }
.slab__arc { position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 36px solid var(--red); opacity: 0.9; }

/* ---- Footer ---------------------------------------------------------------- */
.foot { border-top: 1px solid var(--hairline); padding-block: 36px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.foot, .foot a { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--slate); }

/* ---- Reveal animation (JS adds .in) --------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero__art { order: -1; max-width: 320px; }
  .proof { grid-template-columns: repeat(2, 1fr); }
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .offer-grid { grid-template-columns: 1fr; }
  .subex { grid-template-columns: 1fr; }
  .exhibits { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .nav { gap: 14px; }
  .proof, .pillars { grid-template-columns: 1fr; }
  .stat { border-right: 0; }
  .creds { grid-template-columns: 1fr; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--carbon); color: #fff; padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }
