/* =================================================================
   EMI Calc — design system
   ================================================================= */

:root {
  /* Brand */
  --primary: #4338ca;       /* indigo-700 */
  --primary-600: #4f46e5;   /* indigo-600 */
  --primary-500: #6366f1;
  --primary-50:  #eef2ff;
  --primary-100: #e0e7ff;
  --accent:      #0ea5e9;   /* sky-500 — professional accent */
  --accent-50:   #f0f9ff;
  --success:     #059669;   /* emerald-600 */
  --success-50:  #ecfdf5;
  --danger:      #dc2626;

  /* Neutrals (slate scale) */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --bg: var(--slate-50);
  --surface: #ffffff;
  --border: var(--slate-200);
  --border-strong: var(--slate-300);
  --text: var(--slate-900);
  --text-soft: var(--slate-600);
  --muted: var(--slate-500);

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 24px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Type */
  --ff-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
@media (max-width: 767px) {
  html { scroll-padding-top: 120px; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

/* =================================================================
   Buttons
   ================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-500) 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(67, 56, 202, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08), 0 8px 18px -2px rgba(67, 56, 202, 0.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
}
.hero-cta {
  display: flex;
  gap: 12px;
  margin: 0 0 28px;
  flex-wrap: wrap;
}
@media (max-width: 420px) {
  .btn { padding: 12px 18px; font-size: 14px; }
  .hero-cta .btn { flex: 1 1 auto; }
}

a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, samp {
  font-family: var(--ff-mono);
  font-size: 0.92em;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* =================================================================
   Nav
   ================================================================= */

.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  background: rgba(255, 255, 255, 0.9);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-500) 100%);
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(67, 56, 202, 0.55);
}
.brand-name { white-space: nowrap; }
.brand-accent { color: var(--primary-600); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-links a:hover {
  background: var(--slate-100);
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 720px) {
  .nav-inner { padding: 10px 0; flex-wrap: wrap; }
  .nav-links { width: 100%; padding-bottom: 2px; }
}

/* =================================================================
   Hero
   ================================================================= */

.hero {
  position: relative;
  padding: 56px 0 40px;
  background: linear-gradient(180deg, #ffffff 0%, var(--slate-50) 100%);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(var(--slate-200) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
  mask-image: radial-gradient(ellipse 700px 380px at 50% 30%, black 10%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 700px 380px at 50% 30%, black 10%, transparent 80%);
  opacity: 0.6;
}
.hero-inner {
  position: relative;
  max-width: 820px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 14px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.005em;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.eyebrow-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
  animation: pulse-dot 2.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15); }
  50%      { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0.05); }
}
.hero-title {
  margin: 0 0 16px;
  font-size: clamp(34px, 5.2vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
}
.hero-grad {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-500) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 0 0 28px;
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.6;
  max-width: 620px;
}
.trust-bar {
  display: flex;
  gap: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
  max-width: 580px;
  box-shadow: var(--shadow-xs);
}
.trust-bar li {
  flex: 1;
  padding: 14px 18px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.trust-bar li:first-child { border-left: none; }
.trust-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.trust-cap {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* =================================================================
   Feature row
   ================================================================= */

.feature-row {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 36px 0;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.feature {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-50);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary-100);
  margin-bottom: 4px;
}
.feature h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
}
.feature p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-soft);
}

/* =================================================================
   Mobile optimizations
   ================================================================= */

