/*
    truemortgagecost.com - complete stylesheet.
    Replaces the master template's demo CSS; load AFTER app.css so these
    overrides win.

    Design tokens: editorial finance, navy + copper palette.
    White background for AdSense, deep navy as the serious-money accent,
    copper as the "upside" / lowest-cost highlight, warm cream for muted
    cards, Georgia serif for display, system sans for body.
*/

:root {
    --bg: #ffffff;
    --ink: #141414;
    --muted: #666666;
    --rule: #e8e6e0;
    --rule-strong: #d4d1c7;

    --accent: #1e3a5f;         /* deep navy - primary accent */
    --accent-dark: #152b47;    /* darker navy for hover emphasis */
    --accent-soft: #eef2f7;    /* navy-tinted panel bg (rarely used) */

    --highlight: #b87333;      /* copper - highlights the "better" / lowest tax */
    --highlight-dark: #9c5e26; /* copper hover */

    --warn: #92400e;
    --warn-soft: #fef3c7;
    --hover: #faf8f3;
    --muted-bg: #f8f6f1;       /* cream for floating cards */

    --serif: Georgia, "Charter", "Iowan Old Style", "Times New Roman", serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }

.shell { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.reading { max-width: 640px; }

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--ink);
    color: var(--bg);
    padding: 10px 14px;
    text-decoration: none;
}
.skip:focus { left: 0; }

/* ========== Masthead ========== */
.masthead {
    border-bottom: 1px solid var(--rule);
    padding: 20px 0;
    background: var(--bg);
}
.masthead__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.brand {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
    text-decoration: none;
}
.brand__version { display: none; }
.nav { display: flex; gap: 28px; flex-wrap: wrap; }
.nav__link, .nav a {
    font-size: 15px;
    text-decoration: none;
    color: var(--ink);
    font-family: var(--sans);
    position: relative;
    padding: 4px 0;
}
.nav__link:hover, .nav a:hover { color: var(--accent); }

/* Active nav state - navy color + bottom underline bar.
   .brand--active and .nav__link--active flagged by header.tpl based on $canonical. */
.nav__link--active,
.nav a.nav__link--active {
    color: var(--accent);
    font-weight: 600;
}
.nav__link--active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--accent);
}

/* Brand on home page gets subtle underline too */
.brand--active {
    position: relative;
}

/* Hamburger toggle - hidden on desktop. Three lines morph into an X when
   the drawer is open (controlled by [aria-expanded="true"] on the button).
   align-self: center overrides the parent's `align-items: baseline` (which
   is right for text-vs-text, wrong for a visual icon with no baseline). */
.nav-toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 101;
    color: var(--ink);
    align-self: center;
}
.nav-toggle__line {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.15s ease, top 0.2s ease;
    border-radius: 1px;
}
.nav-toggle__line:nth-child(1) { top: 14px; }
.nav-toggle__line:nth-child(2) { top: 21px; }
.nav-toggle__line:nth-child(3) { top: 28px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}
.nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========== Breadcrumbs ========== */
.breadcrumbs {
    font-size: 13px;
    color: var(--muted);
    padding: 24px 0 16px;
    margin: 0;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span { color: var(--ink); }

/* ========== Page hero (unified across all subpages) ==========
   Every subpage uses this exact structure:
       <header class="page-hero">
           <nav class="breadcrumbs">Home › Section</nav>
           <p class="page-hero__kicker">SECTION LABEL</p>
           <h1 class="page__title">Title</h1>
           <p class="page__lead">Lead paragraph</p>
       </header>
   Breadcrumbs ships inside page-hero so spacing is consistent. The homepage
   uses its own .hero (big-number layout) and is unaffected by this.
*/
.page-hero {
    padding: 0 0 32px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 48px;
    display: block;
}
.page-hero .breadcrumbs {
    padding: 24px 0 24px;
}
.page-hero__kicker {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin: 0 0 20px;
    display: inline-block;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent);
}
.page__title {
    font-family: var(--serif);
    font-size: 44px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    color: var(--ink);
    text-transform: none;
    max-width: 22ch;
    overflow-wrap: break-word;
}
.page__lead {
    font-family: var(--serif);
    font-size: 20px;
    line-height: 1.45;
    color: var(--ink);
    max-width: 56ch;
    margin: 0 0 12px;
}
.page__meta { color: var(--muted); font-size: 14px; margin: 0; }

/* ========== Home hero ========== */
.hero {
    padding: 56px 0 48px;
    border-bottom: 1px solid var(--rule);
}
.hero__h1 {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 24px;
    display: inline-block;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent);
}
.hero__grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 72px;
    align-items: end;
}
.hero__big-number {
    font-family: var(--serif);
    font-size: 104px;
    line-height: 0.95;
    letter-spacing: -0.03em;
    font-weight: 400;
    margin: 0 0 16px;
    color: var(--ink);
}
.hero__big-number .currency {
    color: var(--muted);
    font-size: 56px;
    vertical-align: top;
    margin-right: 2px;
}
.hero__big-caption {
    font-family: var(--serif);
    font-size: 20px;
    line-height: 1.4;
    color: var(--ink);
    margin: 0 0 20px;
    max-width: 32ch;
}
.hero__big-caption em { font-style: italic; }

