/* ══════════════════════════════════════════════════════════
   Finance Tools: Shared CSS
   Design tokens (light/dark), nav, footer, breadcrumb,
   common components (inputs, results, charts, learn/FAQ).
   Tool pages load this + their own inline <style> overrides.
   ══════════════════════════════════════════════════════════ */

/* ── Fonts (self-hosted) ──
   Latin-subset woff2 (covers å/ä/ö), vendored to /fonts/ to remove the
   third-party Google Fonts request chain (privacy posture + no render-blocking
   round-trip through fonts.googleapis.com then fonts.gstatic.com). Cormorant
   Garamond and Schibsted Grotesk are variable fonts, so one file + a weight
   range covers every weight the suite uses. No unicode-range: the latin file
   serves all text, with system fallback for glyphs outside it. */
@font-face { font-family: 'Schibsted Grotesk'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/fonts/schibsted-grotesk.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/dm-mono-300.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/dm-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/dm-mono-500.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 300 500; font-display: swap; src: url('/fonts/cormorant-garamond-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 300 400; font-display: swap; src: url('/fonts/cormorant-garamond-italic.woff2') format('woff2'); }

/* ── Design Tokens: Light (default) ── */
:root {
  --bg: #F4F1EA;
  --surface: #FBF9F3;
  --surface-2: #EFEADC;
  --ink: #1C1E22;
  --muted: #65686F;
  --faint: #6E6A5E;
  --line: #E2DBCC;
  --line-2: #E7E0D1;
  --accent: #B5792B;
  --accent-soft: rgba(181,121,43,0.10);
  /* Accent TEXT at normal sizes (WCAG AA >= 4.5): darker than --accent, which
     stays for borders/buttons/chart colours/big-number (3:1 display rule).
     --accent-text-2 is the darker sibling for accent text on --surface-2. */
  --accent-text: #966020;
  --accent-text-2: #8F5B1D;
  /* Text ON an accent background (buttons, active tabs). #fff was 3.66:1 on the
     light accent and 2.63:1 on the dark one; this dark ink clears AA on both
     (4.56 / 6.34), so no dark-theme override is needed. */
  --on-accent: #1C1E22;
  --green: #43775D;
  --green-soft: rgba(79,138,109,0.12);
  --red: #B04A35;
  --red-soft: rgba(192,86,63,0.12);
  --amber: #B5792B;
  --shadow: 0 2px 18px rgba(120,90,30,0.06);
  --sans: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', monospace;
  --serif: 'Cormorant Garamond', ui-serif, Georgia, serif;
  --maxw: 1200px;
  --gutter: 56px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Design Tokens: Dark ── */
[data-theme="dark"] {
  --bg: #13151A;
  --surface: #1A1D24;
  --surface-2: #21252E;
  --ink: #EDE6D6;
  --muted: #9A9EA6;
  --faint: #84878F;
  --line: rgba(200,151,74,0.14);
  --line-2: rgba(200,151,74,0.13);
  --accent: #C8974A;
  --accent-soft: rgba(200,151,74,0.10);
  /* Dark accent already clears AA on the dark surfaces, so accent text uses it directly. */
  --accent-text: #C8974A;
  --accent-text-2: #C8974A;
  --green: #8FA89E;
  --green-soft: rgba(143,168,158,0.15);
  --red: #E07070;
  --red-soft: rgba(224,112,112,0.15);
  --amber: #D4A95A;
  --shadow: 0 10px 34px rgba(0,0,0,0.34);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light dark; scroll-behavior: smooth; }
[data-theme="dark"] { color-scheme: dark; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-weight: 400; font-size: 15px; line-height: 1.6;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
  transition: background .4s var(--ease), color .4s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button, summary, a { touch-action: manipulation; }

/* ── Utility classes ── */

/* Visually hidden, but exposed to assistive tech (screen-reader-only).
   Use for skip links, off-screen labels, and chart text alternatives. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* Skip-to-content link: off-screen until focused, then pinned top-left. */
.skip-link {
  position: fixed; top: 0; left: 0; z-index: 200;
  transform: translateY(-120%);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 0.6rem 1rem; margin: 0.5rem;
  font-family: var(--mono); font-size: 12px; text-decoration: none;
  transition: transform .15s var(--ease);
}
.skip-link:focus { transform: translateY(0); outline: 2px solid var(--accent); outline-offset: 2px; }

/* Suite-wide keyboard focus ring. Applies only to :focus-visible (keyboard /
   programmatic), so mouse clicks stay clean. Kept here so every interactive
   element across all tools inherits one consistent, AA-contrast ring. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}

/* Keyboard access for the shared `.info-tip` pattern (defined per-tool with
   :hover/.active only). This higher-specificity rule reveals the tooltip body
   on keyboard focus too, so a tabbed-to `?` mark behaves like a hovered one.
   Kept here (not per-tool) so every tool inherits it without a 7-file edit. */
.info-tip:focus .info-tip-body,
.info-tip:focus-within .info-tip-body,
.info-tip:focus-visible .info-tip-body { display: block; }
.info-tip:focus, .info-tip:focus-visible { border-color: var(--accent-text); color: var(--accent-text); }

.eyebrow {
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-text);
}
.label {
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
}

/* ── Page fade-in ── */
main { animation: pageIn .35s ease both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Nav ── */
nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 2rem;
  padding: 18px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.nav-logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
}
.nav-logo .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.nav-links { display: flex; gap: 1.6rem; list-style: none; margin-left: 1rem; }
.nav-links a { font-size: 13px; color: var(--muted); transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-app-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent-text-2);
  background: var(--accent-soft); border: 1px solid transparent;
  padding: 6px 11px; border-radius: 999px; line-height: 1;
  display: inline-flex; align-items: center; gap: 5px; transition: all .2s var(--ease);
}
.nav-app-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.nav-app-badge:hover, .nav-app-badge.active { background: var(--accent); color: var(--on-accent); }
.nav-app-badge:hover::before, .nav-app-badge.active::before { background: var(--bg); }
.toggle {
  display: flex; gap: 2px;
  background: var(--surface-2); border-radius: 6px; padding: 2px;
}
.toggle button {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  padding: 5px 10px; border-radius: 4px; color: var(--muted); transition: all .2s;
}
.toggle button.on { background: var(--ink); color: var(--bg); }

/* ── Settings ── */
.settings-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px; color: var(--faint);
  transition: color .2s, transform .3s var(--ease);
}
.settings-btn:hover { color: var(--ink); transform: rotate(30deg); }
.settings-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.3);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.settings-backdrop.open { opacity: 1; pointer-events: auto; }
.settings-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(420px, 88vw);
  background: var(--bg); border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform .35s var(--ease), width .3s var(--ease);
  padding: 2rem 1.5rem; overflow-y: auto;
  box-shadow: -8px 0 30px rgba(0,0,0,0.08);
  display: flex; flex-direction: column;
}
/* Widen for the two-column "Your details" sub-page. */
.settings-drawer.on-details { width: min(480px, 92vw); }
/* Advanced + version pinned to the foot of the drawer. */
.settings-bottom { margin-top: auto; padding-top: 2rem; }
.settings-drawer.open { transform: translateX(0); }
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.settings-header-left { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.settings-back {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; font-size: 22px; line-height: 1; color: var(--faint);
  border-radius: 6px; transition: color .2s, background .2s; flex: 0 0 auto;
}
.settings-back:hover { color: var(--ink); background: var(--accent-soft); }
.settings-back[hidden] { display: none; }
.settings-title {
  font-family: var(--sans); font-weight: 600; font-size: 18px; color: var(--ink);
}
.settings-title[hidden] { display: none; }
[data-theme="dark"] .settings-title { font-family: var(--serif); font-weight: 300; }
.settings-close {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; font-size: 20px; color: var(--faint);
  border-radius: 6px; transition: color .2s, background .2s;
}
.settings-close:hover { color: var(--ink); background: var(--accent-soft); }
.settings-row {
  padding: 1.25rem 0; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.settings-row-stacked {
  padding: 1.25rem 0; border-bottom: 1px solid var(--line);
}
.settings-row-stacked .settings-row-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.settings-row-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.settings-desc {
  font-family: var(--sans); font-size: 12px; color: var(--faint);
  margin-top: 0.5rem; line-height: 1.5;
}
/* Two-page slider: main switches <-> "Your details" sub-page. */
.settings-pages { flex: 1 1 auto; }
.settings-page[hidden] { display: none; }
.settings-page--in { animation: settingsSlideIn .28s var(--ease); }
@keyframes settingsSlideIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
/* Drill-in row that opens the sub-page. */
.settings-nav-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.25rem 0; background: none; border: none;
  border-bottom: 1px solid var(--line); cursor: pointer; color: var(--muted);
}
.settings-nav-row:hover .settings-row-label { color: var(--ink); }
.settings-nav-chevron {
  font-family: var(--mono); font-size: 18px; color: var(--faint); line-height: 1;
  width: 16px; text-align: center; transition: transform .2s, color .2s;
}
.settings-nav-row:hover .settings-nav-chevron { color: var(--accent); transform: translateX(3px); }
/* Grouped fields on the sub-page. */
.settings-page--details .settings-desc { margin-top: 0; margin-bottom: 1.5rem; }
/* .settings-group / .settings-grid / .settings-fld retired (0.24): the drawer
   "Your details" sub-page now renders .fgroup / .fgrid / .fld (fields.css)
   inside .fields--compact, the same field atoms the tool panel uses. Kept in
   sync with SETTINGS_CSS in settings-drawer.js (the authoritative copy). */
/* Field tooltips (provenance / definitions). */
.settings-tip { display: inline-flex; cursor: help; }
.settings-tip-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--line-2); color: var(--faint);
  font-family: var(--mono); font-size: 9px; line-height: 1; transition: color .2s, border-color .2s;
}
.settings-tip:hover .settings-tip-mark, .settings-tip:focus .settings-tip-mark { color: var(--accent); border-color: var(--accent); }
.settings-tip-body {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 5;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 0.6rem 0.7rem; box-shadow: var(--shadow);
  font-family: var(--sans); font-size: 11px; line-height: 1.45; letter-spacing: 0;
  text-transform: none; color: var(--muted);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s var(--ease), transform .15s var(--ease), visibility .15s;
}
.settings-tip:hover .settings-tip-body, .settings-tip:focus .settings-tip-body { opacity: 1; visibility: visible; transform: translateY(0); }
/* Pension composite (total + breakdown). */
.settings-composite { display: flex; align-items: center; gap: 0.5rem; }
.settings-composite-total { flex: 1 1 auto; }
.settings-composite-total.is-computed { color: var(--muted); background: var(--surface-2); }
.settings-composite-toggle {
  flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid var(--line-2);
  border-radius: var(--radius); background: var(--surface); color: var(--faint);
  font-family: var(--mono); font-size: 17px; line-height: 1; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.settings-composite-toggle:hover { color: var(--accent); border-color: var(--accent); }
.settings-composite-parts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
  margin-top: 0.85rem; padding-left: 0.85rem; border-left: 2px solid var(--line);
}
.settings-composite-parts[hidden] { display: none; }   /* explicit display beats the [hidden] UA rule */
.settings-version {
  padding-top: 1.25rem;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); text-align: center;
}
.settings-version-link { color: inherit; text-decoration: none; transition: color .2s, opacity .2s; }
.settings-version-link:hover { color: var(--accent); }

