/* ============================================================
   eduloan — deep bottle green + pale champagne gold.
   Motif: the moratorium wedge (interest rising while nobody pays).
   Dark is the default scheme; light adapts via prefers-color-scheme.
   ============================================================ */

:root {
  --bg:        #0B2B21;
  --panel:     #113828;
  --panel2:    #16452F;
  --line:      rgba(196, 164, 78, 0.30);   /* deep brass hairlines */
  --ink:       #EFEAD9;                    /* warm ivory */
  --muted:     #C2CDBB;
  --gold:      #E6D28E;                    /* pale champagne gold */
  --brass:     #C4A44E;
  --sage:      #A2BAAD;                    /* Scenario A baseline only (AA on its dim chip) */
  --copper:    #E0A96D;                    /* Scenario C */
  --gold-dim:  rgba(230, 210, 142, 0.13);
  --sage-dim:  rgba(162, 186, 173, 0.14);
  --copper-dim:rgba(224, 169, 109, 0.13);
  --focus:     #E6D28E;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --wrap: 1080px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #F0F3EB;                  /* celadon-tinted paper */
    --panel:     #FAFBF5;
    --panel2:    #EDF1E4;
    --line:      rgba(126, 100, 20, 0.35);
    --ink:       #123A2C;                  /* bottle-green ink */
    --muted:     #40584A;
    --gold:      #755D10;                  /* brass deepened for AA on light (incl. gold-dim chips) */
    --brass:     #8A6E1F;
    --sage:      #4E6A5C;
    --copper:    #8A501B;
    --gold-dim:  rgba(117, 93, 16, 0.10);
    --sage-dim:  rgba(78, 106, 92, 0.11);
    --copper-dim:rgba(138, 80, 27, 0.10);
    --focus:     #123A2C;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 750; letter-spacing: -0.02em; line-height: 1.12; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--gold); }
a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.num, .figs dd, .sched td.num, .sched th.num { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- skip link + focus ---------------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--gold); color: #0B2B21; padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0; font-weight: 700;
}
@media (prefers-color-scheme: light) { .skip-link { color: #FAFBF5; background: #123A2C; } }
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

/* ---------------- hero ---------------- */
.hero { padding: 56px 0 0; border-bottom: 1px solid var(--line); }
.eyebrow {
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin-bottom: 14px;
}
.hero h1 { font-size: clamp(26px, 4.6vw, 42px); max-width: 21ch; }
.hero .accent { color: var(--gold); }
.lede { max-width: 68ch; margin-top: 18px; color: var(--muted); font-size: 17px; }
.lede strong { color: var(--ink); }
.privacy-chip {
  display: inline-flex; align-items: center; gap: 10px; margin: 22px 0 6px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); font-size: 14px; color: var(--muted);
}
.privacy-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.hero-wedge { margin-top: 26px; }
.hero-wedge svg { display: block; width: 100%; height: 96px; }
@media (prefers-color-scheme: light) {
  .hero-wedge rect { fill: #7E6414; }
  .hero-wedge path { stroke: #4E6A5C; }
}

/* ---------------- sections ---------------- */
main section { padding: 44px 0 6px; }
h2 { font-size: clamp(20px, 3vw, 27px); display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.rule-wedge {
  display: inline-block; flex: none; width: 34px; height: 15px;
  background: linear-gradient(135deg, transparent 49.5%, var(--brass) 50%);
  align-self: center;
}
.section-lede { color: var(--muted); max-width: 72ch; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13.5px; margin-top: 8px; max-width: 72ch; }
.model-note strong { color: var(--gold); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

/* ---------------- form ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 18px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.field input[type="number"], .field input[type="month"], .field input[type="text"], .field select {
  width: 100%; padding: 9px 11px; font: inherit; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.field select { appearance: auto; }
.field .hint { margin-top: 5px; font-size: 12.5px; }
.field-toggles { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--brass); flex: none; }

/* ---------------- verdict + cards ---------------- */
.verdict {
  border-left: 4px solid var(--gold);
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 13px 16px; margin-bottom: 18px;
  font-size: 16.5px; max-width: 100%;
}
.verdict strong { color: var(--gold); font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { font-size: 16.5px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card .sub { font-weight: 500; color: var(--muted); font-size: 13.5px; }
.tag {
  display: inline-grid; place-items: center; width: 24px; height: 24px;
  border-radius: 7px; font-size: 13.5px; font-weight: 800; align-self: center;
}
.tag-a { background: var(--sage-dim); color: var(--sage); border: 1px solid var(--sage); }
.tag-b { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold); }
.tag-c { background: var(--copper-dim); color: var(--copper); border: 1px solid var(--copper); }
.card-a { border-top: 3px solid var(--sage); }
.card-b { border-top: 3px solid var(--gold); }
.card-c { border-top: 3px solid var(--copper); }

.figs { margin: 14px 0 0; display: grid; gap: 9px; }
.figs > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 7px; }
.figs dt { color: var(--muted); font-size: 13.5px; }
.figs dd { margin: 0; font-weight: 750; font-size: 15px; }
.delta { margin-top: 13px; font-size: 14px; color: var(--ink); }
.delta strong { color: var(--gold); font-variant-numeric: tabular-nums; }
.delta.baseline { color: var(--muted); font-style: normal; }
.csis-note { margin-top: 10px; font-size: 13px; color: var(--sage); border-left: 3px solid var(--sage); padding-left: 10px; }

/* ---------------- chart ---------------- */
.chart-panel { padding: 14px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-caption { color: var(--muted); font-size: 13px; margin-top: 10px; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12.5px; font-family: var(--sans); }
.chart .hatch-line { stroke: var(--brass); stroke-width: 1.3; opacity: 0.6; }
.chart .wedge { stroke: none; }
.chart .cap-tick { stroke: var(--gold); stroke-width: 2.5; }
.chart .cap-label { fill: var(--gold); font-weight: 700; }
.chart .path-a { stroke: var(--sage); stroke-width: 2.5; }
.chart .path-b { stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 8 5; }
.chart .path-c { stroke: var(--copper); stroke-width: 2.5; stroke-dasharray: 2 4 8 4; }
.chart .legend .axis { fill: var(--ink); font-weight: 650; }

/* ---------------- schedule ---------------- */
.sched-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg-btn {
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  color: var(--muted); background: transparent; border: 0; padding: 8px 15px;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed="true"] { background: var(--gold-dim); color: var(--gold); }
.btn {
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  color: var(--ink); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px;
}
.btn:hover { border-color: var(--brass); color: var(--gold); }

.table-wrap { overflow-x: auto; padding: 0; }
.sched { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.fy-table { min-width: 320px; }
.sched th, .sched td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sched th.num, .sched td.num { text-align: right; }
.sched thead th { color: var(--gold); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.sched .phase-mor td { color: var(--muted); }
.sched .phase-mor td:first-child::before { content: "◔ "; color: var(--brass); }
.sched .year-row td {
  background: var(--panel2); color: var(--gold); font-weight: 750;
  font-size: 12.5px; letter-spacing: 0.05em; text-transform: uppercase;
}
.sched .fy-row td { color: var(--sage); font-weight: 650; }
.sched .final-row td { border-bottom: 2px solid var(--brass); font-weight: 750; }

/* ---------------- 80E ---------------- */
.statute-quote {
  margin: 0 0 10px; padding: 14px 18px;
  border-left: 4px solid var(--brass);
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  font-size: 14.5px; color: var(--ink);
}
.cite { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

/* ---------------- CSIS ---------------- */
.checklist { margin: 0 0 14px; padding: 0 0 0 2px; list-style: none; display: grid; gap: 9px; }
.checklist li { display: flex; gap: 10px; font-size: 14.5px; }
.checklist li::before { content: "☐"; color: var(--brass); flex: none; }
.checklist .clause { color: var(--muted); font-size: 12.5px; display: block; }
.csis-declare { margin: 12px 0 4px; font-weight: 700; }

/* ---------------- saved ---------------- */
.save-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.save-row input[type="text"] {
  flex: 1 1 240px; padding: 9px 11px; font: inherit;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.saved-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.saved-list li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.saved-list .s-name { font-weight: 700; }
.saved-list .s-meta { color: var(--muted); font-size: 12.5px; flex: 1; }
.saved-list .btn { padding: 5px 12px; font-size: 12.5px; }
.saved-empty { color: var(--muted); font-size: 14px; }

/* ---------------- rules panel ---------------- */
.facts { display: grid; gap: 12px; }
.fact { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px; }
.fact .f-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.fact .f-cat {
  font-size: 11px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--gold); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.fact .f-statement { font-size: 14.5px; margin-top: 7px; }
.fact .f-quote { margin: 9px 0 0; padding-left: 12px; border-left: 3px solid var(--brass); color: var(--muted); font-size: 13px; }
.fact .f-src { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------------- limits ---------------- */
.limits { margin: 0; padding: 18px 18px 18px 36px; display: grid; gap: 9px; font-size: 14.5px; color: var(--muted); }
.limits li::marker { color: var(--brass); }

/* ---------------- footer ---------------- */
.site-footer { margin-top: 48px; border-top: 1px solid var(--line); padding: 28px 0 40px; }
.site-footer p { color: var(--muted); font-size: 13.5px; max-width: 80ch; margin-bottom: 12px; }
.site-footer strong { color: var(--ink); }
.foot-meta { font-size: 12.5px; }

/* ---------------- print: the comparison sheet IS the PDF path ---------------- */
.print-only { display: none; }
@media print {
  :root {
    --bg: #fff; --panel: #fff; --panel2: #f2f2ee; --ink: #111; --muted: #333;
    --gold: #6b5410; --brass: #6b5410; --sage: #33473d; --copper: #6b3c12;
    --line: #999; --gold-dim: #f4efdc; --sage-dim: #eef1ee; --copper-dim: #f4ece2;
  }
  body { font-size: 11.5px; }
  .skip-link, .hero-wedge, #calc, #timeline, #schedule, #tax80e, #csis, #saved, #rules, #limits,
  .sched-controls, .privacy-chip { display: none !important; }
  .hero { padding: 0; border: 0; }
  .hero h1 { font-size: 17px; }
  .lede, .eyebrow { display: none; }
  main section { padding: 10px 0 0; }
  .print-only { display: block !important; }
  #print-sheet .cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  #print-sheet h2 { font-size: 15px; }
  .card { border: 1px solid #999; padding: 9px; break-inside: avoid; }
  .verdict { border: 1px solid #999; }
  .print-sources { margin-top: 10px; font-size: 9.5px; color: #333; }
  #compare { display: block; }
  #compare .hint { display: none; }
  a { color: inherit; text-decoration: none; }
  .site-footer { margin-top: 8px; padding: 8px 0 0; }
  .site-footer .foot-meta { display: none; }
}
