/* Correct by Design. Shared across index.html, method.html, about.html,
   and case-studies/*. Page-specific rules stay inline. */

:root {
  /* ink-drench: dark warm surface, light warm ink */
  --bg: #16120d;
  --surface: #1f1912;
  --surface-2: #271f16;
  --paper: #efe9dc;
  --ink: #1c1813;
  --text: #efe9dc;
  --text-soft: rgba(239, 233, 220, 0.80);
  --ink-soft: rgba(239, 233, 220, 0.62);
  --line: rgba(239, 233, 220, 0.15);
  --line-strong: rgba(239, 233, 220, 0.26);
  --accent: #e0481e;
  --accent-bright: #f0633a;
  --maxw: 1180px;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --sans:  "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
::selection { background: var(--accent); color: #f4efe4; }
[id] { scroll-margin-top: 88px; }
a { color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; }

@keyframes riseIn { from { transform: translateY(22px); opacity: 0; } to { transform: none; opacity: 1; } }
.rise { animation: riseIn 0.85s both; }
@media (prefers-reduced-motion: reduce) { .rise { animation: none !important; } }

/* ---------- film grain ---------- */
.grain {
  position: fixed; inset: 0; z-index: 90;
  pointer-events: none; mix-blend-mode: overlay; opacity: 0.08;
  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='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- shell ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 18px; }
.eyebrow.accent { color: var(--accent-bright); }
section { position: relative; }
.lede { font-size: 21px; line-height: 1.55; color: var(--text-soft); max-width: 660px; text-wrap: pretty; }
h2.section-h { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 4.6vw, 44px); line-height: 1.1; letter-spacing: -0.025em; margin: 0; text-wrap: balance; max-width: 22ch; }
h2.section-h em { font-style: normal; color: var(--accent); }
p { text-wrap: pretty; }
.band { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- nav ---------- */
nav.site {
  position: sticky; top: 0; z-index: 50;
  background: rgba(22, 18, 13, 0.72);
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
nav.site .row { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.brand { text-decoration: none; color: var(--text); display: flex; flex-direction: column; align-items: flex-start; gap: 3px; white-space: nowrap; }
.brand .name { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; line-height: 1; }
/* the wordmark spaces are accent underscores. the brand link carries an aria-label
   so the accessible name stays "Correct By Design" rather than reading the marks. */
.brand .name .us { color: var(--accent); }
.brand .spine { font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em; text-transform: none; color: var(--text-soft); line-height: 1; }
nav.site .links { display: flex; align-items: center; gap: 30px; }
.navlink { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text); text-decoration: none; transition: opacity 160ms; }
.navlink:hover { opacity: 0.5; }
/* the nav is identical on every page, so the current page has to be marked */
.navlink[aria-current="page"] { color: var(--accent-bright); }
.navlink[aria-current="page"]:hover { opacity: 1; }
.navcta { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); background: var(--paper); text-decoration: none; padding: 11px 18px; transition: background 180ms, color 180ms; }
.navcta:hover { background: var(--accent); color: var(--paper); }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; margin: -8px -8px -8px 0; cursor: pointer; color: var(--text); }
.nav-toggle .bar { display: block; width: 24px; height: 2px; background: currentColor; transition: transform 0.2s, opacity 0.2s; }
.nav-toggle .bar + .bar { margin-top: 5px; }
nav.site.open .nav-toggle .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.site.open .nav-toggle .bar:nth-child(2) { opacity: 0; }
nav.site.open .nav-toggle .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- buttons ---------- */
.btn-solid { font-family: var(--mono); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); background: var(--paper); text-decoration: none; padding: 15px 26px; transition: background 180ms, color 180ms; display: inline-block; }
.btn-solid:hover { background: var(--accent); color: var(--paper); }
.btn-outline { font-family: var(--mono); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); background: transparent; text-decoration: none; padding: 14px 26px; border: 1px solid var(--line-strong); transition: all 180ms; display: inline-block; }
.btn-outline:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.inline-link { color: var(--accent-bright); text-decoration: none; border-bottom: 1px solid rgba(224,72,30,0.4); transition: border-color 160ms; }
.inline-link:hover { border-color: var(--accent-bright); }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* a link that carries a reader to the deeper page */
.more { display: inline-block; margin-top: 34px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-bright); text-decoration: none; border-bottom: 1px solid rgba(224,72,30,0.4); padding-bottom: 4px; transition: color 160ms, border-color 160ms; }
.more:hover { color: var(--paper); border-color: var(--paper); }