/* Comparison strip under big number: NJ vs HI mini-table */
.hero__compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 0 0 24px;
    padding: 16px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    max-width: 420px;
}
.hero__compare-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hero__compare-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
}
.hero__compare-value {
    font-family: var(--serif);
    font-size: 22px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.hero__compare-item--high .hero__compare-value { color: var(--accent); font-weight: 600; }
.hero__compare-item--low  .hero__compare-value { color: var(--highlight); font-weight: 600; }

/* Rate banner: more prominent with FRED source */
.hero__rate {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 14px 16px;
    background: var(--muted-bg);
    border-radius: 10px;
    font-size: 13px;
    color: var(--muted);
    flex-wrap: wrap;
}
.hero__rate-label {
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--accent);
}
.hero__rate-value {
    font-family: var(--serif);
    font-size: 24px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.hero__rate-meta { font-size: 12px; color: var(--muted); }
.hero__rate-src a {
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
}
.hero__rate-src a:hover { color: var(--accent); }

/* Chart */
.hero__chart { margin: 0; }
.hero__chart figcaption {
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
    letter-spacing: 0.02em;
}
.hero__chart svg { width: 100%; height: auto; display: block; }

/* ========== Section ========== */
.section {
    padding: 80px 0;
    border-bottom: 1px solid var(--rule);
    position: relative;
}
.section:last-child { border-bottom: none; }

/* Muted sections = floating cream cards inside the shell */
.section--muted {
    background: transparent;
    border-bottom: none;
    padding: 24px 0;
}
.section--muted > .shell {
    background: var(--muted-bg);
    border-radius: 16px;
    padding: 72px 48px;
    max-width: 1120px;
}
.section--muted,
.section:has(+ .section--muted) {
    border-bottom: none;
}

.section__head {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 48px;
    margin-bottom: 40px;
    align-items: start;
}
.section__kicker {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin: 10px 0 0;
    display: inline-block;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent);
}
.section__title {
    font-family: var(--serif);
    font-size: 36px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--ink);
    text-transform: none;
    overflow-wrap: break-word;  /* long words like "understanding" at 36px
                                   serif otherwise overflow 320px viewports */
}
.section__lead {
    margin-top: 10px;
    font-size: 16px;
    color: var(--ink);
    max-width: 60ch;
    line-height: 1.6;
}

/* ========== State directory ========== */
.states {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 48px;
}
.state {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
    text-decoration: none;
    position: relative;
}
.state:hover {
    background: var(--hover);
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
}
.state__name { color: var(--ink); }
.state:hover .state__name { color: var(--accent); }
.state__tax, .state__ins {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 13px;
    min-width: 56px;
    text-align: right;
}

/* Highlighted outliers: top-tax navy, bottom-tax copper */
.state--high .state__tax {
    color: var(--accent);
    font-weight: 700;
}
.state--high .state__name::before {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: 2px;
}
.state--low .state__tax {
    color: var(--highlight);
    font-weight: 700;
}
.state--low .state__name::before {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--highlight);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: 2px;
}

.states-legend {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 48px;
    margin-bottom: 8px;
}
.states-legend__col {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ink);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.states-legend__col span:nth-child(2),
.states-legend__col span:nth-child(3) { min-width: 56px; text-align: right; }

/* Legend hint under directory about the dot markers */
.states-note {
    margin-top: 20px;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.states-note__item { display: inline-flex; align-items: center; gap: 6px; }
.states-note__dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
}
.states-note__dot--high { background: var(--accent); }
.states-note__dot--low  { background: var(--highlight); }

/* ========== Why section ========== */
.why {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 48px;
}
.why__item {
    padding: 28px 0;
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 56px 220px 1fr;
    gap: 20px 32px;
    align-items: start;
}
.why__item:last-child { border-bottom: 1px solid var(--rule); }
.why__icon {
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
    color: var(--accent);
}
.why__icon svg {
    width: 36px;
    height: 36px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.why__icon svg text { fill: currentColor; stroke: none; }
.why__term {
    font-family: var(--serif);
    font-size: 24px;
    margin: 0;
    line-height: 1.2;
}
.why__def {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.65;
    color: var(--ink);
}
.why__def strong {
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

/* ========== Comparison / Prose / Guides / FAQ (shared layout) ========== */
.compare, .prose, .guides, .faq {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 48px;
}
.compare { margin: 24px 0 0; }
.compare__table {
    border-collapse: collapse;
    width: 100%;
    font-size: 15px;
}
.compare__table th, .compare__table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rule);
}
.compare__table th {
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--ink);
    padding-bottom: 10px;
}
.compare__table td.num {
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.compare__table tr:last-child td { border-bottom: none; }
.compare__table tr.total td {
    padding-top: 16px;
    font-weight: 600;
    border-top: 1px solid var(--ink);
}
.compare__caption {
    margin-top: 16px;
    font-size: 13px;
    color: var(--muted);
}

/* Mobile fallback for the worked-example 4-column table.
   Below 700px we hide the <table> and show a card per state instead -
   each card is one state's P&I / Tax / Insurance / Monthly stacked. */
.compare__cards { display: none; }

@media (max-width: 700px) {
    .compare__table { display: none; }
    .compare__cards {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .compare__card {
        padding: 18px 20px;
        background: var(--muted-bg);
        border-radius: 12px;
    }
    .compare__card-title {
        font-family: var(--serif);
        font-size: 18px;
        margin: 0 0 12px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--rule);
        letter-spacing: -0.01em;
        color: var(--ink);
    }
    .compare__card-list {
        margin: 0;
        padding: 0;
    }
    .compare__card-list > div {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        padding: 7px 0;
        font-size: 14px;
        color: var(--ink);
    }
    .compare__card-list dt {
        margin: 0;
        color: var(--muted);
    }
    .compare__card-list dd {
        margin: 0;
        font-variant-numeric: tabular-nums;
        font-weight: 500;
        color: var(--ink);
    }
    .compare__card-total {
        margin-top: 6px;
        padding-top: 10px !important;
        border-top: 1px solid var(--ink);
    }
    .compare__card-total dt,
    .compare__card-total dd {
        font-weight: 700;
        color: var(--ink);
    }
}

/* Prose: full-width grid overriding master-template app.css */
.prose {
    max-width: none;
    grid-template-columns: 180px 1fr;
    gap: 48px;
}
.prose__body { max-width: 85ch; }
.prose__body p {
    font-size: 16px;
    line-height: 1.7;
    margin: 0 0 16px;
    color: var(--ink);
    max-width: 72ch;
}
.prose__body ul, .prose__body ol { max-width: 72ch; }
.prose__body h2 {
    font-family: var(--serif);
    font-size: 26px;
    margin: 36px 0 14px;
    letter-spacing: -0.01em;
    scroll-margin-top: 20px;
}
.prose__body h3 {
    font-family: var(--serif);
    font-size: 20px;
    margin: 32px 0 12px;
}
.prose__body ul {
    padding-left: 20px;
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.65;
}
.prose__body li { margin-bottom: 6px; }
.prose__body strong { font-weight: 600; }
.prose__body code {
    background: var(--hover);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* ========== Guides list - editorial card feel ========== */
.guides__list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 48px;
}
.guides__item {
    padding: 22px 0;
    border-top: 1px solid var(--rule);
    position: relative;
}
.guides__item:first-child,
.guides__item:nth-child(2) { border-top: 1px solid var(--ink); }
.guides__meta {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--highlight);
    font-weight: 700;
    margin: 0 0 8px;
}
.guides__title {
    font-family: var(--serif);
    font-size: 20px;
    margin: 0 0 8px;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.guides__title a { text-decoration: none; color: var(--ink); }
.guides__title a:hover { color: var(--accent); }
.guides__excerpt {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
    line-height: 1.55;
    max-width: 50ch;
}
.guides__more {
    margin-top: 32px;
    font-size: 14px;
}
.guides__more a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 2px;
    font-weight: 500;
}
.guides__more a:hover { color: var(--accent-dark); border-bottom-color: var(--accent-dark); }

