/* InterestCalcHub stylesheet.
   Layout: single centred column (max 1180px); calculator is a two-column form/result grid on wide screens, stacked on phones.
   Palette: cool sea-glass neutrals, deep harbour green for growth, indigo for money you put in. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --ink: #12202a;
  --muted: #536370;
  --line: #d9e1df;
  --brand: #0d6b55;
  --brand-ink: #ffffff;
  --brand-soft: #e1f1eb;
  --c-contrib: #3d5a99;
  --c-interest: #17a07a;
  --c-balance: #0d6b55;
  --focus: #e0a526;
  --error: #b42318;
  --error-bg: #fdecea;
  --ok-bg: #e6f4ee;
  --shadow: 0 1px 2px rgba(18, 32, 42, .06), 0 8px 24px rgba(18, 32, 42, .06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --step--1: .875rem; --step-0: 1rem; --step-1: 1.125rem; --step-2: 1.375rem; --step-3: 1.75rem; --step-4: clamp(2rem, 1.4rem + 2.4vw, 2.85rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1619; --surface: #142024; --surface-2: #1a292e; --ink: #e6eef0; --muted: #9db0b6; --line: #253a40;
    --brand: #34c39a; --brand-ink: #062118; --brand-soft: #173a31; --c-contrib: #7f9cdc; --c-interest: #3fd1a3; --c-balance: #34c39a;
    --focus: #f0c040; --error: #ff8a7a; --error-bg: #3a1714; --ok-bg: #133126;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--step-0)/1.6 var(--font); text-rendering: optimizeLegibility; }
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0 0 .5em; }
h1 { font-family: var(--font-display); font-size: var(--step-4); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: var(--step-3); font-family: var(--font-display); font-weight: 700; }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: var(--bg); padding: .5rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { top: 1rem; }

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.narrow { max-width: 780px; }

/* header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; flex-wrap: wrap; padding-block: .8rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.logo-bg { fill: var(--brand); }
.logo-bar { fill: var(--brand-ink); opacity: .75; }
.logo-bar-hi { opacity: 1; }
.main-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.main-nav a { color: var(--muted); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-weight: 550; font-size: .95rem; }
.main-nav a:hover { color: var(--ink); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }

.site-main { padding-bottom: 3rem; }
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding-block: 2.5rem 1.5rem; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 2rem; }
.footer-grid h2 { font: 700 .8rem/1.2 var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .8rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.footer-grid a { color: var(--ink); text-decoration: none; }
.footer-grid a:hover { color: var(--brand); text-decoration: underline; }
.footer-about p { color: var(--muted); margin-top: .8rem; max-width: 36ch; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.footer-base p { margin: 0; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-about { grid-column: 1 / -1; } }

/* breadcrumbs + headings */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 1rem 0 0; font-size: .875rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: .3rem; opacity: .6; }
.crumbs a { color: var(--muted); }
.page-head { padding-block: 1.4rem 1.6rem; max-width: 760px; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: .6rem; }
.lead { font-size: var(--step-1); color: var(--muted); max-width: 65ch; }

/* cards + buttons */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1rem, .7rem + 1.5vw, 1.6rem); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.card-head h2 { font-size: var(--step-2); margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .6rem 1.15rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 1rem/1.2 var(--font); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 40px; padding: .45rem .85rem; font-size: .92rem; }
.btn-large { min-height: 52px; padding: .8rem 1.4rem; font-size: 1.05rem; }

/* calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .calc { grid-template-columns: 1fr; } }
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.form-head h3 { margin: 0; font-size: var(--step-1); }
.currency select { font: 500 .9rem var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem; min-height: 40px; max-width: 12.5rem; }
.field { margin: 0 0 1rem; border: 0; padding: 0; min-width: 0; }
.field > label, .field legend { display: block; font-weight: 650; margin-bottom: .35rem; padding: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input, .input-wrap select, .input-wrap textarea {
  width: 100%; min-height: 48px; padding: .65rem .85rem; font: 500 1.05rem/1.3 var(--font); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; appearance: none; -webkit-appearance: none;
}
.input-wrap textarea { font-weight: 400; resize: vertical; }
.input-wrap input:hover, .input-wrap select:hover, .input-wrap textarea:hover { border-color: color-mix(in srgb, var(--muted) 50%, var(--line)); }
.input-wrap input:focus, .input-wrap select:focus, .input-wrap textarea:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0; }
.has-suffix input { padding-right: 3.2rem; }
.suffix { position: absolute; right: .85rem; color: var(--muted); font-weight: 600; pointer-events: none; }
.select-wrap::after { content: ""; position: absolute; right: 1rem; width: .5rem; height: .5rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); pointer-events: none; }
.select-wrap select { padding-right: 2.4rem; cursor: pointer; }
input[aria-invalid="true"] { border-color: var(--error) !important; background: var(--error-bg) !important; }
.hint { font-size: .85rem; color: var(--muted); margin: .3rem 0 0; }
.error { font-size: .875rem; font-weight: 600; color: var(--error); margin: .3rem 0 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { display: flex; align-items: center; justify-content: center; min-height: 42px; padding: .4rem; border-radius: 8px; font-weight: 600; font-size: .95rem; color: var(--muted); cursor: pointer; text-align: center; }
.seg input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
form[data-mode="deposit"] .mode-time, form[data-mode="time"] .mode-deposit { display: none; }
.field-note { margin: -.6rem 0 1rem; }
.sw-goal { background: transparent; border-top: 2px dashed var(--focus); height: 0; border-radius: 0; width: 1rem; }
.chart-empty { color: var(--muted); padding: 2rem 0; text-align: center; }
.schedule small { color: var(--muted); font-weight: 500; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.form-actions .btn-primary { flex: 1 1 12rem; }

.results { position: sticky; top: 1rem; border-top: 4px solid var(--brand); }
@media (max-width: 860px) { .results { position: static; } }
.results.is-stale .fv, .results.is-stale .stats { opacity: .45; }
.results-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .2rem; }
.fv { font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 0 0 .6rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.res-summary { color: var(--muted); font-size: .95rem; }
.stats { margin: 1rem 0; display: grid; gap: .1rem; }
.stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.stats dt { color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.sw { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; flex: none; }
.sw-contrib { background: var(--c-contrib); }
.sw-interest { background: var(--c-interest); }
.sw-balance { background: var(--c-balance); height: .25rem; border-radius: 2px; }
.split { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin: 1rem 0 .5rem; }
.split-contrib { background: var(--c-contrib); }
.split-interest { background: var(--c-interest); }
.split-label { font-size: .875rem; color: var(--muted); }
.note-warn { font-size: .875rem; background: var(--error-bg); color: var(--error); border-radius: 10px; padding: .6rem .8rem; margin: .8rem 0 0; }
.results-actions { margin-top: 1rem; }
.share-status { font-size: .85rem; color: var(--brand); min-height: 1.2em; margin: .4rem 0 0; overflow-wrap: anywhere; }

/* chart */
.chart-card, .table-card { margin-top: 1.25rem; }
.toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.toggle button { min-height: 38px; padding: .35rem .9rem; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 600 .9rem var(--font); cursor: pointer; }
.toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; padding: 0; margin: 0 0 .5rem; font-size: .875rem; color: var(--muted); }
.legend[data-mode="stacked"] .legend-line { display: none; }
.legend li { display: flex; align-items: center; gap: .45rem; }
.chart { position: relative; min-height: 260px; }
@media (min-width: 520px) { .chart { min-height: 340px; } }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font: 500 11.5px var(--font); font-variant-numeric: tabular-nums; }
.bar-contrib { fill: var(--c-contrib); }
.bar-interest { fill: var(--c-interest); }
.area-balance { fill: var(--c-interest); opacity: .16; }
.line-balance { fill: none; stroke: var(--c-balance); stroke-width: 2.5; stroke-linejoin: round; }
.line-contrib { fill: none; stroke: var(--c-contrib); stroke-width: 2; stroke-dasharray: 6 4; }
.chart-goal { stroke: var(--focus); stroke-width: 2; stroke-dasharray: 7 5; }
.chart-goal-label { fill: var(--ink); font: 700 12px var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.chart-highlight { fill: var(--ink); opacity: .06; }
.chart-tip { position: absolute; z-index: 2; pointer-events: none; display: grid; gap: .15rem; min-width: 12rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: .6rem .75rem; font-size: .85rem; font-variant-numeric: tabular-nums; }
.chart-tip span { display: flex; align-items: center; gap: .45rem; color: var(--muted); }
.chart-tip .sw-balance { height: .8rem; }
.chart-help { font-size: .82rem; color: var(--muted); margin: .6rem 0 0; }

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: .6rem .8rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child { text-align: left; }
thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); position: sticky; top: 0; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.schedule td:last-child { font-weight: 700; }
.table-toggle { margin-top: .8rem; }

