/* ==========================================================================
   NetProceeds — "The Ledger"
   Receipt/accounting aesthetic: paper surfaces, ink text, money-green accent,
   tabular numerals. No frameworks, no webfonts. Mobile-first. Light + dark.
   ========================================================================== */

:root {
  --paper: #f6f3ea;
  --paper-2: #fffdf6;
  --paper-3: #efeadd;
  --ink: #1c1b17;
  --ink-muted: #4d4b42;
  --ink-faint: #6b6658; /* WCAG AA on all four light surfaces: body, cards, footer, and the accent-glow badge */
  --accent: #177144;
  --accent-bright: #1d8a54;
  --accent-dim: #0e5432;
  --accent-glow: rgba(23, 113, 68, 0.09);
  --red: #ad3a2d;
  --line: rgba(28, 27, 23, 0.16);
  --line-soft: rgba(28, 27, 23, 0.09);
  --shadow: 0 10px 34px rgba(40, 36, 24, 0.12);
  --shadow-lg: 0 24px 60px rgba(40, 36, 24, 0.16);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --maxw: 72rem;
  --radius: 10px;
}

[data-theme="dark"] {
  --paper: #15170f;
  --paper-2: #1d2016;
  --paper-3: #23261b;
  --ink: #ebe8da;
  --ink-muted: #b8b4a4;
  --ink-faint: #918d7e; /* WCAG AA (>=4.5:1) on all three dark surfaces incl. the lighter footer */
  --accent: #4cbd83;
  --accent-bright: #63d49a;
  --accent-dim: #34996a;
  --accent-glow: rgba(76, 189, 131, 0.10);
  --red: #e07a6d;
  --line: rgba(235, 232, 218, 0.18);
  --line-soft: rgba(235, 232, 218, 0.10);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

img { max-width: 100%; height: auto; }

::selection { background: var(--accent); color: var(--paper-2); }

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: 0.005em;
}

h1 { font-size: clamp(1.9rem, 5vw, 3.1rem); }
h2, h3 { scroll-margin-top: 5.5rem; }
h2 { font-size: clamp(1.45rem, 3.5vw, 2.05rem); margin: 3rem 0 1rem; }
h3 { font-size: clamp(1.18rem, 2.5vw, 1.45rem); margin: 2rem 0 0.75rem; }
h4 { font-size: 1.08rem; margin: 1.5rem 0 0.5rem; }

p { margin: 0 0 1.15rem; }
p, li { color: var(--ink-muted); }
strong { color: var(--ink); }

a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--accent-bright); text-decoration-color: var(--accent-bright); }

ul, ol { padding-left: 1.4rem; margin: 0 0 1.15rem; }
li { margin-bottom: 0.45rem; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--ink);
}

.num, .amount, td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.wrap-narrow { max-width: 50rem; margin: 0 auto; padding: 0 1.25rem; }

main { display: block; }
.section { padding: 3rem 0; }

.divider {
  border: none;
  height: 1px;
  margin: 3.5rem auto;
  max-width: var(--maxw);
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--ink);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 1.14rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand .brand-accent { color: var(--accent); }
.brand svg { flex: 0 0 auto; }

.site-nav { display: flex; align-items: center; gap: 1.3rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink-muted);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }
.site-nav a.nav-all { color: var(--accent); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 0.6rem; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-dim); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}

@media (max-width: 1000px) {
  .nav-toggle { display: block; }
  .brand { font-size: 1.02rem; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--paper-2);
    border-bottom: 2px solid var(--ink);
    padding: 0.5rem 1.25rem 1rem;
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.7rem 0; width: 100%; border-bottom: 1px dashed var(--line-soft); }
}

/* ---------- Hero ---------- */

.hero { text-align: center; padding: 3.5rem 0 2rem; }

.hero .kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 3px;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1.4rem;
  background: var(--accent-glow);
}

.hero h1 { margin-bottom: 1rem; }
.hero h1 em { font-style: italic; color: var(--accent); }

.hero .lede {
  max-width: 46rem;
  margin: 0 auto 0.5rem;
  font-size: 1.14rem;
  color: var(--ink-muted);
}

/* ---------- Calculator card ---------- */

.calc-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 1.4rem;
  max-width: 47rem;
  margin: 2rem auto 0;
}

@media (min-width: 640px) { .calc-card { padding: 2.25rem 2.5rem; } }