/* ========== FAQ with +/- toggle ========== */
.faq__list { max-width: 68ch; }
.faq__item {
    border-top: 1px solid var(--rule);
}
.faq__item:last-child { border-bottom: 1px solid var(--rule); }
.faq__q {
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.3;
    padding: 20px 36px 20px 0;
    margin: 0;
    cursor: pointer;
    list-style: none;
    position: relative;
    transition: color 0.15s ease;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after {
    content: "";
    position: absolute;
    right: 2px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    background:
        linear-gradient(var(--accent), var(--accent)) center/14px 2px no-repeat,
        linear-gradient(var(--accent), var(--accent)) center/2px 14px no-repeat;
    transition: transform 0.2s ease, opacity 0.15s;
    opacity: 0.75;
}
.faq__item[open] > .faq__q { color: var(--accent); }
.faq__item[open] > .faq__q::after {
    background:
        linear-gradient(var(--accent), var(--accent)) center/14px 2px no-repeat;
    opacity: 1;
}
.faq__q:hover { color: var(--accent); }
.faq__q:hover::after { opacity: 1; }
.faq__a {
    font-size: 15.5px;
    line-height: 1.65;
    color: var(--ink);
    margin: 0 0 20px;
    max-width: 60ch;
}

/* ========== Calculator (restructured in hotfix 10) ========== */

/* Section wrapper - full-width form (no left kicker spacer) */
.calc-section {
    padding-bottom: 48px;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--rule);
}

/* Preset buttons row */
.calc-presets {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 20px 24px;
    background: var(--muted-bg);
    border-radius: 12px;
    margin-bottom: 32px;
}
.calc-presets__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
    margin-right: 8px;
}
.calc-preset {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 16px;
    background: var(--bg);
    border: 1px solid var(--rule-strong);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--sans);
    text-align: left;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    min-width: 150px;
}
.calc-preset:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.calc-preset__name {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    transition: color 0.15s;
}
.calc-preset:hover .calc-preset__name { color: var(--accent); }
.calc-preset__desc {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.calc-preset--active {
    background: var(--accent);
    border-color: var(--accent);
}
.calc-preset--active .calc-preset__name,
.calc-preset--active .calc-preset__desc { color: #fff; }
.calc-preset--active:hover .calc-preset__name,
.calc-preset--active:hover .calc-preset__desc { color: #fff; }

/* Form - 3 titled groups instead of 2x4 flat grid */
.calc-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 40px;
}
.calc-group__title {
    font-family: var(--serif);
    font-size: 18px;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ink);
    letter-spacing: -0.01em;
    color: var(--ink);
}
.calc-group__fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Field layout */
.calc-field { display: flex; flex-direction: column; min-width: 0; }
.calc-field label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 700;
}
.calc-field__hint {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    min-height: 14px;
}
.calc-field__hint strong { color: var(--ink); font-weight: 600; }
.calc-field__hint a { color: var(--accent); text-decoration: none; }
.calc-field__hint a:hover { text-decoration: underline; }

/* Input with prefix/suffix badges that make $, %, /yr, /mo visible at a glance */
.calc-input {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--rule-strong);
    border-radius: 8px;
    background: var(--bg);
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
    max-width: 100%;
    min-width: 0;
}
.calc-input:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}
.calc-input input {
    flex: 1;
    padding: 10px 12px;
    border: none;
    font-size: 18px;
    font-family: var(--serif);
    font-variant-numeric: tabular-nums;
    background: transparent;
    color: var(--ink);
    width: 100%;
    outline: none;
    min-width: 0;
}
.calc-input__prefix,
.calc-input__suffix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: var(--muted-bg);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--sans);
    user-select: none;
}
.calc-input__prefix { border-right: 1px solid var(--rule); }
.calc-input__suffix { border-left: 1px solid var(--rule); }

