/* MortgageMath — shared stylesheet
   Mobile-first, layered green palette, system font stack, no dependencies. */

:root {
  /* Primary green ramp (hue ~162, saturation rises toward the ends) */
  --green-900: #0c3226;
  --green-800: #123f31;
  --green-700: #17553f;
  --green-600: #1a6b54;
  --green-500: #23856a;
  --green-300: #7cc3a8;
  --green-200: #b7dfcd;
  --green-100: #dff3ea;
  --green-50:  #f2f9f6;

  /* Green-tinted greys */
  --ink: #16201c;
  --ink-soft: #52615a;
  --ink-faint: #5f6f67;
  --border: #dbe4df;
  --border-strong: #c3d1ca;
  --bg: #ffffff;
  --bg-alt: #f6f9f7;

  --danger: #b3261e;
  --danger-bg: #fdf1f0;
  --warn-bg: #fbf6ea;
  --warn-border: #e3d3a8;
  --warn-ink: #6d5716;

  --accent: var(--green-600);
  --accent-dark: var(--green-700);
  --accent-light: var(--green-100);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(18, 63, 49, 0.06), 0 4px 16px rgba(18, 63, 49, 0.06);
  --shadow-lift: 0 2px 4px rgba(18, 63, 49, 0.08), 0 10px 28px rgba(18, 63, 49, 0.10);
  --max-width: 1020px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Self-hosted fonts ---------- */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

img, svg, canvas {
  max-width: 100%;
}

h1, h2, h3,
.logo,
.result-card .value,
.chip {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-dark);
}

a:hover {
  color: var(--accent);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Type scale ---------- */

h1 {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 800;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

@media (pointer: coarse) {
  .btn, .btn-secondary {
    min-height: 44px;
  }
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  top: -3rem;
  left: 0.75rem;
  z-index: 100;
  background: var(--green-800);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---------- Header / nav ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(18, 63, 49, 0.04), 0 4px 10px rgba(18, 63, 49, 0.05);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 1rem;
  padding-bottom: 1rem;
  gap: 0.75rem;
}

.logo {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.logo span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.2rem 0.1rem;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
}

.site-nav a:hover {
  color: var(--accent-dark);
  border-bottom-color: var(--green-300);
}

.site-nav a.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

/* Hamburger toggle — shown on mobile/tablet only */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.nav-toggle:hover {
  background: var(--green-50);
}

.nav-toggle .nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.nav-toggle.open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

@media (max-width: 1023px) {
  .site-header .container {
    flex-wrap: nowrap;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(18, 63, 49, 0.12);
    padding: 0.25rem 0 0.5rem;
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    min-height: 48px;
    padding: 0 1.25rem;
    font-size: 1rem;
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  .site-nav a.active {
    border-left-color: var(--accent);
    background: var(--green-50);
    border-bottom: none;
  }
}

/* ---------- Hero / intro ---------- */

.hero {
  background: linear-gradient(160deg, var(--green-50) 0%, #ffffff 70%);
  border-bottom: 1px solid var(--border);
}

.hero .container {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 0.7rem;
  line-height: 1.12;
}

.hero p {
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0;
  font-size: 1.08rem;
}

/* ---------- Split hero (homepage) ---------- */

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: 2.5rem;
  }
}

.trust-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding: 0;
  list-style: none;
}

.trust-chip {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.trust-chip:hover {
  border-color: var(--green-300);
  color: var(--accent-dark);
}

/* Mini live calculator card in hero */
.hero-calc-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 1.35rem;
}

.hero-calc-card h2 {
  font-size: 1rem;
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.hero-calc-field {
  margin-bottom: 1rem;
}

.hero-calc-field .hcf-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.hero-calc-field .hcf-value {
  font-variant-numeric: tabular-nums;
  color: var(--accent-dark);
}

.hero-calc-result {
  background: var(--green-800);
  color: #e9f5ef;
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
  text-align: center;
}

.hero-calc-result .hcr-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #bcd8cb;
}

.hero-calc-result .hcr-value {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.hero-calc-card .btn-secondary {
  width: 100%;
  text-align: center;
  display: block;
  text-decoration: none;
}

.page-intro {
  padding-top: 2rem;
  padding-bottom: 0.5rem;
}

.page-intro h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  line-height: 1.15;
}

.page-intro p.lede {
  color: var(--ink-soft);
  max-width: 65ch;
  margin: 0;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

.breadcrumb a {
  text-decoration: none;
  color: var(--ink-faint);
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* ---------- Calculator grid on homepage ---------- */

.group-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  margin: 2rem 0 0;
}

.group-title:first-of-type {
  margin-top: 2.25rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 2rem 0;
}

@media (min-width: 640px) {
  .calc-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.calc-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.calc-card:hover {
  border-color: var(--green-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.calc-card .calc-icon {
  display: block;
  margin-bottom: 0.6rem;
}

.calc-card .card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-card .new-pill {
  display: inline-block;
  background: var(--green-100);
  color: var(--green-900);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
}

.calc-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent-dark);
}

.calc-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* Fade-up stagger on load for homepage cards */
@keyframes card-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.calc-grid .calc-card {
  animation: card-fade-up 0.4s ease-out both;
}

.calc-grid .calc-card:nth-child(1) { animation-delay: 0.02s; }
.calc-grid .calc-card:nth-child(2) { animation-delay: 0.08s; }
.calc-grid .calc-card:nth-child(3) { animation-delay: 0.14s; }
.calc-grid .calc-card:nth-child(4) { animation-delay: 0.20s; }
.calc-grid .calc-card:nth-child(5) { animation-delay: 0.26s; }
.calc-grid .calc-card:nth-child(6) { animation-delay: 0.32s; }

/* ---------- Two-column calculator layout ---------- */

.calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  margin: 1.5rem 0;
}

@media (min-width: 900px) {
  .calc-layout {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 1.5rem;
  }

  .results-panel {
    position: sticky;
    top: 1rem;
  }
}

/* ---------- Calculator form panels ---------- */

.calculator-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-card);
  padding: 1.35rem;
  margin: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}

