/* Haybird: financial independence pages (years to FI and Coast FI).
   Page-only styles on top of style.css. Everything is scoped to body.fi so the shared look is untouched. */

.fi .hero-head { display: block; padding-block: 24px 4px; }
.fi .hero-head h1 { font-size: var(--step-3); max-width: none; margin-top: 6px; }
.fi-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; }
.fi-tabs a { text-decoration: none; padding: 5px 12px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.fi-tabs a:hover { color: var(--ink); }
.fi-tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* Workspace: graph and answer on the left, inputs on the right. On phones: answer, graph, inputs, numbers. */
.fi-work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px 40px; align-items: start; padding-top: 14px; }
.fi-stage { display: grid; min-width: 0; }
.fi .answer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 18px; }
.fi .answer .label { flex-basis: 100%; }
.fi .answer .big { font-size: clamp(2.8rem, 2rem + 2.6vw, 4.2rem); }
.fi .answer .big small { font-size: 0.32em; }
.fi .answer-line { padding-bottom: 6px; max-width: 48ch; }
.fi .landscape { margin: 0; padding-top: 12px; }
.fi .stats { margin-top: 20px; }
.fi-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: space-between; align-items: center; padding-top: 8px; font-size: 0.84rem; color: var(--muted); }
.fi-legend .keys { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.fi-legend .keys span { display: inline-flex; align-items: center; gap: 7px; }
.fi-legend .hint { font-size: 0.8rem; }
.sq { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.sq-put { background: var(--muted); opacity: 0.35; }
.sq-grow { background: var(--gold-area); opacity: 0.55; }
.sq-zone { background: var(--gold-soft); border: 1px solid var(--line); }
.chip-target { width: 16px; height: 0; border-top: 1.5px dashed var(--ink); display: inline-block; }
.chip-gold { width: 16px; height: 0; border-top: 2.4px solid var(--gold); display: inline-block; }
.chip-dot { width: 16px; height: 0; border-top: 2px dotted var(--gold); display: inline-block; }

.fi-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; display: grid; gap: 14px; min-width: 0; }
.fi-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.fi-panel-head h2 { font-size: 1.3rem; white-space: nowrap; }
.fi-panel-head .inline-field select { width: auto; max-width: 9.5rem; padding-block: 6px; font-size: 0.88rem; }
.fi-fields { display: grid; gap: 12px; border-top: 1px solid var(--ink); padding-top: 14px; }
.fi-fields .row2 { gap: 10px; }
.fi-per { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fi-per .label { font-size: 0.8rem; }
.fi .seg { height: 34px; }
.fi .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.fi-assume { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.fi-assume h3 { font-size: 1rem; }
.fi-assume .presets { flex-wrap: nowrap; }
.fi-assume .preset { padding: 7px 9px; }
.fi-assume .preset-custom { width: 5.6rem; flex: 0 0 auto; }
.fi-assume .preset-custom input { padding-left: 8px; padding-right: 20px; }
.fi-assume .preset-custom span { right: 8px; }
.fi .field .hint { font-size: 0.78rem; line-height: 1.4; }
.fi .opt { font-family: var(--font-body); font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 5px; margin-left: 4px; }
.fi .privacy { margin-top: 2px; }
.fi .errors { margin-top: 0; font-size: 0.9rem; }
.fi .stat .sub { font-size: 0.78rem; color: var(--muted); }

@media (max-width: 1200px) and (min-width: 961px) { .fi-work { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px 28px; } }
@media (max-width: 960px) {
  .fi-work { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .fi-stage { display: contents; }
  .fi-stage .answer { order: 1; }
  .fi-stage .landscape { order: 2; }
  .fi-panel { order: 3; margin-top: 18px; }
  .fi-stage .stats { order: 4; margin-top: 26px; }
}
@media (max-width: 960px) and (min-width: 600px) {
  .fi-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 18px; }
  .fi-fields .fi-per { grid-column: 1 / -1; }
  .fi-assume { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 18px; }
  .fi-assume h3 { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .fi .hero-head { padding-block: 14px 0; }
  .fi .hero-head h1 { font-size: 1.55rem; }
  .fi .hero-head .eyebrow { display: none; }
  .fi-tabs { margin-bottom: 10px; }
  .fi .answer .big { font-size: 2.9rem; }
  .fi .answer .label { display: none; }
  .fi .answer-line { font-size: 0.86rem; flex-basis: 100%; padding-bottom: 0; }
  .fi .landscape { padding-top: 6px; }
  .fi-legend .hint { display: none; }
  .fi-legend, .fi-legend .keys { gap: 2px 12px; font-size: 0.78rem; }
  .fi-panel { padding: 14px 14px 16px; margin-top: 14px; }
  .fi-tabs a { padding: 4px 10px; font-size: 0.8rem; }
  .fi .stats { margin-top: 22px; }
}

/* Charts */
.fi .chart-box .a-put { fill: var(--muted); fill-opacity: 0.16; }
.fi .chart-box .a-grow { fill: url(#fi-grow); }
.fi .chart-box .l-bal { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fi .chart-box .l-put { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.fi .chart-box .l-target { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 6 5; fill: none; }
.fi .chart-box .l-need { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 6 5; fill: none; }
.fi .chart-box .l-stop { fill: none; stroke: var(--gold); stroke-width: 2; stroke-dasharray: 1.5 4.5; stroke-linecap: round; }
.fi .chart-box .after { opacity: 0.32; }
.fi .chart-box .zone { fill: var(--gold-area); fill-opacity: 0.09; }
.fi .chart-box .drop { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.5; }
.fi .chart-box .t-label { font-size: 12px; font-weight: 600; fill: var(--ink); }
.fi .chart-box .t-sub { font-size: 11.5px; fill: var(--muted); }
.fi .chart-box .area-label { font-family: var(--font-body); font-style: normal; font-size: 12.5px; font-weight: 600; }
.fi .chart-box .al-put { fill: var(--muted); }
.fi .chart-box .al-grow { fill: var(--gold); }
.fi .chart-box .halo { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.fi .chart-box .curve { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fi .chart-box .curve-area { fill: url(#fi-curve); }
.fi .chart-box .you { fill: var(--gold); stroke: var(--paper); stroke-width: 2.5; }
.fi .chart-box .ghost { fill: var(--paper); stroke: var(--gold); stroke-width: 2; }
.fi .chart-box .bar { fill: var(--muted); fill-opacity: 0.28; }
.fi .chart-box .bar.ok { fill: var(--gold-area); fill-opacity: 0.75; }
.fi .chart-box .bar.is-you { stroke: var(--ink); stroke-width: 1.5; }
.fi .chart-box .have { stroke: var(--gold); stroke-width: 2; }

/* Second view and table */
.fi-more { padding-top: 64px; display: grid; gap: 12px; }
.fi-more h2 { margin-bottom: 2px; }
.fi-msg { font-size: 1.05rem; max-width: 70ch; }
.fi-msg b { color: var(--gold); font-weight: 700; }
.fi-years { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.fi-years summary { cursor: pointer; font-family: var(--font-display); font-size: 1.12rem; }
.fi-years[open] summary { margin-bottom: 12px; }
.yt-scroll { overflow-x: auto; }
.yt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; border-top: 1px solid var(--ink); }
.yt th, .yt td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.yt th:first-child { text-align: left; }
.yt thead th { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.yt tbody th { font-weight: 600; }
.yt tr.is-fi td, .yt tr.is-fi th { color: var(--gold); font-weight: 700; }
@media (max-width: 480px) { .yt { font-size: 0.82rem; } .yt th, .yt td { padding-right: 7px; } .yt .wide { display: none; } }

/* One content width: reading sections use the full width, heading left, text right. */
.fi .prose, .fi .disclaimer { max-width: none; }
@media (min-width: 900px) {
  .fi .section.prose { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: 48px; row-gap: 0; align-items: start; }
  .fi .section.prose > h2 { grid-column: 1; grid-row: 1 / span 30; }
  .fi .section.prose > :not(h2) { grid-column: 2; margin-bottom: 16px; }
}
.fi .sources { font-size: var(--step--1); color: var(--muted); }
.fi .sources li { overflow-wrap: anywhere; }
.fi .stat { align-content: start; }
/* Four numbers in one row (the shared .stats rule now defaults to three). */
.fi .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .fi .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Very narrow phones: let the panel heading wrap. */
@media (max-width: 360px) { .fi-panel-head { flex-wrap: wrap; } }
