/* Paisa Paath: original stylesheet. System fonts only; no external requests. */
:root {
  --paper: #fbf8f2;
  --surface: #ffffff;
  --ink: #1b2826;
  --muted: #4a5a56;
  --teal: #0b5d52;
  --teal-dark: #084a41;
  --teal-soft: #e3efe9;
  --marigold: #f2b134;
  --marigold-soft: #fdf1d6;
  --rule: #d8d1c2;
  --danger: #a1261b;
  --focus: #b4560a;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6; overflow-wrap: break-word; }
img, svg { max-width: 100%; }
a { color: var(--teal); text-underline-offset: 0.18em; }
a:hover { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; color: var(--ink); }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); margin: 0.2em 0 0.4em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.65rem); margin: 1.8em 0 0.5em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 0.4em; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
li + li { margin-top: 0.35em; }
code { font-size: 0.92em; background: var(--teal-soft); padding: 0.1em 0.35em; border-radius: 5px; overflow-wrap: anywhere; }
var { font-family: var(--serif); font-style: italic; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 3rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--teal); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 8px; color: #fff; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: 44px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; }
.brand-tag { font-size: 0.78rem; color: var(--muted); }
.main-nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -10px; }
.main-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; text-decoration: none; color: var(--ink); font-weight: 600; border-radius: 8px; }
.main-nav a:hover { background: var(--teal-soft); }
.main-nav a[aria-current="page"] { color: var(--teal); box-shadow: inset 0 -3px 0 var(--marigold); }

/* Page heads */
.page-head { padding-top: 1.6rem; max-width: 46rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.78rem; font-weight: 700; color: var(--teal); margin: 0; }
.lede { font-size: 1.12rem; color: var(--muted); }

/* Hero */
.hero { display: grid; gap: 14px; padding-top: 1rem; }
.hero .lede { margin-bottom: 0; }
.hero h1 { margin-top: 0; }
.quick h2 { margin-top: 0; font-size: 1.25rem; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.card-grid, .card-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.card-grid li + li, .card-list li + li { margin-top: 0; }
.card h2, .card h3 { margin: 0 0 0.3em; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); }
.tool-card a { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; text-decoration: none; font-size: 1.08rem; }
.tool-card a:hover .tool-name { text-decoration: underline; }
.tool-card .icon { flex: none; color: var(--teal); background: var(--teal-soft); border-radius: 10px; padding: 4px; width: 38px; height: 38px; }
.tool-card p { margin-top: 6px; }
.principles { max-width: 46rem; }

