/*
 * HOA-Fees.com design system
 *
 * Single source of truth for color, type, spacing, and the shared chrome
 * (header, nav, cards, buttons, footer). Every template loads this file and
 * then adds only page-specific rules, so a change here reaches the whole site.
 *
 * Roboto is loaded as a variable font in partials/head.html, with the system
 * stack as its fallback. The webfont costs a third-party request, so it is
 * loaded with preconnect and display=swap to keep it off the critical render
 * path; see the comment there.
 *
 * Data visualization colors are deliberately NOT defined here. The map marker
 * palette lives with the map code, since those colors carry meaning.
 */

/*
 * Light is the default theme. Dark is opt-in via a data-theme attribute set on
 * <html>, deliberately NOT via prefers-color-scheme: a visitor on a
 * dark-by-default OS should still land on the light site unless they ask
 * otherwise. partials/head.html applies the stored choice before first paint.
 */
:root {
    color-scheme: light;

    /* Neutrals - the site is mostly these */
    --ink: #0f172a;
    --ink-soft: #334155;
    --ink-muted: #64748b;
    --ink-faint: #94a3b8;
    --surface: #ffffff;
    --surface-sunken: #f6f8fb;
    --surface-raised: #ffffff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* One accent, used sparingly so it still means "act here" */
    --accent: #1d4ed8;
    --accent-hover: #1a3fb8;
    --accent-soft: #eef2ff;
    --accent-border: #c7d2fe;
    /* Text and icons drawn on top of --accent */
    --on-accent: #ffffff;

    /* Status */
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --success: #15803d;
    --success-soft: #f0fdf4;

    /* Leaflet tiles are light artwork; in dark mode the map panel keeps its
     * own light chrome rather than being filtered, which would distort the
     * marker colors that carry meaning. */
    --map-chrome: #ffffff;
    --map-chrome-ink: #334155;

    /* Type scale */
    /* Roboto first, with the system stack behind it so text still renders
     * in a sensible face if the webfont fails or is still loading. */
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI',
        'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Consolas,
        'Liberation Mono', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;

    /* Spacing - a 4px scale keeps vertical rhythm consistent */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;

    /* Shadows kept shallow. Heavy drop shadows are the single strongest
     * "built in 2014" signal; borders do the same job more cleanly. */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 4px 16px rgba(15, 23, 42, 0.08);

    --header-height: 60px;
    --content-max: 1400px;
    --prose-max: 720px;
}

html[data-theme='dark'] {
    color-scheme: dark;

    --ink: #e8edf5;
    --ink-soft: #c8d3e2;
    --ink-muted: #94a3b8;
    --ink-faint: #6b7c93;
    --surface: #131a26;
    --surface-sunken: #0b0f16;
    --surface-raised: #161f2e;
    --border: #263449;
    --border-strong: #37496380;

    /* Lightened so it clears contrast requirements on a dark background,
     * which also means text on top of it has to go dark. */
    --accent: #7aa2ff;
    --accent-hover: #9cbaff;
    --accent-soft: #1b2740;
    --accent-border: #33496f;
    --on-accent: #0b1220;

    --danger: #fca5a5;
    --danger-soft: #2a1719;
    --danger-border: #4a2427;
    --success: #6ee7a8;
    --success-soft: #10251b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.45);
}

/* ---------------------------------------------------------------- reset */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--ink-soft);
    background: var(--surface-sunken);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

/* Visible keyboard focus everywhere. The previous styles removed outlines on
 * focus without replacing them, which left keyboard users with no cursor. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ----------------------------------------------------------- typography */

h1,
h2,
h3,
h4 {
    color: var(--ink);
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -0.01em;
}

h1 {
    font-size: var(--text-3xl);
    letter-spacing: -0.02em;
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-lg);
}

h4 {
    font-size: var(--text-base);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.muted {
    color: var(--ink-muted);
}

.text-sm {
    font-size: var(--text-sm);
}

/* ---------------------------------------------------------------- layout */

.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5);
}

.container--prose {
    max-width: var(--prose-max);
}

/* Pushes the footer to the bottom on short pages */
.site-main {
    flex: 1 0 auto;
}

/* ---------------------------------------------------------------- header */

