:root {
    --color-primary: #7b1e2b;
    --color-primary-dark: #5e1620;
    --color-primary-tint-10: #8f3441;
    --color-secondary: #c89b3c;
    --color-secondary-dark: #a87f2c;
    --color-secondary-tint: #e4c77a;
    --color-accent: var(--color-secondary);
    --color-accent-light: var(--color-secondary-tint);
    --color-bg: #fff8ee;
    --color-surface: #fcfaf7;
    --color-surface-alt: #f5eee1;
    --color-bg-alt: var(--color-surface-alt);
    --color-text: #4b352a;
    --color-text-muted: #7a6555;
    --color-accent-green: #355e3b;
    --color-border: #d9c79a;
    --color-border-strong: #c89b3c;

    --shadow-xs: 0 1px 2px rgb(75 53 42 / 6%);
    --shadow-sm: 0 2px 6px rgb(75 53 42 / 8%);
    --shadow-md: 0 6px 16px rgb(75 53 42 / 10%);
    --shadow-lg: 0 12px 32px rgb(75 53 42 / 14%);
    --shadow-gold-glow: 0 0 0 3px rgb(200 155 60 / 25%);

    --transition-fast: 180ms ease-out;
    --transition-base: 300ms ease-out;

    --radius: 0;
    --radius-pill: 0;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 96px;

    --font-heading: "Cinzel", Georgia, serif;
    --font-subheading: "Cormorant Garamond", Georgia, serif;
    --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;

    --text-h1: clamp(2rem, 5vw, 3.5rem);
    --text-h2: clamp(1.625rem, 3.5vw, 2.5rem);
    --text-h3: clamp(1.375rem, 2.5vw, 1.875rem);
    --text-body: 1rem;

    --container-max: 1280px;
    --container-full: 1440px;
    --container-pad: 24px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 90%;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    margin: 0;
    padding-top: var(--header-height, 84px);
    font-family: var(--font-body);
    font-size: var(--text-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    transition: background var(--transition-base), color var(--transition-base);
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    letter-spacing: 0.01em;
    font-weight: 700;
}

p {
    line-height: 1.6;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-pad);
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 100;
    background: linear-gradient(180deg, #fffdf8, var(--color-bg-alt));
    border-bottom: 1px solid var(--color-primary);
    box-shadow: 0 2px 0 var(--color-secondary), var(--shadow-sm);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
}

.site-header .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--color-primary);
}

.site-header .brand .brand-icon {
    font-size: 1.3rem;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.site-header .brand .brand-accent {
    color: var(--color-accent);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 36px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-text);
    padding-bottom: 6px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a.active,
.site-nav a:hover {
    color: var(--color-primary);
    border-bottom-color: var(--color-accent);
}

/* Mega menu */
.has-mega {
    position: static;
}

.nav-trigger {
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-text);
    padding-bottom: 6px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-trigger:hover,
.nav-trigger.active,
.nav-trigger[aria-expanded="true"] {
    color: var(--color-primary);
    border-bottom-color: var(--color-accent);
}

.nav-trigger-chevron {
    vertical-align: middle;
    margin-left: 5px;
    margin-top: -2px;
    transition: transform 0.2s ease;
}

.nav-trigger:hover .nav-trigger-chevron,
.nav-trigger.active .nav-trigger-chevron,
.nav-trigger[aria-expanded="true"] .nav-trigger-chevron,
.has-mega:hover .nav-trigger-chevron,
.has-mega:focus-within .nav-trigger-chevron {
    transform: rotate(180deg);
}

.mega-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 30;
    background: var(--color-surface);
    border-top: 3px solid var(--color-accent);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
}

.has-mega:hover .mega-menu,
.has-mega:focus-within .mega-menu,
.mega-menu.open {
    display: block;
}

.mega-menu-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 28px var(--container-pad);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.mega-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.mega-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.9rem;
    transition: color 0.15s ease;
}

.mega-item:hover {
    color: var(--color-primary);
}

.mega-item-icon {
    font-size: 1rem;
}

