/* ───────────────────────────────────────────────────────────────
 * Time Meter marketing site.
 *
 * The whole page re-skins off `html[data-theme]` — Clay (default),
 * Paper, or Mono. Each theme swaps colour tokens, fonts, radii,
 * border weights and shadow language. The JS toggle in the nav
 * updates the attribute, the CSS does the rest.
 * ─────────────────────────────────────────────────────────────── */

/* ───── Clay (default) ───── */
:root {
    --bg:        oklch(0.97 0.015 265);
    --surface:   #ffffff;
    --ink:       oklch(0.28 0.04 265);
    --ink-soft:  oklch(0.5 0.03 265);
    --ink-mute:  oklch(0.65 0.02 265);
    --hair:      oklch(0.9 0.015 265);
    --track:     oklch(0.94 0.02 265);
    --accent:    oklch(0.7 0.14 265);
    --accent-05: oklch(0.7 0.14 265 / 0.05);
    --accent-10: oklch(0.7 0.14 265 / 0.10);
    --accent-20: oklch(0.7 0.14 265 / 0.20);

    --radius:    20px;
    --radius-lg: 28px;

    /* Card chrome — Clay uses a soft dual shadow, no border. */
    --card-border: 0 solid transparent;
    --card-shadow: 0 1px 3px rgba(40, 60, 120, 0.06),
                   0 8px 24px rgba(40, 60, 120, 0.05);
    --card-shadow-lg: 0 2px 6px rgba(40, 60, 120, 0.08),
                      0 24px 48px rgba(40, 60, 120, 0.08);

    /* Typography */
    --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --font-ui:      "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --h-weight:     400;
    --h-tracking:   -0.02em;
    --h-case:       none;

    /* Hero halo — tinted blob behind the phone mockup. */
    --halo: radial-gradient(circle at 50% 30%, var(--accent-20), transparent 65%);
}

/* ───── Paper ───── */
[data-theme="paper"] {
    --bg:        oklch(0.985 0.006 85);
    --surface:   #ffffff;
    --ink:       oklch(0.22 0.012 60);
    --ink-soft:  oklch(0.45 0.01 60);
    --ink-mute:  oklch(0.62 0.008 60);
    --hair:      oklch(0.88 0.008 60);
    --track:     oklch(0.94 0.012 60);
    --accent:    oklch(0.68 0.15 55);
    --accent-05: oklch(0.68 0.15 55 / 0.05);
    --accent-10: oklch(0.68 0.15 55 / 0.10);
    --accent-20: oklch(0.68 0.15 55 / 0.20);

    --radius:    14px;
    --radius-lg: 22px;

    /* Paper prefers borders over shadows. */
    --card-border: 1px solid var(--hair);
    --card-shadow: none;
    --card-shadow-lg: none;

    --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
    --font-ui:      "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --h-weight:     500;
    --h-tracking:   -0.015em;
    --h-case:       none;

    --halo: radial-gradient(circle at 50% 30%, var(--accent-10), transparent 65%);
}

/* ───── Mono ───── */
[data-theme="mono"] {
    --bg:        #ffffff;
    --surface:   #ffffff;
    --ink:       #0a0a0a;
    --ink-soft:  #3d3d3d;
    --ink-mute:  #8a8a8a;
    --hair:      #e4e4e4;
    --track:     #f0f0f0;
    --accent:    #0a0a0a;
    --accent-05: rgba(10, 10, 10, 0.05);
    --accent-10: rgba(10, 10, 10, 0.10);
    --accent-20: rgba(10, 10, 10, 0.22);

    --radius:    2px;
    --radius-lg: 2px;

    /* Brutalist offset drop shadow + hard ink border. */
    --card-border: 1.5px solid var(--ink);
    --card-shadow: 4px 4px 0 var(--ink);
    --card-shadow-lg: 6px 6px 0 var(--ink);

    --font-display: "JetBrains Mono", ui-monospace, monospace;
    --font-ui:      "JetBrains Mono", ui-monospace, monospace;
    --h-weight:     700;
    --h-tracking:   -0.01em;
    --h-case:       uppercase;

    --halo: none;
}

/* ───── Reset ───── */

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; height: auto; display: block; }

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

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--h-weight);
    letter-spacing: var(--h-tracking);
    text-transform: var(--h-case);
    line-height: 1.08;
    margin: 0;
    color: var(--ink);
}
h1 { font-size: clamp(2.4rem, 5vw + 1rem, 4.5rem); }
h2 { font-size: clamp(1.8rem, 3vw + 0.8rem, 3rem); }
h3 { font-size: 1.5rem; letter-spacing: -0.01em; }
h4 { font-size: 1.25rem; letter-spacing: -0.01em; }

/* Mono shrinks headline size a touch — monospaced type sets wider per-character
   than a proportional serif, so the uppercase treatment can overflow if kept
   at full Clay sizing. */
[data-theme="mono"] h1 { font-size: clamp(2rem, 4vw + 0.8rem, 3.4rem); letter-spacing: 0; }
[data-theme="mono"] h2 { font-size: clamp(1.5rem, 2.5vw + 0.6rem, 2.4rem); letter-spacing: 0; }

p { margin: 0; color: var(--ink-soft); }

.wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 40px);
}

.eyebrow {
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-mute);
    margin: 0 0 14px;
}

/* ───── Nav + theme toggle ───── */

.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in oklch, var(--bg) 85%, transparent);
    backdrop-filter: saturate(1.2) blur(14px);
    -webkit-backdrop-filter: saturate(1.2) blur(14px);
    border-bottom: 1px solid var(--hair);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    flex-wrap: wrap;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: var(--h-weight);
    letter-spacing: var(--h-tracking);
    text-transform: var(--h-case);
    color: var(--ink);
}
.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-20);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
[data-theme="mono"] .brand-dot {
    border-radius: 0;
    box-shadow: 2px 2px 0 var(--ink);
}