.calc-field select {
    padding: 10px 12px;
    border: 1px solid var(--rule-strong);
    border-radius: 8px;
    font-size: 16px;
    font-family: var(--sans);
    font-variant-numeric: tabular-nums;
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23666' stroke-width='1.5' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    /* Keep selected option text inside the box on narrow screens.
       Long native option text overflows otherwise even when the <select>
       itself is 100% wide. */
    width: 100%;
    max-width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.calc-field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* ===== Results hero + bar chart + breakdown ===== */
.calc-results {
    padding-top: 32px;
    border-top: 2px solid var(--ink);
}
.calc-results__hero {
    text-align: center;
    padding: 32px 24px 24px;
    background: var(--muted-bg);
    border-radius: 16px;
    margin-bottom: 32px;
}
.calc-results__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 700;
    margin: 0 0 8px;
}
.calc-results__value {
    font-family: var(--serif);
    font-size: 64px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin: 0 0 16px;
    font-weight: 400;
}
.calc-results__affordability {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}
.calc-results__affordability strong { color: var(--ink); font-weight: 600; }

/* Horizontal stacked bar - shows payment proportions at a glance */
.calc-chart {
    margin-bottom: 32px;
}
.calc-chart__bar {
    display: flex;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--rule);
}
.calc-chart__seg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    transition: filter 0.15s;
    min-width: 2px;
}
.calc-chart__seg:hover { filter: brightness(1.08); }
.calc-chart__seg-label { padding: 0 4px; }

.calc-chart__seg--pi  { background: var(--accent); }
.calc-chart__seg--tax { background: var(--highlight); }
.calc-chart__seg--ins { background: #6b8caa; }
.calc-chart__seg--pmi { background: #92400e; }
.calc-chart__seg--mip { background: #92400e; }
.calc-chart__seg--hoa { background: #8a8a85; }

.calc-chart__legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted);
}
.calc-chart__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.calc-chart__legend-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 2px;
}

/* Breakdown table with colored dots mirroring the bar */
.calc-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    margin-bottom: 24px;
}
.calc-breakdown__title {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 12px;
    font-weight: 700;
    font-family: var(--sans);
}
.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    align-items: center;
}
.calc-row span:last-child, .calc-row strong { font-weight: 600; }
.calc-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: 1px;
}
.calc-dot--pi  { background: var(--accent); }
.calc-dot--tax { background: var(--highlight); }
.calc-dot--ins { background: #6b8caa; }
.calc-dot--pmi { background: #92400e; }
.calc-dot--mip { background: #92400e; }
.calc-dot--hoa { background: #8a8a85; }

#warnings { margin-top: 24px; }
.warning {
    background: #fef3c7;
    border-left: 3px solid #92400e;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 13px;
    border-radius: 4px;
}

/* ===== Related states as mini chip-cards with tax rate ===== */
.state-chips {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.state-chip {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    transition: border-color 0.15s, transform 0.15s;
}
.state-chip:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    color: var(--ink);
}
.state-chip__name {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 500;
}
.state-chip:hover .state-chip__name { color: var(--accent); }
.state-chip__tax {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.state-chip--all { background: var(--muted-bg); border-color: var(--accent); }
.state-chip--all .state-chip__name { color: var(--accent); font-weight: 600; }
.state-chip--all .state-chip__tax { color: var(--accent); font-size: 18px; font-weight: 400; }

/* ========== Blog ========== */
.blog-list__items { list-style: none; padding: 0; margin: 0; }
.blog-list__item {
    padding: 24px 0;
    border-bottom: 1px solid var(--rule);
}
.blog-list__title {
    font-family: var(--serif);
    font-size: 24px;
    margin: 0 0 6px;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.blog-list__title a { color: var(--ink); text-decoration: none; }
.blog-list__title a:hover { color: var(--accent); }
.blog-list__excerpt {
    color: var(--muted);
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    max-width: 60ch;
}

/* ========== /blog grid - card per article with category icon ========== */

/* Filter chip row sits in a cream card like .states-controls */
.blog-filter {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 20px 24px;
    background: var(--muted-bg);
    border-radius: 12px;
    margin-bottom: 32px;
}
.blog-filter__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
    margin-right: 8px;
}

/* 2-column grid on desktop, 1 on mobile */
.blog-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 48px;
}

/* Each card is a single <a> so the whole tile is clickable */
.blog-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 20px;
    align-items: start;
    padding: 20px 22px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 12px;
    text-decoration: none;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    cursor: pointer;
}
.blog-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(20, 20, 20, 0.06);
    transform: translateY(-1px);
    color: var(--ink);
    text-decoration: none;
}
.blog-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.blog-card[hidden] { display: none; }

/* Icon tile: cream square with centered SVG. Color varies by category. */
.blog-card__icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted-bg);
    border-radius: 10px;
    color: var(--accent);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.blog-card__icon svg { width: 36px; height: 36px; display: block; }
.blog-card:hover .blog-card__icon {
    background: var(--accent);
    color: #fff;
}

/* Copper-tinted icons for a few categories so the grid has visual variety */
.blog-card--insurance .blog-card__icon,
.blog-card--rates     .blog-card__icon {
    color: var(--highlight);
}
.blog-card--insurance:hover .blog-card__icon,
.blog-card--rates:hover     .blog-card__icon {
    background: var(--highlight);
    color: #fff;
}

/* Card body: category tag -> title -> excerpt -> meta */
.blog-card__body { min-width: 0; }  /* lets long titles truncate instead of blowing out the column */
.blog-card__cat {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--highlight);
    font-weight: 700;
    margin: 0 0 6px;
    font-family: var(--sans);
}
.blog-card--insurance .blog-card__cat,
.blog-card--rates     .blog-card__cat { color: var(--highlight); }
.blog-card--loans     .blog-card__cat,
.blog-card--costs     .blog-card__cat,
.blog-card--buyers    .blog-card__cat,
.blog-card--finance   .blog-card__cat,
.blog-card--guide     .blog-card__cat { color: var(--accent); }

