/* ============================================
   fincalcs.co — Main Stylesheet
   Design: UtilityEmpire v2 aesthetic (cream, doodles, Playfair Display)
   Adapted with finance-themed doodle patterns
   ============================================ */

:root {
  --cream: #f9f8f4;
  --cream-dark: #f0efe8;
  --navy: #1b2a4a;
  --navy-light: #2a3d66;
  --teal: #2a9d8f;
  --teal-light: #3ab8a8;
  --gold: #c9a84c;
  --gold-light: #e0c36a;
  --coral: #e76f51;
  --green: #2d6a4f;
  --purple: #7b5ea7;
  --blue: #4a7fc4;
  --orange: #e6953a;
  --text: #2c2c2c;
  --text-light: #666;
  --text-muted: #999;
  --border: #ddd;
  --shadow: rgba(27,42,74,0.08);
  --shadow-hover: rgba(27,42,74,0.15);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --max-width: 1200px;
  --content-width: 800px;
}

/* Finance-themed doodle SVG background */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='800'%3E%3Cg stroke='%231b2a4a' fill='none' opacity='0.06' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3C!-- MORTGAGE: House with price tag --%3E%3Cpath d='M60 100 L95 65 L130 100'/%3E%3Crect x='68' y='100' width='54' height='40' rx='2'/%3E%3Crect x='80' y='112' width='18' height='28'/%3E%3Cpath d='M110 80 L110 68 L120 68 L120 90'/%3E%3Cpath d='M135 85 L155 85 L155 100 L140 100' stroke-dasharray='3,3'/%3E%3Ctext x='143' y='96' font-size='10' fill='%231b2a4a' opacity='0.06' font-family='sans-serif' stroke='none'>$</text>%3E%3C!-- AFFORDABILITY: Scale/balance --%3E%3Cline x1='280' y1='60' x2='280' y2='100'/%3E%3Cline x1='250' y1='72' x2='310' y2='72'/%3E%3Cpath d='M250 72 L240 92 L260 92 Z'/%3E%3Cpath d='M310 72 L300 92 L320 92 Z'/%3E%3Ccircle cx='250' cy='86' r='2' fill='%231b2a4a' opacity='0.06'/%3E%3C!-- DEBT PAYOFF: Snowball rolling downhill --%3E%3Cpath d='M440 55 Q470 65 490 95 Q500 115 510 120'/%3E%3Ccircle cx='448' cy='58' r='6'/%3E%3Ccircle cx='472' cy='75' r='10'/%3E%3Ccircle cx='502' cy='105' r='16'/%3E%3Cpath d='M435 120 L520 120' stroke-dasharray='4,4'/%3E%3C!-- EMERGENCY FUND: Shield with dollar --%3E%3Cpath d='M660 55 L685 45 L710 55 L710 85 Q685 110 660 85 Z'/%3E%3Cpath d='M682 65 C678 62,672 64,672 68 C672 72,682 72,682 76 C682 80,674 82,670 79'/%3E%3Cline x1='678' y1='60' x2='678' y2='85'/%3E%3C!-- SAVINGS GOAL: Mountain peak with flag --%3E%3Cpath d='M45 280 L85 210 L125 280'/%3E%3Cline x1='85' y1='210' x2='85' y2='195'/%3E%3Cpath d='M85 195 L100 200 L85 205'/%3E%3Cpath d='M55 265 Q70 250 80 250' stroke-dasharray='3,3'/%3E%3C!-- COMPOUND INTEREST: Exponential growth curve with coins --%3E%3Cpath d='M220 280 Q250 278 280 270 Q320 250 350 200 Q370 170 380 140'/%3E%3Cline x1='215' y1='285' x2='385' y2='285'/%3E%3Cline x1='215' y1='135' x2='215' y2='285'/%3E%3Ccircle cx='380' cy='140' r='8'/%3E%3Cpath d='M376 138 C374 136,370 137,370 140 C370 143,376 143,376 145' stroke-width='1'/%3E%3Ccircle cx='350' cy='200' r='5'/%3E%3Ccircle cx='320' cy='248' r='4'/%3E%3C!-- RETIREMENT: Sunset with rocking chair --%3E%3Ccircle cx='530' cy='230' r='30'/%3E%3Cline x1='470' y1='260' x2='590' y2='260'/%3E%3Cpath d='M500 260 L505 240 L525 240 L530 255'/%3E%3Cpath d='M505 240 Q510 230 515 240'/%3E%3Cpath d='M497 260 Q495 270 500 275'/%3E%3Cpath d='M533 260 Q535 270 530 275'/%3E%3C!-- NET WORTH: Trophy/cup --%3E%3Cpath d='M700 210 L700 240 Q700 260 720 265 Q740 260 740 240 L740 210'/%3E%3Cline x1='700' y1='210' x2='740' y2='210'/%3E%3Cpath d='M700 218 Q685 218 685 230 Q685 240 700 240'/%3E%3Cpath d='M740 218 Q755 218 755 230 Q755 240 740 240'/%3E%3Cline x1='710' y1='265' x2='730' y2='265'/%3E%3Crect x='708' y='265' width='24' height='6' rx='2'/%3E%3C!-- TRUE HOURLY WAGE: Clock with dollar sign --%3E%3Ccircle cx='80' cy='440' r='28'/%3E%3Cline x1='80' y1='440' x2='80' y2='420'/%3E%3Cline x1='80' y1='440' x2='95' y2='445'/%3E%3Ccircle cx='80' cy='440' r='2' fill='%231b2a4a' opacity='0.06'/%3E%3Cpath d='M115 430 L125 425 L125 455 L115 450' stroke-dasharray='2,2'/%3E%3Ctext x='118' y='443' font-size='10' fill='%231b2a4a' opacity='0.06' font-family='sans-serif' stroke='none'>$</text>%3E%3C!-- FREELANCE: Laptop with rate --%3E%3Crect x='240' y='425' width='55' height='35' rx='3'/%3E%3Cpath d='M233 460 L302 460 L297 467 L238 467 Z'/%3E%3Cline x1='255' y1='438' x2='280' y2='438' stroke-width='1'/%3E%3Cline x1='255' y1='445' x2='273' y2='445' stroke-width='1'/%3E%3Cpath d='M300 430 L320 425'/%3E%3Ctext x='305' y='425' font-size='9' fill='%231b2a4a' opacity='0.06' font-family='sans-serif' stroke='none'>$/hr</text>%3E%3C!-- SIDE HUSTLE: Light bulb with coins --%3E%3Cpath d='M460 420 Q440 430 440 450 Q440 460 450 465 L470 465 Q480 460 480 450 Q480 430 460 420'/%3E%3Cline x1='452' y1='465' x2='452' y2='472'/%3E%3Cline x1='468' y1='465' x2='468' y2='472'/%3E%3Cline x1='450' y1='472' x2='470' y2='472'/%3E%3Cpath d='M460 435 L460 450 M453 443 L467 443'/%3E%3Cellipse cx='495' cy='460' rx='8' ry='3'/%3E%3Cellipse cx='495' cy='457' rx='8' ry='3'/%3E%3C!-- RENT VS BUY: Two houses with vs --%3E%3Cpath d='M620 430 L640 415 L660 430'/%3E%3Crect x='625' y='430' width='30' height='20'/%3E%3Cpath d='M700 430 L720 415 L740 430'/%3E%3Crect x='705' y='430' width='30' height='20'/%3E%3Ctext x='675' y='435' font-size='11' fill='%231b2a4a' opacity='0.06' font-family='sans-serif' stroke='none'>vs</text>%3E%3C!-- REFINANCE: Downward arrow with percent --%3E%3Cpath d='M80 600 L80 640'/%3E%3Cpolygon points='70,635 90,635 80,648' fill='%231b2a4a' opacity='0.06'/%3E%3Ccircle cx='95' cy='610' r='4'/%3E%3Ccircle cx='107' cy='625' r='4'/%3E%3Cline x1='110' y1='607' x2='92' y2='628'/%3E%3C!-- PIE CHART with segments --%3E%3Ccircle cx='270' cy='620' r='25'/%3E%3Cline x1='270' y1='620' x2='270' y2='595'/%3E%3Cline x1='270' y1='620' x2='292' y2='630'/%3E%3Cline x1='270' y1='620' x2='250' y2='635'/%3E%3C!-- RISING STEPS (wealth building) --%3E%3Cpath d='M430 650 L430 640 L450 640 L450 625 L470 625 L470 608 L490 608 L490 590 L510 590'/%3E%3Cpath d='M510 590 L505 595 M510 590 L515 595'/%3E%3C!-- CALCULATOR with equals sign --%3E%3Crect x='630' y='590' width='50' height='65' rx='6'/%3E%3Crect x='638' y='598' width='34' height='14' rx='2'/%3E%3Ccircle cx='645' cy='622' r='3'/%3E%3Ccircle cx='660' cy='622' r='3'/%3E%3Ccircle cx='645' cy='636' r='3'/%3E%3Ccircle cx='660' cy='636' r='3'/%3E%3Crect x='670' y='620' width='3' height='20' rx='1' fill='%231b2a4a' opacity='0.06'/%3E%3Cline x1='680' y1='627' x2='692' y2='627' stroke-width='1.5'/%3E%3Cline x1='680' y1='633' x2='692' y2='633' stroke-width='1.5'/%3E%3C!-- Scattered hand-drawn dots and marks --%3E%3Ccircle cx='180' cy='140' r='2' fill='%231b2a4a' opacity='0.04'/%3E%3Ccircle cx='195' cy='155' r='2' fill='%231b2a4a' opacity='0.04'/%3E%3Ccircle cx='560' cy='140' r='2' fill='%231b2a4a' opacity='0.04'/%3E%3Cpath d='M380 350 Q390 340 400 350 Q410 360 420 350' opacity='0.04'/%3E%3Cpath d='M170 510 Q180 500 190 510' opacity='0.04'/%3E%3Cpath d='M560 500 L570 490 L580 500' opacity='0.04'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}

