/* Cash drag calculator: page layout on top of the shared /style.css.
   Kept in this folder so the shared stylesheet stays untouched. The layout copies the
   investment return page: graph and answer on the left, a short inputs panel on the right
   (stacked graph, inputs, stats on phones). Everything is scoped to body.cd. */

.cd .hero-head { display: block; padding-block: 26px 6px; }
.cd .hero-head h1 { font-size: var(--step-3); max-width: none; margin-top: 6px; }
.cd .workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px 40px; align-items: start; padding-top: 18px; }
.cd .stage { position: sticky; top: 12px; display: grid; min-width: 0; }
.cd .answer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 18px; }
.cd .answer .label { flex-basis: 100%; }
.cd .answer .big { font-size: clamp(2.8rem, 2rem + 2.6vw, 4.2rem); }
.cd .answer .big.is-ahead { color: var(--slate); }
.cd .answer-line { padding-bottom: 6px; max-width: 46ch; }
.cd .landscape { padding-top: 14px; }
.cd .legend-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; padding-top: 10px; }
.cd .legend { pointer-events: none; }
.cd .legend span { display: inline-flex; align-items: center; gap: 7px; }
.cd .chip-cash { border-color: var(--ink); border-top-width: 1.8px; }
.cd .chip-start { border-color: var(--muted); border-top-width: 1.3px; border-top-style: dashed; }
.cd .chip-lost { width: 12px; height: 10px; border: 0; border-radius: 2px; background: var(--rust); opacity: 0.35; }