/* Segmented control — mirrors the in-app ClaySegmentedControl. */
.theme-toggle {
    display: inline-flex;
    padding: 4px;
    gap: 2px;
    background: var(--track);
    border-radius: 999px;
    transition: background-color 0.3s ease, border 0.3s ease;
}
[data-theme="mono"] .theme-toggle {
    padding: 0;
    gap: 0;
    background: var(--surface);
    border: 1.5px solid var(--ink);
    border-radius: 0;
}
.theme-seg {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    background: transparent;
    padding: 8px 18px;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.theme-seg:hover { color: var(--ink); }
.theme-seg.is-active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.theme-seg:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
[data-theme="mono"] .theme-seg {
    border-radius: 0;
    padding: 9px 20px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-left: 1.5px solid var(--ink);
}
[data-theme="mono"] .theme-seg:first-child { border-left: 0; }
[data-theme="mono"] .theme-seg.is-active {
    background: var(--ink);
    color: var(--surface);
    box-shadow: none;
}

.nav-cta {
    display: inline-flex;
    align-items: center;
    padding: 9px 18px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    color: var(--surface);
    background: var(--ink);
    border-radius: 999px;
    transition: transform 0.18s ease, background-color 0.3s ease, color 0.3s ease;
}
.nav-cta:hover { transform: translateY(-1px); }
[data-theme="mono"] .nav-cta {
    border-radius: 0;
    border: 1.5px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 720px) {
    .nav-inner {
        justify-content: center;
    }
    .theme-toggle { order: 3; flex-basis: 100%; justify-content: center; }
}

/* ───── Hero ───── */

.hero {
    padding: clamp(24px, 4vw, 56px) 0 clamp(32px, 5vw, 72px);
    overflow: hidden;
}
.hero-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(40px, 6vw, 72px);
    align-items: center;
}
@media (min-width: 900px) {
    .hero-inner { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}
.hero-copy h1 {
    margin-bottom: 22px;
}
.lede {
    font-size: clamp(1rem, 0.6vw + 0.9rem, 1.2rem);
    max-width: 44ch;
    color: var(--ink-soft);
}
.cta-row {
    margin-top: 32px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.btn-store img {
    height: 54px;
    width: auto;
    transition: transform 0.2s ease;
}
.btn-store:hover img { transform: translateY(-2px); }
.btn-ghost {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink-soft);
    padding: 16px 22px;
    border-radius: 999px;
    border: 1px solid var(--hair);
    transition: color 0.18s ease, border-color 0.18s ease, border-radius 0.3s ease;
}
.btn-ghost:hover {
    color: var(--ink);
    border-color: var(--ink-mute);
}
[data-theme="mono"] .btn-ghost {
    border-radius: 0;
    border: 1.5px solid var(--ink);
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hero-phone {
    position: relative;
    justify-self: center;
    width: 100%;
    max-width: 320px;
}
.phone-shell {
    position: relative;
    border-radius: calc(var(--radius-lg) + 12px);
    padding: 10px;
    background: var(--surface);
    box-shadow: var(--card-shadow-lg);
    border: var(--card-border);
    transition: border 0.3s ease, box-shadow 0.3s ease, border-radius 0.3s ease, background-color 0.3s ease;
}
.phone-shell img {
    border-radius: var(--radius-lg);
    display: block;
    transition: border-radius 0.3s ease;
}
[data-theme="mono"] .phone-shell { border-radius: 0; }
[data-theme="mono"] .phone-shell img { border-radius: 0; }
.phone-halo {
    position: absolute;
    inset: -60px;
    background: var(--halo);
    filter: blur(30px);
    z-index: -1;
    pointer-events: none;
    transition: background 0.3s ease;
}

/* ───── Features ───── */

.features {
    padding: clamp(40px, 6vw, 72px) 0;
    background: color-mix(in oklch, var(--surface) 50%, var(--bg));
    border-top: 1px solid var(--hair);
    border-bottom: 1px solid var(--hair);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.section-head {
    max-width: 680px;
    margin: 0 auto clamp(24px, 4vw, 48px);
    text-align: center;
}
.section-head .eyebrow { text-align: center; }
.section-lede {
    margin-top: 18px;
    font-size: 1.05rem;
    color: var(--ink-soft);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
@media (min-width: 900px) {
    .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--card-shadow);
    border: var(--card-border);
    transition: transform 0.22s ease, box-shadow 0.22s ease,
                border 0.3s ease, border-radius 0.3s ease, background-color 0.3s ease;
}
.feature-card:hover {
    transform: translateY(-3px);
}
.feature-card h3 { margin-bottom: 8px; color: var(--ink); }
.feature-card p { font-size: 15px; }

.feature-shot {
    margin: -4px -4px 20px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--hair);
    transition: border-radius 0.3s ease, border-color 0.3s ease;
}
[data-theme="mono"] .feature-shot {
    border: 1.5px solid var(--ink);
}
.feature-shot img {
    width: 100%;
    height: auto;
    display: block;
}

/* ───── Footer ───── */

.footer {
    padding: 40px 0 56px;
    border-top: 1px solid var(--hair);
    transition: border-color 0.3s ease;
}
.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
}
.footer a { color: var(--ink-soft); transition: color 0.18s ease; }
.footer a:hover { color: var(--accent); }
.footer .muted { color: var(--ink-mute); font-size: 13px; }

/* ───── Accessibility ───── */

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