@media (max-width: 1100px) {
    .mega-menu-inner {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .header-bar {
        flex-wrap: wrap;
        padding: 14px 0;
    }

    .nav-toggle {
        display: flex;
    }

    .site-nav-wrap {
        display: none;
        order: 4;
        flex-basis: 100%;
        width: 100%;
        max-height: calc(100vh - var(--header-height, 84px));
        overflow-y: auto;
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid var(--color-border);
    }

    .site-nav-wrap.open {
        display: block;
    }

    .site-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .site-nav li {
        width: 100%;
    }

    .site-nav a,
    .nav-trigger {
        display: block;
        width: 100%;
        padding: 12px 4px;
        border-bottom: 1px solid var(--color-border);
    }

    .nav-trigger-chevron {
        float: right;
        margin-top: 6px;
    }

    .mega-menu {
        position: static;
        border-top: none;
        border-bottom: none;
        box-shadow: none;
        background: var(--color-surface-alt);
    }

    .mega-menu-inner {
        max-width: none;
        padding: 12px 4px 12px 16px;
        grid-template-columns: 1fr;
        gap: 4px;
    }

    body.nav-open {
        overflow: hidden;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    order: 3;
    margin-left: 4px;
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-bars {
    position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}

.nav-toggle-bars::before {
    top: -6px;
}

.nav-toggle-bars::after {
    top: 6px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
    background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.icon-button:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Main content */
main {
    min-height: 60vh;
}

.section {
    padding: 64px 0;
}

.section-alt {
    background: var(--color-bg-alt);
}

.result-section {
    padding-top: 0;
    padding-bottom: 48px;
}

.result-banner {
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border);
    margin: 4px;
    padding: 24px;
    margin-bottom: 24px;
}

.result-label {
    margin: 0 0 8px;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.result-sentence {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--color-primary);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 16px;
}

.stat-tile {
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 20px 12px;
}

.stat-icon {
    display: block;
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.stat-tile strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

@media (max-width: 900px) {
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.section h2 {
    font-size: 1.9rem;
    color: var(--color-primary);
    margin: 0 0 32px;
}

.section-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 32px;
}

.section-header-row h2 {
    margin: 0;
}

.link-arrow {
    display: inline-block;
    margin-top: 20px;
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: none;
}

.link-arrow:hover {
    color: var(--color-primary-dark);
}

/* Generic content pages (contact, about, etc.) */
.page-header {
    padding-bottom: 24px;
    background: var(--color-bg-alt);
    border-bottom: 1px solid var(--color-border);
}

.page-header h1 {
    margin: 8px 0 0;
    font-size: 2.4rem;
    color: var(--color-primary);
}

.page-lead {
    margin: 16px 0 0;
    max-width: 70ch;
    color: var(--color-text-muted);
    font-size: 1.05rem;
}

.legal-updated {
    margin: 10px 0 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.legal-content {
    max-width: 70ch;
}

.legal-section {
    margin-bottom: 32px;
}

.legal-section:last-child {
    margin-bottom: 0;
}

.legal-section h2 {
    font-size: 1.25rem;
    color: var(--color-primary);
    margin: 0 0 12px;
}

.legal-content p {
    color: var(--color-text-muted);
    margin-bottom: 18px;
    line-height: 1.7;
}

.legal-section ul {
    margin: 0 0 18px;
    padding-left: 22px;
    color: var(--color-text-muted);
}

.legal-section li {
    margin-bottom: 10px;
    line-height: 1.65;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 32px;
}

.about-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 28px 20px;
    background: var(--color-surface-alt, #f4ece1);
    border: 1px solid var(--color-border, #e5d9c6);
}

.about-stat strong {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    color: var(--color-primary);
}

.about-stat span {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

@media (max-width: 720px) {
    .about-stats {
        grid-template-columns: 1fr;
    }
}

.timeline {
    max-width: 640px;
    margin-bottom: 32px;
}

.timeline-item {
    position: relative;
    padding-left: 28px;
    padding-bottom: 24px;
    border-left: 2px solid var(--color-border-strong);
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-accent);
    border: 2px solid var(--color-surface);
}

.timeline-year {
    display: block;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.timeline-item p {
    margin: 0;
    color: var(--color-text-muted);
}

.about-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border);
    margin: 4px;
}

.about-col {
    padding: 40px;
}

.about-col:first-child {
    border-right: 1px solid var(--color-border);
}

.about-col h2 {
    margin: 0 0 14px;
    font-size: 1.4rem;
    color: var(--color-primary);
}

.about-col p {
    margin: 0;
    color: var(--color-text-muted);
}

@media (max-width: 900px) {
    .about-columns {
        grid-template-columns: 1fr;
    }

    .about-col:first-child {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
}

.coming-soon-card {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border);
    margin-top: 4px;
    padding: 56px 32px;
}

/* Calculator tool pages */
.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
    margin-bottom: 40px;
}

.tool-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border);
    margin: 4px;
    padding: 32px;
}

.tool-card select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-alt);
    font-size: 1rem;
    color: var(--color-text);
    font-family: var(--font-body);
}

