﻿/* Self-hosted fonts (Google Fonts moved on-site to avoid external CLS/LCP cost) */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/dm-sans-latin-var-400-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/playfair-display-latin-var-400-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Playfair Display';
    font-style: italic;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/playfair-display-latin-italic-var-400-700.woff2') format('woff2');
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0f4c3a;
    --primary-light: #1a6b52;
    --primary-dark: #092e23;
    --accent: #d4af37;
    --accent-text: #937000;
    --accent-light: #e8c547;
    --secondary: #1a2a3a;
    --background: #f5f7fa;
    --card-bg: #ffffff;
    --text-dark: #0f1419;
    --text-light: #595959;
    --border: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    font-family: 'DM Sans', sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #eef2f5 100%);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

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

header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.logo span {
    color: #856300;
}

.hero {
    text-align: center;
    margin-bottom: 50px;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero p {
    font-size: 18px;
    color: var(--text-light);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 400;
}

/* Navigation Tabs */
.afford-mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px auto 40px;
    background: var(--card-bg);
    padding: 8px;
    border-radius: 50px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    position: relative;
    z-index: 10;
}

.afford-mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border-radius: 35px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    gap: 8px;
    white-space: nowrap;
    transform: translateZ(0);
}

.afford-mode-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 20px rgba(15, 76, 58, 0.25);
}

:root[data-theme="dark"] .afford-mode-selector {
    background: #1e293b;
    border-color: #334155;
}

:root[data-theme="dark"] .afford-mode-btn.active {
    box-shadow: 0 2px 20px rgba(52, 211, 153, 0.3);
}

/* Affordability Module Styles */
#afford-module {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.afford-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    align-items: start;
}

/* Direct child div also needs min-width:0 to constrain nested grids */
.afford-grid > div {
    min-width: 0;
}

/* Afford Section - Inner 2-column grid */
.afford-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Grid children must have min-width:0 so they never overflow their track */
.afford-sidebar,
.afford-main {
    min-width: 0;
}

@media (max-width: 768px) {
    .afford-section {
        grid-template-columns: 1fr;
    }
}

.loan-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    background: rgba(15, 76, 58, 0.03);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.loan-selector .form-group {
    margin-bottom: 0;
}

.loan-selector .form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.loan-selector select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230f4c3a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C2.185 5.355 2.402 5 2.808 5h9.384c.406 0 .623.355.358.658l-4.796 5.482a.5.5 0 0 1-.727 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding: 0 48px 0 14px;
    font-size: 14px;
    font-weight: 600;
    background-color: #fff;
    border: 2px solid var(--border);
    border-radius: 12px;
    height: 54px;
    width: 100%;
    color: var(--text-dark);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.loan-selector select:hover {
    border-color: var(--primary-light);
}

.loan-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 58, 0.1);
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 20px;
}

.card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    border-color: rgba(15, 76, 58, 0.2);
}

.card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card h2::before {
    content: '';
    width: 5px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-weight: 600;
    font-size: 15px;
    z-index: 2;
}

input[type="number"],
select {
    width: 100%;
    padding: 12px 14px;
    padding-left: 36px;
    border-radius: 12px;
    border: 2px solid var(--border);
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 76, 58, 0.1);
}

.afford-calc-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(15, 76, 58, 0.3);
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
}

.afford-calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(15, 76, 58, 0.4);
}

.afford-result-display {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 20px;
    padding: 40px 30px;
    color: white;
    text-align: center;
    box-shadow: 0 20px 40px rgba(15, 76, 58, 0.15);
}

