/* =========================================================================
   Sleep Mechanic — styles.css
   System fonts only. CSS custom properties drive both themes.
   ========================================================================= */

/* ---------- Theme tokens ---------- */
:root,
[data-theme="light"] {
    --bg: #f6f4ef;
    --bg-alt: #efece4;
    --surface: #fffdf9;
    --surface-2: #f3f0e8;
    --text: #16202e;
    --text-muted: #4f5b6b;
    --border: #d8dde4;
    --border-strong: #c4ccd6;
    --accent-teal: #2f8f80;
    --accent-blue: #2c6e9b;
    --accent-amber: #d8841f;
    --accent-amber-soft: #f6e2c4;
    --shadow: 0 1px 2px rgba(22, 32, 46, .06), 0 8px 24px rgba(22, 32, 46, .06);
    --ring: rgba(44, 110, 155, .45);
}

[data-theme="dark"] {
    --bg: #0e1726;
    --bg-alt: #111d30;
    --surface: #16223a;
    --surface-2: #1b2a44;
    --text: #e8edf4;
    --text-muted: #9fb0c4;
    --border: #25344c;
    --border-strong: #34465f;
    --accent-teal: #5fb6a8;
    --accent-blue: #6aa9d6;
    --accent-amber: #f3a13c;
    --accent-amber-soft: #3a2e1c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
    --ring: rgba(106, 169, 214, .55);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5em; }
p { margin: 0 0 1rem; }
a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; }
.container.narrow { max-width: 780px; }

/* Accessible focus */
:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--accent-amber);
    color: #16202e;
    padding: .6rem 1rem;
    z-index: 200;
    border-radius: 0 0 8px 0;
    font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font: inherit;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .7rem 1.4rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .12s ease, box-shadow .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-lg { padding: .85rem 1.7rem; font-size: 1.02rem; }
.btn-block { width: 100%; }

.btn-primary {
    background: var(--accent-amber);
    color: #1a1206;
    box-shadow: 0 6px 18px -8px var(--accent-amber);
}
.btn-primary:hover { background: var(--accent-amber); filter: brightness(1.05); }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent-teal); }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 68px;
}
.logo { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; }
.logo:hover { text-decoration: none; }
.logo-mark { display: inline-flex; }
.logo-text { font-size: 1.15rem; letter-spacing: -0.02em; }
.logo-text-accent { color: var(--accent-teal); }

.primary-nav { display: flex; gap: 1.4rem; }
.primary-nav a { color: var(--text-muted); font-weight: 500; font-size: .95rem; }
.primary-nav a:hover { color: var(--text); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: .6rem; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
}
.theme-toggle:hover { border-color: var(--accent-teal); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px; height: 40px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    border-radius: 10px;
    cursor: pointer;
    padding: 0 10px;
}
.menu-toggle span {
    display: block; height: 2px; width: 100%;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0; }
.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent-teal);
    margin: 0 0 .8rem;
}
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 42ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.6rem 0 1rem; }
.trust-line { color: var(--text-muted); font-weight: 600; font-size: .95rem; }

/* Fault finder card */
.fault-finder { padding: 1.4rem; }
.fault-finder-head { display: flex; align-items: center; justify-content: space-between; }
.fault-finder-title { font-weight: 700; letter-spacing: -0.01em; }
.status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent-teal);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-teal) 22%, transparent);
}
.fault-finder-sub { color: var(--text-muted); font-size: .85rem; margin: .2rem 0 1rem; }
.diagnostic-list { display: grid; gap: .7rem; }
.diagnostic-list li { display: grid; grid-template-columns: 1fr 90px; align-items: center; gap: .8rem; font-size: .92rem; }
.diag-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.diag-bar i { display: block; height: 100%; width: var(--v); background: linear-gradient(90deg, var(--accent-teal), var(--accent-blue)); border-radius: 999px; }
.fault-finder-foot { margin: 1rem 0 0; font-size: .78rem; color: var(--text-muted); }

