* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    transition: background .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 720px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.site-main { min-height: calc(100vh - var(--header-h) - 200px); }

/* Header */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; transition: opacity .15s ease; }
.brand:hover { opacity: .85; }
.brand-mark { display: inline-flex; }
.brand-name { font-size: 1.25rem; letter-spacing: -.02em; }
.brand-name b { color: var(--brand); }

.primary-nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-link {
    background: none; border: none; color: var(--text-muted); font-size: .95rem;
    padding: 9px 14px; border-radius: var(--radius-sm); font-weight: 500;
    position: relative; transition: color .15s ease, background .15s ease;
}
.nav-link:hover { color: var(--text); background: var(--bg-alt); }
.nav-link.is-current { color: var(--brand); }
.nav-link.is-current::after {
    content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
    background: var(--brand); border-radius: 2px;
}
.nav-dropdown { position: static; }
.caret { font-size: .65rem; transition: transform .15s ease; }
.nav-trigger[aria-expanded="true"] .caret { transform: rotate(180deg); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-trigger {
    display: flex; align-items: center; gap: 8px; background: var(--bg-alt);
    border: 1px solid var(--border); color: var(--text-muted);
    padding: 8px 12px; border-radius: var(--radius-sm); font-size: .9rem;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.search-trigger:hover { color: var(--text); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.search-hint kbd {
    background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
    padding: 1px 6px; font-size: .75rem; font-family: var(--mono);
}
.theme-toggle {
    background: var(--bg-alt); border: 1px solid var(--border); color: var(--text);
    width: 40px; height: 40px; border-radius: var(--radius-sm); font-size: 1rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.theme-toggle:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

.nav-burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 8px; border-radius: var(--radius-sm); }
.nav-burger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-nav {
    display: none; border-top: 1px solid var(--border);
    background: var(--surface);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav-inner { display: flex; flex-direction: column; padding: 12px 20px 20px; }
.mobile-nav-link { display: flex; align-items: center; gap: 12px; padding: 13px 6px; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 500; }
.mobile-nav-link:hover { color: var(--brand); }
.mobile-nav-link.is-current { color: var(--brand); }
.mobile-nav-icon { width: 20px; height: 20px; color: var(--brand); flex: none; }
.mobile-nav-label { color: var(--text-faint); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin: 14px 6px 2px; }
.mobile-nav-divider { height: 1px; background: var(--border); margin: 12px 0 0; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: var(--radius-sm); font-weight: 600; font-size: .95rem;
    border: 1px solid transparent; transition: transform .08s ease, background .2s ease, box-shadow .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: var(--bg-alt); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--border); }

/* Sections */
.section { padding: 56px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; }
.section-head h2 { font-size: 1.6rem; letter-spacing: -.02em; }
.link-more { color: var(--brand); font-weight: 600; }
.page-head { margin-bottom: 32px; }
.page-head h1 { font-size: 2.2rem; letter-spacing: -.03em; }
.page-sub { color: var(--text-muted); margin-top: 8px; max-width: 680px; }
.center { text-align: center; }

/* Footer */
.site-footer { background: color-mix(in srgb, var(--bg-alt) 70%, var(--surface)); border-top: 1px solid var(--border); padding: 52px 0 22px; margin-top: 48px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1.1fr 1fr 1fr 1fr; gap: 36px; }
.footer-brand .brand-name { font-size: 1.25rem; letter-spacing: -.02em; }
.footer-brand .brand-name b { color: var(--brand); }
.footer-brand p { color: var(--text-muted); margin-top: 14px; max-width: 330px; font-size: .92rem; }
.footer-trust { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.footer-badge { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--border)); padding: 5px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.footer-col h4 { font-size: .95rem; margin-bottom: 14px; letter-spacing: -.01em; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-col a { color: var(--text-muted); font-size: .92rem; transition: color .15s ease; }
.footer-col a:hover { color: var(--brand); }
.footer-strong { color: var(--brand) !important; font-weight: 600; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 36px; padding-top: 20px; color: var(--text-faint); font-size: .85rem; }
.footer-legal { display: flex; align-items: center; gap: 10px; }
.footer-legal a { color: var(--text-muted); }
.footer-legal a:hover { color: var(--brand); }

/* Responsive */
@media (max-width: 1080px) {
    .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
    .primary-nav, .search-hint { display: none; }
    .nav-burger { display: flex; }
    .mobile-nav { display: block; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .page-head h1 { font-size: 1.7rem; }
    .section { padding: 40px 0; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}
