/* HiFi Bliss — "Warm Signal" design system.
   Dark-first identity (a quiet listening room, warm tube glow), with a light reading mode.
   Hand-authored, no build step. Extend these tokens; don't fight them. */

/* ---------- Tokens ---------- */
:root {
  /* dark (primary) */
  --bg:       #14110F;
  --surface:  #1E1A17;
  --ink:      #EDE6DA;
  --muted:    #A89F92;
  --hairline: #2E2823;
  --accent:   #F2B25B;   /* tube-glow amber — used with restraint */
  --accent-ink: #14110F; /* text on amber */
  --signal:   #5FD0C5;   /* oscilloscope cyan — TOOL READOUTS ONLY */

  /* type */
  --font-display: "Archivo", system-ui, sans-serif;
  --font-body:    "Newsreader", Georgia, serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  /* scale & rhythm */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1:  clamp(1.33rem, 1.2rem + 0.6vw, 1.6rem);
  --step-2:  clamp(1.77rem, 1.5rem + 1.2vw, 2.4rem);
  --step-3:  clamp(2.36rem, 1.9rem + 2.2vw, 3.6rem);

  --wrap: 72rem;
  --gap: clamp(1rem, 0.8rem + 1vw, 1.75rem);
  --radius: 10px;
}

[data-theme="light"] {
  --bg:       #FAF8F4;
  --surface:  #FFFFFF;
  --ink:      #211C18;
  --muted:    #6B6358;
  --hairline: #E5DFD5;
  --accent:   #B5791E;
  --accent-ink: #FFFFFF;
  --signal:   #1E8C82;
}