/* ---------- Sections ---------- */
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { max-width: 60ch; margin: 0 0 2.5rem; }
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.section-intro { color: var(--text-muted); font-size: 1.08rem; }
.subhead { font-size: 1.1rem; margin-top: 1.5rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1.6rem;
}
.card-grid { display: grid; gap: 1.2rem; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card h3 { font-size: 1.15rem; }
.card p { color: var(--text-muted); margin: 0; }
.card-icon {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--accent-teal);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

/* ---------- Sleep MOT ---------- */
.mot-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.check-list { display: grid; gap: .6rem; }
.check-list.two-col { grid-template-columns: 1fr 1fr; }
.check-list li {
    position: relative;
    padding-left: 1.7rem;
    color: var(--text-muted);
}
.check-list li::before {
    content: "";
    position: absolute; left: 0; top: .45em;
    width: 16px; height: 16px;
    border-radius: 5px;
    background:
        linear-gradient(var(--accent-teal), var(--accent-teal)) no-repeat center/9px 2px,
        var(--accent-amber-soft);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}
.check-list li::after {
    content: "";
    position: absolute; left: 5px; top: .5em;
    width: 4px; height: 8px;
    border: solid var(--accent-teal);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.mot-output { position: sticky; top: 90px; }
.output-list { display: grid; gap: .55rem; margin: .5rem 0 1.4rem; }
.output-list li { display: flex; align-items: center; gap: .8rem; font-weight: 600; padding: .55rem .2rem; border-bottom: 1px dashed var(--border); }
.output-list li:last-child { border-bottom: 0; }
.output-step { color: var(--accent-amber); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.step { position: relative; padding-top: 2.6rem; }
.step-number {
    position: absolute; top: 1.3rem; left: 1.6rem;
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--accent-amber-soft);
    color: var(--accent-amber);
    border: 1px solid var(--border-strong);
    font-weight: 700;
    transform: translateY(-2.2rem);
}

/* ---------- Pricing ---------- */
.pricing-grid { align-items: stretch; }
.price-card { display: flex; flex-direction: column; position: relative; }
.price-card .check-list { margin: 1rem 0 1.4rem; flex: 1; }
.price { margin: .3rem 0 .4rem; }
.price-amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.price-for { color: var(--text-muted); font-size: .95rem; }
.price-card.featured {
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 1px var(--accent-teal), var(--shadow);
}
.badge {
    position: absolute; top: -12px; right: 1.4rem;
    background: var(--accent-teal);
    color: #06231f;
    font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    padding: .3rem .7rem; border-radius: 999px;
}

/* ---------- FAQ ---------- */
.faq { display: grid; gap: .8rem; }
.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 1.2rem;
    box-shadow: var(--shadow);
}
.faq-item summary {
    cursor: pointer;
    list-style: none;
    padding: 1.1rem 2rem 1.1rem 0;
    font-weight: 600;
    position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+";
    position: absolute; right: .1rem; top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem; color: var(--accent-teal);
    transition: transform .25s ease;
}
.faq-item[open] summary::after { content: "–"; }
.faq-body { padding: 0 0 1.1rem; }
.faq-body p { color: var(--text-muted); margin: 0; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.contact-email { font-size: 1.2rem; font-weight: 700; margin: .4rem 0; }
.contact-alt { color: var(--text-muted); font-size: .95rem; }
.disclaimer { margin-top: 1.5rem; background: var(--surface-2); }
.disclaimer strong { display: block; margin-bottom: .4rem; color: var(--text); }
.disclaimer p { color: var(--text-muted); font-size: .92rem; margin: 0; }

.contact-form-wrap { padding: 1.8rem; }
.field { margin-bottom: 1.1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .4rem; }
.req { color: var(--accent-amber); }
input, textarea, select {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: .7rem .85rem;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--ring);
}
textarea { resize: vertical; }
.checkbox { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; cursor: pointer; }
.checkbox input { width: auto; margin-top: .25rem; }
.consent span { color: var(--text-muted); font-size: .92rem; }
.form-note { font-size: .82rem; color: var(--text-muted); margin: .8rem 0 0; text-align: center; }
.form-alert {
    background: var(--accent-amber-soft);
    border: 1px solid var(--accent-amber);
    color: var(--text);
    border-radius: 10px;
    padding: .8rem 1rem;
    margin-bottom: 1.2rem;
    font-weight: 600;
}
/* Honeypot — hidden from users, present for bots. */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 3rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr .8fr 1.6fr; gap: 2rem; }
.footer-brand p { color: var(--text-muted); font-size: .92rem; margin: .6rem 0 .3rem; }
.footer-links { display: grid; gap: .55rem; align-content: start; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }
.footer-disclaimer p { color: var(--text-muted); font-size: .82rem; margin: 0; }
.footer-bottom { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.footer-bottom p { color: var(--text-muted); font-size: .85rem; margin: 0; }

/* ---------- Simple pages (privacy / thank-you) ---------- */
.page { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.page h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.page h2 { font-size: 1.25rem; margin-top: 2rem; }
.page p, .page li { color: var(--text-muted); }
.page ul { display: grid; gap: .5rem; margin: 1rem 0; }
.page ul li { padding-left: 1.4rem; position: relative; }
.page ul li::before { content: "›"; position: absolute; left: 0; color: var(--accent-teal); font-weight: 700; }
.page .card { margin-top: 1.5rem; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; margin-top: 1.5rem; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; }
    .mot-grid, .contact-grid { grid-template-columns: 1fr; }
    .mot-output { position: static; }
    .cols-3, .steps { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .primary-nav {
        position: fixed;
        inset: 68px 0 auto 0;
        flex-direction: column;
        gap: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: .5rem 1.25rem 1rem;
        transform: translateY(-120%);
        transition: transform .28s ease;
        box-shadow: var(--shadow);
    }
    .primary-nav.open { transform: translateY(0); }
    .primary-nav a { padding: .85rem 0; border-bottom: 1px solid var(--border); font-size: 1.05rem; }
    .header-cta { display: none; }
    .menu-toggle { display: flex; }
    .cols-3, .steps { grid-template-columns: 1fr; }
    .check-list.two-col { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
}

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