/* Today's money / future money switch */
.cd .seg { height: 32px; }
.cd .seg button { padding: 0 12px; font-size: 0.8rem; white-space: nowrap; }
.cd .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Stats under the graph */
.cd .stats { margin-top: 22px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .cd .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cd .stat { align-content: start; }
.cd .stat .sub { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cd .stat-gold .v { color: var(--gold); }
.cd .stat-rust .v { color: var(--rust); }
.cd .stat-range .v { font-size: 1.2rem; white-space: nowrap; }

/* Inputs panel */
.cd .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; display: grid; gap: 4px; min-width: 0; }
.cd .panel-head { display: grid; gap: 10px; padding-bottom: 12px; }
.cd .panel-head h2 { font-size: 1.45rem; }
.cd .panel-head .btn-row { flex-wrap: nowrap; }
.cd .panel-head .inline-field { flex: 1; min-width: 0; }
.cd .panel-head .inline-field select { width: 100%; }
.cd .simple { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--ink); }
.cd .simple .col { border: 0; margin: 0; padding: 14px 0; display: grid; gap: 12px; align-content: start; min-width: 0; }
.cd .simple .col + .col { border-top: 1px solid var(--line); }
.cd .simple .col:last-child { padding-bottom: 4px; }
.cd .simple legend { float: left; width: 100%; padding: 0; font-family: var(--font-display); font-size: 1.05rem; }
.cd .simple legend + * { clear: both; }
.cd .row2 { gap: 10px; }
.cd .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cd .idle-line { font-size: 0.88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cd .idle-line b { color: var(--ink); font-weight: 600; }
.cd .field-hint { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.cd .presets .preset { min-width: 44px; }
.cd .preset-custom { width: 5.6rem; }
.cd .preset-custom input { padding-right: 30px; }
.cd .pct input { padding-right: 28px; }
.cd .privacy { margin-top: 8px; }
.cd .errors { margin-top: 8px; }
.cd .errors:empty { display: none; }
.cd input[type="text"] { min-height: 42px; }

/* Graph extras */
.chart-box .l-cash { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .l-start { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 4; }
.chart-box .lost-area { fill: var(--rust); fill-opacity: 0.16; }
.chart-box .ahead-area { fill: var(--slate); fill-opacity: 0.16; }
.chart-box .lost-label { font-family: var(--font-body); font-style: normal; font-size: 12.5px; font-weight: 600; fill: var(--rust); }
.chart-box .bracket { fill: none; stroke: var(--gold); stroke-width: 1.3; }
.chart-box .bracket.is-ahead { stroke: var(--slate); }
.chart-box .cost-v { font-family: var(--font-body); font-size: 15px; font-weight: 700; fill: var(--gold); }
.chart-box .cost-v.is-ahead { fill: var(--slate); }
.chart-box .start-dot { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.chart-box .cash-dot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.chart-box .empty-msg { font-family: var(--font-body); font-style: normal; font-size: 13px; fill: var(--muted); }
.tip .t-cost { color: var(--gold); font-weight: 600; }
.tip .t-cost.is-ahead { color: var(--slate); }

/* Second graph: why the gap grows */
.cd .why { padding-top: 64px; display: grid; gap: 14px; }
.cd .why-msg { font-size: 1.05rem; max-width: 70ch; }
.cd .why-msg b { font-weight: 700; }
.cd .why-msg .g { color: var(--gold); }
.cd .why-msg .r { color: var(--rust); }
.cd .rates-box { border-top: 1px solid var(--ink); padding-top: 8px; }
.cd .rates-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.cd .rates-box text { font-family: var(--font-body); font-size: 12px; font-variant-numeric: tabular-nums; }
.rates-box .r-name { font-family: var(--font-body); font-size: 14px; font-weight: 600; fill: var(--ink); }
.rates-box .r-eaten { fill: var(--muted); fill-opacity: 0.28; }
.rates-box .r-real { fill: var(--gold-area); }
.rates-box .r-short { fill: var(--rust); fill-opacity: 0.18; stroke: var(--rust); stroke-width: 1.2; stroke-dasharray: 3 3; }
.rates-box .r-infl { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 2 3; }
.rates-box .r-zero { stroke: var(--ink); stroke-width: 1; }
.rates-box .r-v { font-weight: 700; font-size: 13px; }
.rates-box .r-v.pos { fill: var(--gold); }
.rates-box .r-v.neg { fill: var(--rust); }
.rates-box .r-s { fill: var(--muted); }
.rates-box .ax { fill: var(--muted); }
.cd .legend-static { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.84rem; color: var(--muted); }
.cd .legend-static span { display: inline-flex; align-items: center; gap: 7px; }
.cd .sq { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.cd .sq-real { background: var(--gold-area); }
.cd .sq-eaten { background: var(--muted); opacity: 0.4; }
.cd .sq-short { border: 1.2px dashed var(--rust); background: transparent; }

/* Year by year */
.cd #years { padding-top: 56px; }
.cd #years h2 { margin-bottom: 14px; }
.cd .yt-scroll { overflow-x: auto; }
.cd .yt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; border-top: 1px solid var(--ink); }
.cd .yt th, .cd .yt td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.cd .yt th:first-child { text-align: left; }
.cd .yt th:last-child, .cd .yt td:last-child { padding-right: 0; }
.cd .yt thead th { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.cd .yt tbody th { font-weight: 600; }
.cd .yt td.cost { color: var(--gold); font-weight: 600; }
.cd .yt td.cost.is-ahead { color: var(--slate); }
.cd .yt td.lost { color: var(--rust); }
.cd .yt tr.is-end { background: var(--surface-2); }
.cd .yt-note { margin-top: 10px; }

/* Reading: one content width, heading left and text right on wide screens */
.cd .prose, .cd .disclaimer { max-width: none; }
@media (min-width: 900px) {
  .cd .section.prose { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: 48px; row-gap: 0; align-items: start; }
  .cd .section.prose > h2 { grid-column: 1; grid-row: 1 / span 30; }
  .cd .section.prose > :not(h2) { grid-column: 2; margin-bottom: 16px; }
}
.cd .sources { font-size: var(--step--1); color: var(--muted); }

@media (max-width: 1200px) and (min-width: 961px) { .cd .workspace { grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; } }
@media (max-width: 960px) {
  .cd .workspace { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cd .stage { display: contents; }
  .cd .stage .answer { order: 1; }
  .cd .stage .landscape { order: 2; }
  .cd .panel { order: 3; margin-top: 20px; }
  .cd .stage .stats { order: 4; margin-top: 28px; }
}
@media (max-width: 960px) and (min-width: 600px) {
  .cd .simple { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cd .simple .col:nth-child(2) { border-top: 0; border-left: 1px solid var(--line); padding-left: 18px; }
  .cd .simple .col:nth-child(1) { padding-right: 18px; }
  .cd .simple .col:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .cd .hero-head { padding-block: 18px 0; }
  .cd .hero-head h1 { font-size: 1.6rem; }
  .cd .hero-head .eyebrow { display: none; }
  .cd .answer .big { font-size: 2.9rem; }
  .cd .answer-line { font-size: 0.85rem; flex-basis: 100%; padding-bottom: 0; }
  .cd .landscape { padding-top: 6px; }
  .cd .panel { padding: 14px 14px 16px; margin-inline: -4px; }
  .cd .legend-row { gap: 6px 14px; padding-top: 6px; }
  .cd .legend { gap: 2px 14px; font-size: 0.8rem; }
  .cd .legend .lg-start { display: none; }
  .cd .seg { height: 30px; }
  .cd .panel { margin-top: 14px; }
  .cd .yt { font-size: 0.84rem; }
  .cd .yt th, .cd .yt td { padding-right: 8px; }
  .cd .yt .wide { display: none; }
}

/* While a number is invalid, keep the last result but fade it. */
.cd .is-stale .landscape, .cd .is-stale .stats { opacity: 0.35; transition: opacity 0.15s; }

@media (max-width: 400px) { .cd .stat-range .v { white-space: normal; } }