/* ---------- hero ---------- */
header.hero { padding-top: 108px; padding-bottom: 96px; }
header.hero.tall { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; }
.hero h1 { font-family: var(--display); font-weight: 700; font-size: clamp(40px, 7.6vw, 82px); line-height: 1.02; letter-spacing: -0.03em; margin: 0; max-width: 14ch; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero h1.sub-scale { font-size: clamp(34px, 5.4vw, 60px); max-width: 20ch; }
.hero-body { font-size: clamp(19px, 2.2vw, 23px); line-height: 1.5; max-width: 640px; margin: 34px 0 40px; color: var(--text-soft); }
.hero-body.small { font-size: 18px; max-width: 620px; margin-bottom: 34px; color: var(--ink-soft); }

/* ---------- numbered detail rows (properties, parts) ---------- */
.rows { margin-top: 46px; border-top: 1px solid var(--line-strong); }
.row-item { display: grid; grid-template-columns: 96px 1fr; gap: 0 28px; padding: 36px 0; border-bottom: 1px solid var(--line); }
/* grid items default to min-width:auto, so anything wide inside the 1fr track
   (a diagram with a min-width, a long code string) widens the track instead of
   scrolling or wrapping inside it. */
.row-item > * { min-width: 0; }
.row-item .pn { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-bright); padding-top: 7px; line-height: 1.5; }
.row-item h3 { font-family: var(--display); font-weight: 600; font-size: clamp(21px, 2.6vw, 26px); line-height: 1.22; letter-spacing: -0.02em; margin: 0 0 14px; }
.row-item h3 em { font-style: normal; color: var(--accent); }
.row-item p { font-size: 17px; line-height: 1.62; color: var(--text-soft); margin: 0 0 16px; max-width: 62ch; }
.row-item p:last-child { margin-bottom: 0; }
.row-item p strong { color: var(--text); font-weight: 600; }
.row-item code { font-family: var(--mono); font-size: 0.9em; color: var(--paper); }
.row-item p.echo { font-family: var(--display); font-weight: 500; font-size: clamp(19px, 2.4vw, 23px); line-height: 1.32; letter-spacing: -0.015em; color: var(--text); max-width: 34ch; margin-top: 24px; }

/* ---------- the report list ---------- */
.report-list { list-style: none; margin: 40px 0 0; padding: 0; max-width: 760px; }
.report-list li { padding: 20px 0; border-top: 1px solid var(--line); font-size: 18px; line-height: 1.58; color: var(--text-soft); }
.report-list li:last-child { border-bottom: 1px solid var(--line); }
.report-list li strong { color: var(--text); font-weight: 600; }

/* ---------- free scan ---------- */
.scan-block { margin-top: 34px; padding: 32px; border: 1px dashed var(--line-strong); }
.scan-block h3 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-bright); margin: 0 0 16px; }
.scan-block p { font-size: 17px; line-height: 1.62; color: var(--text-soft); margin: 0 0 18px; max-width: 64ch; }
.scan-block p strong { color: var(--text); font-weight: 600; }

/* ---------- data display ---------- */
.data-figure { font-family: var(--mono); font-weight: 500; font-size: clamp(52px, 8vw, 92px); line-height: 0.92; letter-spacing: -0.035em; color: var(--paper); display: block; }
.data-label { display: block; margin-top: 14px; font-size: 15px; line-height: 1.4; color: var(--text-soft); max-width: 30ch; }
.counts { margin-top: 40px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; border-top: 1px solid var(--line-strong); padding-top: 40px; }

/* ---------- contact ---------- */
section.contact { padding-top: 80px; padding-bottom: 80px; }
.contact h2 { font-family: var(--display); font-weight: 600; font-size: clamp(44px, 7vw, 80px); line-height: 1.02; letter-spacing: -0.03em; margin: 0; max-width: 14ch; }
.contact h2 em { font-style: normal; color: var(--accent); }
.contact-body { margin-top: 30px; max-width: 640px; }
.contact-body p { font-size: 19px; line-height: 1.6; color: var(--text-soft); }
.contact-body p strong { color: var(--text); font-weight: 600; }
.where { margin-top: 40px; }
.where .q { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-bright); margin: 0 0 8px; }
.where ul { list-style: none; margin: 0; padding: 0; max-width: 720px; }
.where li { padding: 20px 0; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.55; color: var(--text-soft); }
.where li:last-child { border-bottom: 1px solid var(--line); }
.where li strong { color: var(--text); font-weight: 600; }

/* ---------- footer ---------- */
footer.foot { border-top: 1px solid var(--line); margin-top: 80px; }
footer.foot .inner { padding-top: 40px; padding-bottom: 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
footer.foot a { color: var(--ink-soft); text-decoration: none; transition: color 160ms; }
footer.foot a:hover { color: var(--paper); }
/* wrap, or the four links overflow the viewport on mobile and scroll the whole page sideways */
footer.foot .social { display: flex; flex-wrap: wrap; gap: 12px 24px; }

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  /* hamburger: the links collapse into a toggled panel below the bar */
  .nav-toggle { display: block; }
  nav.site .links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(22, 18, 13, 0.94); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
    border-bottom: 1px solid var(--line); padding: 6px 40px 22px;
  }
  nav.site.open .links { display: flex; }
  nav.site .links .navlink { padding: 13px 2px; border-bottom: 1px solid var(--line); }
  nav.site .links .navcta { margin-top: 14px; text-align: center; }
  .counts { grid-template-columns: 1fr; gap: 40px; }
  header.hero.tall { min-height: 0; padding-top: 72px; padding-bottom: 72px; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 22px; padding-right: 22px; }
  nav.site .links { padding-left: 22px; padding-right: 22px; }
  .row-item { grid-template-columns: 1fr; gap: 10px; }
  .row-item .pn { padding-top: 0; }
}
