:root,
[data-theme="dark"] {
    --bg-window: #121314;
    --bg-chrome: #18191B;
    --bg-surface: #222427;
    --bg-hover: #2A2D32;
    --bg-active: #2F3238;
    --border: #2C2F35;
    --text-primary: #F0F1F2;
    --text-muted: #A8ADB5;
    --accent-text: #F2A477;
    --accent-fill: #F2A477;
    --accent-fill-hover: #F6B48C;
    --accent-btn-text: #121314;
    --accent-border: #D97745;
    --danger: #F08080;
    --surface-rail: #D97745;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg-window: #F6F5F2;
    --bg-chrome: #ECEAE4;
    --bg-surface: #FFFFFF;
    --bg-hover: #E2DFD7;
    --bg-active: #DAD7CE;
    --border: #D4D1C8;
    --text-primary: #1A1B1D;
    --text-muted: #50545C;
    --accent-text: #9C4218;
    --accent-fill: #9C4218;
    --accent-fill-hover: #873712;
    --accent-btn-text: #FFFFFF;
    --accent-border: #9C4218;
    --danger: #B3261E;
    --surface-rail: #9C4218;
    color-scheme: light;
}

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

html {
    background-color: var(--bg-window);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg-window);
    color: var(--text-primary);
    overflow-x: clip;
}

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

code,
pre,
.mono {
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

a {
    color: var(--accent-text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: 2px solid var(--accent-border);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 200;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
}

.skip-link:focus {
    left: 16px;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin-inline: auto;
    padding-inline: 24px;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-chrome);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 60px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    min-height: 44px;
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
}

.brand img {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    flex-shrink: 0;
}

.brand-meta {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-text);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 2px 7px;
    border-radius: 5px;
}

.nav-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 140ms ease, color 140ms ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: var(--text-primary);
    background-color: var(--bg-hover);
    text-decoration: none;
}

.theme-btn,
.menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.theme-btn:hover,
.menu-btn:hover {
    background-color: var(--bg-hover);
    border-color: var(--accent-border);
}

.menu-btn {
    display: none;
    min-width: 44px;
    padding: 0 12px;
}

.header-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 6px;
    background-color: var(--accent-fill);
    color: var(--accent-btn-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.header-cta:hover {
    background-color: var(--accent-fill-hover);
    text-decoration: none;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.btn-primary {
    background-color: var(--accent-fill);
    color: var(--accent-btn-text);
    border: 1px solid var(--accent-border);
}

.btn-primary:hover {
    background-color: var(--accent-fill-hover);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--accent-border);
    text-decoration: none;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--bg-chrome);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-copy:hover {
    background-color: var(--bg-hover);
    border-color: var(--accent-border);
}

/* Sections */
.section {
    padding-block: 56px;
    border-bottom: 1px solid var(--border);
}

.hero {
    padding-block: 56px 64px;
    border-bottom: 1px solid var(--border);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-text);
    margin: 0 0 14px;
    border-left: 2px solid var(--surface-rail);
    padding-left: 10px;
}

h1 {
    margin: 0 0 16px;
    font-size: clamp(1.95rem, 3.6vw, 2.75rem);
    line-height: 1.14;
    letter-spacing: -0.025em;
    font-weight: 600;
    color: var(--text-primary);
}

h2 {
    margin: 0 0 10px;
    font-size: clamp(1.35rem, 2.3vw, 1.75rem);
    line-height: 1.24;
    letter-spacing: -0.02em;
    font-weight: 600;
    color: var(--text-primary);
}

h3 {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 600;
    color: var(--text-primary);
}

.hero-lead {
    margin: 0 0 24px;
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 54ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.spec-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.spec-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.spec-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* Mockup window matching pxbrowser chrome */
.app-preview {
    background-color: var(--bg-chrome);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-chrome);
}

.traffic-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--bg-active);
    border: 1px solid var(--border);
}