@media (min-width: 560px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-weight: 400;
}

.field input,
.field select {
  font-family: inherit;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--green-100);
}

/* prefixed € inputs */
.money-wrap {
  position: relative;
}

.money-wrap input {
  padding-left: 1.7rem;
}

.money-wrap::before {
  content: "€";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 1rem;
  pointer-events: none;
}

/* ---------- Range sliders ---------- */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0.15rem 0 0;
  padding: 0;
  border: none;
}

input[type="range"]:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--green-500) 0%, var(--green-500) var(--fill, 50%), var(--green-100) var(--fill, 50%), var(--green-100) 100%);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--green-600);
  box-shadow: 0 1px 4px rgba(18, 63, 49, 0.25);
  margin-top: -7px;
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover,
input[type="range"]:focus-visible::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 0 0 4px var(--green-100), 0 1px 4px rgba(18, 63, 49, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--green-100);
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--green-500);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--green-600);
  box-shadow: 0 1px 4px rgba(18, 63, 49, 0.25);
}

.radio-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding-top: 0.3rem;
}

.radio-row label {
  font-weight: 400;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.radio-row input[type="radio"] {
  accent-color: var(--green-600);
  width: auto;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border-strong);
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
}

.btn-secondary:hover {
  background: var(--green-50);
  border-color: var(--green-300);
}

/* ---------- Tooltips ---------- */

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: help;
  padding: 0;
  font-family: inherit;
  flex-shrink: 0;
}

/* 44px tap target while keeping the visual dot small (::after overlay) */
.tip::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.tip .tip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green-900);
  color: #eef7f2;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  width: 230px;
  z-index: 30;
  text-align: left;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.tip:hover .tip-text,
.tip:focus .tip-text,
.tip.open .tip-text {
  visibility: visible;
  opacity: 1;
}

/* ---------- Results ---------- */

.results {
  margin: 0;
}

.results-panel .calculator-note {
  margin-top: 0.85rem;
}

.result-sentence {
  background: var(--green-800);
  color: #e9f5ef;
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  font-size: 1.02rem;
  line-height: 1.6;
  margin: 0 0 0.85rem;
  box-shadow: var(--shadow-card);
}

.result-sentence .chip {
  display: inline-block;
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  border-radius: 8px;
  padding: 0.05rem 0.5rem;
  white-space: nowrap;
}

.result-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 560px) {
  .result-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--bg);
  text-align: center;
  box-shadow: var(--shadow-card);
}

.result-card.highlight {
  background: var(--green-50);
  border-color: var(--green-200);
}

.result-card.highlight:first-child {
  grid-column: 1 / -1;
}

.result-card .label {
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-card .value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--green-800);
  line-height: 1.2;
}

.result-card.highlight:first-child .value {
  font-size: clamp(1.9rem, 4vw, 2.4rem);
}

