/* ════════════════════════════════════════════════════════════
   Third Rock Wealth · tool-extras.css
   Two universal additions to every calculator page, post-MW4M-review:

   1) .tk-faq — a small FAQ accordion at the bottom of each tool,
      4 tool-specific Q&A in TRW's editorial voice. Mirrors the
      existing .tk-guide `<details>` pattern so visual rhythm
      matches the "How to read this tool" affordance above it.

   2) .tk-horizons — a small multi-horizon projection table that
      sits below the chart on each tool, showing the same inputs
      projected at standard horizons. No new math; just maps the
      existing schedule data each compute function returns.

   Both inherit the existing tool-dark.css palette + each tool's
   `body[data-tool="<x>"] --accent / --accent-bright` overrides, so
   styling stays palette-agnostic per-tool.
   ════════════════════════════════════════════════════════════ */


/* ── Multi-horizon projection table ───────────────────────
   A contained panel — accent-tinted surface, hairline border, the
   same rounded treatment as the readout / console / chart panels —
   rather than a bare table floating in the page flow. Each
   single-value row carries a proportional magnitude bar so the
   compounding curve reads visually down the table; the longest
   horizon (last row) is emphasised as the destination. */

.tk-horizons-band {
  margin: clamp(14px, 1.6vw, 22px) 0 clamp(6px, 0.8vw, 12px);
  padding: clamp(16px, 2vw, 24px) clamp(18px, 2.2vw, 28px) clamp(8px, 1vw, 14px);
  background:
    linear-gradient(180deg,
      color-mix(in oklab, var(--accent) 5%, var(--surface-raised)) 0%,
      var(--surface-raised) 58%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-panel);
}
.tk-horizons-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(9px, 1.1vw, 13px);
  margin-bottom: clamp(2px, 0.4vw, 6px);
  border-bottom: 1px solid var(--hairline);
}
.tk-horizons-head .tk-kicker {
  font-family: var(--mono, 'IBM Plex Mono', monospace);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-bright);
}
.tk-horizons-head .tk-horizons-hint {
  font-family: var(--sans, 'Inter Tight', sans-serif);
  font-size: 12.5px;
  color: var(--text-mute);
}

.tk-horizons {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-feature-settings: "tnum";
}
.tk-horizons th:first-child,
.tk-horizons td:first-child { width: clamp(76px, 12vw, 128px); }

.tk-horizons tbody tr {
  border-top: 1px solid var(--hairline);
  transition: background 160ms ease;
}
.tk-horizons tbody tr:first-child { border-top: none; }
.tk-horizons tbody tr:hover {
  background: color-mix(in oklab, var(--accent) 5%, transparent);
}
/* longest-horizon row — the destination */
.tk-horizons tbody tr.is-peak {
  background: color-mix(in oklab, var(--accent) 8%, transparent);
}
.tk-horizons tbody tr.is-peak .tk-hz-val { color: var(--accent-bright); }

.tk-horizons th,
.tk-horizons td {
  text-align: left;
  padding: clamp(9px, 1.1vw, 13px) clamp(4px, 1vw, 14px);
  vertical-align: middle;
}
.tk-horizons thead th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.tk-horizons thead th:last-child { text-align: right; }
.tk-horizons tbody th {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}

/* single-value rows: label | magnitude bar | value */
.tk-horizons:not(.is-versus) tbody td {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
}
.tk-hz-track {
  flex: 1 1 auto;
  height: 5px;
  min-width: 32px;
  border-radius: 3px;
  background: color-mix(in oklab, var(--accent) 9%, transparent);
  overflow: hidden;
}
.tk-hz-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: color-mix(in oklab, var(--accent) 58%, transparent);
  transition: width 460ms cubic-bezier(.2,.8,.2,1);
}
.tk-hz-val {
  flex: 0 0 auto;
  font-family: var(--serif, 'Fraunces', serif);
  font-size: clamp(15px, 1.5vw, 19px);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  text-align: right;
  min-width: 78px;
}

/* versus: two value columns, no bars, accent/contrast keyed.
   Both value columns AND their headers right-align so each header
   sits directly above its numbers (the first column, Years, stays
   left). */
.tk-horizons.is-versus thead th:nth-child(2),
.tk-horizons.is-versus thead th:last-child { text-align: right; }
.tk-horizons.is-versus tbody td {
  font-family: var(--serif, 'Fraunces', serif);
  font-size: clamp(15px, 1.5vw, 18px);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: right;
}
.tk-horizons.is-versus tbody td:nth-of-type(1) { color: var(--accent-bright); }
.tk-horizons.is-versus tbody td:nth-of-type(2) { color: var(--contrast-bright); }

@media (max-width: 600px) {
  .tk-horizons th,
  .tk-horizons td { padding: 9px 4px; }
  .tk-hz-val { font-size: 15px; min-width: 64px; }
  /* drop the bar on narrow screens; the value alone is clearer */
  .tk-hz-track { display: none; }
  .tk-horizons:not(.is-versus) tbody td { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .tk-hz-fill { transition: none !important; }
}


/* ── FAQ accordion ───────────────────────────────────────
   Sits in its own band between .tk-guide-band and .tk-related on
   each calculator. Mirrors .tk-guide markup for visual continuity. */

.tk-faq-band {
  width: min(880px, 92vw);
  margin: clamp(18px, 2.2vw, 28px) auto clamp(10px, 1.4vw, 18px);
}
.tk-faq-band > .tk-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-bright);
  margin-bottom: clamp(8px, 1vw, 12px);
}

.tk-faq {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 0;
  background: transparent;
  list-style: none;   /* details>summary marker reset, mirror tk-guide */
}
.tk-faq[open] {
  /* nothing structural — child styling handles the open state */
}
.tk-faq + .tk-faq { border-top: none; }

.tk-faq > summary {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 14px;
  cursor: pointer;
  padding: clamp(10px, 1.2vw, 14px) clamp(0px, 0.6vw, 12px) clamp(10px, 1.2vw, 14px) 0;
  font-family: var(--serif, 'Fraunces', serif);
  font-weight: 500;
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.32;
  color: var(--text);
  letter-spacing: -0.005em;
  user-select: none;
  list-style: none;
  outline-offset: 4px;
}
.tk-faq > summary::-webkit-details-marker { display: none; }
.tk-faq > summary::marker { display: none; }

.tk-faq > summary::before {
  content: '+';
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1;
  color: var(--accent-bright);
  transform-origin: center;
  transform: translateY(2px);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
}
.tk-faq[open] > summary::before {
  content: '−';
}
.tk-faq > summary:hover { color: var(--accent-bright); }

.tk-faq-body {
  padding: 0 0 clamp(10px, 1.4vw, 16px) clamp(28px, 2.4vw, 32px);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-soft);
  max-width: 64ch;
}
.tk-faq-body p { margin: 0 0 10px; }
.tk-faq-body p:last-child { margin-bottom: 0; }
.tk-faq-body strong { color: var(--text); font-weight: 600; }


/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tk-faq > summary::before { transition: none !important; }
}
