/* Rapid Memory Express. Tokens are documented in DESIGN.md. */

@font-face {
  font-family: "Barlow";
  src: url("/fonts/barlow-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("/fonts/barlow-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #F6F5F0;
  --bg-alt: #ECEAE3;
  --surface: #FBFAF7;
  --ink: #17191C;
  --ink-muted: #50555C;
  --line: #D8D5CC;
  --primary: #0D6B48;
  --primary-hover: #0A583B;
  --on-primary: #FFFFFF;
  --link: #0D6B48;
  --focus: #0D6B48;
  --band-bg: #17191C;
  --band-ink: #F6F5F0;
  --band-muted: #B9BDC2;
  --band-link: #6FD3A5;
  --band-line: #33383E;

  /* module drawing */
  --pcb: #1F6E4E;
  --pcb-edge: #154F38;
  --chip: #24282D;
  --gold: #C79A2B;
  --sticker: #FFFFFF;
  --sticker-ink: #9AA0A6;
  --dim: #6B7077;
  --ihs: #B9BEC4;
  --leg: #9AA0A6;

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-text: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "SF Mono", Menlo, "Roboto Mono", monospace;

  --text-label: 0.8125rem;
  --text-small: 0.9375rem;
  --text-body: 1.0625rem;
  --text-lede: 1.25rem;
  --text-h3: 1.5rem;
  --text-h2: clamp(2rem, 1.45rem + 2.2vw, 2.875rem);
  --text-display: clamp(2.625rem, 1.55rem + 4.4vw, 4.75rem);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --section: var(--s8);
  --gutter: 20px;
  --container: 1140px;
  --measure: 62ch;

  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;
}

@media (min-width: 768px) {
  :root { --gutter: 32px; --section: var(--s9); }
}
@media (min-width: 1024px) {
  :root { --text-body: 1.125rem; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --bg-alt: #1A1D21;
    --surface: #16191C;
    --ink: #ECEAE4;
    --ink-muted: #A7ADB4;
    --line: #2B3036;
    --primary: #52C792;
    --primary-hover: #6FD3A5;
    --on-primary: #0B1F16;
    --link: #6FD3A5;
    --focus: #6FD3A5;
    --band-bg: #0B0C0E;
    --band-ink: #ECEAE4;
    --band-muted: #A7ADB4;
    --band-link: #6FD3A5;
    --band-line: #2B3036;

    --pcb: #236F50;
    --pcb-edge: #3B8A69;
    --chip: #0C0E10;
    --gold: #D6AC4A;
    --sticker: #E4E2DC;
    --sticker-ink: #8A9096;
    --dim: #8C9299;
    --ihs: #8C939A;
    --leg: #6B7077;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
}
h1 { font-size: var(--text-display); line-height: 0.98; letter-spacing: -0.01em; }
h2 { font-size: var(--text-h2); line-height: 1.05; }
h3 { font-size: var(--text-h3); line-height: 1.15; }

p { margin: 0; max-width: var(--measure); }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.nowrap { white-space: nowrap; }

.skip-link {
  position: absolute;
  left: var(--s4);
  top: -100px;
  z-index: 10;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--s4); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 48px;
  padding: 0 var(--s5);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--bg-alt); }

.btn-sm { min-height: 44px; padding: 0 var(--s4); font-size: 1rem; }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
}

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: 72px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
}
.wordmark svg { width: 36px; flex: none; }

.header-right { display: flex; align-items: center; gap: var(--s5); }
.site-nav { display: none; }
@media (min-width: 880px) {
  .site-nav { display: flex; gap: var(--s5); }
  .site-nav a {
    padding-block: var(--s2);
    color: var(--ink);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
  }
  .site-nav a:hover,
  .site-nav a[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.35em;
  }
}

.call-short { display: none; }
@media (max-width: 479px) {
  .wordmark { font-size: 1.0625rem; letter-spacing: 0.04em; gap: var(--s2); }
  .wordmark svg { width: 30px; }
  .call-long { display: none; }
  .call-short { display: inline; }
}

/* ---------- Hero ---------- */
.hero { padding-block: var(--s8) var(--section); }

.hero-grid {
  display: grid;
  gap: var(--s7);
  align-items: center;
}
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s8); }
}

.hero-copy h1 { margin-top: var(--s4); }
.lede {
  margin-top: var(--s5);
  font-size: var(--text-lede);
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 34em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s6);
}
@media (max-width: 599px) {
  .actions .btn { flex: 1 1 100%; }
}
.hero-aside { margin-top: var(--s5); font-size: var(--text-small); color: var(--ink-muted); }