.blog-card__title {
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.25;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
    color: var(--ink);
    transition: color 0.15s;
}
.blog-card:hover .blog-card__title { color: var(--accent); }

.blog-card__excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__meta {
    font-size: 11px;
    color: var(--muted);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    font-family: var(--sans);
}

/* Empty state (filter matched zero) */
.blog-grid__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: var(--muted);
    font-size: 16px;
}
.blog-grid__empty-reset {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    margin-left: 6px;
}
.blog-grid__empty-reset:hover { color: var(--accent-dark); }

.article-header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rule);
}

/* ========== /blog/{slug} article page extras (hotfix 12) ========== */

/* Hero with category icon alongside the title */
.article-hero__row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 24px;
    align-items: start;
}
.article-hero__icon {
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted-bg);
    border-radius: 14px;
    color: var(--accent);
    flex-shrink: 0;
}
.article-hero__icon svg { width: 48px; height: 48px; display: block; }

/* Insurance + rates = copper icon tint, rest navy */
.article-hero--insurance .article-hero__icon,
.article-hero--rates     .article-hero__icon { color: var(--highlight); }

.article-hero__text { min-width: 0; }
.article-hero .page-hero__kicker { margin-bottom: 14px; }
.article-hero .page-hero__kicker a {
    color: var(--accent);
    text-decoration: none;
}
.article-hero .page-hero__kicker a:hover { text-decoration: underline; }

/* Editorial break - inline promo for the calculator inside article body.
   Rejects the AI "callout card" default (left-border + bg-color + rounded
   corners + filled button). This is a classified-ad / newspaper break:
   thin hairlines top & bottom, serif title IS the link, extra link in a
   plain prose sentence. No background, no border radius, no filled button. */
.editorial-break {
    margin: 56px 0 40px;
    padding: 28px 0 24px;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    max-width: 72ch;
}
.editorial-break__kicker {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--highlight);
    font-weight: 700;
    font-family: var(--sans);
    margin: 0 0 10px;
}
.editorial-break__title {
    font-family: var(--serif);
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.015em;
    margin: 0 0 10px;
    color: var(--ink);
}
.editorial-break__title a {
    color: var(--ink);
    text-decoration: none;
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-size: 100% 2px;
    background-position: 0 100%;
    transition: color 0.15s;
}
.editorial-break__title a:hover { color: var(--accent); }
.editorial-break__text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--muted);
    margin: 0;
    max-width: 60ch;
}
.editorial-break__text a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--rule-strong);
    text-underline-offset: 2px;
}
.editorial-break__text a:hover { text-decoration-color: var(--accent); }

/* Share - plain inline text links with middot separators. No pills. */
.article-share {
    margin: 32px 0 20px;
    font-size: 14px;
    color: var(--muted);
    font-family: var(--sans);
}
.article-share__label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-right: 10px;
}
.article-share a,
.article-share__copy {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--rule-strong);
    padding-bottom: 2px;
    transition: color 0.15s, border-bottom-color 0.15s;
}
.article-share a:hover,
.article-share__copy:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.article-share__copy {
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 0 0 2px;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
}
.article-share__sep {
    color: var(--rule-strong);
    margin: 0 4px;
}

/* Disclaimer: subtle, prose-styled, no bordered box */
.article-disclaimer {
    font-size: 13px;
    color: var(--muted);
    margin: 24px 0 32px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
    line-height: 1.55;
    max-width: 68ch;
}
.article-disclaimer strong { color: var(--ink); font-weight: 600; }

/* Prev/Next - compact 2-column row. Big arrow left + text block,
   big arrow right + text block. No card borders, no backgrounds. */
.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin: 48px 0 64px;
    padding: 32px 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
}
.article-nav__item {
    display: flex;
    align-items: baseline;
    gap: 14px;
    text-decoration: none;
    color: var(--ink);
}
.article-nav__item--next {
    justify-content: flex-end;
    text-align: right;
}
.article-nav__arrow {
    font-family: var(--serif);
    font-size: 28px;
    line-height: 1;
    color: var(--accent);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.article-nav__item--prev:hover .article-nav__arrow { transform: translateX(-3px); }
.article-nav__item--next:hover .article-nav__arrow { transform: translateX(3px); }
.article-nav__meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.article-nav__dir {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-weight: 700;
    font-family: var(--sans);
}
.article-nav__title {
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.25;
    color: var(--ink);
    letter-spacing: -0.01em;
    transition: color 0.15s;
}
.article-nav__item:hover .article-nav__title { color: var(--accent); }

/* Related guides grid - 3 cols, uses the same blog-card from hotfix 11 */
.blog-grid--related {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 24px;
}
.blog-grid__all {
    text-align: right;
    margin: 16px 0 0;
    font-size: 14px;
}
.blog-grid__all a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 2px;
}
.blog-grid__all a:hover { color: var(--accent-dark); }

.toc {
    padding: 20px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin: 0 0 32px;
}
.toc__title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 10px;
    font-weight: 500;
    font-family: var(--sans);
}
.toc__list {
    list-style: none;
    padding: 0;
    columns: 2;
    column-gap: 40px;
    font-size: 15px;
    font-family: var(--serif);
}
.toc__item { margin: 4px 0; break-inside: avoid; }
.toc__item a { color: var(--ink); text-decoration: none; }
.toc__item a:hover { color: var(--accent); }

.article-footer {
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 14px;
}
.article-footer p { margin: 6px 0; }

