/* ============================================================
   CryptoTaxAI — legacy.css
   Minimal restyle of the old site's markup hooks using the
   design-system tokens. Every class below is either:
   (a) queried/injected by the byte-identical tool JS
       (assets/js/calculator.js, staking.js, harvest.js,
        legacy-main.js) — class names MUST NOT change, or
   (b) an old content class with no design-system equivalent
       (prose article styles, callouts, tables, FAQ, forms).
   No new colors except documented semantic ones (gain/loss,
   warning). All sizes from the type scale, spacing from --s-*.
   ============================================================ */

/* ---- article prose ---- */
.prose { max-width: 72ch; }
.prose h2 { margin: var(--s-8) 0 var(--s-4); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: var(--s-6) 0 var(--s-3); }
.prose p { color: var(--ink-soft); }
.prose ul, .prose ol { margin: 0 0 var(--s-5); padding-left: var(--s-5); color: var(--ink-soft); }
.prose li { margin-bottom: var(--s-3); }
.prose li::marker { color: var(--muted); }
.prose a { color: var(--accent-deep); }
.text-center { text-align: center; }
.text-center .prose, .prose.text-center { margin-left: auto; margin-right: auto; }

/* ---- guide hero (maps old .guide-hero onto .hero) ---- */
.hero .breadcrumb { margin-bottom: var(--s-5); }
.breadcrumb { font-size: var(--t-14); color: var(--muted); }
.breadcrumb a { color: var(--accent-deep); text-decoration: none; }
.meta { font-size: var(--t-14); color: var(--muted); margin: var(--s-4) 0 0; }
.meta a { color: var(--accent-deep); }

/* ---- table of contents ---- */
.toc {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s-5) var(--s-6);
  margin: 0 0 var(--s-7);
}
.toc strong { display: block; font-size: var(--t-14); text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-bottom: var(--s-3); }
.toc ol { margin: 0; padding-left: var(--s-5); }
.toc li { margin-bottom: var(--s-2); font-size: var(--t-16); }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--accent-deep); }

