/* ==========================================================================
   LeashLink — marketing/legal site design system
   This stylesheet IS the style guide: tokens first, then components.
   Light ("The Porch") is the default; dark ("The Trail") is toggled via
   [data-theme="dark"], set before first paint by the inline script in
   marketing/base.html. Palette and typography follow brand_standards.html.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts — self-hosted woff2 from static/fonts/, populated by
   scripts/download-fonts.sh. Relative URLs keep this correct under any
   STATIC_URL prefix (runserver and Apache alike).
   -------------------------------------------------------------------------- */
@font-face {
    font-family: 'DM Serif Display';
    src: url('../fonts/DMSerifDisplay-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('../fonts/DMSans-VariableFont_opsz,wght.woff2') format('woff2-variations');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('../fonts/DMSans-Italic-VariableFont_opsz,wght.woff2') format('woff2-variations');
    font-weight: 300 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-VariableFont_wght.woff2') format('woff2-variations');
    font-weight: 400 600;
    font-style: normal;
    font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens — Light ("The Porch")
   -------------------------------------------------------------------------- */
:root, [data-theme="light"] {
    --bg: #F8F4EC;
    --bg-card: #FFFFFF;
    --bg-card-alt: #EDE6D8;
    --text: #1A332A;
    --text-muted: #6B6560;
    --border: #D6CCBA;

    --forest: #1A332A;
    --pine: #264D3B;
    --grove: #2F5A46;
    --fern: #3E7A5C;
    --meadow: #5B9E76;
    --cream: #F8F4EC;
    --linen: #EDE6D8;
    --sand: #B5A795;
    --terracotta: #C08B6E;
    --bark: #7A6252;
    --sage: #8AB89C;
    --cloud: #F4F1EA;
    --morning: #7BAFBE;
    --dusk: #A88EC0;

    --focus: #A96038;

    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 9999px;

    --shadow-sm: 0 2px 8px rgba(26, 51, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(26, 51, 42, 0.12), 0 2px 4px rgba(26, 51, 42, 0.08);
    --shadow-lg: 0 12px 28px rgba(26, 51, 42, 0.16), 0 4px 10px rgba(26, 51, 42, 0.10);
    --card-shadow: var(--shadow-sm);
    --nav-bg: #1A332A;

    --container: 960px;
    --container-narrow: 720px;

    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;

    color-scheme: light;
}

/* --------------------------------------------------------------------------
   Tokens — Dark ("The Trail")
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
    --bg: #1A332A;
    --bg-card: #264D3B;
    --bg-card-alt: #2F5A46;
    --text: #F4F1EA;
    --text-muted: #8EA699;
    --border: #3A6B54;
    --nav-bg: #264D3B;
    --focus: #E8A87C;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.32);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.40);
    --card-shadow: var(--shadow-sm);
    color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1rem;
}
main.container { padding-top: 1.5rem; padding-bottom: 3rem; }

/* Accessibility helpers */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}
.skip-link:focus { left: 0.75rem; top: 0.75rem; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

::selection { background: var(--fern); color: #fff; }

/* ── Page Glow ───────────────────────────────────── */
.page-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--fern) 12%, transparent) 0, transparent 30%),
        radial-gradient(circle at bottom right, color-mix(in srgb, var(--morning) 10%, transparent) 0, transparent 28%);
    z-index: -1;
}

/* ── Typography ──────────────────────────────────── */
h1, h2 {
    font-family: var(--font-display);
    font-weight: 400;
}
h1 { font-size: 2.2rem; line-height: 1.2; margin-bottom: 0.75rem; }
h2 { font-size: 1.6rem; line-height: 1.25; margin-bottom: 0.5rem; }
h3 {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
p { margin-bottom: 1rem; }
a { color: var(--meadow); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--fern); }
[data-theme="dark"] a:hover { color: var(--sage); }
.text-muted { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Header / navigation — sticky, translucent, blurred
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--nav-bg), transparent 10%);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}
.nav-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    color: var(--cloud);
}
.nav-inner .brand {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.3rem;
    margin-right: auto;
}
.nav-inner .brand a { color: var(--cloud); padding: 0.25rem 0; }
.nav-inner .brand a:hover { color: #fff; }
.nav-inner a {
    color: var(--sage);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    transition: color var(--transition-fast), background var(--transition-fast);
}
.nav-inner a:hover { color: var(--cloud); background: rgba(255, 255, 255, 0.08); }
.nav-inner a[aria-current="page"] {
    color: var(--cloud);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
}
/* the wordmark keeps aria-current for a11y but never the pill treatment */
.nav-inner .brand a[aria-current="page"] { background: none; }

/* ── Theme Toggle ────────────────────────────────── */
.theme-toggle {
    background: none;
    border: 1px solid var(--sage);
    border-radius: var(--radius-pill);
    cursor: pointer;
    padding: 0.3rem;
    margin-left: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sage);
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.theme-toggle:hover { border-color: var(--cloud); color: var(--cloud); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    background: var(--fern);
    color: #fff;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-fast), border-color var(--transition-fast),
                transform 100ms ease, box-shadow var(--transition-base);
    border: 2px solid var(--fern);
}
.btn:hover {
    background: var(--grove);
    border-color: var(--grove);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-outline {
    background: transparent;
    color: var(--fern);
    border: 2px solid var(--fern);
    box-shadow: none;
}
.btn-outline:hover { background: var(--fern); color: #fff; }
[data-theme="dark"] .btn-outline { color: var(--meadow); border-color: var(--meadow); }
[data-theme="dark"] .btn-outline:hover { background: var(--meadow); color: var(--forest); }
.btn-large { padding: 0.75rem 1.8rem; font-size: 1.05rem; }

/* ── Cards ────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}
.card-lift,
.card.feature-card,
.card.cta-card,
.card.platform-card {
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}
.card-lift:hover,
.card.feature-card:hover,
.card.cta-card:hover,
.card.platform-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--fern) 45%, var(--border));
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* ── Sections ─────────────────────────────────────── */
section { margin-bottom: 3rem; }
section > h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.6rem;
}
section > h2::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 48px;
    height: 3px;
    border-radius: var(--radius-pill);
    background: var(--terracotta);
}

/* ── Hero (shared across pages) ───────────────────── */
.hero {
    text-align: center;
    padding: 3.5rem 1rem 3rem;
}
.hero h1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    max-width: 700px;
    margin: 0 auto 0.75rem;
}
.hero-sub {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto 1.75rem;
    line-height: 1.6;
}
.hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Feature Cards ────────────────────────────────── */
.feature-card {
    text-align: center;
    padding: 2rem 1.5rem;
}
.feature-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.75rem;
}
.feature-icon svg {
    width: 40px;
    height: 40px;
    color: var(--fern);
}
.feature-card h3 { color: var(--fern); }
[data-theme="dark"] .feature-card h3 { color: var(--sage); }
[data-theme="dark"] .feature-icon svg { color: var(--sage); }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0; }