@media (max-width: 767px) {
  /* Container + spacing */
  .container { padding: 0 16px; }
  .site-nav { position: sticky; }
  .nav-inner { min-height: 56px; padding: 8px 0; gap: 12px; }
  .nav-inner { flex-direction: column; align-items: stretch; }
  .brand { font-size: 16px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-mark svg { width: 18px; height: 18px; }
  .nav-links {
    gap: 2px;
    padding: 4px 0 2px;
    margin: 0 -4px;
  }
  .nav-links a {
    padding: 8px 10px;
    font-size: 13px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  /* Hero */
  .hero { padding: 28px 0 24px; }
  .hero-eyebrow { font-size: 12px; padding: 5px 12px; margin-bottom: 14px; }
  .hero-title { margin-bottom: 12px; }
  .hero-sub { font-size: 15px; margin-bottom: 22px; }
  .trust-bar li { padding: 10px 10px; }
  .trust-num { font-size: 16px; }
  .trust-cap { font-size: 10.5px; line-height: 1.3; }

  /* Feature row */
  .feature-row { padding: 24px 0; }
  .feature-grid { grid-template-columns: 1fr; gap: 18px; }
  .feature-icon { width: 36px; height: 36px; }

  /* Touch targets */
  input[type="range"] { height: 8px; }
  input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; }
  input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; }
  .value-wrap { padding: 8px 12px; min-height: 44px; }
  .value-wrap input { width: 100%; font-size: 16px; /* prevents iOS zoom-in */ }

  /* Card spacing */
  .card { padding: 18px 16px; border-radius: 14px; }
  .card-title { font-size: 18px; margin-bottom: 16px; }
  .control { margin-bottom: 20px; }

  /* Outputs */
  .outputs { gap: 10px; margin-bottom: 18px; }

  /* Tighter article type */
  .article h3 { font-size: 16px; margin-top: 22px; }
  .article p, .article li, .article dd { font-size: 14.5px; line-height: 1.65; }
  .article ul, .article ol { padding-left: 20px; }

  /* Footer */
  .site-footer { padding: 28px 0 22px; margin-top: 20px; font-size: 13px; }
  .footer-col h4 { font-size: 12px; margin-bottom: 10px; }
  .footer-col a { font-size: 13px; }
  .footer-blurb { font-size: 13px; }
}

/* Very small screens */
@media (max-width: 420px) {
  .container { padding: 0 14px; }
  .hero { padding: 22px 0 20px; }
  .hero-title { font-size: clamp(28px, 8vw, 34px); letter-spacing: -0.025em; }
  .hero-sub { font-size: 14.5px; }
  .trust-bar { flex-wrap: wrap; }
  .trust-bar li { flex: 1 1 33%; padding: 8px 8px; }
  .card-title { font-size: 17px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 18px; }
  .stat:first-child .stat-value { font-size: 22px; }
}

/* =================================================================
   Layout
   ================================================================= */

.ad-row {
  padding-top: 20px;
  padding-bottom: 4px;
  display: flex;
  justify-content: center;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  padding-top: 28px;
  padding-bottom: 48px;
  align-items: start;
}
.main-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.rail { display: block; }

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; gap: 18px; padding-top: 20px; padding-bottom: 32px; }
  .rail { display: none; }
}

/* =================================================================
   Cards
   ================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  margin: 0 0 22px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}
.card-title.inline { display: inline; margin-right: 10px; }

.card-header {
  margin-bottom: 22px;
}
.card-header .card-title { margin: 0 0 6px; }
.card-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 4px 10px 4px 8px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--primary-100);
}
.eyebrow-bullet {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* EMI insight line under stats */
.emi-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 18px;
  padding: 12px 14px;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.55;
}
.emi-insight .insight-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.emi-insight strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Active nav link */
.nav-links a.is-active {
  background: var(--primary-50);
  color: var(--primary);
}

/* Callout — reusable in article content */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--slate-50);
  margin: 12px 0 18px;
  font-size: 14.5px;
  line-height: 1.6;
}
.callout.callout-tip {
  background: var(--accent-50);
  border-color: #bae6fd;
  color: #075985;
}
.callout.callout-warn {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}
.callout strong { color: inherit; font-weight: 700; }

/* =================================================================
   Form controls (calculator)
   ================================================================= */

.control { margin-bottom: 24px; }
.control:last-of-type { margin-bottom: 20px; }
.control-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.control-head label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-soft);
  letter-spacing: 0.005em;
}
.value-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px 12px;
  gap: 4px;
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.value-wrap:focus-within {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}
.value-wrap input {
  border: none;
  background: transparent;
  width: 110px;
  font: inherit;
  color: inherit;
  text-align: right;
  padding: 2px 0;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.prefix, .suffix {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, var(--primary-600) 0%, var(--primary-600) 50%, var(--slate-200) 50%, var(--slate-200) 100%);
  border-radius: 999px;
  outline: none;
  margin: 6px 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--primary-600);
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(67, 56, 202, 0.45);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--primary-600);
  cursor: pointer;
}
.range-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* =================================================================
   Calculator outputs
   ================================================================= */