/* Reserve the calculator's height before calculator.js injects the form, so the
   prose below it doesn't jump (CLS). :empty stops matching the instant JS fills
   the card, so the reserve self-cancels and never double-counts. Heights are
   measured from the rendered forms: seller pages carry 5 fields + extras,
   payment/auction pages carry 1-2. */
.calc-card:empty { min-height: 890px; }
.calc-card[data-calculator="stripe"]:empty,
.calc-card[data-calculator="venmo"]:empty,
.calc-card[data-calculator="cashapp"]:empty,
.calc-card[data-calculator="square"]:empty,
.calc-card[data-calculator="copart"]:empty { min-height: 590px; }
@media (min-width: 560px) {
  .calc-card:empty { min-height: 715px; }
  .calc-card[data-calculator="stripe"]:empty,
  .calc-card[data-calculator="venmo"]:empty,
  .calc-card[data-calculator="cashapp"]:empty,
  .calc-card[data-calculator="square"]:empty,
  .calc-card[data-calculator="copart"]:empty { min-height: 515px; }
}

.calc-card h2 { margin: 0 0 1.4rem; font-size: 1.35rem; text-align: center; }

.field-row { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 560px) {
  .field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
  .field-row.cols-2 { grid-template-columns: 1fr 1fr; }
}

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

.field select, .field input {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font-size: 1rem;
  padding: 0.75rem 0.85rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field select:focus, .field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field .hint { font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.3rem; text-transform: none; letter-spacing: 0; font-family: var(--sans); }

.calc-optional summary {
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin: 0.25rem 0 1rem;
  list-style: none;
}
.calc-optional summary::before { content: "+ "; color: var(--accent); font-family: var(--mono); }
.calc-optional[open] summary::before { content: "− "; }
.calc-optional summary::-webkit-details-marker { display: none; }

/* Toggle row (boosted listings, offsite ads, intl card…) */
.toggle-row { display: flex; align-items: center; gap: 0.65rem; margin: 0.35rem 0 1rem; }
.toggle-row input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); min-height: 0; }
.toggle-row label { font-size: 0.95rem; color: var(--ink-muted); cursor: pointer; }

/* Mode selector (Venmo send/sell/cash-out, Square in-person/online/keyed…) */
.mode-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.mode-tabs button {
  flex: 1 1 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  min-height: 44px;
}
.mode-tabs button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper-2);
  font-weight: 700;
}

.btn-accent {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--paper-2);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--mono);
  border: none;
  border-radius: 7px;
  padding: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
  min-height: 48px;
  transition: background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.btn-accent:hover { background: var(--accent-bright); transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0); }

.calc-note { text-align: center; font-size: 0.85rem; color: var(--ink-faint); margin: 1rem 0 0; }

.verified-badge {
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-faint);
  max-width: 47rem;
  margin: 1rem auto 0;
  padding: 0.6rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: var(--accent-glow);
}
.verified-badge a { color: var(--accent); }

/* ---------- The receipt (results) ---------- */

#results { max-width: 47rem; margin: 0 auto; }
#results[hidden] { display: none; }

.receipt {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding: 1.75rem 1.5rem 1.25rem;
  margin: 2.25rem auto 0;
  position: relative;
}
@media (min-width: 560px) { .receipt { padding: 2rem 2.25rem 1.5rem; } }

.receipt-tear {
  max-width: 47rem;
  margin: 0 auto 1.5rem;
  height: 12px;
  background:
    linear-gradient(-45deg, transparent 8px, var(--paper-2) 0) 0 0 / 16px 12px repeat-x,
    linear-gradient(45deg, transparent 8px, var(--paper-2) 0) 8px 0 / 16px 12px repeat-x;
  filter: drop-shadow(0 6px 8px rgba(40, 36, 24, 0.08));
}

.receipt-head { text-align: center; margin-bottom: 1.25rem; }
.receipt-head .rh-brand { font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faint); }
.receipt-head h3 { font-family: var(--mono); font-size: 1.05rem; margin: 0.4rem 0 0.1rem; letter-spacing: 0.02em; }
.receipt-head .rh-sub { font-size: 0.78rem; color: var(--ink-faint); }
.receipt-head::after {
  content: "· · · · · · · · · · · · · · · · · · · ·";
  display: block;
  color: var(--line);
  letter-spacing: 0.3em;
  margin-top: 0.9rem;
  overflow: hidden;
  white-space: nowrap;
}

