/* ==========================================================
   Design tokens
   ========================================================== */
:root {
    --bg: #f6f7fd;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.72);
    --text: #0f172a;
    --text-soft: #475569;
    --text-faint: #94a3b8;
    --border: rgba(15, 23, 42, 0.08);

    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --accent: #06b6d4;
    --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);
    --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));

    --ok: #10b981;
    --bad: #e11d48;
    --bad-bg: #fff1f2;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 30px 80px rgba(99, 102, 241, 0.22);

    --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    --r-sm: 12px;
    --r-md: 18px;
    --r-lg: 28px;
}

:root[data-theme="dark"] {
    --bg: #080b1a;
    --surface: #11152d;
    --surface-glass: rgba(21, 26, 56, 0.7);
    --text: #f1f5f9;
    --text-soft: #a5b0c8;
    --text-faint: #64708f;
    --border: rgba(255, 255, 255, 0.09);
    --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    --bad-bg: rgba(225, 29, 72, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 30px 80px rgba(99, 102, 241, 0.25);
}

/* ==========================================================
   Base
   ========================================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
    margin: 0;
}

h1, h2, h3 {
    letter-spacing: -0.03em;
    line-height: 1.12;
}

a {
    color: inherit;
}

svg {
    display: block;
}

.wrap {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.55);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ==========================================================
   Navbar (glass)
   ========================================================== */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface-glass);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--border);
}

.nav .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--grad);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.brand-mark svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a {
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--text-soft);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.nav-links a:hover {
    background: var(--grad-soft);
    color: var(--text);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.icon-btn svg {
    width: 19px;
    height: 19px;
}

.icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .icon-btn .i-moon { display: none; }

@media (max-width: 680px) {
    .nav-links a { display: none; }
}

/* ---------- Footer ---------- */
.foot {
    position: relative;
    margin-top: 40px;
    padding: 64px 0 28px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 15px;
}

.foot::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--grad);
    opacity: 0.85;
}

.foot-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 40px 48px;
}

.foot-brand .brand { color: var(--text); font-weight: 800; }

.foot-brand p {
    max-width: 34ch;
    margin: 16px 0 0;
    line-height: 1.6;
}

.foot-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.foot-badges span {
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--grad-soft);
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 700;
}

.foot h4 {
    margin: 0 0 16px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.foot-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 11px;
}

.foot a {
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease, transform 0.15s ease;
}

.foot-col a:hover {
    color: var(--primary);
    transform: translateX(3px);
}

.foot-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 13.5px;
}

.foot-bottom a:hover { color: var(--primary); }

@media (max-width: 860px) {
    .foot-grid { grid-template-columns: 1fr 1fr; }
    .foot-brand { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
    .foot { padding-top: 48px; }
    .foot-bottom { flex-direction: column; align-items: flex-start; }
}

/* ---------- Mobile menu toggle ---------- */
.menu-btn { display: none; }
.menu-btn .i-close { display: none; }
.nav.open .menu-btn .i-bars { display: none; }
.nav.open .menu-btn .i-close { display: block; }
.mobile-menu { display: none; }

@media (max-width: 680px) {
    .menu-btn { display: inline-flex; }
    .nav-links .icon-btn:first-of-type { margin-left: 0; }
    .nav.open .mobile-menu {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 10px 16px 16px;
        border-top: 1px solid var(--border);
        background: var(--surface);
        box-shadow: var(--shadow-md);
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
    }
    .mobile-menu a {
        padding: 13px 14px;
        border-radius: 12px;
        color: var(--text);
        font-size: 16px;
        font-weight: 600;
        text-decoration: none;
    }
    .mobile-menu a:hover,
    .mobile-menu a[aria-current="page"] { background: var(--grad-soft); }
}