.outputs {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease;
}
.stat:first-child {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-500) 100%);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(67, 56, 202, 0.5);
}
.stat:first-child .stat-label { color: rgba(255, 255, 255, 0.82); }
.stat:first-child .stat-value { color: #ffffff; }
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat:first-child .stat-value { font-size: 26px; }

@media (max-width: 680px) {
  .outputs { grid-template-columns: 1fr; }
  .stat-value { font-size: 20px; }
  .stat:first-child .stat-value { font-size: 24px; }
}

/* =================================================================
   Pie chart
   ================================================================= */

.chart-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
#pie {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
}
#pie-principal { fill: var(--primary-600); }
#pie-interest  { fill: var(--accent); }
.pie-center-top {
  font-size: 11px;
  fill: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--ff-sans);
}
.pie-center-bottom {
  font-size: 16px;
  font-weight: 700;
  fill: var(--text);
  font-family: var(--ff-sans);
  font-variant-numeric: tabular-nums;
}
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-soft);
}
.legend strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  font-weight: 700;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.dot-principal { background: var(--primary-600); }
.dot-interest  { background: var(--accent); }

@media (max-width: 600px) {
  .chart-wrap { flex-direction: column; gap: 18px; }
  .legend { width: 100%; }
}

/* =================================================================
   Schedule
   ================================================================= */

.schedule summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.schedule summary::-webkit-details-marker { display: none; }
.schedule summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-right: 4px;
}
.schedule details[open] summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.hint {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.table-wrap {
  margin-top: 18px;
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--slate-50);
  text-align: right;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  z-index: 1;
}
thead th:first-child { text-align: left; }
tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--slate-100);
  text-align: right;
  color: var(--text);
}
tbody tr:nth-child(odd) td { background: var(--slate-50); }
tbody td:first-child { text-align: left; color: var(--text-soft); }
tr.year-row td {
  background: var(--primary-50) !important;
  font-weight: 700;
  color: var(--primary);
  border-top: 1px solid var(--primary-100);
  border-bottom: 1px solid var(--primary-100);
}

/* =================================================================
   Ad containers
   ================================================================= */

.ad-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px 12px;
  text-align: center;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ad-row .ad-container { display: flex; }
.main-col > .ad-container,
.rail > .ad-container { align-self: center; }
.ad-label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}
.ad-slot {
  background: var(--slate-50);
  border-radius: var(--r-sm);
}
.sticky { position: sticky; top: 80px; }

/* All slots render as 300x250 (see AD_FORMATS) */
.ad-slot[data-ad-format] {
  width: 300px;
  max-width: 100%;
  min-height: 50px;
}
@media (max-width: 1023px) {
  .ad-slot[data-ad-format="halfpage"] { display: none !important; }
}

/* =================================================================
   Article content
   ================================================================= */

.article { max-width: 820px; }
.article h3 {
  margin: 28px 0 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.article h3:first-of-type { margin-top: 8px; }
.article p,
.article li,
.article dd {
  color: var(--text-soft);
  font-size: 15.5px;
  line-height: 1.7;
  margin: 0 0 14px;
}
.article strong { color: var(--text); font-weight: 700; }
.article ul,
.article ol { padding-left: 22px; margin: 10px 0 16px; }
.article li { margin-bottom: 8px; }
.article li::marker { color: var(--primary-600); }
.article .formula {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: var(--r-md);
  padding: 14px 16px;
  text-align: center;
  font-size: 15px;
  overflow-x: auto;
}
.article .formula code {
  background: transparent;
  color: var(--primary);
  font-weight: 600;
}
.article .faq dt {
  font-weight: 700;
  color: var(--text);
  margin-top: 18px;
  font-size: 15.5px;
}
.article .faq dt:first-child { margin-top: 0; }
.article .faq dd { margin-left: 0; }

/* =================================================================
   Bank tables
   ================================================================= */

.bank-section { max-width: 860px; }
.bank-table {
  margin: 12px 0 22px;
  max-height: none;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.bank-table table { font-size: 14px; }
.bank-table thead th {
  background: var(--slate-50);
  color: var(--text-soft);
  text-align: left;
  padding: 12px 14px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.bank-table tbody td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--text);
  font-size: 14px;
}
.bank-table tbody tr:last-child td { border-bottom: none; }
.bank-table tbody tr:nth-child(odd) td { background: var(--surface); }
.bank-table tbody tr:nth-child(even) td { background: var(--slate-50); }
.bank-table tbody td:first-child {
  font-weight: 600;
  color: var(--text);
}
.bank-table tbody tr:hover td { background: var(--primary-50); }

.bank-section .disclaimer {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--accent-50);
  border: 1px solid #bae6fd;
  border-radius: var(--r-md);
  font-size: 13px;
  color: #075985;
  line-height: 1.6;
}
.bank-section .disclaimer strong { color: #0c4a6e; }

/* Bank tables → card layout on mobile */
@media (max-width: 640px) {
  .bank-table { border: none; overflow-x: visible; box-shadow: none; border-radius: 0; }
  .bank-table table,
  .bank-table thead,
  .bank-table tbody,
  .bank-table tr,
  .bank-table td { display: block; width: 100%; }
  .bank-table thead { display: none; }
  .bank-table tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--surface) !important;
    box-shadow: var(--shadow-xs);
  }
  .bank-table tbody tr:hover td { background: transparent !important; }
  .bank-table tbody td {
    padding: 6px 0 !important;
    border: none !important;
    text-align: right;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    background: transparent !important;
  }
  .bank-table tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
  }
  .bank-table tbody td:first-child {
    border-bottom: 1px solid var(--border) !important;
    padding-bottom: 10px !important;
    margin-bottom: 6px;
    font-size: 15px;
    color: var(--primary);
    justify-content: flex-start;
  }
  .bank-table tbody td:first-child::before { display: none; }
}