.receipt-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.32rem 0;
  font-size: 0.95rem;
  color: var(--ink);
}
.receipt-line .rl-label { color: var(--ink-muted); }
.receipt-line .rl-fill { flex: 1; border-bottom: 2px dotted var(--line); transform: translateY(-4px); min-width: 1.5rem; }
.receipt-line .rl-amt { white-space: nowrap; }
.receipt-line.deduction .rl-amt { color: var(--red); }
.receipt-line.subtle { font-size: 0.85rem; }
.receipt-line.subtle .rl-label, .receipt-line.subtle .rl-amt { color: var(--ink-faint); }

.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  border-top: 2px solid var(--ink);
  margin-top: 0.75rem;
  padding-top: 0.7rem;
  font-weight: 700;
  font-size: 1.18rem;
}
.receipt-total .rl-amt { color: var(--accent); font-size: 1.35rem; }
.receipt-total.negative .rl-amt { color: var(--red); }

.receipt-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.receipt-meta b { color: var(--ink-muted); font-weight: 700; }

.receipt .barcode {
  margin: 1.1rem auto 0;
  height: 34px;
  max-width: 220px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 6px, transparent 6px 9px, var(--ink) 9px 12px, transparent 12px 14px);
  opacity: 0.75;
}

.result-actions { display: flex; gap: 0.75rem; justify-content: center; margin: 1.25rem 0; flex-wrap: wrap; }
.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--accent);
  border-radius: 7px;
  padding: 0.65rem 1.3rem;
  font-size: 0.9rem;
  font-family: var(--mono);
  cursor: pointer;
  min-height: 44px;
}
.btn-ghost:hover { background: var(--accent-glow); border-color: var(--accent-dim); }

.calc-card.computing { opacity: 0.75; }

/* Collapsible "how this is calculated" */
.calc-how {
  max-width: 47rem;
  margin: 0 auto 1.5rem;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--paper-2);
  padding: 0.25rem 1.25rem;
}
.calc-how summary { cursor: pointer; font-size: 0.95rem; color: var(--accent); padding: 0.75rem 0; list-style: none; }
.calc-how summary::-webkit-details-marker { display: none; }
.calc-how summary::before { content: "ƒ "; font-family: var(--mono); color: var(--accent-dim); }
.calc-how .formula {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--paper-3);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin: 0.25rem 0 1rem;
  overflow-x: auto;
  color: var(--ink);
}

/* ---------- Compare table (homepage) ---------- */

.compare-wrap { margin: 2rem auto 0; }
.compare-table th { cursor: default; }
.compare-table td.num, .compare-table th.num { text-align: right; }
.compare-table .platform-cell a { font-weight: 600; text-decoration: none; }
.compare-table tr.best td { background: var(--accent-glow); }
.best-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--paper-2);
  border-radius: 3px;
  padding: 0.15rem 0.5rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.eff-rate { font-size: 0.8rem; color: var(--ink-faint); }

/* ---------- Content / article ---------- */

.article { padding: 1rem 0 2rem; }
.article h2 { border-bottom: 1px solid var(--line-soft); padding-bottom: 0.6rem; }
.article .byline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 2rem;
  font-size: 0.9rem;
  color: var(--ink-faint);
}
.article .byline .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--paper-2);
  font-weight: 700;
  flex: 0 0 auto;
}
.article .byline b { color: var(--ink-muted); display: block; }
.article .byline a { color: inherit; }

.featured-img { margin: 0 0 2rem; }
.featured-img img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
}

.callout {
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}
.callout p:last-child { margin-bottom: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.table-scroll { overflow-x: auto; margin: 1.5rem 0; -webkit-overflow-scrolling: touch; }
.table-scroll table { margin: 0; min-width: 540px; }
.table-credit {
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-align: right;
  margin: 0.35rem 0 1.75rem;
  font-style: italic;
}
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line-soft); }
th {
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--ink);
}
td { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--accent-glow); }

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

.faq h3 { margin: 0; }
.faq details { border-bottom: 1px solid var(--line-soft); padding: 0.25rem 0; }
.faq summary {
  cursor: pointer;
  padding: 1rem 2rem 1rem 0;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink);
  list-style: none;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.4rem;
  font-family: var(--mono);
}
.faq details[open] summary::after { content: "−"; }
.faq .faq-a { padding: 0 0 1.25rem; }
.faq .faq-a p:last-child { margin-bottom: 0; }

