/* styles.css — theme_01 "Editorial Split-Column Reference" for homefrontnews.com
   Tokens: bg #faf8f4 · surface #ffffff · ink #18181b · accent #1d4ed8 · muted #52525b */

:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3f0e9;
  --ink: #18181b;
  --accent: #1d4ed8;
  --muted: #52525b;
  --hairline: #e3ded2;
  --hairline-soft: #ece8dd;
  --pass: #15803d;
  --warn: #b45309;
  --fail: #b91c1c;
  --serif: Georgia, 'Times New Roman', Times, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Disclosure strip ---------- */

.disclosure-strip {
  margin: 0;
  padding: 10px 24px;
  background: var(--ink);
  color: #d4d4d8;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  text-align: center;
}
.disclosure-strip a { color: #93c5fd; }

/* ---------- Masthead ---------- */

.masthead { border-bottom: 1px solid var(--hairline); background: var(--bg); }
.masthead-inner { max-width: 1180px; margin: 0 auto; padding: 40px 24px 36px; }
.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
h1 { font-size: clamp(40px, 7vw, 68px); line-height: 1.02; margin: 0 0 16px; }
h1 .accent { color: var(--accent); }
.lede { max-width: 62ch; margin: 0 0 18px; font-size: 16.5px; line-height: 1.6; color: var(--ink); }
.meta-line {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}

/* ---------- Editorial split-column layout ---------- */

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
}

.toc-rail {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px 0;
}
.toc-nav { display: flex; flex-direction: column; gap: 2px; }
.toc-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
  margin: 18px 0 6px;
}
.toc-title:first-child { margin-top: 0; }
.toc-nav a {
  display: block; padding: 7px 12px;
  font-size: 13.5px; font-weight: 600;
  color: var(--ink); text-decoration: none;
  border-left: 2px solid var(--hairline);
}
.toc-nav a:hover { color: var(--accent); border-left-color: var(--accent); }

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .toc-rail {
    position: static; max-height: none;
    padding: 20px 0 8px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 8px;
  }
  .toc-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .toc-nav a { border-left: 0; border: 1px solid var(--hairline); border-radius: 999px; padding: 5px 12px; background: var(--surface); }
  .toc-title { width: 100%; margin: 8px 0 2px; }
}

/* ---------- Modules ---------- */

.content { min-width: 0; }
.module { margin-top: 48px; padding-top: 26px; border-top: 1px solid var(--hairline); }
.module:first-child { border-top: 0; padding-top: 0; margin-top: 24px; }
.module-head {
  display: grid; grid-template-columns: 44px 1fr;
  gap: 16px; align-items: start; margin-bottom: 20px;
}
.mod-num {
  font-family: var(--serif); font-size: 24px; font-weight: 700;
  color: var(--accent); line-height: 1.2; text-align: center;
}
.module h2 { margin: 0 0 6px; font-size: 26px; }
.module h3 { margin: 0 0 10px; font-size: 19px; }
.hint { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 68ch; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- Workbench panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 22px;
}
.tab-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tab-btn {
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: 0.03em;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface-2);
  color: var(--muted);
}
.tab-btn.active { background: var(--ink); border-color: var(--ink); color: #faf8f4; }
.tab-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
.tab-panel[hidden] { display: none; }

.split {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 24px; align-items: start;
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.controls label {
  display: block; margin-bottom: 13px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.controls input {
  display: block; width: 100%; margin-top: 5px;
  padding: 9px 11px; font: inherit; font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 8px;
}
.controls input:focus { border-color: var(--accent); }

.preset-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.preset-btn {
  font: inherit; font-size: 13px; font-weight: 600; text-align: left;
  padding: 9px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface-2); color: var(--ink);
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent); }

.results h3 { margin-top: 0; }
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 18px;
}
.stat {
  padding: 11px 13px; border: 1px solid var(--hairline-soft);
  border-radius: 10px; background: var(--surface-2);
}
.stat-k { display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-v {
  display: block; margin-top: 3px;
  font-family: var(--mono); font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.stat-v.accent { color: var(--accent); }

.curve-fig { margin: 0; }
.curve-fig svg { width: 100%; height: auto; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 10px; }
.curve-fig figcaption { margin-top: 8px; }

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface);
  margin-top: 14px;
}
table.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
table.data-table th, table.data-table td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--hairline-soft); vertical-align: top;
}
table.data-table thead th {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--hairline);
}
table.data-table tbody tr:last-child td { border-bottom: 0; }
table.data-table .num { text-align: right; font-family: var(--mono); }
table.data-table th { font-weight: 600; }
table.domain-table th { width: 200px; font-size: 12px; color: var(--muted); font-weight: 600; }

.error { color: var(--fail); font-family: var(--mono); font-size: 12.5px; }

/* ---------- Rubric ---------- */

.rubric-list { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.rubric-item {
  border: 1px solid var(--hairline); border-radius: 10px;
  padding: 14px 16px; background: var(--surface);
}
.rubric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rubric-head .muted { font-size: 12px; white-space: nowrap; }
.rubric-item input[type="range"] { width: 100%; margin: 10px 0 4px; accent-color: var(--accent); }
.rubric-item output { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.rubric-total { font-size: 15px; margin: 8px 0 0; }

/* ---------- Export ---------- */

.export-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.btn {
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
  padding: 10px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #ffffff;
}
.btn:hover { background: var(--ink); border-color: var(--ink); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent); color: #ffffff; }

.code-out {
  margin: 0; padding: 18px;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 12px;
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  overflow: auto; white-space: pre; max-height: 460px;
}
#exp-hash { color: var(--accent); font-weight: 700; }

/* ---------- Reference extras ---------- */

.spark-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.spark-chip {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  border: 1px solid var(--hairline); border-radius: 10px;
  padding: 10px 12px; background: var(--surface-2);
}
.spark-chip svg { display: block; }

.archive-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px; margin-top: 8px;
}
.archive-card {
  border: 1px solid var(--hairline); border-radius: 12px;
  padding: 18px; background: var(--surface);
}
.archive-card h3 { font-family: var(--mono); font-size: 13.5px; margin-bottom: 8px; color: var(--accent); }
.archive-card p { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- Methodology / FAQ ---------- */

.method-list { margin: 0; padding-left: 20px; max-width: 72ch; }
.method-list li { margin-bottom: 7px; font-size: 14.5px; }
.method-list strong { font-family: var(--mono); font-size: 0.92em; }

.faq-item {
  border: 1px solid var(--hairline); border-radius: 12px;
  background: var(--surface); padding: 0; margin-bottom: 10px;
}
.faq-item summary {
  cursor: pointer; padding: 14px 18px;
  font-family: var(--serif); font-size: 16px; font-weight: 700; list-style: none;
}
.faq-item summary::before { content: "+ "; color: var(--accent); font-family: var(--mono); }
.faq-item[open] summary::before { content: "− "; }
.faq-item p { margin: 0; padding: 0 18px 16px; font-size: 14px; color: var(--muted); max-width: 70ch; }
.faq-item code, .hint code, .method-list code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--hairline-soft); padding: 1px 5px; border-radius: 4px; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  padding: 32px 24px 48px;
  max-width: 1180px; margin: 0 auto;
  font-size: 13.5px; text-align: center; color: var(--muted);
}
.site-footer p { margin: 0 0 8px; }
.site-footer strong { color: var(--ink); }
.site-footer a { color: var(--accent); }
.legal-links a { margin: 0 10px; }
.fine { color: var(--muted); font-size: 12px; margin-top: 12px !important; }