.afford-result-label {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.afford-result-value {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: 'DM Sans', sans-serif;
    margin-bottom: 10px;
}

.afford-breakdown-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.afford-breakdown-item {
    display: flex;
    flex-direction: column;
}

.afford-breakdown-label {
    font-size: 12px;
    opacity: 0.8;
}

.afford-breakdown-val {
    font-weight: 700;
    font-size: 15px;
}

/* Tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--primary-light);
    color: white;
    border-radius: 50%;
    margin-left: 6px;
    cursor: help;
    position: relative;
    vertical-align: middle;
}

.info-icon:hover::after {
    content: attr(data-tooltip);
    position: fixed;
    background: var(--primary-dark);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    width: max-content;
    max-width: 250px;
    text-align: left;
    z-index: 999999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
    top: var(--tooltip-top, auto);
    left: var(--tooltip-left, -9999px);
    transform: translate(var(--tooltip-shift, -50%), -100%);
}

.info-icon:hover::before {
    content: '';
    position: fixed;
    border: 6px solid transparent;
    border-top-color: var(--primary-dark);
    z-index: 999999;
    top: var(--arrow-top, auto);
    left: var(--arrow-left, -9999px);
    transform: translate(var(--arrow-shift, -50%), -100%);
}

/* DTI Colors */
.afford-dti-low {
    color: #059669;
    background: rgba(52, 211, 153, 0.15);
    border-radius: 20px;
    padding: 2px 8px;
}

.afford-dti-mid {
    color: #a35200;
    background: rgba(251, 191, 36, 0.15);
    border-radius: 20px;
    padding: 2px 8px;
}

.afford-dti-high {
    color: #b91c1c;
    background: rgba(248, 113, 113, 0.15);
    border-radius: 20px;
    padding: 2px 8px;
}

#afford_dti_slider {
    width: 100%;
    margin-top: 10px;
}

.afford-wow-box {
    background: rgba(251, 191, 36, 0.08);
    border: 1px dashed var(--accent);
    border-radius: 16px;
    padding: 20px;
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Dark Mode */
:root[data-theme="dark"] {
    --primary: #34d399;
    --primary-light: #6ee7b7;
    --primary-dark: #059669;
    --accent: #fbbf24;
    --accent-text: #fbbf24;
    --accent-light: #fcd34d;
    --secondary: #1e293b;
    --background: #0f172a;
    --card-bg: #1e293b;
    --text-dark: #f1f5f9;
    --text-light: #cbd5e1;
    --border: #334155;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
}

:root[data-theme="dark"] body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

:root[data-theme="dark"] header {
    background: #1e293b;
    border-bottom-color: #334155;
}

/* Dark Mode Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    color: var(--text-dark);
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: rotate(30deg) scale(1.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

@media print {

    header,
    .theme-toggle,
    .afford-mode-selector {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px 10px !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    .afford-mode-selector {
        grid-template-columns: repeat(3, 1fr);
        border-radius: 20px;
        padding: 8px;
        gap: 5px;
    }

    .afford-mode-btn {
        height: 44px;
        border-radius: 12px;
        font-size: 11px;
        padding: 0 4px;
        gap: 4px;
    }

    .hide-mobile {
        display: none;
    }
}

@media (max-width: 900px) {
    #afford-module {
        max-width: 100%;
    }

    .afford-grid {
        grid-template-columns: 1fr;
    }

    .loan-selector {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

footer {
    background: var(--primary-dark);
    color: white;
    padding: 40px 24px;
    text-align: center;
    margin-top: 60px;
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem !important;
    }

    .hero p {
        font-size: 14px;
    }
}

/* ==================== SEO KNOWLEDGE HUB STYLES ==================== */
.seo-knowledge-hub {
    border-top: 1px solid var(--border);
    padding-top: 60px !important;
    margin-bottom: 60px;
}

.seo-item {
    padding: 24px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 20px;
}

.seo-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-light);
}

.faq-item h3::after {
    content: '+';
    float: right;
    font-size: 20px;
    color: var(--primary);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    border: none;
}

@media (max-width: 860px) {
    .back-to-top {
        bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
        right: 16px;
        width: 40px;
        height: 40px;
    }
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-light);
    transform: translateY(-5px);
}

/* ==================== SEO INTERNAL LINKS STYLES ==================== */
.internal-links-section {
    margin-bottom: 40px;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Modifier for when nested inside another card to prevent cumulative padding/borders */
.internal-links-section.nested {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 30px;
}

.internal-links-section h3 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 25px;
    font-family: 'Playfair Display', serif;
    text-align: center;
}

