:root {
    --bg: #dad4d8;
    --panel: #f3edf2;
    --panel-2: #ebe3ea;
    --line: #b2a2ae;
    --ink: #1a1719;
    --muted: #615964;
    --accent: #462168;
    --accent-2: #705194;
    --accent-soft: #d5c6e3;
}

html[data-theme="dark"] {
    --bg: #1a1719;
    --panel: #221d24;
    --panel-2: #302734;
    --line: #615964;
    --ink: #ebe3ea;
    --muted: #b2a2ae;
    --accent: #b28ed9;
    --accent-2: #d0b7eb;
    --accent-soft: #3b185d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: "Space Grotesk", "Trebuchet MS", monospace;
    line-height: 1.55;
}

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(95rem 28rem at 7% -10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent),
        radial-gradient(90rem 34rem at 96% 2%, color-mix(in srgb, var(--accent-2) 28%, transparent), transparent),
        repeating-linear-gradient(
            135deg,
            color-mix(in srgb, var(--panel-2) 55%, transparent) 0,
            color-mix(in srgb, var(--panel-2) 55%, transparent) 2px,
            transparent 2px,
            transparent 16px
        );
    opacity: 0.75;
}

.shell {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.1rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--panel) 90%, transparent);
    backdrop-filter: blur(3px);
    margin-bottom: 1rem;
}

.brand {
    font-family: "Cormorant Garamond", "Georgia", serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand a {
    color: var(--ink);
    text-decoration: none;
}

.meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.theme-toggle {
    border: 1px solid var(--line);
    background: var(--accent-soft);
    color: var(--ink);
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-shell {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--panel) 94%, transparent);
    padding: 0.4rem;
}

.nav-shell ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.nav-shell li {
    animation: fade-slide 0.5s ease both;
}

.nav-shell li:nth-child(2) {
    animation-delay: 0.06s;
}

.nav-shell li:nth-child(3) {
    animation-delay: 0.12s;
}

.nav-shell a {
    display: block;
    text-decoration: none;
    color: var(--ink);
    background: var(--panel-2);
    border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-weight: 600;
}

.nav-shell a:hover {
    background: var(--accent);
    color: #ffffff;
}

.nav-shell a.is-active {
    background: var(--accent);
    color: #ffffff;
    border-color: color-mix(in srgb, var(--accent) 80%, var(--line));
}

.content {
    min-width: 0;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 10%, transparent);
    animation: reveal-up 0.45s ease both;
}

h1,
h2 {
    font-family: "Cormorant Garamond", "Georgia", serif;
    line-height: 1.15;
    margin-top: 0;
}

a {
    color: var(--accent);
}

.mono {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 0.9rem;
    color: var(--muted);
}

.kicker {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
}

.row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    margin: 0.35rem 0;
}

.row strong {
    color: var(--muted);
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.65rem;
}

.stat-card {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.7rem;
}

.stat-value {
    display: block;
    font-family: "Cormorant Garamond", "Georgia", serif;
    font-size: 1.6rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.85rem;
}

ul.clean {
    margin: 0;
    padding-left: 1.1rem;
}

.index-thumb-link {
    display: block;
    margin: -1rem -1rem 0.75rem;
}

.index-thumb {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--line);
    background: var(--line);
}

.carousel {
    position: relative;
}

.carousel-track {
    position: relative;
    overflow: hidden;
}

.carousel-slide {
    display: none;
    margin: 0;
}

.carousel-slide.active {
    display: block;
}

.carousel-slide img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--panel-2);
}

.carousel-slide figcaption {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.4rem;
    text-align: center;
}

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.carousel-btn {
    background: var(--accent-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.75rem;
    line-height: 1.5;
}

.carousel-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

.carousel-counter {
    font-size: 0.85rem;
    color: var(--muted);
    min-width: 3rem;
    text-align: center;
}

@keyframes reveal-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-slide {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 780px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 781px) {
    .layout {
        display: grid;
        grid-template-columns: minmax(150px, 240px) 1fr;
        align-items: start;
    }

    .nav-shell {
        position: sticky;
        top: 1rem;
    }

    .nav-shell ul {
        flex-direction: column;
    }

    .nav-shell a {
        border-radius: 10px;
    }

    .topbar {
        align-items: center;
    }
}