.result-box {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.result-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    font-size: 1rem;
}

.result-row strong {
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.tool-info {
    padding: 8px 4px;
}

.tool-info h2 {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin: 0 0 12px;
}

.tool-info p {
    color: var(--color-text-muted);
    margin: 0 0 12px;
}

.tool-faq {
    margin-top: 8px;
}

.tool-faq h2,
.related-block h2 {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin: 0 0 20px;
}

.tool-notes,
.tool-who {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.tool-notes h3,
.tool-who h3 {
    font-size: 1rem;
    color: var(--color-primary);
    margin: 0 0 10px;
}

.tool-notes ul,
.tool-who ul {
    margin: 0;
    padding-left: 20px;
    color: var(--color-text-muted);
}

.tool-notes li,
.tool-who li {
    margin-bottom: 6px;
}

.tool-example {
    margin-bottom: 40px;
    padding: 20px 24px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}

.tool-example h2 {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin: 0 0 10px;
}

.tool-example p {
    color: var(--color-text-muted);
    margin: 0;
}

.tool-intro {
    max-width: 780px;
    color: var(--color-text-muted);
    margin: 12px 0 0;
}

.tool-steps,
.tool-rich-examples,
.tool-benefits,
.tool-comparison,
.author-bio {
    margin-bottom: 40px;
    padding: 20px 24px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}

.tool-steps h2,
.tool-rich-examples h2,
.tool-benefits h2,
.tool-comparison h2,
.author-bio h2 {
    font-size: 1.4rem;
    color: var(--color-primary);
    margin: 0 0 10px;
}

.tool-steps ol,
.tool-rich-examples ul,
.tool-benefits ul {
    margin: 0;
    padding-left: 20px;
    color: var(--color-text-muted);
}

.tool-steps li,
.tool-rich-examples li,
.tool-benefits li {
    margin-bottom: 8px;
}

.author-bio p {
    color: var(--color-text-muted);
    margin: 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.comparison-table th,
.comparison-table td {
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.comparison-table th {
    color: var(--color-primary);
    background: var(--color-surface);
}

/* Amortization / growth schedule */
.schedule-block {
    margin-bottom: 40px;
}

.schedule-details {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border);
    margin: 4px;
    padding: 20px 24px;
}

.schedule-details summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: 1.1rem;
}

.schedule-table-wrap {
    margin-top: 16px;
    overflow-x: auto;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.schedule-table th,
.schedule-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--color-border);
}

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

.schedule-table th {
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
}

/* Related calculators */
.related-block {
    margin-bottom: 40px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.related-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 14px 16px;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.related-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.related-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border-strong);
    color: var(--color-primary);
    font-weight: 700;
    padding: 14px 20px;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.related-cta:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

@media (max-width: 900px) {
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .tool-layout {
        grid-template-columns: 1fr;
    }
}

.coming-soon-icon {
    display: block;
    font-size: 2.8rem;
    margin-bottom: 16px;
}

.coming-soon-card h2 {
    margin: 0 0 12px;
    color: var(--color-primary);
}

.coming-soon-card p {
    margin: 0 0 24px;
    color: var(--color-text-muted);
}

.category-section {
    margin-bottom: 56px;
}

.category-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.category-section-icon {
    font-size: 1.5rem;
}

.category-section-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.calc-search {
    margin-top: 24px;
    max-width: 480px;
}

.calc-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--color-text);
}