/* ── Breadcrumb ── */
.breadcrumb {
  padding: 6rem var(--gutter) 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.10em; color: var(--faint);
}
.breadcrumb a { color: var(--accent-text); text-decoration: none; transition: color .2s; }
.breadcrumb a:hover { color: var(--ink); }

/* ── Page Header ── */
.page-header {
  padding: 2rem var(--gutter) 4rem; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 4rem;
  animation: fadeUp .7s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.ph-eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent-text); margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.ph-eyebrow::before { content: ''; display: block; width: 28px; height: 1px; background: var(--accent); }
.page-header h1 {
  font-family: var(--sans); font-size: clamp(32px, 4vw, 48px);
  font-weight: 600; line-height: 1.08; letter-spacing: -0.025em;
}
.page-header h1 em { font-style: normal; color: var(--accent); }
.ph-desc { color: var(--muted); line-height: 1.8; max-width: 44ch; font-size: 15px; }

/* Dark theme: serif display headings */
[data-theme="dark"] .page-header h1 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(42px, 4.5vw, 64px); letter-spacing: -0.01em;
}
[data-theme="dark"] .page-header h1 em { font-style: italic; }

/* ── Sections ── */
.calc-section { padding: 4rem var(--gutter); border-top: 1px solid var(--line); }
.reveal { opacity: 0; visibility: hidden; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease, visibility .6s ease; }
.reveal.in { opacity: 1; visibility: visible; transform: none; }
.section-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent-text); margin-bottom: 1rem;
}
.section-heading, h2.section-heading {
  font-family: var(--sans); font-size: 24px; font-weight: 600;
  line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 2rem;
}
.section-heading em, h2.section-heading em { font-style: normal; color: var(--accent); }
[data-theme="dark"] .section-heading,
[data-theme="dark"] h2.section-heading {
  font-family: var(--serif); font-weight: 300; font-size: 26px;
}
[data-theme="dark"] .section-heading em,
[data-theme="dark"] h2.section-heading em { font-style: italic; }