/* ===== NAVIGATION ===== */
.nav {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px var(--shadow);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.nav-brand span { color: var(--teal); }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-light);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 0.2s;
  position: relative;
}
.nav-links a:hover { background: var(--cream); }
.nav-links a.active { color: var(--navy); font-weight: 600; }
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 14px; right: 14px;
  height: 2px;
  border-radius: 2px;
}
/* Cluster-specific nav colors */
.nav-links a[data-cluster="mortgage"]:hover, .nav-links a[data-cluster="mortgage"].active { color: var(--green); }
.nav-links a[data-cluster="mortgage"].active::after { background: var(--green); }
.nav-links a[data-cluster="debt"]:hover, .nav-links a[data-cluster="debt"].active { color: var(--orange); }
.nav-links a[data-cluster="debt"].active::after { background: var(--orange); }
.nav-links a[data-cluster="income"]:hover, .nav-links a[data-cluster="income"].active { color: var(--blue); }
.nav-links a[data-cluster="income"].active::after { background: var(--blue); }
.nav-links a[data-cluster="investing"]:hover, .nav-links a[data-cluster="investing"].active { color: var(--purple); }
.nav-links a[data-cluster="investing"].active::after { background: var(--purple); }
.nav-links a[data-cluster="about"]:hover, .nav-links a[data-cluster="about"].active { color: var(--text-muted); }