.calc-search input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.calc-no-results {
    text-align: center;
    color: var(--color-text-muted);
    padding: 24px 0;
}

@media (max-width: 900px) {
    .calc-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .calc-card-grid {
        grid-template-columns: 1fr;
    }
}

.breadcrumb {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

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

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

.breadcrumb span {
    color: var(--color-primary);
}

.contact-section {
    padding-top: 40px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    align-items: start;
}

.contact-card,
.info-card,
.map-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border);
    margin: 4px;
}

.contact-card {
    padding: 32px;
}

.contact-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-card {
    padding: 28px;
}

.info-card h2 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin: 0 0 16px;
}

.info-card p {
    margin: 0 0 8px;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.map-card {
    overflow: hidden;
    line-height: 0;
}

.map-card iframe {
    width: 100%;
    height: 260px;
    border: 0;
    display: block;
}

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

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-alt);
    font-size: 1rem;
    color: var(--color-text);
    font-family: var(--font-body);
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.btn-inline {
    width: auto;
    padding: 14px 32px;
}

.form-success {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eaf7ee;
    border: 1px solid #b3ddc0;
    color: #1e6b39;
    font-weight: 600;
    padding: 14px 16px;
    margin-bottom: 24px;
    border-radius: var(--radius, 6px);
}

.form-success::before {
    content: "\2713";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #2f9e57;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

:root[data-theme="dark"] .form-success {
    background: #163823;
    border-color: #2a5c3c;
    color: #8fe0aa;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .form-success {
        background: #163823;
        border-color: #2a5c3c;
        color: #8fe0aa;
    }
}

@media (max-width: 900px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

/* Hero */
.hero {
    background: radial-gradient(circle at 15% 20%, #fff7ea 0%, var(--color-bg-alt) 55%);
    padding: 72px 0;
    border-bottom: 1px solid var(--color-border);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 48px;
    align-items: start;
}

.eyebrow {
    color: var(--color-accent);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin: 0 0 12px;
}

.hero h1 {
    font-size: 3rem;
    line-height: 1.15;
    color: var(--color-primary);
    margin: 0 0 20px;
}

.hero .lead {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    max-width: 46ch;
}

.badge-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.badge {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    box-shadow: var(--shadow-sm);
}

.hero-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border), var(--shadow-lg);
    padding: 40px;
    margin: 4px;
}

.hero-card h2 {
    margin: 0 0 24px;
    font-size: 1.7rem;
    color: var(--color-primary);
}

.hero-card label {
    display: block;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--color-text);
}

.date-picker {
    position: relative;
}

.date-picker-input {
    width: 100%;
    padding: 12px 40px 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    font-size: 1rem;
    color: var(--color-text);
    font-family: var(--font-body);
    cursor: text;
}

.date-picker-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.date-field-icon {
    position: absolute;
    right: 14px;
    top: 12px;
    font-size: 1.1rem;
    pointer-events: none;
}

/* Custom calendar panel */
.date-picker-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border), var(--shadow-lg);
    margin: 4px;
    padding: 20px;
}

.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.dp-nav {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

.dp-selects {
    display: flex;
    gap: 8px;
    flex: 1;
}

.dp-month,
.dp-year {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-alt);
    color: var(--color-primary);
    font-weight: 700;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
}

.dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.dp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.dp-day {
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 0.9rem;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.dp-day:hover {
    background: var(--color-bg-alt);
}

.dp-day-muted {
    color: var(--color-border-strong);
}

.dp-day-today {
    font-weight: 700;
    color: var(--color-primary);
}

.dp-day-selected {
    background: var(--color-primary);
    color: #fff;
}

.dp-day-selected:hover {
    background: var(--color-primary-dark);
}

.dp-footer {
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

.dp-today {
    background: none;
    border: none;
    color: var(--color-primary);
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
}

.dp-today:hover {
    text-decoration: underline;
}

.hero-card .hint {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin: 10px 0 24px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--color-primary-dark);
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    forced-color-adjust: none;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-primary);
    text-decoration: underline;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.hero-card .result {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.hero-card .result-line {
    margin: 0 0 10px;
    font-size: 1.05rem;
    color: var(--color-text);
}

.hero-card .result .link-arrow {
    margin-top: 0;
    font-size: 0.9rem;
}

.hero-card .error {
    margin-top: 16px;
    color: #c0392b;
}

/* Card grid (calculators / categories / articles) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.calc-card-grid {
    grid-template-columns: repeat(3, 1fr);
}

.articles-grid {
    grid-template-columns: repeat(3, 1fr);
}

.calc-card,
.category-card,
.article-card {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 22px;
    text-decoration: none;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.calc-card:hover,
.category-card:hover,
.article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
}

.calc-card h3,
.category-card h3,
.article-card h3 {
    margin: 12px 0 8px;
    font-size: 1.1rem;
    color: var(--color-primary);
}

.calc-card p,
.category-card p,
.article-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

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

.calc-icon {
    font-size: 1.6rem;
}

.pill {
    display: inline-block;
    background: var(--color-accent);
    color: var(--color-primary-dark);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
}

.pill-outline {
    background: transparent;
    border: 1px solid var(--color-accent);
    color: var(--color-primary);
    margin-bottom: 12px;
}

.category-card {
    text-align: left;
}

.muted {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Feature grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.feature {
    text-align: center;
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 28px 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.feature:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 2rem;
    display: inline-block;
    margin-bottom: 12px;
}

.feature h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--color-primary);
}

.feature p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Steps */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.step {
    text-align: center;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-light));
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 14px;
    box-shadow: var(--shadow-md);
}

.step h3 {
    margin: 0 0 8px;
    color: var(--color-primary);
}

.step p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.faq-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-strong);
}

.faq-item[open] {
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}

.faq-item summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-primary);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    font-size: 1.02rem;
    line-height: 1.4;
}

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

.faq-item summary .faq-icon {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-surface-alt);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.faq-item[open] summary .faq-icon {
    background: var(--color-accent);
    color: var(--color-primary-dark);
    transform: rotate(135deg);
}

.faq-item .faq-answer {
    padding: 0 22px 20px 22px;
}

.faq-item .faq-category {
    display: inline-block;
    margin: 0 0 8px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-accent-dark, var(--color-secondary-dark));
}

.faq-item p {
    margin: 0;
    color: var(--color-text-muted);
    line-height: 1.65;
}

/* Content hero (Articles / FAQ page headers) */
.content-hero {
    background: radial-gradient(circle at 15% 20%, #fff7ea 0%, var(--color-bg-alt) 60%);
    padding: 56px 0 40px;
    border-bottom: 1px solid var(--color-border);
}

.content-hero h1 {
    margin: 10px 0 0;
    font-size: 2.6rem;
    color: var(--color-primary);
}

.content-hero .page-lead {
    margin-top: 14px;
}

/* Filter pills */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-pill, 999px);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.filter-pill:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--color-accent);
}

.filter-pill.active {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-light));
    border-color: var(--color-accent);
    color: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}

/* Search box (FAQ / Articles) */
.content-search {
    margin-top: 24px;
    max-width: 480px;
    position: relative;
}

.content-search input[type="search"] {
    width: 100%;
    padding: 13px 18px 13px 44px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill, 999px);
    font-size: 0.95rem;
    color: var(--color-text);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a6555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 16px center;
    background-size: 18px;
}

.content-search input[type="search"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-gold-glow);
}

/* Article cards - richer treatment */
.article-card {
    position: relative;
    overflow: hidden;
    padding-top: 26px;
}

.article-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.article-card:hover::before {
    transform: scaleX(1);
}

.article-card h3 {
    line-height: 1.35;
}

.article-card p {
    line-height: 1.55;
}

.article-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}

