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

:root {
    --ac-red: #e41320;
    --ac-bg: #0a0a0c;
    --ac-surface: #161619;
    --ac-surface-2: #1e1e22;
    --ac-border: rgba(255, 255, 255, 0.08);
    --ac-text: #f2f2f3;
    --ac-text-muted: #9a9aa2;
    --sidebar-width: 280px;

    --main-bg: #0a0a0c;
    --main-surface-2: #1e1e22;
    --main-border: rgba(255, 255, 255, 0.08);
    --main-text: #f2f2f3;
    --main-text-muted: #9a9aa2;
    --main-glow: rgba(228, 19, 32, 0.2);
    --main-code-bg: rgba(255, 255, 255, 0.08);
    --main-code-text: #ff9aa2;
}

:root[data-theme="light"] {
    --main-bg: #f4f4f6;
    --main-surface-2: #ffffff;
    --main-border: rgba(0, 0, 0, 0.1);
    --main-text: #1a1a1d;
    --main-text-muted: #6b6b73;
    --main-glow: rgba(120, 120, 130, 0.18);
    --main-code-bg: rgba(0, 0, 0, 0.06);
    --main-code-text: #b3131f;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--main-bg);
    color: var(--main-text);
    transition: background 0.2s ease, color 0.2s ease;
}

.app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--ac-surface);
    border-right: 1px solid var(--ac-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid var(--ac-border);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: var(--ac-text);
}

.sidebar-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 0 16px rgba(228, 19, 32, 0.4);
}

.sidebar-header .brand {
    font-family: 'Anybody', 'Lato', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.2;
}

.sidebar-header .brand span {
    display: block;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--ac-text-muted);
}

.sidebar-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Audience toggle (Internal / Public) */
.audience-toggle {
    display: flex;
    gap: 0.25rem;
    margin: 1rem 1.25rem 0;
    padding: 0.25rem;
    background: var(--ac-surface-2);
    border: 1px solid var(--ac-border);
    border-radius: 8px;
}

.audience-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--ac-text-muted);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.45rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.audience-btn.active {
    background: var(--ac-red);
    color: #fff;
}

.nav-search {
    margin: 0.75rem 1.25rem 0;
}

.nav-search-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--ac-border);
    background: var(--ac-surface-2);
    color: var(--ac-text);
    font-family: inherit;
    font-size: 0.85rem;
}

.nav-search-input::placeholder {
    color: var(--ac-text-muted);
}

.nav-search-input:focus {
    outline: none;
    border-color: var(--ac-red);
}

.nav-empty {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--ac-text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow-y: auto;
}

.sidebar-section-label {
    padding: 0.9rem 1rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ac-text-muted);
}

.nav-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    color: var(--ac-text-muted);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-item .nav-icon {
    font-size: 1rem;
    line-height: 1.4;
}

.nav-item .nav-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nav-item .nav-title-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.nav-item .nav-title {
    font-weight: 700;
    font-size: 0.86rem;
    letter-spacing: 0.01em;
    color: var(--ac-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item .nav-subtitle {
    font-size: 0.72rem;
    color: var(--ac-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.latest-badge {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: var(--ac-red);
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
}

.nav-item:hover {
    background: var(--ac-surface-2);
}

.nav-item.active {
    background: rgba(228, 19, 32, 0.15);
    border-left-color: var(--ac-red);
}

.nav-item.active .nav-title {
    color: var(--ac-text);
}

.theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--ac-border);
    cursor: pointer;
}

.theme-toggle-row:focus-visible {
    outline: 2px solid var(--ac-red);
    outline-offset: -2px;
}

.theme-toggle-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--ac-text-muted);
}

.theme-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--ac-surface-2);
    border: 1px solid var(--ac-border);
    transition: background 0.2s ease;
}

.theme-toggle-row[aria-checked="true"] .theme-switch {
    background: var(--ac-red);
}

