/* Layout concept: an assay certificate. A citation margin runs beside each section,
   so every claim on the page sits next to the regulation it rests on. */
:root {
  --paper: #f3f5f7;
  --surface: #ffffff;
  --ink: #131b26;
  --muted: #536072;
  --line: #d6dbe2;
  --gold: #85651d;
  --gold-soft: #efe6d1;
  --band: #18263a;
  --band-ink: #e9edf2;
  --band-muted: #a9b4c3;
  --band-gold: #d4b062;
  --alert: #9a2f22;
  --ok: #2f6b4a;

  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.4rem, 5.2vw, 3.6rem);
  --measure: 66ch;
  --wrap: 1160px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e131a; --surface: #151c26; --ink: #e5e9ef; --muted: #9ba6b5; --line: #29323f;
    --gold: #d2ad5c; --gold-soft: #2b2617; --band: #0a0f15; --band-ink: #e5e9ef; --band-muted: #9ba6b5;
    --band-gold: #d2ad5c; --alert: #e2826f; --ok: #7cc39c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e131a; --surface: #151c26; --ink: #e5e9ef; --muted: #9ba6b5; --line: #29323f;
  --gold: #d2ad5c; --gold-soft: #2b2617; --band: #0a0f15; --band-ink: #e5e9ef; --band-muted: #9ba6b5;
  --band-gold: #d2ad5c; --alert: #e2826f; --ok: #7cc39c; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: var(--step-0); line-height: 1.6;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--band);
}
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
img, svg { max-width: 100%; }

.wrap {
  max-width: var(--wrap); margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 720px) {
  .wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--band); color: var(--band-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--band-gold) 35%, transparent);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--band-ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--display); font-size: 1.45rem; font-weight: 600; letter-spacing: 0.01em; }
.brand-name b { color: var(--band-gold); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--band-muted); text-decoration: none; font-size: 0.93rem; font-weight: 500;
  padding: 8px 12px; border-radius: 4px;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--band-ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--band-gold); border-radius: 0; }
.nav a.nav-cta { color: var(--band); background: var(--band-gold); margin-left: 8px; }
.nav a.nav-cta:hover { color: var(--band); filter: brightness(1.08); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--band-muted); color: var(--band-ink);
  font: 600 0.85rem var(--body); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 8px 12px; border-radius: 4px; cursor: pointer;
}
@media (max-width: 920px) {
  .nav-toggle { display: inline-block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch;
    background: var(--band); padding: 8px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
    border-bottom: 1px solid var(--line);
  }
  .nav[data-open="false"] { display: none; }
  .nav a { padding: 12px 8px; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--band-gold); padding-left: 14px; }
  .nav a.nav-cta { margin: 8px 0 0; text-align: center; }
}

/* ---------- Type ---------- */
h1, h2, h3 { text-wrap: balance; line-height: 1.15; margin: 0; }
h1 { font-family: var(--display); font-size: var(--step-4); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-family: var(--display); font-size: var(--step-3); font-weight: 600; }
h3 { font-family: var(--body); font-size: var(--step-1); font-weight: 700; letter-spacing: -0.005em; }
p { margin: 0; max-width: var(--measure); }
.lede { font-size: var(--step-1); color: var(--muted); line-height: 1.55; }
.eyebrow {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); font-weight: 500;
}
.cite {
  display: inline-block; font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; white-space: nowrap;
  background: var(--surface);
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }
ul.plain { margin: 0; padding-left: 1.2em; max-width: var(--measure); display: flex; flex-direction: column; gap: 8px; }
ul.plain li::marker { color: var(--gold); }