/* ---------- Quote checklist card ---------- */
.rfq-card {
  width: 100%;
  max-width: 540px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
@media (min-width: 960px) {
  .rfq-card { max-width: 500px; justify-self: end; }
}
.rfq-head {
  padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1.5px solid var(--ink);
}
.rfq-title {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rfq-to {
  margin-top: var(--s1);
  font-size: var(--text-small);
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.rfq-fields { margin: 0; padding: 0 var(--s5); list-style: none; }
.rfq-fields li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: var(--s3);
  padding-block: var(--s4);
  border-bottom: 1px solid var(--line);
}
.rfq-fields li:last-child { border-bottom: 0; }
.rfq-num {
  padding-top: 0.2rem;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  color: var(--ink-muted);
}
.rfq-key { display: block; font-weight: 600; line-height: 1.35; }
.rfq-val { display: block; font-size: var(--text-small); line-height: 1.45; color: var(--ink-muted); }
.rfq-foot {
  max-width: none;
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: var(--bg-alt);
  font-size: var(--text-small);
  color: var(--ink-muted);
}

.hero-figure {
  margin: 0;
  padding: var(--s5) var(--s4) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background-color: var(--surface);
}
.hero-figure .modules {
  background-image: radial-gradient(var(--line) 1px, transparent 1.2px);
  background-size: 18px 18px;
  background-position: center;
}
@media (min-width: 600px) {
  .hero-figure { padding: var(--s6) var(--s6) var(--s5); }
}
.hero-figure { width: 100%; max-width: 540px; }
@media (min-width: 960px) {
  .hero-figure { max-width: 520px; justify-self: end; }
}
.hero-figure figcaption {
  margin-top: var(--s4);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  line-height: 1.5;
  color: var(--ink-muted);
}

/* ---------- Module drawing ---------- */
.modules { width: 100%; }
.m-pcb { fill: var(--pcb); stroke: var(--pcb-edge); stroke-width: 1; }
.m-chip { fill: var(--chip); }
.m-gold { fill: var(--gold); }
.m-sticker { fill: var(--sticker); }
.m-print { fill: var(--sticker-ink); }
.m-ihs { fill: var(--ihs); }
.m-leg { fill: var(--leg); }
.m-dim { fill: none; stroke: var(--dim); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.m-callout { fill: none; stroke: var(--ink); stroke-width: 1.25; }
.m-calldot { fill: var(--ink); stroke: var(--surface); stroke-width: 1.5; }
.m-tag {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  fill: var(--ink);
}
.m-tagsub { font-weight: 400; fill: var(--ink-muted); letter-spacing: 0; }
.m-note, .m-dimtext {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--ink-muted);
}
.m-dimtext { fill: var(--dim); }

/* ---------- Types ---------- */
.types {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
}
.types-grid { display: grid; gap: var(--s6); }
@media (min-width: 960px) {
  .types-grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: var(--s8); align-items: start; }
}
.section-intro { margin-top: var(--s4); color: var(--ink-muted); }
@media (min-width: 960px) {
  .types-intro { position: sticky; top: var(--s6); }
}

.spec-list { margin: 0; border-top: 1.5px solid var(--ink); }
.spec-row {
  display: grid;
  gap: var(--s2) var(--s5);
  padding-block: var(--s5);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 600px) {
  .spec-row { grid-template-columns: 17rem minmax(0, 1fr); align-items: center; }
}
.spec-row dt {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: var(--s4);
  row-gap: 2px;
  align-items: center;
}
.spec-icon { grid-row: 1 / span 2; width: 64px; height: 32px; }
.spec-code, .spec-use { grid-column: 2; }
.spec-code {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.spec-use {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.1;
}
.spec-row dd { margin: 0; }


/* ---------- Steps ---------- */
.steps { padding-block: var(--section); background: var(--bg-alt); }
.step-list {
  display: grid;
  gap: var(--s6);
  margin: var(--s7) 0 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 960px) {
  .step-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.step-list li { padding-top: var(--s4); border-top: 1.5px solid var(--ink); }
.step-num {
  display: block;
  margin-bottom: var(--s3);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.step-list h3 { margin-bottom: var(--s3); }
.step-list a { overflow-wrap: anywhere; }

/* ---------- Guide strip ---------- */
.guide-strip { padding-block: var(--s7); }
.guide-strip-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4) var(--s6);
}
.guide-strip-title { font-size: var(--text-h3); }
.guide-strip p { margin-top: var(--s2); color: var(--ink-muted); }
@media (max-width: 599px) {
  .guide-strip-inner > .btn { flex: 1 1 100%; }
}

/* ---------- Contact band + footer ---------- */
.contact {
  padding-block: var(--section);
  background: var(--band-bg);
  color: var(--band-ink);
}
.contact .label { color: var(--band-muted); }
.contact a { color: var(--band-ink); }
.contact a:hover { color: var(--band-link); }
.contact :focus-visible { outline-color: var(--band-link); }

.contact-phone {
  display: inline-block;
  margin-top: var(--s3);
  font-family: var(--font-display);
  font-size: clamp(3rem, 1.6rem + 6.4vw, 6rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.contact-note { margin-top: var(--s3); color: var(--band-muted); }

.contact-list {
  display: grid;
  gap: var(--s5);
  margin: var(--s7) 0 0;
}
@media (min-width: 768px) {
  .contact-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6); }
}
.contact-list > div { padding-top: var(--s4); border-top: 1px solid var(--band-line); }
.contact-list dt {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--band-muted);
}
.contact-list dd {
  margin: var(--s2) 0 0;
  font-size: 1.25rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.site-footer {
  background: var(--band-bg);
  color: var(--band-muted);
  font-size: var(--text-small);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s2) var(--s5);
  padding-block: var(--s5);
  border-top: 1px solid var(--band-line);
}
.site-footer a { color: var(--band-muted); }
.site-footer a:hover { color: var(--band-link); }
.site-footer :focus-visible { outline-color: var(--band-link); }

/* ---------- 404 ---------- */
.notfound { padding-block: var(--s9) var(--s10); }
.notfound p { margin-top: var(--s5); color: var(--ink-muted); }