.theme-switch-knob {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.theme-toggle-row[aria-checked="true"] .theme-switch-knob {
    transform: translateX(18px);
}

.sidebar-footer {
    padding: 0.75rem 1.25rem 1rem;
    font-size: 0.75rem;
    color: var(--ac-text-muted);
}

/* Main content */
.content {
    flex: 1;
    position: relative;
    overflow-y: auto;
}

.home-view {
    background:
        radial-gradient(circle at 50% -10%, var(--main-glow) 0%, rgba(0, 0, 0, 0) 45%),
        var(--main-bg);
    min-height: 100%;
    padding: 3rem 2rem 1rem 2rem;
    display: flex;
    flex-direction: column;
}

.home-inner {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.home-main {
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-family: 'Anybody', 'Lato', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--main-text-muted);
}

.release-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
}

.release-card {
    flex: 0 1 220px;
    background: var(--main-surface-2);
    border: 1px solid var(--main-border);
    border-top: 3px solid var(--ac-red);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--main-text);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.release-card:hover {
    transform: translateY(-6px);
    border-color: var(--ac-red);
    box-shadow: 0 12px 30px rgba(228, 19, 32, 0.2);
}

.release-card .release-date-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.release-card .release-date-main {
    font-family: 'Anybody', 'Lato', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.release-card .release-subtitle {
    font-size: 0.85rem;
    color: var(--main-text-muted);
}

footer {
    margin-top: auto;
    padding-top: 3rem;
    text-align: center;
    color: var(--main-text-muted);
    font-size: 0.9rem;
}

/* Docs view (rendered markdown) */
.docs-view {
    display: none;
    min-height: 100%;
    background: var(--main-bg);
    padding: 2.5rem 2rem 3rem;
}

.docs-inner {
    max-width: 800px;
    margin: 0 auto;
}

.docs-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--main-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
}

.back-link:hover {
    color: var(--ac-red);
}

.audience-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--main-border);
    color: var(--main-text-muted);
}

.docs-header {
    margin-bottom: 1.5rem;
}

.docs-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.docs-title {
    font-family: 'Anybody', 'Lato', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 0.02em;
    text-transform: none;
    margin-bottom: 0;
}

.docs-subtitle {
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: var(--main-text-muted);
}

.docs-content {
    background: var(--main-surface-2);
    border: 1px solid var(--main-border);
    border-radius: 12px;
    padding: 2rem 2.25rem;
    line-height: 1.65;
}

.docs-content h2 {
    font-family: 'Anybody', 'Lato', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 0.01em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--main-border);
}

.docs-content h3 {
    font-family: 'Anybody', 'Lato', sans-serif;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--ac-red);
    margin: 1.75rem 0 0.75rem;
}

.docs-content h3:first-of-type {
    margin-top: 1.25rem;
}

.docs-content p {
    margin-bottom: 0.9rem;
}

.docs-content ul {
    margin: 0 0 1rem 1.25rem;
}

.docs-content li {
    margin-bottom: 0.6rem;
}

.docs-content li > ul {
    margin-top: 0.4rem;
}

.docs-content strong {
    color: var(--main-text);
}

.docs-content code {
    background: var(--main-code-bg);
    color: var(--main-code-text);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}

.docs-content a {
    color: var(--ac-red);
}

.docs-state {
    color: var(--main-text-muted);
    padding: 2rem;
    text-align: center;
}

/* Mobile hamburger + off-canvas nav drawer */
.hamburger-btn {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--ac-surface-2);
    border: 1px solid var(--ac-border);
    color: var(--ac-text);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
}

@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }

    .hamburger-btn {
        display: flex;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .sidebar-overlay {
        top: 64px;
    }

    .sidebar {
        width: 100%;
        border-right: none;
    }

    .sidebar-header {
        height: 64px;
        padding: 0 1rem;
    }

    .sidebar-body {
        position: fixed;
        top: 64px;
        right: 0;
        left: auto;
        height: calc(100vh - 64px);
        width: min(85vw, 320px);
        background: var(--ac-surface);
        padding-top: 0.5rem;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar-body.open {
        transform: translateX(0);
    }

    .docs-content {
        padding: 1.5rem;
    }
}