/* ---------- Hero ---------- */
.hero { background: var(--band); color: var(--band-ink); }
.hero .wrap { padding-block: 72px 80px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.hero h1 { color: var(--band-ink); }
.hero h1 em { font-style: italic; color: var(--band-gold); }
.hero .lede { color: var(--band-muted); }
.hero .eyebrow { color: var(--band-gold); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.hero.compact .wrap { padding-block: 56px 56px; grid-template-columns: minmax(0, 1fr); }
.hero.compact h1 { font-size: clamp(2.1rem, 4.4vw, 3rem); max-width: 22ch; }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-block: 48px 56px; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font: 600 0.98rem var(--body); padding: 13px 20px; border-radius: 4px; border: 1px solid transparent;
}
.btn-gold { background: var(--band-gold); color: var(--band); }
.btn-gold:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--band-ink); border-color: color-mix(in srgb, var(--band-ink) 35%, transparent); }
.btn-ghost:hover { border-color: var(--band-gold); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { filter: brightness(1.15); }

/* The stamp: a hallmarked bar */
.stamp { justify-self: center; width: min(100%, 400px); }
.stamp svg { display: block; width: 100%; height: auto; }
.stamp-caption { font-family: var(--mono); font-size: 0.75rem; color: var(--band-muted); text-align: center; margin-top: 12px; letter-spacing: 0.04em; }

/* ---------- Sections with citation margin ---------- */
.section { padding-block: 72px; }
.section + .section { border-top: 1px solid var(--line); }
.section.alt { background: var(--surface); }
.ledger { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; }
.ledger-margin { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding-top: 6px; }
.ledger-margin .eyebrow { line-height: 1.4; }
.ledger-body { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 820px) {
  .section { padding-block: 52px; }
  .ledger { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ledger-margin { flex-direction: row; flex-wrap: wrap; align-items: center; }
}

/* ---------- Grids & entries ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.entry { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; border-top: 2px solid var(--ink); min-width: 0; }
.entry p { color: var(--muted); font-size: 0.98rem; }
.entry .cite { align-self: flex-start; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 28px;
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.section.alt .panel { background: var(--paper); }

/* The dealer test: two thresholds, both required */
.threshold { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: stretch; }
.threshold .side {
  border: 1px solid var(--line); border-radius: 6px; padding: 22px; background: var(--surface);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.threshold .amt { font-family: var(--display); font-size: 2.4rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.threshold .and { align-self: center; font-family: var(--mono); font-weight: 600; color: var(--gold); letter-spacing: 0.1em; }
.threshold .side span:last-child { color: var(--muted); font-size: 0.95rem; }
@media (max-width: 640px) { .threshold { grid-template-columns: minmax(0, 1fr); } .threshold .and { justify-self: center; } }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.96rem; min-width: 560px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; background: var(--paper); }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 0.78rem; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.req { color: var(--ok); }
.status.na { color: var(--muted); }
.status.vol { color: var(--gold); }

/* Disposition tiers */
.tiers { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.tier { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.tier:last-child { border-bottom: 0; }
.tier-tag { padding: 18px; font-family: var(--mono); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; border-right: 1px solid var(--line); background: var(--paper); }
.tier-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tier-body p { color: var(--muted); font-size: 0.97rem; }
.tier.block .tier-tag { color: var(--alert); box-shadow: inset 4px 0 0 var(--alert); }
.tier.close .tier-tag { color: var(--muted); }
@media (max-width: 600px) { .tier { grid-template-columns: minmax(0, 1fr); } .tier-tag { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 18px; } }

/* Process steps (real sequence) */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.steps li { list-style: none; counter-increment: step; display: flex; flex-direction: column; gap: 8px; border-top: 2px solid var(--gold); padding-top: 16px; min-width: 0; }
.steps li::before { content: "Step " counter(step); font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.steps p { color: var(--muted); font-size: 0.96rem; }
.steps { padding: 0; margin: 0; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps { grid-template-columns: minmax(0, 1fr); } }

/* Callout */
.callout { border-left: 3px solid var(--gold); background: var(--gold-soft); padding: 18px 22px; border-radius: 0 6px 6px 0; display: flex; flex-direction: column; gap: 8px; max-width: 78ch; }
.callout p { max-width: none; }
.callout strong { font-weight: 700; }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding-block: 16px; max-width: 80ch; }
details:first-of-type { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--mono); color: var(--gold); font-size: 1.2rem; line-height: 1; }
details[open] summary::after { content: "\2212"; }
details p { margin-top: 10px; color: var(--muted); }

/* CTA band */
.cta-band { background: var(--band); color: var(--band-ink); }
.cta-band .wrap { padding-block: 64px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; }
.cta-band h2 { color: var(--band-ink); font-size: var(--step-3); max-width: 24ch; }
.cta-band p { color: var(--band-muted); margin-top: 10px; }

/* Bio */
.bio { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 48px; align-items: start; }
.credential { border: 1px solid var(--line); border-radius: 6px; padding: 24px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.credential dl { margin: 0; display: grid; gap: 12px; }
.credential dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.credential dd { margin: 2px 0 0; font-weight: 600; }
.monogram { font-family: var(--display); font-size: 3rem; font-weight: 600; line-height: 1; color: var(--gold); }
@media (max-width: 760px) { .bio { grid-template-columns: minmax(0, 1fr); gap: 28px; } }

/* Contact form */
.form { display: grid; gap: 16px; max-width: 640px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.93rem; }
input, select, textarea {
  font: 400 1rem var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; padding: 11px 12px; width: 100%;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.form-note { font-size: 0.88rem; color: var(--muted); }
.form-result { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.form-result pre { margin: 0; white-space: pre-wrap; font-family: var(--mono); font-size: 0.85rem; color: var(--ink); }
.email-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.email-line code { font-family: var(--mono); font-size: 1.05rem; user-select: all; }
.copy-btn { font: 600 0.85rem var(--body); padding: 6px 12px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.copy-btn:hover { border-color: var(--gold); }

/* Footer */
.site-footer { background: var(--band); color: var(--band-muted); font-size: 0.9rem; }
.site-footer .wrap { padding-block: 48px 40px; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 32px; }
.site-footer h4 { margin: 0 0 10px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--band-gold); font-weight: 500; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--band-ink); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid color-mix(in srgb, var(--band-muted) 30%, transparent); padding-top: 20px; font-size: 0.82rem; line-height: 1.55; max-width: none; }
@media (max-width: 720px) { .site-footer .wrap { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: no-preference) {
  .stamp svg .strike { transform-origin: 50% 50%; animation: strike 700ms cubic-bezier(.2,.9,.3,1.2) 150ms both; }
  @keyframes strike { from { transform: scale(1.06); opacity: .55; } to { transform: scale(1); opacity: 1; } }
}

/* ---------- Blog ---------- */
.post-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 720px) { .post-list { grid-template-columns: minmax(0, 1fr); } }
.post-card {
  display: flex; flex-direction: column; gap: 12px; padding: 26px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 0 0 6px 6px; min-width: 0;
}
.post-card:hover { border-color: var(--gold); }
.post-card h2 { font-size: var(--step-2); }
.post-card p { color: var(--muted); font-size: 0.98rem; }
.post-card .read { color: var(--gold); font-weight: 600; font-size: 0.95rem; margin-top: auto; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.post-meta span:first-child { color: var(--gold); }
.post-head { background: var(--band); color: var(--band-ink); }
.post-head .wrap { padding-block: 52px 48px; display: flex; flex-direction: column; gap: 18px; }
.post-head h1 { color: var(--band-ink); font-size: clamp(2rem, 4.4vw, 3rem); max-width: 24ch; }
.post-head .post-meta { color: var(--band-muted); }
.post-head .post-meta span:first-child { color: var(--band-gold); }
.post-head .back { color: var(--band-gold); text-decoration: none; }
.prose { max-width: 70ch; padding-block: 48px 64px; display: flex; flex-direction: column; gap: 18px; }
.prose h2 { font-size: var(--step-2); margin-top: 18px; }
.prose h3 { font-size: 1.1rem; margin-top: 6px; }
.prose .lede { font-size: var(--step-1); }
.post-note { font-size: 0.88rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 18px; margin-top: 12px; }

.faq-cite { font-family: var(--mono); font-size: .8rem; color: var(--gold); margin-top: 8px; }
.faq-more { font-size: .95rem; margin-top: 6px; }
.faq-more a { color: inherit; text-decoration: underline; }
