/* What Does 1% Cost? — fund fees compounded.
 * Shared Money-app tokens: paper, green accent for the cheap path, copper for
 * the expensive one. The shaded gap between them is the hero.
 */
:root {
  --paper: #f4f1e8; --card: #fbf9f3; --ink: #1d2420; --ink-2: #4c5650;
  --ink-3: #87908a; --rule: rgba(29,36,32,.18); --rule-soft: rgba(29,36,32,.09);
  --accent: #2f5d46;
  --accent-2: #b0662a;
  --mid: #7d7a3a;           /* the middle path (active fund), between green and copper */
  --gap-1: rgba(176,102,42,.16);
  --gap-2: rgba(176,102,42,.32);
  --serif: "Fraunces", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --side-w: 330px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--appnav-h, 0px) + 20px); }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- layout ---- */
.layout {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--appnav-h, 0px));
}
.side {
  border-right: 1px solid var(--rule); background: var(--paper);
  position: sticky; top: var(--appnav-h, 0px);
  height: calc(100vh - var(--appnav-h, 0px)); overflow-y: auto;
}
.side-inner { padding: 22px 22px 20px; }
.chart-main {
  position: sticky; top: var(--appnav-h, 0px);
  height: calc(100vh - var(--appnav-h, 0px)); min-height: 460px;
  padding: 18px 22px 10px 10px;
}

.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
}
.title {
  font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.05;
  letter-spacing: -.01em; margin-bottom: 10px;
}
.title em, h2 em { font-style: italic; color: var(--accent); }
.lede { color: var(--ink-2); margin-bottom: 14px; }

.side-h {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 6px;
}
fieldset { border: 0; border-top: 1px solid var(--rule); padding-top: 10px; margin-bottom: 12px; }
legend.side-h { padding-right: 8px; }