/* ads: always below content blocks, never next to calculator controls */
.ad { margin: 2rem auto; padding: .75rem; min-height: 280px; max-width: 970px; text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ad-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 .5rem; }

/* article */
.article-wrap { margin-top: 2.5rem; }
.article { max-width: 760px; }
.article > section { margin-bottom: 2.5rem; }
.article h3 { margin-top: 1.6rem; }
.article ul, .article ol, .prose ul, .prose ol { padding-left: 1.3rem; }
.article li, .prose li { margin-bottom: .45rem; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 2.5rem; }
.toc h2 { font: 700 .8rem/1.2 var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.toc ol { margin: 0; columns: 2 16rem; column-gap: 2rem; }
.steps li { padding-left: .25rem; }
.mini { margin: 0; }
.article .table-scroll { margin: 1rem 0 1.2rem; }
.figures { list-style: none; padding: 0 !important; margin: 1rem 0; display: grid; gap: .5rem; }
.figures li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .7rem 1rem; margin: 0; }
.figures span { color: var(--muted); }
.figures strong { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 1.05rem; }
.formula { background: var(--surface-2); border-left: 4px solid var(--brand); border-radius: 0 10px 10px 0; padding: .9rem 1.1rem; font-family: var(--font-display); font-size: 1.1rem; overflow-x: auto; }
.formula var { font-style: italic; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 1rem 2rem 1rem 0; font-weight: 650; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .3rem; top: .85rem; font-size: 1.3rem; color: var(--brand); }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--muted); }
.related { background: var(--surface-2); border-radius: var(--radius); padding: 1.3rem; margin-bottom: 2rem; }
.related h2 { font-size: var(--step-2); }
.related-list { list-style: none; padding: 0 !important; margin: 0 0 .8rem; display: grid; gap: .9rem; }
.related-list li { display: grid; gap: .1rem; margin: 0; }
.related-list a { font-weight: 650; }
.related-list span, .soon-note { color: var(--muted); font-size: .95rem; }
.soon-note { margin: 0; }
.soon-list { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: .8rem; }
.soon-list li { display: grid; gap: .1rem; }
.soon-list span { color: var(--muted); font-size: .95rem; }
.reviewed { font-size: .875rem; color: var(--muted); }

/* prose pages */
.prose h2 { font-size: var(--step-2); margin-top: 2rem; }
.prose { max-width: 70ch; }
.updated, .note { color: var(--muted); font-size: .95rem; }
.notice { padding: .9rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.notice-ok { background: var(--ok-bg); }
.notice-warn { background: var(--error-bg); color: var(--error); }
.contact-form { margin-top: 1rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* home */
.hero { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2.5rem; align-items: center; padding-block: clamp(2rem, 1rem + 4vw, 4.5rem); }
@media (max-width: 860px) { .hero-inner { grid-template-columns: 1fr; } }
.hero-figure { margin: 0; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 1.6rem; border-top: 4px solid var(--brand); }
.hero-card-label { color: var(--muted); font-size: .95rem; }
.hero-card-value { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; margin: 0; font-variant-numeric: tabular-nums; }
.hero-card-legend { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .35rem; color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.hero-card-legend li { display: flex; align-items: center; gap: .5rem; }
.hero-figure figcaption { color: var(--muted); font-size: .82rem; margin-top: .7rem; }
.section { margin-top: 3rem; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; }
.calc-tile { display: flex; flex-direction: column; gap: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
a.calc-tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.calc-tile h3 { margin: .2rem 0 0; }
.calc-tile p { color: var(--muted); font-size: .95rem; margin: 0; flex: 1; }
.tile-status { align-self: flex-start; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: .2rem .55rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); }
.is-soon { box-shadow: none; background: transparent; border-style: dashed; }
.is-soon .tile-status { background: var(--surface-2); color: var(--muted); }
.soon-line { color: var(--muted); margin-top: 1rem; font-size: .95rem; }
.tile-cta { margin-top: .8rem; font-weight: 650; color: var(--brand); }
.principle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1.5rem; }
.principle-grid h3 { margin-bottom: .3rem; }
.principle-grid p { color: var(--muted); margin: 0; }
.home-intro { max-width: 70ch; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .ad, .form-actions, .results-actions, .toggle, #ci-csv, .table-toggle, .toc { display: none !important; }
  .card { box-shadow: none; }
}