.nav-hamburger { display: none; cursor: pointer; font-size: 24px; background: none; border: none; color: var(--navy); }

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw + 1rem, 3.5rem);
  color: var(--navy);
  margin: 0 0 16px;
  line-height: 1.15;
  letter-spacing: -1px;
}
.hero h1 span { color: var(--teal); }
.hero .subtitle {
  font-size: 1.2rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* ===== TOOL GRID ===== */
.tools-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
}
.tools-section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw + 0.5rem, 2rem);
  color: var(--navy);
  text-align: center;
  margin: 0 0 12px;
}
.tools-section .section-desc {
  text-align: center;
  color: var(--text-light);
  margin: 0 0 40px;
  font-size: 1.05rem;
}
.cluster-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 48px 0 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.cluster-label.mortgage { color: var(--green); border-color: var(--green); }
.cluster-label.debt { color: var(--orange); border-color: var(--orange); }
.cluster-label.income { color: var(--blue); border-color: var(--blue); }
.cluster-label.investing { color: var(--purple); border-color: var(--purple); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.tool-card {
  background: white;
  border-radius: 12px;
  padding: 28px 24px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 12px 12px 0 0;
  transition: height 0.3s;
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--shadow-hover);
  border-color: transparent;
}
.tool-card:hover::before { height: 4px; }
.tool-card.mortgage::before { background: var(--green); }
.tool-card.debt::before { background: var(--orange); }
.tool-card.income::before { background: var(--blue); }
.tool-card.investing::before { background: var(--purple); }