.result-note {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.75rem;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

/* secondary metrics row, e.g. cost per €1,000 borrowed */
.metric-line {
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-top: none;
  border-left: 3px solid var(--green-300);
  margin-top: 0.85rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  padding-left: 0.75rem;
}

.metric-line strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Results pulse (re-triggered by ui.js on recalc) ---------- */

@keyframes result-pulse {
  from {
    opacity: 0.55;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-sentence.updated,
.result-cards.updated {
  animation: result-pulse 250ms ease-out;
}

/* ---------- Slider captions ---------- */

.range-caption {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 0.25rem;
}

/* ---------- LTV bar ---------- */

.ltv-bar {
  margin-top: 0.9rem;
}

.ltv-bar .ltv-track {
  display: flex;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
}

.ltv-bar .ltv-loan {
  background: var(--green-600);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  transition: width 0.25s ease;
}

.ltv-bar .ltv-deposit {
  background: var(--green-200);
  color: var(--green-900);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  transition: width 0.25s ease;
}

.ltv-bar .ltv-caption {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-top: 0.3rem;
}

/* ---------- Charts ---------- */

.chart-legend {
  display: flex;
  gap: 1.25rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0.75rem 0;
}

.chart-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.swatch-interest { background: var(--green-600); }
.swatch-principal { background: var(--green-200); }
.swatch-baseline { background: var(--ink-faint); }
.swatch-overpay { background: var(--green-500); }

/* ---------- Amortisation table ---------- */

details.amort-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.5rem 0;
  overflow: hidden;
  background: var(--bg);
}

details.amort-details summary {
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  background: var(--bg-alt);
  list-style: none;
}

details.amort-details summary::-webkit-details-marker {
  display: none;
}

details.amort-details summary::before {
  content: "\25B8  ";
  color: var(--accent);
}

details.amort-details[open] summary::before {
  content: "\25BE  ";
}

.table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

table.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

table.amort-table th,
table.amort-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.amort-table th:first-child,
table.amort-table td:first-child {
  text-align: left;
}

table.amort-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* ---------- Content / SEO copy ---------- */

.content {
  padding: 1.5rem 0 3rem;
  max-width: 72ch;
}

.content h2 {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  margin-top: 2rem;
  color: var(--ink);
}

.content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.5rem;
}

.content p {
  color: var(--ink-soft);
}

.content ul, .content ol {
  color: var(--ink-soft);
}

.faq-item {
  margin-bottom: 1.1rem;
}

.faq-item h3 {
  margin-bottom: 0.3rem;
  color: var(--ink);
}

.callout {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--ink);
  margin: 1.25rem 0;
}

.callout strong {
  color: var(--accent-dark);
}

/* MSE-style pre-result risk/eligibility note */
.note-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--warn-ink);
  margin: 1rem 0 0;
}

.note-warn strong {
  color: var(--warn-ink);
}

.disclaimer-note {
  background: var(--bg-alt);
  border: 1px dashed var(--border-strong);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 1.25rem 0;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--green-900);
  color: #b9cfc5;
  margin-top: 2rem;
}

.site-footer .container {
  padding: 2.25rem 1.25rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.footer-nav a {
  text-decoration: none;
  color: #d5e6dd;
}

.footer-nav a:hover {
  color: #ffffff;
}

.footer-disclaimer {
  font-size: 0.78rem;
  color: #a9c2b6;
  max-width: 70ch;
  line-height: 1.5;
}

.footer-disclaimer strong {
  color: #c4d8ce;
}

.footer-copy {
  font-size: 0.78rem;
  color: #a9c2b6;
  margin-top: 1rem;
}

/* ---------- Mobile sticky result bar ---------- */

.mobile-result-bar {
  display: none;
}

@media (max-width: 899px) {
  .mobile-result-bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: var(--green-800);
    color: #fff;
    padding: 0.65rem 1.1rem calc(0.65rem + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -2px 10px rgba(18, 63, 49, 0.18);
    transform: translateY(0);
    transition: transform 0.2s ease;
  }

  .mobile-result-bar.hidden {
    transform: translateY(100%);
  }
}

.mobile-result-bar .mrb-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #bcd8cb;
}

.mobile-result-bar .mrb-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- Fieldset grouping (rent vs buy) ---------- */

.field-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.field-fieldset legend {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 0 0 0.6rem;
  margin: 0;
  width: 100%;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.9rem;
}

/* ---------- Utility ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: none;
}

.error-msg.visible {
  display: block;
}

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

/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-nav,
  .site-footer,
  .result-actions,
  .breadcrumb,
  .content,
  .note-warn,
  .skip-link,
  .mobile-result-bar,
  .range-caption,
  input[type="range"] {
    display: none !important;
  }

  body {
    font-size: 12px;
  }

  .calc-layout {
    display: block;
  }

  .calculator-panel,
  .result-card,
  .result-sentence {
    box-shadow: none;
    border: 1px solid #bbb;
    break-inside: avoid;
  }

  .result-sentence {
    background: #fff;
    color: #000;
  }

  .result-sentence .chip {
    background: #fff;
    color: #000;
    border: 1px solid #000;
  }

  details.amort-details {
    border: none;
  }

  details.amort-details summary {
    display: none;
  }

  /* force schedule open in print via [open] set by JS before print */
  .table-wrap {
    max-height: none;
    overflow: visible;
  }
}
