/* =====================================================================
   KHANZA - Stylesheet
   ===================================================================== */

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-alt: #eef2f6;
    --text: #18202b;
    --muted: #5b6676;
    --border: #dde3ea;
    --primary: #0f766e;
    --primary-hover: #0b5f58;
    --primary-soft: #d5f0ec;
    --on-primary: #ffffff;
    --success-bg: #e3f6ea;
    --success-text: #1d6b3a;
    --error-bg: #fde8e8;
    --error-text: #9b1c1c;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1419;
        --surface: #171e26;
        --surface-alt: #131a21;
        --text: #e6ebf1;
        --muted: #9aa6b5;
        --border: #2a3440;
        --primary: #2dd4bf;
        --primary-hover: #5eead4;
        --primary-soft: #123a36;
        --on-primary: #06201d;
        --success-bg: #12301f;
        --success-text: #86e0a8;
        --error-bg: #3a1717;
        --error-text: #f5a3a3;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    }
}

:root[data-theme="dark"] {
    --bg: #0f1419;
    --surface: #171e26;
    --surface-alt: #131a21;
    --text: #e6ebf1;
    --muted: #9aa6b5;
    --border: #2a3440;
    --primary: #2dd4bf;
    --primary-hover: #5eead4;
    --primary-soft: #123a36;
    --on-primary: #06201d;
    --success-bg: #12301f;
    --success-text: #86e0a8;
    --error-bg: #3a1717;
    --error-text: #f5a3a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: var(--primary); }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 680px; }
.muted { color: var(--muted); }
.center { text-align: center; }

.skip-link {
    position: absolute; left: -9999px; top: 8px;
    background: var(--primary); color: var(--on-primary);
    padding: 8px 12px; border-radius: 6px; z-index: 100;
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.brand-mark {
    display: grid; place-items: center; width: 34px; height: 34px;
    border-radius: 9px; background: var(--primary); color: var(--on-primary); font-weight: 800;
}

.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
    display: block; padding: 8px 14px; border-radius: 8px;
    color: var(--muted); text-decoration: none; font-weight: 500;
}
.site-nav a:hover { color: var(--text); background: var(--surface-alt); }
.site-nav a.active { color: var(--primary); background: var(--primary-soft); }

.theme-toggle {
    display: grid; place-items: center; width: 38px; height: 38px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-alt); }

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

/* ---------- Main ---------- */
.site-main { flex: 1; }

.hero { padding: 96px 0 80px; background: linear-gradient(180deg, var(--primary-soft), var(--bg)); }
.hero-inner { max-width: 760px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 600; color: var(--primary); margin-bottom: .5em; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 3.8rem); letter-spacing: -.02em; }
.lead { font-size: 1.15rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.page-head { padding: 64px 0 32px; }
.page-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); }
.big-code { font-size: 5rem; font-weight: 800; color: var(--primary); margin: 0; line-height: 1; }

.section { padding: 56px 0; }
.section-alt { background: var(--surface-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title { font-size: 1.6rem; margin-bottom: 1em; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card h3 { font-size: 1.15rem; }
.card p { color: var(--muted); margin: 0; }
.card-icon {
    display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 14px;
    border-radius: 10px; background: var(--primary-soft); color: var(--primary);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-block { width: 100%; }

/* ---------- Clock ---------- */
.clock-wrap { text-align: center; }
.clock { font-size: clamp(2.5rem, 9vw, 4.5rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--primary); }
.clock-date { margin-top: .25em; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.checklist li {
    position: relative; padding: 14px 16px 14px 48px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.checklist li::before {
    content: "✓"; position: absolute; left: 14px; top: 13px;
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .8rem;
}

/* ---------- Form ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; }
.counter { font-weight: 400; font-size: .85rem; }
.field input, .field textarea {
    width: 100%; padding: 11px 13px; font: inherit; color: var(--text);
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field [aria-invalid="true"] { border-color: var(--error-text); }
.field-error { color: var(--error-text); font-size: .9rem; margin: 0; }

.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

.alert { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 20px; font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 0; font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner p { margin: 0; }

/* ---------- Reveal animation ---------- */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
    .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .nav-toggle { display: flex; }
    .site-nav {
        position: absolute; top: 64px; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 8px;
        padding: 12px 16px 16px; background: var(--surface);
        border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
        display: none;
    }
    .site-nav.open { display: flex; }
    .site-nav ul { flex-direction: column; }
    .theme-toggle { width: 100%; }
    .hero { padding: 64px 0 56px; }
    .footer-inner { flex-direction: column; }
}