.internal-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.seo-link-card {
    text-decoration: none;
    padding: 16px;
    background: rgba(15, 76, 58, 0.05);
    border-radius: 12px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.seo-link-card:hover {
    border-color: var(--primary);
    background: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(15, 76, 58, 0.1);
    color: var(--primary);
}

:root[data-theme="dark"] .seo-link-card {
    background: rgba(52, 211, 153, 0.1);
    color: var(--primary-light);
}

:root[data-theme="dark"] .seo-link-card:hover {
    background: var(--card-bg);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .internal-links-section:not(.nested) {
        padding: 20px;
        border-radius: 16px;
    }

    .internal-links-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 480px) {
    .internal-links-section {
        margin-bottom: 25px;
    }

    .internal-links-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .seo-link-card {
        min-height: 50px;
        padding: 12px;
        font-size: 13px;
    }

    .internal-links-section h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

/* === SHARED NAVIGATION - MortgagePayoffPlanner ===
   Nav HTML is baked into each page statically - no CLS.
   ================================================== */

header.legacy-header, .header-content { display: none !important; }
.afford-mode-selector { display: none !important; }

:root {
  --nv-green:     #0f4c3a;
  --nv-gold:      #d4af37;
  --nv-top-muted: rgba(255,255,255,0.65);
  --nv-sub-bg:    #f8faf9;
  --nv-sub-bdr:   #e2e8e5;
  --nv-sub-muted: #6b7280;
  --nv-sub-hover: #f0fdf4;
  --nv-sub-act:   #0f4c3a;
}

header.nv { position: sticky; top: 0; z-index: 200; box-shadow: 0 2px 12px rgba(0,0,0,0.12); }

.nv-top { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); height: 58px; display: flex; align-items: center; }
.nv-top-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; width: 100%;
}
.nv-logo {
  font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700;
  color: #fff; text-decoration: none; white-space: nowrap;
  flex-shrink: 0; margin-right: 8px; letter-spacing: -0.01em;
}
.nv-logo span { color: var(--nv-gold); }
.nv-logo-sep {
  width: 1px; height: 22px; background: rgba(255,255,255,0.15);
  flex-shrink: 0; margin: 0 12px 0 4px;
}
.nv-top-nav { display: flex; align-items: stretch; flex: 1; }
.nv-top-item { position: relative; }
.nv-top-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 0 13px; height: 58px;
  background: transparent; border: none;
  color: var(--nv-top-muted);
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 -3px 0 transparent;
}
.nv-top-btn:hover { color: #fff; box-shadow: inset 0 -3px 0 rgba(255,255,255,0.25); }
.nv-top-btn.active { color: #fff; box-shadow: inset 0 -3px 0 var(--nv-gold); }

/* Hover preview - instant, pure CSS */
.nv-preview {
  position: absolute; top: 100%; left: 0;
  background: #fff; border: 1px solid #e0ebe5;
  border-top: 3px solid var(--nv-green);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.12);
  padding: 14px 16px 12px;
  display: none; z-index: 400;
  width: auto; white-space: nowrap;
}
.nv-top-item:hover .nv-preview { display: block; }
.nv-preview.wide { width: 300px; white-space: normal; }

.nv-preview-title {
  font-family: 'DM Sans', sans-serif; font-size: 10px; font-weight: 700;
  color: var(--nv-green); text-transform: uppercase; letter-spacing: 1.3px;
  margin-bottom: 8px; padding-bottom: 7px; border-bottom: 1px solid #e8f0ec;
}
.nv-preview-grid { display: grid; gap: 2px; grid-template-columns: 1fr; }
.nv-preview-grid.g2 { grid-template-columns: 1fr 1fr; }
.nv-preview-grid.g3 { grid-template-columns: 1fr 1fr 1fr; }
.nv-preview-grid a {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; color: #374151; text-decoration: none;
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  border-radius: 5px; white-space: nowrap;
}
.nv-preview-grid a:hover { background: var(--nv-sub-hover); color: var(--nv-green); }

/* Hamburger */
.nv-ham {
  display: none; align-items: center; gap: 7px; margin-left: auto;
  padding: 6px 10px; border: none; background: rgba(255,255,255,0.1);
  border-radius: 6px; color: rgba(255,255,255,0.9);
  font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.nv-ham-lines { display: flex; flex-direction: column; gap: 4px; }
.nv-ham-lines span { display: block; width: 16px; height: 1.5px; background: rgba(255,255,255,0.9); border-radius: 2px; }

/* Sub-bar */
.nv-sub-bar {
  background: var(--nv-sub-bg); border-bottom: 1px solid var(--nv-sub-bdr);
  min-height: 40px; display: flex; align-items: center;
}
.nv-sub-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; overflow-x: auto;
  scrollbar-width: none; width: 100%;
}
.nv-sub-inner::-webkit-scrollbar { display: none; }
.nv-sub-panel { display: none; align-items: center; gap: 2px; flex-wrap: nowrap; }
.nv-sub-panel.nv-sub-active { display: flex; }
.nv-sub-link {
  display: inline-flex; align-items: center; padding: 7px 13px;
  color: var(--nv-sub-muted); text-decoration: none;
  font-family: 'DM Sans', sans-serif; font-size: 12.5px; font-weight: 500;
  white-space: nowrap; border-radius: 5px;
  box-shadow: inset 0 -2px 0 transparent;
}
.nv-sub-link:hover { color: var(--nv-sub-act); background: var(--nv-sub-hover); }
.nv-sub-link.active { color: var(--nv-sub-act); font-weight: 600; box-shadow: inset 0 -2px 0 var(--nv-gold); }

/* Mobile bottom tab bar */
.nv-mob-tabbar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: 64px; background: #fff; border-top: 1px solid #e5e7eb;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08); z-index: 600;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nv-mob-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: transparent; border: none; cursor: pointer;
  padding: 8px 4px 10px; color: #9ca3af;
  font-family: 'DM Sans', sans-serif; font-size: 10px; font-weight: 600;
  position: relative;
}
.nv-mob-tab .tab-emoji { font-size: 22px; line-height: 1; display: block; margin-top: 2px; }
.nv-mob-tab.active { color: var(--nv-green); }
.nv-mob-tab.active::after {
  content: ''; position: absolute; top: 5px; left: 50%;
  transform: translateX(-50%); width: 24px; height: 3px;
  background: var(--nv-green); border-radius: 2px;
}