/* ── Calc Grid (2-column inputs/results) ── */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }

/* ── Inputs ── */
.inputs-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem 2.5rem; max-width: 900px; }
.input-group { margin-bottom: 1.5rem; }
.calc-label {
  display: block; font-family: var(--mono); font-size: 10px; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-bottom: 0.5rem;
}
.calc-input, select.calc-input {
  display: block; width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); font-family: var(--mono); font-size: 13px; font-weight: 400;
  padding: 0.65rem 0.9rem; min-height: 44px;
  outline: none; transition: border-color .2s;
  -webkit-appearance: none; appearance: none;
}
.calc-input:focus { border-color: var(--accent); }
select.calc-input {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(28,30,34,0.35)'/%3E%3C/svg%3E") no-repeat right 0.9rem center;
  padding-right: 2.5rem;
}
[data-theme="dark"] .calc-input, [data-theme="dark"] select.calc-input {
  background-color: var(--surface);
}
[data-theme="dark"] select.calc-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(237,230,214,0.5)'/%3E%3C/svg%3E");
}

/* ── Results ── */
.result-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
}
.result-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.55rem 0; border-bottom: 1px solid var(--line);
}
.result-row:last-child { border-bottom: none; }
.result-label { font-size: 13px; color: var(--muted); }
.result-value { font-family: var(--mono); font-size: 13px; color: var(--ink); font-weight: 400; text-align: right; }
.result-value.highlight { color: var(--accent-text); font-size: 15px; font-weight: 500; }
[data-theme="dark"] .result-value.highlight { font-weight: 300; }
.result-value.positive { color: var(--green); }
.result-value.negative { color: var(--red); }
.result-divider { border: none; border-top: 1px solid var(--line-2); margin: 0.25rem 0; }
.big-number {
  font-family: var(--sans); font-size: clamp(36px, 4vw, 56px);
  font-weight: 600; letter-spacing: -0.02em; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
[data-theme="dark"] .big-number { font-family: var(--serif); font-weight: 300; }

/* ── Charts ── */
.chart-wrap { position: relative; height: 320px; width: 100%; }
/* Per-chart height modifiers. Use these instead of an inline style="height:NNNpx":
   inline heights outrank the 600px reduction below and freeze phone charts at
   desktop height (report 599). Same single-class specificity as the 600px rule,
   which sits later in this file, so mobile still wins the cascade. */
.chart-wrap--h300 { height: 300px; }
.chart-wrap--h340 { height: 340px; }
.chart-wrap--h350 { height: 350px; }
.chart-wrap--h360 { height: 360px; }
.chart-wrap--h380 { height: 380px; }
.chart-wrap--h420 { height: 420px; }
.chart-wrap canvas { display: block; }
.chart-skeleton {
  position: absolute; inset: 0;
  background: var(--surface-2); border-radius: var(--radius);
  animation: skeletonPulse 1.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes skeletonPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.7; } }