.field {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 6px 0; font-size: 14.5px;
}
.field > span:first-child { color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.field.range { flex-wrap: wrap; }
.field.range input { width: 100%; accent-color: var(--accent); }
.field output { font-family: var(--mono); color: var(--ink); font-size: 14px; margin-left: 4px; }
.money, .pct {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 14px; color: var(--ink-3);
}
.money b, .pct b { font-weight: 400; white-space: nowrap; }
.field input[type=number] {
  font-family: var(--mono); font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: 4px;
  padding: 4px 6px; text-align: right;
}
.money input { width: 104px; }
.pct input { width: 70px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.fee-index .sw { color: var(--accent); }
.fee-active .sw { color: var(--mid); }
.fee-advisor .sw { color: var(--accent-2); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 8px; }
.chips button, .reset {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  background: transparent; border: 1px solid var(--rule); border-radius: 999px;
  padding: 3px 9px; cursor: pointer;
}
.chips button[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chips button:hover, .reset:hover { border-color: var(--ink-2); color: var(--ink); }
.reset { margin-top: 6px; }
.hint { font-size: 13px; line-height: 1.45; color: var(--ink-3); margin: 2px 0 6px; }

.readout { border-top: 1px solid var(--rule); padding-top: 10px; }
.big {
  font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1;
  color: var(--accent-2); margin: 4px 0 2px;
}
.big-sub { color: var(--ink-2); font-size: 14.5px; margin-bottom: 10px; }
.ro-rows { list-style: none; font-size: 14px; }
.ro-rows li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--rule-soft); }
.ro-rows .v { font-family: var(--mono); }
.ro-rows .l { color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.side-foot { margin-top: 14px; font-size: 13.5px; color: var(--ink-3); }

/* ---- chart ---- */
.chart { position: relative; height: 100%; display: flex; flex-direction: column; }
#svg { flex: 1; width: 100%; min-height: 0; display: block; }
#svg:focus-visible { outline-offset: -2px; }
.cap { font-family: var(--mono); font-size: 11px; color: var(--ink-3); padding: 2px 0 0 54px; }
.axis text { font-family: var(--mono); font-size: 11px; fill: var(--ink-3); }
.axis line { stroke: var(--rule-soft); }
.axis .base { stroke: var(--rule); }
.line { fill: none; stroke-width: 2.4; stroke-linejoin: round; }
.line.index { stroke: var(--accent); }
.line.active { stroke: var(--mid); stroke-width: 1.8; }
.line.advisor { stroke: var(--accent-2); }
.line.paid { stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 3 4; }
.band1 { fill: var(--gap-1); }
.band2 { fill: var(--gap-2); }
.end-lab { font-family: var(--mono); font-size: 12px; }
.end-lab .n { font-weight: 500; }
.hero-lab .amt { font-family: var(--serif); font-weight: 600; fill: var(--accent-2); }
.hero-lab .sub { font-family: var(--sans); fill: var(--ink-2); }
.hero-lead { stroke: var(--accent-2); stroke-width: 1; }
.cursor { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
.dot { stroke: var(--card); stroke-width: 1.5; }
.tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(29,36,32,.12);
  padding: 8px 10px; font-size: 13px; min-width: 210px;
}
.tip h4 { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.tip table { border-collapse: collapse; width: 100%; }
.tip td { padding: 1px 0; }
.tip td.v { font-family: var(--mono); text-align: right; padding-left: 12px; }
.tip tr.gap td { border-top: 1px solid var(--rule-soft); color: var(--accent-2); padding-top: 3px; }

/* ---- panels below ---- */
.panel { max-width: 980px; margin: 0 auto; padding: 40px 24px 8px; }
.panel h2 { font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.15; margin-bottom: 10px; }
.panel-h { font-family: var(--serif); font-weight: 600; font-size: 20px; margin: 30px 0 8px; }
.panel-lede { color: var(--ink-2); max-width: 680px; margin-bottom: 14px; }
.note { font-size: 13px; color: var(--ink-3); margin-top: 8px; max-width: 760px; }
#why { border-top: 1px solid var(--rule); }

.spiva { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px 28px; }
.sp-card { background: var(--card); border: 1px solid var(--rule-soft); border-radius: 8px; padding: 14px 16px; }
.sp-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 1px; }
.sp-card .bench { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-bottom: 10px; }
.sp-row { display: grid; grid-template-columns: 54px 1fr 54px; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
.sp-row .h { font-family: var(--mono); color: var(--ink-2); }
.sp-row .v { font-family: var(--mono); text-align: right; }
.sp-track { height: 14px; background: var(--rule-soft); border-radius: 3px; position: relative; overflow: hidden; }
.sp-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent-2); opacity: .8; border-radius: 3px 0 0 3px; }
.sp-half { position: absolute; top: -2px; bottom: -2px; left: 50%; width: 1px; background: var(--ink-3); }

.gap-table-wrap { overflow-x: auto; }
.gap-table { border-collapse: collapse; font-size: 14px; width: 100%; max-width: 640px; }
.gap-table th, .gap-table td { padding: 6px 14px 6px 0; border-bottom: 1px solid var(--rule-soft); text-align: right; }
.gap-table th:first-child, .gap-table td:first-child { text-align: left; }
.gap-table th { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.gap-table td.n { font-family: var(--mono); }
.gap-table td.g { font-family: var(--mono); color: var(--accent-2); }

.reading p { max-width: 720px; margin-bottom: 12px; }
.formula {
  font-family: var(--mono); font-size: 13px; line-height: 1.7; background: var(--card);
  border: 1px solid var(--rule-soft); border-radius: 6px; padding: 12px 14px; margin: 6px 0 14px;
  overflow-x: auto; white-space: pre; max-width: 720px;
}
.src-list { padding-left: 18px; max-width: 820px; }
.src-list li { margin-bottom: 10px; }
.sources p { max-width: 820px; margin: 10px 0; }
.changelog { padding-bottom: 60px; }
.changelog ul { list-style: none; }
.changelog li { font-size: 14px; color: var(--ink-2); }
.changelog time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-right: 10px; }

/* ---- narrow ---- */
@media (max-width: 860px) {
  .layout { display: block; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .chart-main { position: static; height: 72vh; min-height: 420px; max-height: 620px; padding: 12px 6px 6px 0; }
  .title { font-size: 30px; }
  .panel { padding: 30px 16px 6px; }
  .side-inner { padding: 18px 16px; }
  .gap-table th, .gap-table td { padding-right: 8px; font-size: 13px; }
}

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