/* ========== State hub facts ========== */
.facts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 40px;
    padding: 0;
    margin: 0;
}
.facts > div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
}
.facts dt { font-size: 15px; color: var(--ink); margin: 0; }
.facts dd {
    margin: 0;
    font-family: var(--serif);
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

/* ========== Related states ========== */
.related-states {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 32px;
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    font-size: 15px;
}
.related-states a {
    text-decoration: none;
    color: var(--ink);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--rule-strong);
}
.related-states a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ========== Footer ========== */
.footer {
    padding: 56px 0 32px;
    border-top: 1px solid var(--ink);
    margin-top: 56px;
}
.footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}
.footer__brand {
    font-family: var(--serif);
    font-size: 20px;
    margin: 0 0 8px;
}
.footer p {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 10px;
}
.footer h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 500;
    margin: 0 0 14px;
}
.footer ul { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.footer li { margin-bottom: 6px; }
.footer li a { text-decoration: none; color: var(--ink); }
.footer li a:hover { color: var(--accent); }
.footer__disclaimer {
    padding-top: 24px;
    border-top: 1px solid var(--rule);
    font-size: 12px;
    color: var(--muted);
}
.footer__disclaimer strong { color: var(--ink); }

/* Methodology prose--wide: paragraphs fill the full column */
.prose--wide { grid-template-columns: 180px 1fr; }
.prose--wide .prose__body { max-width: none; }
.prose--wide .prose__body p,
.prose--wide .prose__body ul,
.prose--wide .prose__body ol { max-width: none; }

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .hero { padding: 40px 0; }
    .hero__grid { grid-template-columns: 1fr; gap: 40px; align-items: start; }
    .hero__big-number { font-size: 72px; }
    .hero__big-number .currency { font-size: 42px; }
    .hero__compare { max-width: none; }
    .hero__rate { padding: 12px 14px; }

    .section { padding: 48px 0; }
    .section__head, .why, .compare, .prose, .guides, .faq {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .states, .states-legend, .guides__list, .facts { grid-template-columns: 1fr; }
    .why__item { grid-template-columns: 1fr; gap: 10px; padding: 20px 0; }
    .why__icon { padding-top: 0; }
    .why__icon svg { width: 32px; height: 32px; }

    /* Calculator mobile */
    .calc-form { grid-template-columns: 1fr; gap: 24px; }
    .calc-presets { padding: 16px; gap: 8px; }
    .calc-preset { min-width: 140px; flex: 1; }
    .calc-presets__label { width: 100%; margin: 0 0 4px; }
    .calc-results__value { font-size: 44px; }
    .calc-breakdown { grid-template-columns: 1fr; gap: 32px; }
    .state-chips { grid-template-columns: 1fr 1fr; }

    /* Blog grid mobile - 1 column */
    .blog-grid { grid-template-columns: 1fr; }
    .blog-grid--related { grid-template-columns: 1fr; }
    .blog-card { grid-template-columns: 56px 1fr; gap: 16px; padding: 16px; }
    .blog-card__icon { width: 56px; height: 56px; }
    .blog-card__icon svg { width: 28px; height: 28px; }
    .blog-filter { padding: 16px; }

    /* Article page mobile */
    .article-hero__row { grid-template-columns: 1fr; gap: 20px; }
    .article-hero__icon { width: 64px; height: 64px; }
    .article-hero__icon svg { width: 36px; height: 36px; }

    .editorial-break { padding: 24px 0 20px; margin: 40px 0 32px; }
    .editorial-break__title { font-size: 22px; }

    .article-nav { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; }
    .article-nav__item--next { justify-content: flex-start; text-align: left; }

    .article-share { font-size: 13px; }
    .article-share__label { display: block; margin: 0 0 6px; }

    .toc__list { columns: 1; }

    .page__title { font-size: 32px; }
    .page__lead { font-size: 17px; }

    .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }

    .section--muted > .shell {
        padding: 48px 24px;
        border-radius: 12px;
    }
}
@media (max-width: 480px) {
    .footer__grid { grid-template-columns: 1fr; }
    .hero__big-number { font-size: 56px; }
    .hero__big-number .currency { font-size: 32px; }
    .hero__compare { grid-template-columns: 1fr; gap: 10px; }

    /* Phone-size titles. The default 36px serif + letter-spacing -0.02em
       overflows the viewport for words like "understanding". */
    .section__title { font-size: 26px; letter-spacing: -0.01em; }
    .page__title { font-size: 28px; letter-spacing: -0.01em; }
}

/* Mobile nav drawer - full-height overlay from the top. Takes over the
   screen when the hamburger is tapped. */
@media (max-width: 700px) {
    .nav-toggle { display: block; }

    .nav {
        position: fixed;
        inset: 0;              /* top:0 right:0 bottom:0 left:0 */
        z-index: 100;
        background: var(--bg);
        padding: 80px 32px 40px;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        overflow-y: auto;

        /* Hidden by default - slides down from the top */
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.25s ease, opacity 0.2s ease;
    }
    .nav.nav--open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    .nav a {
        padding: 18px 0;
        font-family: var(--serif);
        font-size: 24px;
        letter-spacing: -0.01em;
        color: var(--ink);
        border-bottom: 1px solid var(--rule);
    }
    .nav a:hover,
    .nav a:focus { color: var(--accent); }

    /* Active state in mobile drawer - navy + bold, no underline bar
       (border-bottom from drawer rows already there) */
    .nav a.nav__link--active {
        color: var(--accent);
        font-weight: 700;
    }
    .nav a.nav__link--active::after { display: none; }

    /* Prevent background scroll when drawer is open */
    .body--nav-open { overflow: hidden; }
}