.article-card-footer .muted {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-card-footer .card-arrow {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.article-card:hover .article-card-footer .card-arrow {
    transform: translateX(4px);
}

/* Featured article hero card */
.article-featured {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    background: linear-gradient(135deg, #fff 0%, var(--color-surface-alt) 100%);
    border: 1px solid var(--color-border-strong);
    border-radius: 14px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    color: var(--color-text);
    margin-bottom: 32px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-featured:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-gold-glow);
}

.article-featured .eyebrow {
    margin-bottom: 4px;
}

.article-featured h2 {
    margin: 8px 0 12px;
    font-size: 1.7rem;
    color: var(--color-primary);
    line-height: 1.3;
}

.article-featured p {
    color: var(--color-text-muted);
    font-size: 1.02rem;
    line-height: 1.6;
    max-width: 70ch;
}

.article-featured .card-arrow {
    color: var(--color-primary);
    font-weight: 700;
}

/* Article detail body */
.article-body {
    max-width: 760px;
}

.article-body p {
    margin: 0 0 16px;
    line-height: 1.7;
    color: var(--color-text);
}

.article-toc {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 20px 24px;
    max-width: 760px;
    margin-bottom: 28px;
}

.article-toc strong {
    color: var(--color-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Article comments */
.comment-form {
    max-width: 560px;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    box-shadow: 0 0 0 4px var(--color-surface), 0 0 0 5px var(--color-border);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 700px;
}

.comment-item {
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.comment-item-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.comment-item-header strong {
    color: var(--color-primary);
}

.comment-item p {
    margin: 0;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 40px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-pill, 999px);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.pagination-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--color-accent);
}

.pagination-status {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Legacy simple calculator page (kept for non-home pages) */
.calculator-page {
    max-width: 480px;
    margin: 60px auto;
    text-align: center;
    padding: 0 24px;
}

/* Newsletter band */
.newsletter-band {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    padding: 40px 0;
}

.newsletter-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.newsletter-band h2 {
    margin: 0 0 6px;
    color: #fff;
}

.newsletter-band p {
    margin: 0;
    color: var(--color-accent-light);
}

.newsletter-success {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e6b39;
    background: #eaf7ee;
    border: 1px solid #b3ddc0;
    border-radius: var(--radius, 6px);
    padding: 14px 18px;
}

.newsletter-success::before {
    content: "\2713";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #2f9e57;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.newsletter-form {
    display: flex;
    gap: 10px;
}

.newsletter-form input {
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius);
    min-width: 240px;
}

.newsletter-form button {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    background: var(--color-accent);
    color: var(--color-primary-dark);
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.newsletter-form button:hover {
    transform: translateY(-1px);
}

/* Footer */
.site-footer {
    background: var(--color-bg-alt);
    border-top: 3px solid var(--color-accent);
    padding: 40px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr;
    gap: 24px;
}

.footer-grid h3 {
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin: 0 0 12px;
}

.footer-grid ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-grid li {
    margin-bottom: 8px;
}

.footer-grid a {
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    transition: color 0.15s ease;
}

.footer-grid a:hover {
    color: var(--color-primary);
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    line-height: 1.2;
    font-weight: bold;
    letter-spacing: 0.02em;
    color: var(--color-primary);
    margin-bottom: 14px;
}

.footer-tagline {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin: 0 0 16px;
    max-width: 32ch;
}

.footer-social {
    display: flex;
    gap: 10px;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    font-size: 0.95rem;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.footer-social a:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.footer-contact-icon {
    flex-shrink: 0;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.footer-bottom p {
    margin: 0;
}

.footer-version {
    opacity: 0.6;
    font-size: 0.8em;
}

.footer-bottom-links {
    display: flex;
    gap: 20px;
}

.footer-bottom-links a {
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    transition: color 0.15s ease;
}

.footer-bottom-links a:hover {
    color: var(--color-primary);
}

@media (max-width: 900px) {
    .hero-grid,
    .card-grid,
    .articles-grid,
    .feature-grid,
    .steps-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    :root {
        --container-pad: 16px;
    }

    .hero,
    .content-hero {
        padding: 40px 0 28px;
    }

    .hero h1,
    .content-hero h1 {
        font-size: 2rem;
    }

    .hero-card,
    .tool-card,
    .about-col,
    .contact-card,
    .info-card {
        padding: 20px;
    }

    .section {
        padding: 40px 0;
    }

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

    .newsletter-inner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-form input {
        min-width: 0;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-row {
        flex-wrap: wrap;
    }

    .search-panel {
        width: min(340px, calc(100vw - 32px));
        right: -8px;
    }
}

/* ============================
   Dark theme
   ============================ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-primary: #e0a8b0;
        --color-primary-dark: #c98891;
        --color-primary-tint-10: #eabbc1;
        --color-secondary: #d9b25c;
        --color-secondary-dark: #c89b3c;
        --color-secondary-tint: #ecd08a;
        --color-bg: #1b1613;
        --color-surface: #241d19;
        --color-surface-alt: #2c2420;
        --color-bg-alt: #2c2420;
        --color-text: #f0e6da;
        --color-text-muted: #b8a996;
        --color-border: #4a3d33;
        --color-border-strong: #6b5842;

        --shadow-xs: 0 1px 2px rgb(0 0 0 / 30%);
        --shadow-sm: 0 2px 6px rgb(0 0 0 / 35%);
        --shadow-md: 0 6px 16px rgb(0 0 0 / 40%);
        --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
    }
}

:root[data-theme="dark"] {
    --color-primary: #e0a8b0;
    --color-primary-dark: #c98891;
    --color-primary-tint-10: #eabbc1;
    --color-secondary: #d9b25c;
    --color-secondary-dark: #c89b3c;
    --color-secondary-tint: #ecd08a;
    --color-bg: #1b1613;
    --color-surface: #241d19;
    --color-surface-alt: #2c2420;
    --color-bg-alt: #2c2420;
    --color-text: #f0e6da;
    --color-text-muted: #b8a996;
    --color-border: #4a3d33;
    --color-border-strong: #6b5842;

    --shadow-xs: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-sm: 0 2px 6px rgb(0 0 0 / 35%);
    --shadow-md: 0 6px 16px rgb(0 0 0 / 40%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
}

:root[data-theme="dark"] .site-header {
    background: linear-gradient(180deg, var(--color-surface), var(--color-bg-alt));
}

:root[data-theme="dark"] .hero {
    background: radial-gradient(circle at 15% 20%, var(--color-surface-alt) 0%, var(--color-bg-alt) 55%);
}

:root[data-theme="dark"] .content-hero {
    background: radial-gradient(circle at 15% 20%, var(--color-surface-alt) 0%, var(--color-bg-alt) 60%);
}

:root[data-theme="dark"] .article-featured {
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
}

:root[data-theme="dark"] .content-search input[type="search"] {
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8a996' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .site-header {
        background: linear-gradient(180deg, var(--color-surface), var(--color-bg-alt));
    }

    :root:not([data-theme="light"]) .hero {
        background: radial-gradient(circle at 15% 20%, var(--color-surface-alt) 0%, var(--color-bg-alt) 55%);
    }

    :root:not([data-theme="light"]) .content-hero {
        background: radial-gradient(circle at 15% 20%, var(--color-surface-alt) 0%, var(--color-bg-alt) 60%);
    }

    :root:not([data-theme="light"]) .article-featured {
        background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
    }

    :root:not([data-theme="light"]) .content-search input[type="search"] {
        background-color: var(--color-surface);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8a996' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    }
}

@media not all and (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-icon-moon { display: inline; }
    :root:not([data-theme]) .theme-icon-sun { display: none; }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-icon-moon { display: none; }
    :root:not([data-theme]) .theme-icon-sun { display: inline; }
}

:root[data-theme="light"] .theme-icon-moon { display: inline; }
:root[data-theme="light"] .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: inline; }

/* ============================
   Header search
   ============================ */
.header-search {
    position: relative;
}

.search-panel {
    display: none;
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    width: 340px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 16px;
    z-index: 50;
}

.search-panel.open {
    display: block;
}

.search-panel input[type="search"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill, 999px);
    font-size: 0.95rem;
    color: var(--color-text);
    background: var(--color-bg);
}

.search-panel input[type="search"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-gold-glow);
}

.search-panel-results {
    margin-top: 10px;
    max-height: 320px;
    overflow-y: auto;
}

.search-panel-results a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.92rem;
    transition: background 0.15s ease;
}

.search-panel-results a:hover,
.search-panel-results a.active {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

.search-panel-empty {
    padding: 10px 8px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.search-panel-hint {
    padding: 10px 8px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}