/* ---- callouts ---- */
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: var(--s-4) var(--s-5); margin: 0 0 var(--s-5); font-size: var(--t-16);
}
.callout strong { display: block; margin-bottom: var(--s-2); color: var(--ink); }
.callout p:last-child { margin-bottom: 0; }
/* warn = semantic warning wash (documented one-off, not decoration) */
.callout.warn { background: #fdf8ec; border-color: #f3e3bb; border-left-color: #b45309; }

/* ---- source lists / checklists / captions ---- */
.src-list { font-size: var(--t-14); color: var(--muted); }
.src-list li { margin-bottom: var(--s-2); }
.check-list { list-style: none; padding-left: 0; }
.check-list li { padding-left: var(--s-5); position: relative; }
.check-list li::before { content: ""; position: absolute; left: 0; color: var(--accent-deep); font-weight: 700; }
.table-cap { font-size: var(--t-14); color: var(--muted); margin-top: var(--s-2); }
.table-wrap { overflow-x: auto; margin: 0 0 var(--s-5); }

/* ---- data tables ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--t-16); }
.data-table th, .data-table td {
  text-align: left; padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.data-table thead th {
  font-size: var(--t-14); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); border-bottom: 2px solid var(--line); white-space: nowrap;
}
.data-table .num, .data-table th.num { text-align: right; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: none; }

/* ---- calculator shell ---- */
.calc-shell {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  overflow: hidden; margin-bottom: var(--s-5);
}
.calc-head { padding: var(--s-6) var(--s-6) 0; }
.calc-head h2 { margin-bottom: var(--s-3); }
.calc-head p { color: var(--muted); margin-bottom: 0; }
.calc-body { padding: var(--s-6); }
.calc-body > .btn { width: 100%; }

/* ---- forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); margin-bottom: var(--s-5); }
.form-group.full { grid-column: 1 / -1; }
.form-hint { display: block; font-size: var(--t-14); color: var(--muted); margin-top: var(--s-2); }
input[type="date"] {
  width: 100%; font: inherit; font-size: var(--t-16); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--bg);
}
input[type="date"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- example chips (queried by calculator.js — name frozen) ---- */
.example-chips { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-bottom: var(--s-5); }
.example-chip {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-soft);
  border-radius: 999px; padding: var(--s-2) var(--s-4); font-size: var(--t-14);
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.example-chip:hover { border-color: var(--accent); color: var(--accent-deep); }
.example-label { margin: 0; align-self: center; }

/* ---- results (innerHTML injected by tool JS — names frozen) ---- */
.result-box { display: none; margin-top: var(--s-5); }
.result-box.show {
  display: block; background: var(--bg-soft);
  border-radius: var(--radius); padding: var(--s-6);
}
.result-box h3 { margin-bottom: var(--s-4); display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.result-row {
  display: flex; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-3) 0; border-bottom: 1px solid var(--line); font-size: var(--t-16);
}
.result-row:last-child { border-bottom: none; }
.result-row .val { font-weight: 600; text-align: right; color: var(--ink); }
/* semantic gain/loss colors (documented one-offs) */
.gain-pos { color: #15803d; }
.gain-neg { color: #b91c1c; }
.term-badge {
  font-size: var(--t-12); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 999px; padding: 4px 12px; font-family: var(--font-body);
}
.term-long { background: #e9f7ee; color: #15803d; }
.term-short { background: #fdf3e7; color: #b45309; }
.calc-note { font-size: var(--t-14); color: var(--muted); margin-top: var(--s-4); }
.calc-note:last-child { margin-bottom: 0; }
.calc-error {
  display: none; background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d;
  border-radius: var(--radius-sm); padding: var(--s-4) var(--s-5); margin-top: var(--s-4);
}
.calc-error h3 { font-size: var(--t-18); margin-bottom: var(--s-2); color: #7f1d1d; }
.calc-error p { margin: 0; font-size: var(--t-16); }

/* ---- staking tracker extras ---- */
.tracker-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-5); }
.tracker-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.del-btn {
  background: #fee2e2; border: 1px solid #fecaca; color: #b91c1c;
  border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 12px; line-height: 1;
}
.del-btn:hover { background: #fecaca; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-5); }
.kv-box { background: var(--bg-soft); border-radius: var(--radius); padding: var(--s-5); text-align: center; }
.kv-box .k { font-size: var(--t-14); color: var(--muted); margin-bottom: var(--s-2); }
.kv-box .v { font-family: var(--font-display); font-size: var(--t-36); font-weight: 700; color: var(--ink); }
#emptyRow { padding: var(--s-4); text-align: center; }
#byType { margin-top: var(--s-2); }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } }

/* ---- old content components ---- */
.grad { color: var(--accent-deep); }
.card-tag {
  display: block; font-size: var(--t-12); font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--s-3);
}
.badge-new {
  font-size: var(--t-12); font-weight: 700; letter-spacing: 0.04em;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 999px; padding: 3px 10px; vertical-align: middle;
  font-family: var(--font-body);
}
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
.step-num {
  font-family: var(--font-display); font-size: var(--t-36); font-weight: 700;
  color: var(--accent-deep); margin-bottom: var(--s-3); line-height: 1;
}
.step h3 { margin-bottom: var(--s-3); }
.step p { color: var(--muted); font-size: var(--t-16); margin-bottom: 0; }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }
.disclosure {
  font-size: var(--t-14); color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: var(--s-4) var(--s-5); margin-bottom: var(--s-6);
}
.cta-band {
  background: var(--accent-soft); border-radius: var(--radius);
  padding: var(--s-8) var(--s-6); text-align: center;
}
.cta-band h2 { margin-bottom: var(--s-4); }
.cta-band p { color: var(--ink-soft); margin-bottom: var(--s-6); }
.cta-band p:last-of-type { margin-bottom: var(--s-6); }

/* ---- FAQ accordion (driven by legacy-main.js — names frozen) ---- */
.faq { max-width: 760px; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-q {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-4);
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: var(--t-18); color: var(--ink);
  padding: var(--s-4) 0;
}
.faq-q::after { content: "+"; color: var(--accent); font-size: var(--t-24); font-weight: 400; flex: none; }
.faq-item.open .faq-q::after { content: "\2212"; }
.faq-a { display: none; }
.faq-item.open .faq-a { display: block; }
.faq-a-inner { color: var(--muted); padding-bottom: var(--s-4); }
.faq-a-inner p { margin-bottom: var(--s-3); }

/* ---- small button variants ---- */
.btn-danger {
  background: #fee2e2; color: #b91c1c; border: 1px solid transparent;
}
.btn-danger:hover { background: #fecaca; color: #7f1d1d; }