/* =================================================================
   Sticky mobile bottom banner
   ================================================================= */

.ad-sticky-mobile {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ad-sticky-mobile .ad-label {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.12em;
}
.ad-sticky-mobile .ad-sticky-close {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 22px; height: 22px;
  border: none;
  background: var(--slate-100);
  color: var(--muted);
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-sticky-mobile .ad-sticky-close:hover { background: var(--slate-200); color: var(--text); }
.ad-sticky-mobile { display: none !important; }

/* =================================================================
   Interstitial popup
   ================================================================= */

.popup-interstitial {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.popup-interstitial[hidden] { display: none; }
.popup-interstitial.is-open {
  opacity: 1;
  pointer-events: auto;
}
.popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.popup-card {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-width: 520px;
  padding: 28px 22px 22px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.25);
  transform: translateY(28px);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 92vh;
  overflow-y: auto;
}
.popup-interstitial.is-open .popup-card { transform: translateY(0); }
.popup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px; height: 34px;
  border: none;
  background: var(--slate-100);
  color: var(--muted);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.popup-close:hover { background: var(--slate-200); color: var(--text); }
.popup-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
}
.popup-title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  padding-right: 36px;
  line-height: 1.25;
}
.popup-body {
  margin: 0 0 18px;
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.6;
}
.popup-body strong { color: var(--primary); }
.popup-ad-wrap {
  border: 1px solid var(--border);
  background: var(--slate-50);
  border-radius: var(--r-md);
  padding: 10px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.popup-ad-wrap .ad-label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}
.popup-cta {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-500) 100%);
  color: #fff;
  border: none;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.005em;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  font-family: inherit;
}
.popup-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -4px rgba(67, 56, 202, 0.4);
}
.popup-cta:active { transform: translateY(0); }

body.popup-open {
  overflow: hidden;
  touch-action: none;
}

@media (min-width: 768px) {
  .popup-interstitial { align-items: center; }
  .popup-card {
    border-radius: var(--r-xl);
    max-width: 460px;
    padding: 30px 28px 26px;
    transform: translateY(0) scale(0.96);
  }
  .popup-interstitial.is-open .popup-card { transform: translateY(0) scale(1); }
}

@media (max-width: 420px) {
  .popup-card { padding: 22px 18px 20px; max-height: 100vh; }
  .popup-title { font-size: 20px; }
  .popup-body { font-size: 14px; }
}

/* =================================================================
   Footer
   ================================================================= */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 0 28px;
  margin-top: 32px;
  color: var(--text-soft);
  font-size: 14px;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.footer-col h4 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col a {
  color: var(--text-soft);
  font-size: 14px;
}
.footer-col a:hover { color: var(--primary-600); }
.footer-brand { margin-bottom: 14px; }
.footer-blurb {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 360px;
}
.footer-meta {
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}
.footer-meta code {
  background: var(--slate-100);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
}
.footer-meta .copyright { margin-top: 6px; }
.footer-meta a { color: var(--text-soft); }
.footer-meta a:hover { color: var(--primary-600); }

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; gap: 24px; padding-bottom: 24px; }
  .site-footer { padding: 32px 0 24px; }
}

/* =================================================================
   Print
   ================================================================= */

@media print {
  .ad-container, .rail, .ad-sticky-mobile, .popup-interstitial,
  .site-nav, input[type="range"], .range-meta {
    display: none !important;
  }
  .layout { grid-template-columns: 1fr; }
  .card { box-shadow: none; border-color: #ddd; }
  body { background: #fff; }
}