/* Back-to-top button - fixed bottom-right, shown while scrolling,
   fades out 1.5s after the user stops. */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(20, 20, 20, 0.18);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s;
    z-index: 90;
    padding: 0;
}
.back-to-top svg { width: 20px; height: 20px; display: block; }
.back-to-top:hover { background: var(--accent-dark); }
.back-to-top:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
.back-to-top--visible {
    opacity: 1;
    transform: translateY(0);
}
@media (max-width: 480px) {
    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 42px;
        height: 42px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .back-to-top { transition: opacity 0.15s; transform: none; }
    .back-to-top--visible { transform: none; }
}

/* ========== Print ========== */
@media print {
    .masthead, .footer, #warnings, .breadcrumbs, .nav { display: none; }
    .section { border-bottom: 1px solid #ccc; padding: 24px 0; }
    body { font-size: 12pt; }
}

/* ========== Reduced motion ========== */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ========== /loan-types compare page ========== */

/* Sticky anchor nav */
.loan-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.loan-nav__inner {
    display: flex;
    gap: 24px;
    padding: 14px 24px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.loan-nav__link {
    font-size: 13px;
    text-decoration: none;
    color: var(--muted);
    white-space: nowrap;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    font-weight: 500;
}
.loan-nav__link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Compare table */
.loan-compare {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 48px;
}
.loan-compare__scroll { overflow-x: auto; }
.loan-compare__table {
    border-collapse: collapse;
    width: 100%;
    min-width: 760px;
    font-size: 14px;
}
.loan-compare__table th,
.loan-compare__table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}
.loan-compare__table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    border-bottom: 1px solid var(--ink);
    font-weight: 700;
    padding-bottom: 10px;
    font-family: var(--sans);
}
.loan-compare__table tbody th {
    font-weight: 600;
    color: var(--ink);
    font-size: 13px;
    background: var(--muted-bg);
    width: 160px;
}
.loan-compare__table td.num {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.loan-compare__table td.num--good {
    color: var(--highlight);
    font-weight: 700;
}
.loan-compare__table td.warn {
    color: var(--warn);
    font-weight: 500;
}
.loan-compare__legend {
    margin: 20px 0 0 228px;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.loan-compare__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.loan-compare__legend-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
}
.loan-compare__legend-dot--good { background: var(--highlight); }
.loan-compare__legend-dot--warn { background: var(--warn); }

/* Loan detail sections (one per type) */
.loan-detail {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 48px;
}
.loan-detail__body { max-width: 68ch; }
.loan-detail__h {
    font-family: var(--serif);
    font-size: 20px;
    margin: 32px 0 12px;
    letter-spacing: -0.01em;
    color: var(--ink);
}
.loan-detail__body > :first-child { margin-top: 0; }
.loan-detail__body p {
    font-size: 15.5px;
    line-height: 1.7;
    margin: 0 0 14px;
}
.loan-detail__list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}
.loan-detail__list li {
    position: relative;
    padding: 6px 0 6px 22px;
    font-size: 15px;
    line-height: 1.55;
    border-bottom: 1px solid var(--rule);
}
.loan-detail__list li:last-child { border-bottom: none; }
.loan-detail__list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 15px;
    width: 10px;
    height: 1px;
    background: var(--accent);
}
.loan-detail__facts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0 0 20px;
    padding: 0;
    border-top: 1px solid var(--rule);
}
.loan-detail__facts > div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 14px;
}
.loan-detail__facts dt { color: var(--muted); margin: 0; }
.loan-detail__facts dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    text-align: right;
    font-weight: 500;
}
.loan-detail__facts dd.warn { color: var(--warn); font-weight: 600; }
.loan-detail__cta {
    margin: 28px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
    font-size: 15px;
}
.loan-detail__cta a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 2px;
    font-weight: 600;
}
.loan-detail__cta a:hover { color: var(--accent-dark); }

/* "warn" color token tweak for navy palette */
.loan-detail__facts dd.warn,
.loan-compare__table td.warn { color: #92400e; }

/* Big CTA at bottom of /loan-types */
.loan-cta {
    text-align: center;
    padding: 40px 24px;
    background: var(--muted-bg);
    border-radius: 16px;
}
.loan-cta__title {
    font-family: var(--serif);
    font-size: 32px;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
}
.loan-cta__lead {
    font-size: 16px;
    color: var(--muted);
    max-width: 55ch;
    margin: 0 auto 24px;
    line-height: 1.6;
}
.loan-cta__buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
}
.loan-cta__primary {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
}
.loan-cta__primary:hover { background: var(--accent-dark); color: #fff; }
.loan-cta__secondary {
    display: inline-block;
    padding: 12px 24px;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--accent);
    border-radius: 6px;
    font-weight: 500;
    font-size: 15px;
}
.loan-cta__secondary:hover { background: var(--accent); color: #fff; }


/* ========== /states directory page ========== */

/* Search + filter + sort bar - floating cream card inside the shell,
   matching the look of .section--muted on the homepage */
.states-controls {
    padding: 24px 0;
    margin-bottom: 24px;
}
.states-controls > .shell {
    background: var(--muted-bg);
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 1120px;
}
.states-controls__grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto auto;
    gap: 32px;
    align-items: end;
}
.states-controls__label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 8px;
}
.states-controls__input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--rule-strong);
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
}
.states-controls__input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}
.states-controls__chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.chip {
    padding: 7px 14px;
    background: var(--bg);
    border: 1px solid var(--rule-strong);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 13px;
    cursor: pointer;
    border-radius: 999px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.chip--active:hover { background: var(--accent-dark); color: #fff; }
.states-controls__select {
    padding: 10px 14px;
    border: 1px solid var(--rule-strong);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
}
.states-controls__select:focus { outline: none; border-color: var(--accent); }
.states-controls__count {
    margin: 20px 0 0;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 16px;
}
.states-controls__count #states-count { color: var(--ink); font-weight: 600; }
.states-controls__reset {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-family: var(--sans);
    font-size: 13px;
    padding: 0;
}
.states-controls__reset:hover { color: var(--accent-dark); }

/* State grid - each card is an <a>, so the entire tile is clickable, not
   just the name link or the "Open calculator" CTA at the bottom */
.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.state-card {
    padding: 20px 22px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;

    /* Was <article>, now <a>: reset link styles */
    text-decoration: none;
    color: var(--ink);
    cursor: pointer;
}
.state-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(20, 20, 20, 0.06);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--ink);
}
.state-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.state-card[hidden] { display: none; }