/* ── Steps ────────────────────────────────────────── */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    counter-reset: step;
}
.step {
    text-align: center;
    counter-increment: step;
}
.step::before {
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--fern);
    color: #fff;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}
.step h3 { margin-bottom: 0.25rem; }
.step p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0; }

/* ── Benefit Lists ────────────────────────────────── */
.benefit-list {
    list-style: none;
    padding: 0;
}
.benefit-list li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}
.benefit-list li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--fern);
    font-weight: 700;
}
[data-theme="dark"] .benefit-list li::before { color: var(--sage); }

/* ── FAQ (details/summary) ────────────────────────── */
details {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 0.5rem;
    transition: border-color var(--transition-fast);
}
details:hover { border-color: color-mix(in srgb, var(--fern) 45%, var(--border)); }
details summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-lg);
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
    content: "+";
    color: var(--fern);
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
}
[data-theme="dark"] details summary::before { color: var(--sage); }
details[open] summary::before { content: "\2212"; }
details .answer {
    padding: 0 1rem 1rem 2.7rem;
    color: var(--text-muted);
}
details .answer p:last-child { margin-bottom: 0; }
.faq-group { margin-bottom: 2rem; }
.faq-group > h3 { margin-bottom: 0.75rem; color: var(--fern); }
[data-theme="dark"] .faq-group > h3 { color: var(--sage); }

/* ── App Badges ───────────────────────────────────── */
.app-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.app-links.centered { justify-content: center; }
.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1.2rem;
    min-width: 175px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--card-shadow);
    transition: border-color var(--transition-fast), transform var(--transition-base), box-shadow var(--transition-base);
    text-decoration: none;
}
.app-badge:hover {
    border-color: var(--fern);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.app-badge svg { flex-shrink: 0; width: 24px; height: 24px; color: var(--text); }
.app-badge .badge-text { display: flex; flex-direction: column; align-items: flex-start; }
.app-badge .eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1;
}
.app-badge .label {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

/* ── Stat Counters ────────────────────────────────── */
.stat {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--fern);
    display: block;
    line-height: 1.2;
}
[data-theme="dark"] .stat { color: var(--sage); }
.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
}

/* ── Dual CTA ─────────────────────────────────────── */
.dual-cta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.cta-card {
    text-align: center;
    padding: 2.5rem 1.5rem;
}
.cta-card h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}
.cta-card p { color: var(--text-muted); margin-bottom: 1.25rem; }

/* --------------------------------------------------------------------------
   Footer — full-bleed band with three columns
   -------------------------------------------------------------------------- */
.site-footer {
    background: var(--bg-card-alt);
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 2.5rem 1rem 1.5rem;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.2fr;
    gap: 2rem;
    align-items: start;
    text-align: left;
}
.footer-brand .wordmark {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text);
    display: block;
    margin-bottom: 0.5rem;
}
.footer-brand p { max-width: 32ch; margin-bottom: 0; }
.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.footer-links a { color: var(--bark); width: fit-content; }
[data-theme="dark"] .footer-links a { color: var(--sage); }
.footer-links a:hover { color: var(--fern); }
[data-theme="dark"] .footer-links a:hover { color: var(--cloud); }
.footer-apps p { margin-bottom: 0.5rem; }
.footer-apps .app-links { justify-content: flex-start; }
.footer-note {
    max-width: var(--container);
    margin: 0 auto;
    padding: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
}

/* ── Legal Prose ──────────────────────────────────── */
.legal-prose { max-width: var(--container-narrow); margin: 0 auto; }
.legal-prose h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.legal-prose h2 { font-size: 1.25rem; margin-top: 1.75rem; margin-bottom: 0.5rem; }
.legal-prose ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.legal-prose .effective { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 900px) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .footer-apps { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }
    .btn-large { padding: 0.65rem 1.4rem; font-size: 0.95rem; }
    .app-badge { min-width: 0; width: 100%; justify-content: center; }
    .steps { grid-template-columns: 1fr 1fr; }
    .nav-inner a { padding: 0.3rem 0.5rem; }
    .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
}

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

/* ── Print ────────────────────────────────────────── */
@media print {
    .site-header, .site-footer, .theme-toggle, .btn, .app-links, .page-glow {
        display: none !important;
    }
    body { background: #fff; color: #000; }
    a { color: #000; text-decoration: underline; }
}