/* ── Learn / FAQ Section ── */
.learn-section { padding: 4rem var(--gutter); border-top: 1px solid var(--line); }
.learn-section .label { margin-bottom: 0.5rem; }
.learn-section h2 {
  font-family: var(--sans); font-size: 24px; font-weight: 600;
  letter-spacing: -0.02em; margin-bottom: 1.5rem;
}
.learn-section h2 em { font-style: normal; color: var(--accent); }
[data-theme="dark"] .learn-section h2 { font-family: var(--serif); font-weight: 300; font-size: 26px; }
[data-theme="dark"] .learn-section h2 em { font-style: italic; }
.learn-details { max-width: min(680px, 100%); }
.learn-details summary {
  font-family: var(--sans); font-size: 17px; font-weight: 500; color: var(--ink);
  cursor: pointer; padding: 14px 0; list-style: none;
  display: flex; align-items: center; gap: 12px;
}
.learn-details summary::before {
  content: '+'; font-family: var(--mono); font-size: 14px; color: var(--accent);
  width: 20px; text-align: center; flex-shrink: 0; transition: transform .2s;
}
.learn-details[open] summary::before { content: '\2212'; }
.learn-details summary::-webkit-details-marker { display: none; }
.learn-content {
  color: var(--muted); font-size: 14px; line-height: 1.8;
  padding: 0 0 20px 32px; border-bottom: 1px solid var(--line);
}
.learn-content strong { color: var(--ink); font-weight: 500; }
.learn-content p { margin-bottom: 12px; }
.learn-content p:last-child { margin-bottom: 0; }
.learn-content a { color: var(--accent-text); text-decoration: none; }
.learn-content a:hover { text-decoration: underline; }