.preview-omnibar {
    flex: 1 1 auto;
    min-width: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-update-pill {
    flex-shrink: 0;
    background-color: var(--accent-fill);
    color: var(--accent-btn-text);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.preview-body {
    display: grid;
    grid-template-columns: 164px minmax(0, 1fr);
    min-height: 280px;
}

.preview-sidebar {
    background-color: var(--bg-chrome);
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preview-space-lbl {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 8px 6px;
}

.preview-tab {
    padding: 7px 9px;
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-tab.is-active {
    background-color: var(--bg-active);
    color: var(--text-primary);
    border-left-color: var(--surface-rail);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.preview-canvas {
    background-color: var(--bg-window);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 2px solid var(--surface-rail);
    border-radius: 7px;
    padding: 12px 14px;
}

.preview-card-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.preview-card-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.preview-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.mini-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border);
    background-color: var(--bg-chrome);
    color: var(--text-primary);
}

.mini-pill.is-accent {
    background-color: var(--accent-fill);
    color: var(--accent-btn-text);
    border-color: var(--accent-border);
    font-weight: 600;
}

/* Section headers & grids */
.section-head {
    max-width: 62ch;
    margin-bottom: 28px;
}

.section-sub {
    margin: 0;
    font-size: 15px;
    color: var(--text-muted);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.two-col-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    min-width: 0;
}

.card.has-rail {
    border-left: 2px solid var(--surface-rail);
}

.card p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.55;
}

.card-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-text);
    margin-bottom: 8px;
}

/* Update flow pipeline */
.step-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.step-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    min-width: 0;
}

.step-num {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-text);
    margin-bottom: 8px;
}

.step-card p {
    margin: 0;
    font-size: 13.5px;
    color: var(--text-muted);
}

/* Downloads page specifics */
.release-hero-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 2px solid var(--surface-rail);
    border-radius: 8px;
    padding: 24px;
    margin-top: 24px;
}

.release-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.release-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin: 14px 0 20px;
    padding-block: 14px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text-muted);
}

.release-facts strong {
    color: var(--text-primary);
    font-weight: 500;
}

.checksum-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: var(--bg-window);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 10px 14px;
    margin-top: 14px;
}

.checksum-text {
    min-width: 0;
    flex: 1 1 auto;
}

.checksum-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.checksum-code {
    display: block;
    font-size: 12.5px;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.status-note {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.status-note[data-state="error"] {
    color: var(--danger);
}

.install-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.simple-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.simple-step {
    background-color: var(--bg-window);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 14px 16px;
}

.simple-step strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.simple-step span {
    font-size: 13px;
    color: var(--text-muted);
}

.disclosure-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

details.disclosure {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

details.disclosure[open] {
    border-left: 2px solid var(--surface-rail);
}

details.disclosure summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
}

details.disclosure summary::-webkit-details-marker {
    display: none;
}

details.disclosure summary::after {
    content: "+";
    font-family: "SF Mono", ui-monospace, monospace;
    font-size: 16px;
    color: var(--accent-text);
    flex-shrink: 0;
}

details.disclosure[open] summary::after {
    content: "-";
}

details.disclosure summary:hover {
    background-color: var(--bg-hover);
}

.disclosure-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    font-size: 14px;
    color: var(--text-muted);
}

.disclosure-body p {
    margin: 0 0 10px;
}

.disclosure-body p:last-child {
    margin-bottom: 0;
}

.code-block {
    background-color: var(--bg-window);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12.5px;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    margin-top: 10px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
}

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.history-notes {
    margin: 0;
    padding-left: 18px;
    font-size: 14px;
    color: var(--text-muted);
}

.history-notes li + li {
    margin-top: 4px;
}

/* Footer */
.site-footer {
    padding-block: 28px 36px;
    background-color: var(--bg-chrome);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* Breakpoints: Tablet <= 960px, Nav Drawer <= 860px, Mobile <= 640px */
@media (max-width: 960px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .card-grid,
    .step-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .install-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .header-cta {
        display: none;
    }

    .menu-btn {
        display: inline-flex;
    }

    .nav-wrap {
        position: relative;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 52px;
        right: 0;
        width: min(260px, calc(100vw - 32px));
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 8px;
        background-color: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        z-index: 120;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-links a {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .container {
        padding-inline: 16px;
    }

    .section,
    .hero {
        padding-block: 36px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .preview-body {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .preview-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .card-grid,
    .two-col-grid,
    .step-list,
    .simple-steps {
        grid-template-columns: 1fr;
    }

    .checksum-box {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-copy {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