.tool-card .tool-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.tool-card.mortgage .tool-icon { background: #e8f5e9; color: var(--green); }
.tool-card.debt .tool-icon { background: #fff3e0; color: var(--orange); }
.tool-card.income .tool-icon { background: #e3f2fd; color: var(--blue); }
.tool-card.investing .tool-icon { background: #f3e5f5; color: var(--purple); }

.tool-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--navy);
  margin: 0 0 8px;
}
.tool-card p {
  font-size: 0.92rem;
  color: var(--text-light);
  margin: 0;
  line-height: 1.5;
}
.tool-card .cpc-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 12px;
  font-weight: 500;
}
.tool-card.mortgage .cpc-badge { background: #e8f5e9; color: var(--green); }
.tool-card.debt .cpc-badge { background: #fff3e0; color: var(--orange); }
.tool-card.income .cpc-badge { background: #e3f2fd; color: var(--blue); }
.tool-card.investing .cpc-badge { background: #f3e5f5; color: var(--purple); }

/* ===== CALCULATOR PAGE LAYOUT ===== */
.page-wrapper {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.page-wrapper.wide { max-width: 960px; }
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--teal); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.calc-header h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--navy);
  margin: 0 0 8px;
  line-height: 1.2;
}
.calc-header .calc-desc {
  font-size: 1.05rem;
  color: var(--text-light);
  margin: 0 0 32px;
  line-height: 1.6;
}

/* ===== CALCULATOR FORM ===== */
.calc-box {
  background: white;
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
  margin-bottom: 32px;
}
.calc-box h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--navy);
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--cream);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.form-group label .hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.form-group input, .form-group select {
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  color: var(--navy);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(42,157,143,0.15);
}
.input-prefix {
  position: relative;
}
.input-prefix::before {
  content: '$';
  position: absolute;
  left: 16px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}
.input-prefix input { padding-left: 32px; }
.input-suffix {
  position: relative;
}
.input-suffix::after {
  content: attr(data-suffix);
  position: absolute;
  right: 16px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.input-suffix input { padding-right: 40px; }

.range-group { margin-top: 4px; }
.range-group input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--cream-dark);
  outline: none;
  border: none;
  padding: 0;
}
.range-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.range-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--teal);
  font-weight: 600;
  text-align: right;
  margin-top: 4px;
}