/* ── Related Tools ── */
.related { padding: 3rem var(--gutter) 4rem; border-top: 1px solid var(--line); }
.related h2 {
  font-family: var(--sans); font-size: 18px; font-weight: 600;
  letter-spacing: -0.01em; margin-bottom: 1.5rem;
}
[data-theme="dark"] .related h2 { font-family: var(--serif); font-weight: 400; }
.related-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  border: 1px solid var(--line-2); background: var(--line-2);
}
.related-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); padding: 18px 20px; transition: background .3s var(--ease);
}
.related-card:hover { background: var(--surface-2); }
.related-card .tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent-text);
}
.related-card .name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
[data-theme="dark"] .related-card .name { font-family: var(--serif); font-weight: 400; font-size: 18px; }

/* ── Footer ── */
footer { border-top: 1px solid var(--line); padding: 48px var(--gutter) 32px; }
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem; max-width: var(--maxw); margin: 0 auto;
}
.footer-brand {
  font-size: 14px; font-weight: 500; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.footer-brand .dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.footer-tagline { font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 28ch; }
.footer-col-title {
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin-bottom: 14px;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a {
  font-size: 13px; color: var(--muted); transition: color .2s;
}
.footer-links a:hover { color: var(--ink); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 28px; margin-top: 36px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em; color: var(--faint);
}
.footer-sources {
  max-width: var(--maxw); margin: 12px auto 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em;
  color: var(--faint); line-height: 1.7;
}

/* Legacy .shared-panel / .shared-grid / .panel-label retired (0.24): the shared
   identity panel is now injected as .people/.person/.fgroup/.fld (fields.css). */

/* ── Mobile ── */
@media (max-width: 860px) {
  :root { --gutter: 22px; }
  .nav-links { display: none; }
  .nav-tools .toggle { display: none; }
  .page-header { grid-template-columns: 1fr; gap: 1.5rem; padding-bottom: 2.5rem; }
  .calc-grid { grid-template-columns: 1fr; }
  .inputs-grid { grid-template-columns: 1fr 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .footer-bottom { flex-direction: column; gap: 6px; align-items: flex-start; }
}
@media (max-width: 600px) {
  .calc-section { padding: 3rem var(--gutter); }
  .inputs-grid { grid-template-columns: 1fr; }
  .calc-input, select.calc-input { font-size: 16px; }
  .chart-wrap { height: 260px; }
  .breadcrumb { padding-top: 5rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  /* Larger touch targets on phones (mobile-scoped, no desktop effect) */
  .footer-links { gap: 2px; }
  .footer-links a { display: inline-block; padding: 10px 0; }
  .breadcrumb a { display: inline-block; padding: 6px 4px; margin: -6px -4px; }
  .settings-btn { width: 40px; height: 40px; }
  .nav-logo { padding: 6px 0; }
  /* "Your details" sub-page uses .fields--compact (already single-column). */
  .settings-composite-parts { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) and (min-width: 861px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
  /* Reveal-on-scroll elements appear immediately (no fade/visibility gate) so a
     reduced-motion user never waits on an animation that has been zeroed out. */
  .reveal { opacity: 1 !important; visibility: visible !important; transform: none !important; }
}
@media (scripting: none) {
  /* Fail open: without JS there is no IntersectionObserver to add .in, so the
     hidden default would blank every .reveal section (incl. the primary
     calculator) permanently. The broken-JS case is covered by _shared.js
     self-arming initScrollReveal on DOMContentLoaded. */
  .reveal { opacity: 1 !important; visibility: visible !important; transform: none !important; }
}