.state-card__hdr {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rule);
}
.state-card__name {
    font-family: var(--serif);
    font-size: 20px;
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.2;
    flex: 1;
    color: var(--ink);
    font-weight: 400;
    transition: color 0.15s;
}
.state-card:hover .state-card__name { color: var(--accent); }
.state-card__code {
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    background: var(--muted-bg);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--sans);
}
.state-card__facts {
    margin: 0 0 16px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}
.state-card__fact {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px dashed var(--rule);
    font-size: 13px;
}
.state-card__fact:last-child { border-bottom: none; }
.state-card__fact dt { color: var(--muted); margin: 0; }
.state-card__fact dd {
    margin: 0;
    color: var(--ink);
    text-align: right;
}
.state-card__fact dd.num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.state-card__cta {
    margin: auto 0 0;
    padding-top: 12px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    display: inline-block;
    align-self: flex-start;
    transition: border-bottom-color 0.15s;
}
.state-card:hover .state-card__cta {
    border-bottom-color: var(--accent);
}

.state-grid__empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--muted);
    font-size: 16px;
}
.state-grid__empty-reset {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}

/* /loan-types + /states responsive */
@media (max-width: 900px) {
    .loan-nav__inner { gap: 16px; padding: 10px 16px; }
    .loan-nav__link { font-size: 12px; }
    .loan-compare { grid-template-columns: 1fr; gap: 16px; }
    .loan-compare__legend { margin-left: 0; }
    .loan-detail { grid-template-columns: 1fr; gap: 16px; }
    .loan-cta__title { font-size: 24px; }
    .loan-cta { padding: 32px 20px; }

    .states-controls__grid { grid-template-columns: 1fr; gap: 20px; }
    .state-grid { grid-template-columns: 1fr; }
}

/* ========== Mobile touch-target audit (hotfix 19) ==========
   Everything clickable needs at least 40-44px tall on touch screens
   (iOS HIG = 44, Material = 48dp, WCAG 2.5.5 AAA = 44). Below is the
   catch-up for places that render smaller than that at phone widths. */
@media (max-width: 700px) {
    /* Filter chips (used in /states, /blog, loan-types etc.) */
    .chip {
        padding: 10px 16px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        font-size: 14px;
    }

    /* Footer nav links - were ~20px tall, now 36px */
    .footer li { margin-bottom: 4px; }
    .footer li a {
        display: inline-block;
        padding: 8px 0;
        min-height: 36px;
        line-height: 1.4;
    }

    /* Breadcrumbs - thin text, bump the links */
    .breadcrumbs {
        line-height: 1.9;
    }
    .breadcrumbs a {
        display: inline-block;
        padding: 6px 2px;
    }

    /* Table of contents on article page */
    .toc__item { margin: 6px 0; }
    .toc__item a {
        display: inline-block;
        padding: 6px 0;
        min-height: 36px;
    }

    /* Article share - inline text links, add vertical padding so each
       is a 40px tall tap target. Separators between them don't need
       breathing room because the targets themselves provide it. */
    .article-share {
        line-height: 2.4;
    }
    .article-share a,
    .article-share__copy {
        padding: 8px 2px;
        display: inline-block;
        min-height: 40px;
    }

    /* Prev / Next article nav - item is already a block link but
       the arrow area is small, make the whole block more generous */
    .article-nav__item { padding: 8px 0; }

    /* Related states (home guides, state calc page) */
    .related-states { gap: 10px 24px; }
    .related-states a {
        display: inline-block;
        padding: 8px 0;
        min-height: 36px;
    }

    /* State directory rows on home - bump from 10px to 14px padding */
    .state { padding: 14px 0; }

    /* Loan compare sticky anchor nav */
    .loan-nav__inner { gap: 20px; }
    .loan-nav__link {
        padding: 10px 2px;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    /* "All guides" trailing link (end of related guides on article page) */
    .blog-grid__all a {
        display: inline-block;
        padding: 10px 0;
        min-height: 40px;
    }

    /* "All guides →" after guides list on home */
    .guides__more a {
        display: inline-block;
        padding: 8px 0;
    }

    /* States-note dot legend inline links - not links, but if become so */
    .states-controls__reset {
        padding: 8px 4px;
        min-height: 36px;
    }

    /* FAQ summary already has 20px vertical padding, OK */
    /* FAQ grid__empty reset button */
    .state-grid__empty-reset,
    .blog-grid__empty-reset {
        padding: 8px 4px;
        min-height: 36px;
    }

    /* Internal/link anchors inside hints (e.g. "Not sure? Compare loan types") */
    .calc-field__hint a {
        display: inline-block;
        padding: 4px 0;
        line-height: 1.6;
    }

    /* Loan detail CTA ("Run the numbers for your state →") */
    .loan-detail__cta a {
        display: inline-block;
        padding: 8px 0;
    }

    /* Editorial break title link (blog article inline CTA) is already
       serif 26px, big enough as a tap target just by text height */

    /* Any inline prose link gets min 24px tap area via line-height */
    .prose__body p a,
    .loan-detail__body a {
        padding: 2px 0;
    }
}

/* ========== Utilities (replaces inline styles that violated CSP) ========== */
.section--thin { padding-bottom: 48px; }

.debug-pre {
    background: var(--hover);
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    border: 1px solid var(--rule);
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
}