.btn-calculate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 36px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.btn-calculate.green { background: var(--green); color: white; }
.btn-calculate.green:hover { background: #245a42; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,106,79,0.3); }
.btn-calculate.orange { background: var(--orange); color: white; }
.btn-calculate.orange:hover { background: #d4842e; }
.btn-calculate.blue { background: var(--blue); color: white; }
.btn-calculate.blue:hover { background: #3d6fad; }
.btn-calculate.purple { background: var(--purple); color: white; }
.btn-calculate.purple:hover { background: #6a4e94; }
.btn-calculate.teal { background: var(--teal); color: white; }
.btn-calculate.teal:hover { background: #228b7e; }

/* ===== RESULTS ===== */
.results-box {
  background: white;
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
  margin-bottom: 32px;
  display: none;
}
.results-box.visible { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.result-highlight {
  text-align: center;
  padding: 24px;
  background: var(--cream);
  border-radius: 12px;
  margin-bottom: 24px;
}
.result-highlight .big-number {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.result-highlight .big-label {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-top: 4px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.result-item {
  text-align: center;
  padding: 16px;
  background: var(--cream);
  border-radius: 10px;
}
.result-item .value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
}
.result-item .label {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Amortization table */
.amort-table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 16px;
}
.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.amort-table th {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  background: var(--navy);
  padding: 10px 12px;
  position: sticky;
  top: 0;
  text-align: right;
}
.amort-table th:first-child { text-align: center; }
.amort-table td {
  font-family: var(--font-mono);
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  text-align: right;
  font-size: 0.82rem;
}
.amort-table td:first-child { text-align: center; color: var(--text-muted); }
.amort-table tr:nth-child(even) { background: var(--cream); }

/* Chart container */
.chart-container {
  margin: 24px 0;
  padding: 16px;
  background: var(--cream);
  border-radius: 12px;
}
.chart-container canvas { max-height: 350px; }

/* ===== SUPPORTING CONTENT ===== */
.content-section {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.content-section h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--navy);
  margin: 0 0 16px;
}
.content-section h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--navy);
  margin: 24px 0 8px;
}
.content-section p {
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.75;
}
.content-section ul {
  padding-left: 20px;
  margin: 0 0 14px;
}
.content-section li {
  margin-bottom: 6px;
  line-height: 1.6;
  color: var(--text);
}

/* FAQ accordion */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-q {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--navy);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-q::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--teal);
  font-weight: 300;
  transition: transform 0.3s;
}
.faq-item.open .faq-q::after { content: '\2212'; }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s;
  color: var(--text-light);
  line-height: 1.7;
}
.faq-item.open .faq-a { max-height: 500px; padding-top: 12px; }

/* Related tools */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.related-card {
  padding: 20px;
  background: var(--cream);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.related-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}
.related-card h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--navy);
  margin: 0 0 4px;
}
.related-card p { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

/* ===== AD PLACEHOLDERS ===== */
.ad-unit {
  background: var(--cream-dark);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 24px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-unit.leaderboard { min-height: 90px; }
.ad-unit.in-article { min-height: 250px; }
.ad-unit.sidebar { min-height: 600px; }

/* ===== FOOTER ===== */
.footer {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  padding: 48px 24px 32px;
  margin-top: 60px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer h4 {
  font-family: var(--font-display);
  color: white;
  font-size: 1rem;
  margin: 0 0 16px;
}
.footer p { font-size: 0.88rem; line-height: 1.6; margin: 0 0 8px; }
.footer a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 0.88rem; display: block; margin-bottom: 8px; transition: color 0.2s; }
.footer a:hover { color: var(--gold-light); }
.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-bottom a { display: inline; margin: 0 0 0 16px; }

/* ===== FLUID TYPOGRAPHY (scales smoothly between mobile and desktop) ===== */
html {
  /* Base font scales from 16px at 320px viewport to 18px at 1200px */
  font-size: clamp(16px, 14.5px + 0.5vw, 19px);
}

/* ===== RESPONSIVE: TABLET (768px and below) ===== */
@media (max-width: 768px) {
  /* Navigation */
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: white;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    box-shadow: 0 8px 24px var(--shadow);
    gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 14px 16px;
    font-size: 1rem;
    border-radius: 8px;
  }
  .nav-hamburger { display: block; }

  /* Hero */
  .hero { padding: 48px 20px 36px; }
  .hero h1 { font-size: clamp(1.8rem, 6vw, 3rem); }
  .hero .subtitle { font-size: 1rem; }

  /* Tool grid: 2 columns on tablet */
  .tool-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .tool-card { padding: 22px 18px; }
  .tool-card h3 { font-size: 1.05rem; }
  .tool-card p { font-size: 0.88rem; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .form-group input, .form-group select {
    font-size: 1rem;
    padding: 14px 16px;
    min-height: 48px; /* Touch-friendly minimum */
  }
  .input-prefix input { padding-left: 34px; }
  .form-group label { font-size: 0.92rem; margin-bottom: 6px; }

  /* Calculator boxes */
  .calc-box, .results-box, .content-section {
    padding: 24px 20px;
    border-radius: 14px;
  }
  .calc-box h2 { font-size: 1.3rem; }
  .calc-header h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.25; }
  .calc-header .calc-desc { font-size: 1rem; }

  /* Results */
  .result-highlight { padding: 20px 16px; }
  .result-highlight .big-number { font-size: clamp(1.8rem, 7vw, 3rem); }
  .result-highlight .big-label { font-size: 0.9rem; }
  .result-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .result-item { padding: 14px 10px; }
  .result-item .value { font-size: 1.1rem; }
  .result-item .label { font-size: 0.78rem; }

  /* Buttons - bigger touch targets */
  .btn-calculate {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.05rem;
    justify-content: center;
  }

  /* Content sections */
  .content-section h2 { font-size: 1.4rem; }
  .content-section h3 { font-size: 1.1rem; }
  .content-section p { font-size: 0.95rem; line-height: 1.7; }

  /* Amortization table */
  .amort-table th { font-size: 0.7rem; padding: 8px 6px; }
  .amort-table td { font-size: 0.75rem; padding: 6px; }

  /* Related tools */
  .related-tools { grid-template-columns: 1fr 1fr; }

  /* FAQ */
  .faq-q { font-size: 1rem; padding: 4px 0; }
  .faq-a { font-size: 0.92rem; }

  /* Footer */
  .footer { padding: 36px 20px 24px; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer h4 { font-size: 0.95rem; }

  /* Ad units - don't let them break layout */
  .ad-unit { min-height: 60px; margin: 16px 0; }
  .ad-unit.in-article { min-height: 200px; }

  /* Page wrapper */
  .page-wrapper { padding: 28px 16px 60px; }
  .page-wrapper.wide { max-width: 100%; }

  /* Breadcrumb */
  .breadcrumb { font-size: 0.82rem; margin-bottom: 16px; }

  /* Cluster labels */
  .cluster-label { font-size: 0.75rem; margin: 36px 0 16px; }

  /* Chart containers */
  .chart-container { padding: 10px 4px; }
}

/* ===== RESPONSIVE: MOBILE (480px and below) ===== */
@media (max-width: 480px) {
  /* Single column everything */
  .tool-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .related-tools { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }

  /* Even larger touch targets */
  .form-group input, .form-group select {
    font-size: 1.05rem;
    padding: 16px;
    min-height: 52px;
  }

  /* Hero adjustments */
  .hero { padding: 36px 16px 28px; }
  .hero h1 { font-size: clamp(1.6rem, 8vw, 2.4rem); letter-spacing: -0.5px; }

  /* Calculator results */
  .result-highlight .big-number { font-size: clamp(1.6rem, 8vw, 2.6rem); }

  /* Make amortization table horizontally scrollable */
  .amort-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .amort-table { min-width: 450px; }

  /* Tools section */
  .tools-section { padding: 0 16px 40px; }
  .tools-section h2 { font-size: 1.5rem; }
  .tools-section .section-desc { font-size: 0.95rem; }

  /* Tighter spacing */
  .calc-box, .results-box, .content-section {
    padding: 20px 16px;
    margin-bottom: 20px;
  }

  /* Footer bottom stack */
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-bottom a { margin: 0 8px; }

  /* Range slider bigger thumb for touch */
  .range-group input[type="range"]::-webkit-slider-thumb {
    width: 26px; height: 26px;
  }
}

/* ===== RESPONSIVE: SMALL MOBILE (360px and below) ===== */
@media (max-width: 360px) {
  .hero h1 { font-size: 1.5rem; }
  .nav-brand { font-size: 22px; }
  .calc-header h1 { font-size: 1.4rem; }
  .result-highlight .big-number { font-size: 1.5rem; }
  .tool-card { padding: 18px 14px; }
  .tool-card h3 { font-size: 1rem; }
}