/*
 * A slim bar with a wordmark and navigation, rather than a tall colored
 * banner. The page's own <h1> then sits in the content area where it belongs,
 * which also means the h1 describes the page instead of the site.
 */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header__inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--space-5);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
}

.wordmark {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    font-size: var(--text-lg);
    font-weight: 680;
    color: var(--ink);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.wordmark:hover {
    text-decoration: none;
}

.wordmark__accent {
    color: var(--accent);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
}

.site-nav a {
    display: inline-block;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 550;
    color: var(--ink-soft);
}

.site-nav a:hover {
    background: var(--surface-sunken);
    color: var(--ink);
    text-decoration: none;
}

.site-nav a[aria-current='page'] {
    color: var(--accent);
    background: var(--accent-soft);
}

.site-nav .site-nav__cta {
    background: var(--accent);
    color: var(--on-accent);
    padding: var(--space-2) var(--space-4);
    margin-left: var(--space-2);
}

.site-nav .site-nav__cta:hover {
    background: var(--accent-hover);
    color: var(--on-accent);
}

/* --------------------------------------------------------- theme toggle */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-left: var(--space-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--surface-sunken);
    color: var(--ink);
    border-color: var(--border-strong);
}

.theme-toggle svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Show whichever icon represents the mode you would switch TO */
.theme-toggle__moon {
    display: block;
}

.theme-toggle__sun {
    display: none;
}

html[data-theme='dark'] .theme-toggle__moon {
    display: none;
}

html[data-theme='dark'] .theme-toggle__sun {
    display: block;
}

/* ------------------------------------------------------------ page intro */

.page-intro {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5) 0;
}

.page-intro h1 {
    margin-bottom: var(--space-2);
}

.page-intro p {
    color: var(--ink-muted);
    font-size: var(--text-lg);
    max-width: 60ch;
}

/* ----------------------------------------------------------------- cards */

.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.card--flush {
    padding: 0;
    overflow: hidden;
}

.card__title {
    font-size: var(--text-sm);
    font-weight: 620;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    margin-bottom: var(--space-4);
}

/* --------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    color: var(--on-accent);
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-sunken);
    border-color: var(--ink-faint);
}

/* ---------------------------------------------------------------- inputs */

.field {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: var(--text-base);
}

.field::placeholder {
    color: var(--ink-faint);
}

.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ------------------------------------------------------------ trust band */

.trust-band {
    margin-top: var(--space-7);
}

.trust-band > h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-5);
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}

.trust-item {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.trust-item__figure {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin-bottom: var(--space-2);
}

.trust-item h3 {
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
}

.trust-item p {
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

/* The limitations paragraph is part of the trust argument, not a disclaimer
 * to bury - so it gets the same visual weight as the claims above it. */
.trust-limits {
    margin-top: var(--space-4);
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

.trust-limits strong {
    color: var(--ink);
}

/* ---------------------------------------------------------------- footer */

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: var(--space-8);
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

.site-footer__inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    justify-content: space-between;
}

.site-footer__brand {
    max-width: 34ch;
}

.site-footer__brand .wordmark {
    margin-bottom: var(--space-2);
}

.site-footer__links {
    display: flex;
    gap: var(--space-7);
    flex-wrap: wrap;
}

.site-footer__col h4 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    margin-bottom: var(--space-3);
}

.site-footer__col ul {
    list-style: none;
    display: grid;
    gap: var(--space-2);
}

.site-footer__col a {
    color: var(--ink-soft);
}

.site-footer__legal {
    border-top: 1px solid var(--border);
    padding: var(--space-4) var(--space-5);
    text-align: center;
    font-size: var(--text-xs);
    color: var(--ink-faint);
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 720px) {
    :root {
        --text-3xl: 1.75rem;
        --text-2xl: 1.375rem;
    }

    .site-header__inner {
        padding: 0 var(--space-4);
        gap: var(--space-3);
    }

    .container,
    .page-intro {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .site-nav a {
        padding: var(--space-2);
    }

    .site-nav .site-nav__cta {
        margin-left: 0;
        padding: var(--space-2) var(--space-3);
    }

    .site-footer__inner {
        flex-direction: column;
        gap: var(--space-5);
    }

    .site-footer__links {
        gap: var(--space-6);
    }
}

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