/* ---------- Hub / spoke cards ---------- */

.spoke-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
  margin: 2rem 0;
}
@media (min-width: 640px) { .spoke-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .spoke-grid { grid-template-columns: 1fr 1fr 1fr; } }

.spoke-card {
  display: block;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.spoke-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.spoke-card h3 { margin: 0 0 0.4rem; font-size: 1.12rem; color: var(--accent); }
.spoke-card p { margin: 0; font-size: 0.9rem; color: var(--ink-faint); }
.spoke-card .fee-line { display: block; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-muted); margin-top: 0.6rem; }

.breadcrumbs { font-size: 0.85rem; color: var(--ink-faint); padding: 1.25rem 0 0; }
.breadcrumbs a { color: var(--ink-faint); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span[aria-current] { color: var(--ink-muted); }

/* ---------- Related links ---------- */

.related {
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.6rem 1.75rem;
  margin: 2.5rem 0;
}
.related h2 { margin: 0 0 1rem; font-size: 1.25rem; border: none; padding: 0; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { padding: 0.4rem 0; border-bottom: 1px dashed var(--line-soft); }
.related li:last-child { border: none; }
.related li::before { content: "→ "; color: var(--accent); font-family: var(--mono); }

/* ---------- Ad slots (reserved, empty at launch — fixed heights = zero CLS) ---------- */

.ad-slot { min-height: 250px; margin: 2rem auto; max-width: 47rem; }
.ad-slot:empty { min-height: 250px; }

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

.site-footer {
  border-top: 2px solid var(--ink);
  margin-top: 4rem;
  padding: 3rem 0 2.5rem;
  background: var(--paper-3);
}
.footer-cols { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 720px) { .footer-cols { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .footer-cols { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer h3 {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin: 0 0 1rem;
}
.site-footer p, .site-footer li { font-size: 0.9rem; color: var(--ink-faint); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.5rem; }
.site-footer a { color: var(--ink-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-faint);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ---------- Cookie banner ---------- */

#cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(44rem, calc(100vw - 2rem));
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem 1.5rem;
  z-index: 100;
}
#cookie-banner[hidden] { display: none; }
#cookie-banner p { font-size: 0.9rem; margin: 0 0 0.9rem; color: var(--ink-muted); }
#cookie-banner .cb-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
#cookie-banner .cb-btn { width: auto; padding: 0.55rem 1.4rem; font-size: 0.9rem; margin: 0; text-transform: none; }

/* ---------- Reading progress bar ---------- */

#read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent-bright));
  z-index: 60;
}

/* ---------- Table of contents ---------- */

.toc {
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.5rem 1.25rem;
  margin: 1.75rem 0;
}
.toc summary {
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--ink);
  padding: 0.5rem 0;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::before { content: "☰ "; color: var(--accent); font-size: 0.9rem; }
.toc ol { margin: 0.25rem 0 0.75rem; padding-left: 1.4rem; }
.toc li { margin-bottom: 0.35rem; font-size: 0.92rem; }
.toc a { color: var(--ink-muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* ---------- Inline tool CTA ---------- */

.cta-inline {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--paper-2);
  border: 1px dashed var(--accent-dim);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}
.cta-inline p { margin: 0; flex: 1 1 16rem; font-size: 0.95rem; color: var(--ink-muted); }
.cta-inline p strong { color: var(--ink); }
.cta-inline a.btn-accent { display: inline-block; width: auto; padding: 0.7rem 1.4rem; font-size: 0.9rem; margin: 0; text-decoration: none; }

/* ---------- Scroll-to-top ---------- */

#scroll-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  cursor: pointer;
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  box-shadow: var(--shadow);
}
#scroll-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
#scroll-top:hover { border-color: var(--accent); transform: translateY(-2px); }
#scroll-top:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Motion & print ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

@media print {
  .site-header, .site-footer, .result-actions, #scroll-top, #read-progress,
  #cookie-banner, .nav-toggle, .toc, .cta-inline, .breadcrumbs, .related,
  .ad-slot, .theme-toggle { display: none !important; }
  body { background: #fff !important; color: #1c1c1c !important; }
  h1, h2, h3, h4 { color: #141414 !important; }
  p, li, td, th { color: #262626 !important; }
  a { color: #177144 !important; text-decoration: none; }
  .receipt, .calc-card { box-shadow: none !important; border: 1px solid #bbb !important; }
}