/* Forms */
.tool { margin-top: 1.2rem; }
.calc-form, .results { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.calc-page .results, .lesson .results { margin-top: 14px; }
.quick .calc-form, .quick .results { border: 0; padding: 0; background: none; }
.quick .results { margin-top: 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
legend { font-family: var(--serif); font-weight: 700; font-size: 1.08rem; padding: 0; margin-bottom: 6px; }
.grid-2, .grid-3 { display: grid; gap: 4px 16px; grid-template-columns: 1fr; }
.grid-2.tight { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.quick .stat-big { grid-column: auto; }
.quick .stat-big dd { font-size: 1.35rem; }
.quick .field { margin-bottom: 8px; }
.field { margin-bottom: 12px; min-width: 0; }
.field[hidden] { display: none; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.input-row { display: flex; align-items: stretch; border: 1.5px solid #8d958f; border-radius: 10px; background: var(--surface); overflow: hidden; }
.input-row:focus-within { border-color: var(--teal); outline: 3px solid var(--focus); outline-offset: 2px; }
.input-row input { flex: 1 1 auto; min-width: 0; border: 0; font: inherit; font-variant-numeric: tabular-nums; padding: 10px 12px; min-height: 46px; background: transparent; color: var(--ink); }
.input-row input:focus { outline: none; }
.input-row input[aria-invalid="true"] { background: #fdecea; }
.unit { display: flex; align-items: center; padding: 0 12px; color: var(--muted); background: #f3f0e8; font-size: 0.95rem; white-space: nowrap; }
.unit-pre { padding: 0 10px; font-weight: 700; color: var(--ink); }
select { width: 100%; font: inherit; min-height: 46px; padding: 8px 10px; border: 1.5px solid #8d958f; border-radius: 10px; background: var(--surface); color: var(--ink); }
select:focus-visible { border-color: var(--teal); }
.hint { font-size: 0.9rem; color: var(--muted); margin: 4px 0 0; }
.words { font-size: 0.9rem; color: var(--teal-dark); margin: 4px 0 0; min-height: 0; font-weight: 600; }
.words:empty, .field-error:empty { margin: 0; }
.field-error { color: var(--danger); font-size: 0.92rem; font-weight: 600; margin: 4px 0 0; }
.remember { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 10px; margin: 6px 0 14px; }
.remember input { width: 22px; height: 22px; margin: 11px 0; accent-color: var(--teal); }
.remember label { font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.remember .hint { grid-column: 1 / -1; margin-top: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 20px; border: 0; border-radius: 10px; background: var(--teal); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--teal-dark); }
.btn-secondary { background: var(--surface); color: var(--teal); border: 2px solid var(--teal); }
.btn-secondary:hover { background: var(--teal-soft); color: var(--teal-dark); }

/* Results */
.results h2 { margin-top: 0; font-size: 1.25rem; }
.results h3 { margin-top: 1em; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.stat { background: var(--paper); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.stat dt { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.stat dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-big { grid-column: 1 / -1; background: var(--marigold-soft); border-left: 5px solid var(--marigold); }
.stat-big dd { font-size: 1.7rem; font-family: var(--serif); }
.result-sentence { font-weight: 600; }
.split { margin-top: 14px; }
.split-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--rule); }
.split-p { background: var(--teal); }
.split-i { background: var(--marigold); }
.split-key { font-size: 0.9rem; color: var(--muted); margin: 6px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.key-p { background: var(--teal); }
.key-i { background: var(--marigold); margin-left: 10px; }

/* Tables: scroll inside their own box, never the page */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); margin: 8px 0 14px; }
.table-wrap:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #ebe6da; vertical-align: top; }
thead th { background: var(--teal-soft); font-weight: 700; white-space: nowrap; }
.num-table td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-table tbody th { font-weight: 600; white-space: nowrap; }
.num-table thead th:not(:first-child) { text-align: right; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
td.gap { text-align: center !important; color: var(--muted); font-style: italic; }
th[hidden] { display: none; }
details { margin: 8px 0 12px; }
summary { cursor: pointer; font-weight: 700; color: var(--teal); min-height: 44px; display: flex; align-items: center; }

/* Explainers */
.explain, .worked, .lesson section, .principles { max-width: 46rem; }
.lesson .tool { max-width: none; }
.formula { background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--teal); border-radius: 10px; padding: 12px 14px; margin: 0 0 1em; overflow-x: auto; font-size: 1.08rem; }
.formula p { margin: 0; white-space: nowrap; }
.formula-inline { font-style: italic; }
.terms { color: var(--muted); }
.worked { background: var(--marigold-soft); border-radius: var(--radius); padding: 2px 16px 6px; margin-top: 1.6rem; }
.worked h2 { margin-top: 0.9em; }
.steps li { font-variant-numeric: tabular-nums; }
.limits { max-width: 46rem; border: 2px solid var(--marigold); border-radius: var(--radius); padding: 2px 16px; margin-top: 2rem; background: var(--surface); }
.limits h2 { font-size: 1.15rem; margin-top: 0.8em; }
.asof { max-width: 46rem; background: var(--teal-soft); border-radius: 10px; padding: 10px 14px; }
.stale { display: block; margin-top: 6px; color: var(--danger); font-weight: 700; }
.stale[hidden] { display: none; }
.cite { font-size: 0.88rem; color: var(--muted); }
.sources { max-width: 46rem; font-size: 0.95rem; }
.sources li { color: var(--muted); }
.small { font-size: 0.9rem; color: var(--muted); }
.related { max-width: 46rem; }
.related h2 { font-size: 1.15rem; }
.noscript { background: var(--marigold-soft); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.log { padding-left: 1.2em; }
.clear-box { margin: 12px 0 16px; }
.link-list li { margin-top: 0.5em; }
.sources a { display: inline-block; min-height: 24px; }
.related a, .link-list a, .card h2 a, .card h3 a { display: inline-flex; align-items: center; min-height: 44px; }
.related li, .link-list li { padding: 6px 0; }

/* Footer */
.site-footer { background: #13302c; color: #e9efe9; padding: 24px 0 30px; margin-top: 2rem; }
.site-footer a { color: #ffd58a; }
.site-footer a:hover { color: #fff; }
.site-footer :focus-visible { outline-color: #ffd58a; }
.footer-note { max-width: 46rem; font-size: 0.95rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 4px; margin-bottom: 8px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px 0 0; }
.footer-meta { font-size: 0.9rem; color: #c9d5cf; margin: 0; }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-big { grid-column: auto; }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: 1.1fr 1fr; align-items: start; padding-top: 2.5rem; gap: 36px; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quick .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .calc-form, .skip-link, .related { display: none; }
  body { background: #fff; }
}