/* Sheet */
.nv-sheet {
  display: none; position: fixed; left: 0; right: 0; bottom: 64px;
  top: auto; max-height: 82vh;
  background: #fff; z-index: 550; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
  border-top: 3px solid var(--nv-green);
}
.nv-sheet.open { display: block; }
.nv-sheet-handle {
  width: 40px; height: 4px; background: #d1d5db;
  border-radius: 2px; margin: 10px auto 0;
}
.nv-sheet-header {
  position: sticky; top: 0; background: #fff;
  border-bottom: 1px solid #f0ebe0; padding: 12px 20px 14px;
  display: flex; align-items: center; justify-content: space-between; z-index: 10;
}
.nv-sheet-title { font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 700; color: #111827; }
.nv-sheet-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: #f3f4f6; color: #6b7280;
  font-size: 14px; cursor: pointer; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.nv-sheet-close:hover { background: #fee2e2; color: #dc2626; }
.nv-sheet-group-hdr {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px 6px;
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 700;
  color: var(--nv-green); text-transform: uppercase; letter-spacing: 0.06em;
  background: #f8faf9; border-top: 1px solid #f0ebe0;
}
.nv-sheet-group-hdr .sh-e { font-size: 16px; }
.nv-sheet-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  color: #374151; text-decoration: none;
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  border-bottom: 1px solid #f5f0e8;
}
.nv-sheet-link:hover { background: #f9fdf9; color: var(--nv-green); }
.nv-sheet-link .sh-e { font-size: 18px; flex-shrink: 0; width: 26px; text-align: center; }
.nv-sheet-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 540;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.nv-sheet-overlay.open { display: block; }

@media (max-width: 860px) {
  .nv-top-nav { display: none; }
  .nv-ham     { display: flex; }
  .nv-sub-bar { display: none; }
  .nv-mob-tabbar { display: flex; }
  body { padding-bottom: 64px; }
}

/* === ACCORDION SHEET (mobile More/hamburger) === */
/* Group header row */
.nv-acc-hdr {
  display: flex;
  align-items: center;
  border-top: 1px solid #f0ebe0;
  background: #f8faf9;
  cursor: pointer;
  user-select: none;
}
/* Nav label — fills space, navigates on tap */
.nv-acc-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 0 13px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--nv-green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.nv-acc-nav-btn .sh-e { font-size: 17px; }
/* Chevron — right side, only toggles expand */
.nv-acc-toggle {
  padding: 13px 20px 13px 12px;
  font-size: 20px;
  font-weight: 400;
  color: var(--nv-gold);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
/* Direct link headers (no subs) — span full row */
.nv-acc-hdr.nv-acc-direct .nv-acc-nav-btn {
  padding-right: 20px;
}
/* Sub-links body — hidden by default */
.nv-acc-body {
  display: none;
  background: #fff;
}
.nv-acc-body.open { display: block; }
.nv-acc-body .nv-sheet-link {
  padding-left: 32px;
  font-size: 13.5px;
}
.nv-acc-body .nv-sheet-link .sh-e {
  font-size: 16px;
  width: 24px;
}

/* === FONT METRIC OVERRIDES — eliminate nav height shift on font load ===
   These @font-face rules make the fallback fonts (Arial, Georgia) match
   the metrics of DM Sans and Playfair Display exactly.
   Result: zero visual shift when web fonts swap in. */

@font-face {
  font-family: 'DM Sans Fallback';
  src: local('Arial');
  ascent-override:  94%;
  descent-override: 24%;
  line-gap-override: 0%;
  size-adjust: 100%;
}

@font-face {
  font-family: 'Playfair Display Fallback';
  src: local('Georgia');
  ascent-override:  82%;
  descent-override: 21%;
  line-gap-override: 0%;
  size-adjust: 103%;
}

/* Use overridden fallbacks in nav elements */
.nv-logo {
  font-family: 'Playfair Display', 'Playfair Display Fallback', serif;
  /* Fixed line-height prevents any font metric from stretching the bar */
  line-height: 1;
}
.nv-top-btn,
.nv-sub-link,
.nv-ham,
.nv-mob-tab,
.nv-preview-grid a,
.nv-sheet-link,
.nv-acc-nav-btn,
.nv-sheet-title,
.nv-sheet-group-hdr {
  font-family: 'DM Sans', 'DM Sans Fallback', sans-serif;
  line-height: 1;
}

/* Lock the top bar to EXACTLY 58px regardless of font metrics */
.nv-top {
  min-height: 58px;
  max-height: 58px;
}
/* Lock sub-bar to exactly 40px */
.nv-sub-bar {
  min-height: 40px;
  max-height: 40px;
}
/* Lock mob tab bar height */
.nv-mob-tabbar {
  min-height: 64px;
}

/* === NAV TEXT COLOR FIXES ===
   Unselected: readable white (0.88 opacity, not 0.65)
   Active:     pure white + subtle bright tint on background
   Hover:      pure white */
:root {
  --nv-top-muted: rgba(255,255,255,0.88);
}
.nv-top-btn {
  color: rgba(255,255,255,0.88);
}
.nv-top-btn:hover {
  color: #ffffff;
  box-shadow: inset 0 -3px 0 rgba(255,255,255,0.3);
}
/* Active: pure white + very subtle brighter green tint on background */
.nv-top-btn.active {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 -3px 0 var(--nv-gold);
}

/* === BOTTOM TAB BAR: subtle green-tinted background === */
.nv-mob-tabbar {
  background: #f0fdf7;
  border-top: 1px solid #d1ede3;
}
/* Active tab: green text (already set) — add stronger indicator */
.nv-mob-tab.active {
  color: var(--nv-green);
}
.nv-mob-tab.active::after {
  background: var(--nv-green);
  width: 28px;
  height: 3px;
}

/* === MORE BUTTON: SVG icon sizing === */
.nv-more-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  margin-top: 2px;
  color: currentColor;
}
.nv-more-icon svg {
  display: block;
}

/* === ACCORDION: wider + tap area for toggle (25% of row) === */
.nv-acc-hdr {
  /* row height fixed so tap zones are consistent */
  min-height: 52px;
}
.nv-acc-nav-btn {
  /* takes ~75% of the row */
  flex: 3;
  min-height: 52px;
}
.nv-acc-toggle {
  /* takes ~25% of the row, centred */
  flex: 0 0 25%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 22px;
  /* visible tap boundary */
  border-left: 1px solid #f0ebe0;
}

/* === MORE BUTTON SVG - explicit colors, no currentColor inheritance === */
.nv-more-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
}
.nv-more-svg {
  display: block;
  overflow: visible;
}
.nv-more-line {
  fill: #9ca3af;
}
/* Active tab: green lines */
.nv-mob-tab.active .nv-more-line {
  fill: #0f4c3a;
}
/* Non-more tabs: hide the icon class */
.nv-mob-tab:not(#nvMoreTab) .nv-more-icon {
  display: none;
}

/* === BOTTOM TAB BAR: use --primary-dark background (matches brand) === */
.nv-mob-tabbar {
  background: var(--primary-dark, #092e23);
  border-top: none;
}
/* Tabs: white text on dark background */
.nv-mob-tab {
  color: rgba(255,255,255,0.6);
}
.nv-mob-tab.active {
  color: #ffffff;
}
.nv-mob-tab.active::after {
  background: var(--nv-gold, #d4af37);
}
/* More icon: white on dark */
.nv-more-line {
  fill: rgba(255,255,255,0.6) !important;
}
.nv-mob-tab.active .nv-more-line {
  fill: #ffffff !important;
}

/* ================================================================
   FINAL OVERRIDES — accordion layout + tab brightness
   These sit at end of file to win the cascade cleanly.
   ================================================================ */

/* --- Accordion header: proper flex row, no button artifacts --- */
.nv-acc-hdr {
  display: flex !important;
  align-items: stretch !important;
  overflow: hidden !important;
  min-height: 52px;
  background: #f8faf9;
  border-top: 1px solid #e8ede9;
}
.nv-acc-nav-btn {
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none !important;
  outline: none;
  border: none !important;
  border-radius: 0;
  flex: 1 1 75% !important;
  min-width: 0;
  display: flex !important;
  align-items: center !important;
  padding: 0 12px 0 20px;
  min-height: 52px;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--nv-green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent !important;
  cursor: pointer;
  text-align: left;
}
.nv-acc-toggle {
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none !important;
  outline: none;
  border: none !important;
  border-left: 1px solid #e8ede9 !important;
  border-radius: 0;
  flex: 0 0 25% !important;
  width: 25%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  min-height: 52px;
  font-size: 22px;
  font-weight: 300;
  color: var(--nv-gold);
  background: #f8faf9 !important;
  cursor: pointer;
}

/* --- Bottom tabs: FULL brightness on dark background --- */
.nv-mob-tab {
  color: rgba(255,255,255,1) !important;
}
.nv-mob-tab.active {
  color: #ffffff !important;
}
.nv-more-line {
  fill: rgba(255,255,255,1) !important;
}

/* === SHARED FOOTER ===
   footer-content is already styled (max-width, text-align, color).
   These add the link cloud and remove Made with heart. */
.footer-tagline {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.7;
}
.footer-links {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 20px;
    font-size: 12px;
}
.footer-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-links a:hover {
    color: var(--accent, #d4af37);
    text-decoration: underline;
}

/* === FOOTER LINKS: always white, all states, no purple visited === */
.footer-links a,
.footer-links a:link,
.footer-links a:visited,
.footer-links a:active,
.footer-links a:hover {
  color: rgba(255,255,255,0.85) !important;
  text-decoration: none;
}
.footer-links a:hover {
  text-decoration: underline;
  opacity: 0.7;
}

/* Mobile: hide hero descriptions sitewide */
@media (max-width: 768px) {
  .hero p {
    display: none !important;
  }
}

/* ============================================================
   MOBILE FIXES — appended last so they win the cascade
   ============================================================ */

@media (max-width: 768px) {

    /* Prevent iOS zoom on input focus */
    input[type="number"],
    input[type="text"],
    select {
        font-size: 16px !important;
    }

    /* Result display: less padding so content fits in ~340px screens */
    .afford-result-display {
        padding: 24px 16px !important;
    }

    /* Result value: scale down from 3.5rem so it never overflows */
    .afford-result-value {
        font-size: 2rem !important;
        word-break: break-all;
    }

    /* Breakdown grid: 2 fixed columns, no auto-fit that can overflow */
    .afford-breakdown-mini {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Wow box: stack vertically */
    .afford-wow-box {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

@media (max-width: 400px) {
    .afford-result-value {
        font-size: 1.6rem !important;
    }
}