@media (prefers-color-scheme: light) {
  html:not([data-theme]) { /* mirror light tokens if no explicit choice */ }
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.muted { color: var(--muted); }

h1, h2, h3, .brand-name, .eyebrow, .btn, .site-nav, .card-title {
  font-family: var(--font-display);
}

.eyebrow {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.skip-link {
  position: absolute; left: -999px;
}
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.5rem 0.75rem; border-radius: 6px;
}

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--hairline); }
.header-inner {
  display: flex; align-items: center; gap: var(--gap);
  padding-block: 0.9rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-name { font-weight: 800; letter-spacing: -0.01em; font-size: var(--step-1); }
.site-nav { margin-left: auto; display: flex; gap: clamp(0.75rem, 2vw, 1.5rem); flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 500; font-size: var(--step--1);
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.site-nav a:hover { color: var(--ink); }
.theme-toggle {
  background: transparent; border: 1px solid var(--hairline); color: var(--ink);
  border-radius: 50%; width: 2.25rem; height: 2.25rem; cursor: pointer; font-size: 1rem;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Signature: waveform rule ---------- */
.wave--rule { color: var(--accent); line-height: 0; }
.wave--rule svg { display: block; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 4vw, 3rem); max-width: 46rem; }
.hero-title { font-size: var(--step-3); line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
.hero-lede { font-size: var(--step-1); color: var(--muted); margin: 0 0 1.5rem; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.1rem; border-radius: var(--radius); text-decoration: none;
  font-weight: 600; font-size: var(--step--1); letter-spacing: 0.03em;
  border: 1px solid transparent; cursor: pointer; transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--accent:hover { filter: brightness(1.06); }
.btn--ghost { border-color: var(--hairline); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Sections & cards ---------- */
.section-title { font-size: var(--step-2); margin: clamp(1.5rem, 4vw, 3rem) 0 1.25rem; letter-spacing: -0.01em; }
.card-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 1.1rem; transition: border-color .15s ease;
}
.card:hover { border-color: var(--accent); }
.card-img { border-radius: 8px; margin-bottom: 0.75rem; aspect-ratio: 16/10; object-fit: cover; }
.card-title { font-size: var(--step-1); line-height: 1.15; margin: 0 0 0.4rem; }
.card-title a { text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-excerpt { margin: 0; font-size: var(--step--1); }

/* ---------- Article body (long-form reading) ---------- */
.article { width: min(100% - 2rem, 42rem); margin-inline: auto; }
.article :where(h2, h3) { font-family: var(--font-display); letter-spacing: -0.01em; margin-top: 2em; }
.article p, .article li { font-size: var(--step-0); }
.article a { color: var(--accent); text-underline-offset: 0.18em; }
.spec-table { font-family: var(--font-mono); font-size: var(--step--1); width: 100%; border-collapse: collapse; }
.spec-table td { border-bottom: 1px solid var(--hairline); padding: 0.5rem 0; }

/* ---------- Newsletter & footer ---------- */
.site-footer { margin-top: clamp(3rem, 8vw, 6rem); border-top: 1px solid var(--hairline); }
.footer-grid {
  display: grid; gap: var(--gap); padding-block: 2rem;
  grid-template-columns: 1.2fr 1fr 1.5fr;
}
@media (max-width: 48rem) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer nav { display: flex; flex-direction: column; gap: 0.4rem; }
.site-footer nav a, .footer-brand { text-decoration: none; }
.footer-brand { font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); margin: 0 0 0.25rem; }
.newsletter label { display: block; font-family: var(--font-display); font-size: var(--step--1);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.5rem; }
.newsletter-row { display: flex; gap: 0.5rem; }
.newsletter input[type="email"] {
  flex: 1; padding: 0.6rem 0.75rem; border-radius: 8px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink); font-family: var(--font-mono); font-size: var(--step--1);
}
.newsletter input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.newsletter button {
  padding: 0.6rem 1rem; border: 0; border-radius: 8px; background: var(--accent);
  color: var(--accent-ink); font-family: var(--font-display); font-weight: 600; cursor: pointer;
}
.newsletter-msg { margin: 0.75rem 0 0; font-size: var(--step--1); color: var(--accent); }
.newsletter-msg.is-error { color: #E0796A; }
.newsletter-result { padding-block: clamp(3rem, 10vw, 6rem); max-width: 60ch; }
.newsletter-result-body { color: var(--ink); font-size: var(--step-0); line-height: 1.6; margin: 0 0 1.5rem; }
.newsletter-result-body.is-error { color: #E0796A; }
.disclosure { padding-block: 1rem 2rem; }
.disclosure p { color: var(--muted); font-size: var(--step--1); margin: 0; max-width: 60ch; }

/* ---------- Tool readouts: the one place --signal appears ---------- */
.tool-readout { font-family: var(--font-mono); color: var(--signal); }

/* ---------- Matcher tool ---------- */
.tool-explainer p { max-width: 65ch; margin: 0 0 0.75rem; }
.tool-explainer strong { color: var(--ink); }

.matcher {
  display: grid; gap: var(--gap); align-items: start; margin-top: var(--gap);
  grid-template-columns: 1.05fr 1fr;
}
@media (max-width: 48rem) { .matcher { grid-template-columns: 1fr; } }

.matcher-form, .matcher-result {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.1rem;
}
.matcher-form { display: flex; flex-wrap: wrap; gap: var(--gap); align-content: start; }
.matcher-form .filter-field { min-width: 9rem; }
.matcher-form input, .matcher-form select {
  width: 100%; padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--hairline);
  background: var(--bg); color: var(--ink); font-family: var(--font-mono); font-size: var(--step--1);
}
.matcher-form input:focus, .matcher-form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.matcher-form .filter-actions { flex-basis: 100%; }

.readout-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(3, 1fr); margin: 0 0 1rem; }
@media (max-width: 30rem) { .readout-grid { grid-template-columns: 1fr; } }
.readout-item dt { font-family: var(--font-display); font-size: var(--step--1); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.25rem; }
.readout-item dd { margin: 0; font-size: var(--step-2); line-height: 1.05; }
.readout-item dd .unit { font-size: var(--step--1); color: var(--muted); }
.matcher-verdict { margin: 0.5rem 0 0; font-family: var(--font-display); }
.verdict-badge { font-weight: 700; }
.verdict-badge--ok { color: var(--signal); }
.verdict-badge--warn { color: var(--accent); }
.verdict-badge--hard { color: #E0796A; }

.tool-note { color: var(--muted); font-size: var(--step--1); margin: 0.25rem 0 0; }
.tool-note--error { color: #E0796A; }

.tool-assumptions { margin-top: var(--gap); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 0.75rem 1.1rem; }
.tool-assumptions summary { cursor: pointer; font-family: var(--font-display); color: var(--ink); }
.tool-assumptions ul { margin: 0.75rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: var(--step--1); }
.tool-assumptions li { margin-bottom: 0.4rem; }

.source-card .source-spec { margin: 0.2rem 0; font-size: var(--step--1); }
.source-card .source-rated { font-family: var(--font-mono); font-size: var(--step--1); margin: 0.2rem 0 0.6rem; }
.btn--sm { padding: 0.45rem 0.8rem; font-size: var(--step--1); }

/* ---------- Errors ---------- */
.error-page { padding-block: clamp(3rem, 10vw, 7rem); text-align: center; }
.error-page h1 { font-size: var(--step-2); }

/* ---------- Article header & long-form body ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.5rem; font-family: var(--font-display);
  font-size: var(--step--1); color: var(--muted); margin-bottom: 1.25rem; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.article-head { margin-bottom: 1.5rem; }
.article-title { font-size: var(--step-3); line-height: 1.08; letter-spacing: -0.02em; margin: 0.25rem 0 0.5rem; }
.article-lede { font-size: var(--step-1); line-height: 1.4; margin: 0 0 1rem; }
.article-meta { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); margin: 0; }
.article-hero { width: 100%; border-radius: var(--radius); margin: 0 0 1.5rem; aspect-ratio: 16/9; object-fit: cover; }
.article-body { margin-top: 1.5rem; }
.article-body > :first-child { margin-top: 0; }
.article-body img { border-radius: 8px; margin-block: 1.5rem; }
.article-body blockquote { border-left: 3px solid var(--accent); margin-inline: 0;
  padding-left: 1rem; color: var(--muted); font-style: italic; }
.article-body pre { background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px;
  padding: 1rem; overflow-x: auto; font-family: var(--font-mono); font-size: var(--step--1); }
.article-body code { font-family: var(--font-mono); font-size: 0.92em; }
.article-body table { width: 100%; border-collapse: collapse; font-size: var(--step--1); margin-block: 1.5rem; }
.article-body th, .article-body td { border-bottom: 1px solid var(--hairline); padding: 0.5rem 0.6rem; text-align: left; }

/* ---------- Tags ---------- */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 2rem 0 0; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: var(--step--1); text-decoration: none;
  padding: 0.2rem 0.6rem; border: 1px solid var(--hairline); border-radius: 999px; color: var(--muted); }
.tag:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Listing head, kicker & pager ---------- */
.list-head { margin-top: clamp(1.5rem, 4vw, 3rem); }
.list-intro { max-width: 60ch; }
.card-kicker { margin: 0 0 0.2rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin: clamp(2rem, 5vw, 3.5rem) 0; font-family: var(--font-display); }
.pager-link { text-decoration: none; padding: 0.5rem 0.9rem; border: 1px solid var(--hairline); border-radius: 8px; }
.pager-link:hover { border-color: var(--accent); color: var(--accent); }
.pager-link.is-disabled { color: var(--muted); opacity: 0.5; }
.pager-status { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); }

/* ---------- Related products ---------- */
.related { margin-top: clamp(2.5rem, 6vw, 4rem); }
.rating { font-family: var(--font-mono); color: var(--accent); font-size: var(--step--1); margin: 0 0 0.3rem; }
.price-note { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); margin: 0.3rem 0 0; }

/* ---------- Directory filter bar ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--gap);
  padding: 1rem 1.1rem; margin-bottom: var(--gap);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
}
.filter-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 12rem; flex: 1; }
.filter-field label {
  font-family: var(--font-display); font-size: var(--step--1); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.filter-field select {
  padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--hairline);
  background: var(--bg); color: var(--ink); font-family: var(--font-mono); font-size: var(--step--1);
}
.filter-field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.filter-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ---------- Product page ---------- */
.product { margin-top: clamp(1.5rem, 4vw, 3rem); }
.product-layout {
  display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start;
}
@media (max-width: 48rem) { .product-layout { grid-template-columns: 1fr; } }
.product-img {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--hairline);
  background: var(--surface); aspect-ratio: 4/3; object-fit: cover;
}
.product-title { font-size: var(--step-2); line-height: 1.1; letter-spacing: -0.01em; margin: 0.25rem 0 0.5rem; }
.product-head .eyebrow a { text-decoration: none; }
.product-rating { font-size: var(--step-0); margin: 0 0 0.5rem; }
.product-lede { font-size: var(--step-1); line-height: 1.4; margin: 0 0 1.25rem; }
.product-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.6rem; }
.product-body { width: 100%; max-width: 42rem; }
.product-specs { margin-top: clamp(2rem, 5vw, 3rem); max-width: 42rem; }
.spec-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 0.5rem 1rem 0.5rem 0;
  border-bottom: 1px solid var(--hairline); white-space: nowrap; }

/* ---------- A11y: focus + motion ---------- */
:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
