:root {
    --accent-color: #6FD3FF;
    --accent-rgb: 111, 211, 255;
    --site-bg-base: #1e1e1e;
    --site-edge-peak-alpha: 0.24;
    --site-edge-mid-alpha: 0.07;
    --site-edge-mid-stop: 3.75%;
    --site-edge-clear-stop: 7.5%;
    --site-grain-opacity: 0.06;
    --site-grain-size: 120px;
}

html {
    background-color: var(--site-bg-base);
    min-height: 100%;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--site-bg-base);
    background-image:
        linear-gradient(
            90deg,
            rgba(0,0,0,var(--site-edge-peak-alpha)) 0%,
            rgba(0,0,0,var(--site-edge-mid-alpha)) var(--site-edge-mid-stop),
            rgba(0, 0, 0, 0) var(--site-edge-clear-stop),
            rgba(0,0,0,0) calc(100% - var(--site-edge-clear-stop)),
            rgba(0,0,0,var(--site-edge-mid-alpha)) calc(100% - var(--site-edge-mid-stop)),
            rgba(0,0,0,var(--site-edge-peak-alpha)) 100%
        ),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    background-size: 100% 100%, var(--site-grain-size) var(--site-grain-size);
    background-repeat: no-repeat, repeat;
    background-blend-mode: normal, normal;
    font-family: sans-serif;
    overflow-x: hidden;
}

body.no-site-bg-effects {
    background-image: none;
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pageSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-40px);
    }
}

@keyframes activeHighlightIn {
    from {
        background-color: rgba(255,255,255,0.06);
        color: #f2f2f2;
    }
    to {
        background-color: var(--accent-color);
        color: #0b1a24;
    }
}

@keyframes activeHighlightOut {
    from {
        background-color: var(--accent-color);
        color: #0b1a24;
    }
    to {
        background-color: rgba(255,255,255,0.06);
        color: #f2f2f2;
    }
}

body.page-enter .content {
    animation: pageSlideIn 360ms cubic-bezier(.22,.8,.24,1);
}

body.page-exit {
    pointer-events: none;
}

body.page-exit .content {
    animation: pageSlideOut 320ms cubic-bezier(.22,.8,.24,1) forwards;
}

/* Style the top bar container (fixed + backdrop blur) */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 50000;
    --line-alpha: 0.03;
    --pointer-x: 50%;
    --line-radius: 120px;
    background-color: rgba(255,255,255,0.03);
    background-image: linear-gradient(90deg, rgba(255,255,255,0.065) 0%, rgba(255,255,255,0.04) 34%, rgba(0,0,0,0.12) 100%);
    background-size: 100% 100%;
    background-position: left top;
    background-repeat: no-repeat;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 8px 20px rgba(0,0,0,0.28);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    overflow: visible;
}

/* On the dedicated secret-game page, treat the nav as a regular document flow element
   so it doesn't float above the canvas. The page body will have `secret-page`. */
.secret-page .top-bar {
    position: static;
    width: 100%;
    box-shadow: 0 6px 16px rgba(0,0,0,0.22);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-color: rgba(255,255,255,0.02);
    z-index: auto;
}

/* Ensure top-bar children still align when not fixed */
.secret-page .top-bar { display: flex; align-items: center; }

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    background: rgba(18,18,18,0.5);
    color: rgba(255,255,255,0.92);
    cursor: pointer;
}

.nav-toggle:hover {
    background: rgba(var(--accent-rgb), 0.14);
}

.nav-toggle:focus-visible {
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 0 1px rgba(var(--accent-rgb), 0.70), 0 3px 10px rgba(0,0,0,0.24);
}

.nav-toggle-bar {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    display: block;
    transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle-bar + .nav-toggle-bar {
    margin-top: 4px;
}

.top-bar.nav-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.top-bar.nav-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.top-bar.nav-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.top-bar::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    pointer-events: none;
    background-repeat: no-repeat;
    background-image: radial-gradient(circle var(--line-radius) at var(--pointer-x) 100%, rgba(255,255,255,var(--line-alpha)) 0px, rgba(255,255,255,0) 100%);
    transition: background-image 120ms linear, opacity 120ms linear;
}

/* Style the logo */
.top-bar .logo {
    --logo-track-shift: 0em;
    color: white;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
    display: inline-flex;
    align-items: stretch;
    gap: 6px;
    opacity: 0;
    animation: logoFadeIn 700ms cubic-bezier(.2,.9,.2,1) 40ms forwards;
    text-transform: uppercase;
    line-height: 0.9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    transition: opacity 130ms ease, filter 130ms ease, text-shadow 140ms ease;
    transform-origin: center center;
    will-change: opacity, filter, text-shadow;
}

.top-bar .logo .logo-mark {
    width: 38px;
    height: 38px;
    display: block;
    flex: 0 0 auto;
    align-self: center;
    transform: translateY(-2px);
    filter: brightness(0) invert(1);
    transition: filter 130ms ease;
}

.top-bar .logo:hover .logo-mark {
    filter: brightness(0) invert(1) drop-shadow(0 0 8px rgba(255,255,255,0.26));
}

.top-bar .logo:active .logo-mark {
    filter: brightness(0) invert(1) drop-shadow(0 0 5px rgba(255,255,255,0.20));
}

.top-bar .logo .logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

html.skip-nav-intro .top-bar .logo {
    animation: none;
    opacity: 1;
}

.top-bar .logo:hover {
    opacity: 0.90;
    filter: brightness(1.07);
    text-shadow: 0 0 10px rgba(255,255,255,0.16), 0 0 18px rgba(255,255,255,0.08);
    --logo-track-shift: 0.02em;
}

.top-bar .logo:active {
    opacity: 0.82;
    filter: brightness(1.02);
    text-shadow: 0 0 6px rgba(255,255,255,0.12), 0 0 12px rgba(255,255,255,0.06);
    --logo-track-shift: 0.012em;
}

/* Two-line logo: top word heavier, bottom word slightly lighter */
.logo.bodoni .logo-top,
.logo.bodoni .logo-bottom {
    text-align: left;
    display: block;
    margin: 0;
    padding: 0;
}

.logo.bodoni .logo-top {
    font-weight: 900;
    font-size: 20px;
    letter-spacing: calc(0.04em + var(--logo-track-shift));
    transition: letter-spacing 130ms ease;
}

.logo.bodoni .logo-bottom {
    font-weight: 200;
    font-size: 20px;
    letter-spacing: calc(-0.02em + var(--logo-track-shift));
    transition: letter-spacing 130ms ease;
}

/* Style the navigation list */
.top-bar ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
}

/* Fade-in keyframes for nav items */
@keyframes navFadeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes logoFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Staggered fade-in for first six items */
.top-bar .nav-links li:nth-child(1) a { animation: navFadeIn 700ms cubic-bezier(.2,.9,.2,1) 80ms forwards; }
.top-bar .nav-links li:nth-child(2) a { animation: navFadeIn 700ms cubic-bezier(.2,.9,.2,1) 140ms forwards; }
.top-bar .nav-links li:nth-child(3) a { animation: navFadeIn 700ms cubic-bezier(.2,.9,.2,1) 200ms forwards; }
.top-bar .nav-links li:nth-child(4) a { animation: navFadeIn 700ms cubic-bezier(.2,.9,.2,1) 260ms forwards; }
.top-bar .nav-links li:nth-child(5) a { animation: navFadeIn 700ms cubic-bezier(.2,.9,.2,1) 320ms forwards; }
.top-bar .nav-links li:nth-child(6) a { animation: navFadeIn 700ms cubic-bezier(.2,.9,.2,1) 380ms forwards; }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    body.page-enter .content,
    body.page-exit .content {
        animation: none;
    }

    .top-bar li a {
        transition: none;
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Style the navigation links */
.top-bar li a {
    color: #f2f2f2;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    text-align: center;
    padding: 10px 14px;
    text-decoration: none;
    display: inline-block;
    border-radius: 8px;
    transition: transform 180ms cubic-bezier(.2,.9,.2,1),
                background-color 280ms ease,
                color 280ms ease,
                box-shadow 110ms ease,
                opacity 300ms ease;
    transform-origin: center;
    will-change: transform, opacity;
    opacity: 0;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

html.skip-nav-intro .top-bar .nav-links li a {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

body.nav-highlight-static .top-bar .nav-links li a {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

html.skip-nav-intro body.page-enter:not(.nav-highlight-static) .top-bar .nav-links li a.active {
    animation: activeHighlightIn 360ms ease-out both !important;
}

html.skip-nav-intro body.page-exit:not(.nav-highlight-static) .top-bar .nav-links li a.active {
    animation: activeHighlightOut 240ms ease-in both !important;
}

.top-bar li a:hover {
    background-color: rgba(var(--accent-rgb), 0.16);
    color: #f6fcff;
}

.top-bar li a:active {
    transform: translateY(1px) scale(0.985);
    background-color: rgba(255,255,255,0.035);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.03), 0 0 0 1px rgba(255,255,255,0.03);
}

/* Prevent pressed/click visual when the nav link is the active page highlight */
.top-bar li a.active:active {
    transform: none;
    background-color: var(--accent-color);
    box-shadow: none;
}

/* When a nav link is the active page, show non-clickable cursor */
.top-bar li a.active,
.top-bar li a.active:hover {
    cursor: default;
}

.top-bar li a:focus-visible {
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 0 0 1px rgba(var(--accent-rgb), 0.70), 0 3px 10px rgba(0,0,0,0.24);
}

.top-bar li a.active {
    background-color: var(--accent-color);
    color: #0b1a24;
}

/* Make active nav links non-interactive (no clicks or hover) */
.top-bar li a.active {
    pointer-events: none;
    cursor: default;
}
.top-bar li a.active:focus {
    outline: none;
    box-shadow: none;
}

body.page-enter:not(.nav-highlight-static) .top-bar li a.active {
    animation: activeHighlightIn 360ms ease-out both;
}

body.page-exit:not(.nav-highlight-static) .top-bar li a.active {
    animation: activeHighlightOut 240ms ease-in both;
}

.top-bar li a[aria-disabled="true"] {
    pointer-events: none;
    cursor: default;
    opacity: 1;
}

.content {
    margin-top: 64px;
    padding: 28px 20px 56px;
}

@supports not (backdrop-filter: blur(10px)) {
    .top-bar {
        background-color: rgba(16,16,16,0.85);
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
}

.bodoni {
    font-family: "Bodoni Moda SC", serif;
    font-optical-sizing: auto;
    font-weight: 1000;
    font-style: normal;
    line-height: 100%;
    text-align: center;
    color: white;
}

.collage-shell {
    max-width: 1080px;
    margin: 0 auto;
}

.collage-title {
    margin: 6px 0 24px;
    color: white;
    font-family: "Bodoni Moda SC", serif;
    font-weight: 400;
    font-size: clamp(34px, 7vw, 64px);
    line-height: 0.95;
    text-align: center;
}

@media (max-width: 640px) {
    .collage-title {
        margin-bottom: 18px;
    }
}

/* Device-aware overrides when JS marks document as mobile-capable */
.is-mobile .content {
    padding: 20px 12px 40px;
}

.is-mobile .collage-shell {
    max-width: calc(100vw - 32px);
}

.is-mobile .collage-title {
    font-size: clamp(20px, 9vw, 34px);
}

.top-bar.nav-collapsed {
    padding: 0 14px;
}

.top-bar.nav-collapsed .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    right: 14px;
    left: auto;
    min-width: 176px;
    max-width: min(320px, calc(100vw - 28px));
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    background: rgba(20,20,20,0.92);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.4);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 50001;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.top-bar.nav-collapsed.nav-open .nav-links,
.top-bar.nav-collapsed.nav-opening .nav-links,
.top-bar.nav-collapsed.nav-closing .nav-links {
    display: flex;
}

.top-bar.nav-collapsed.nav-open .nav-links {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.top-bar.nav-collapsed.nav-closing .nav-links {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    pointer-events: none;
}

.top-bar.nav-collapsed .nav-links li {
    width: 100%;
}

.top-bar.nav-collapsed .nav-links li a {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    text-align: left;
    opacity: 1;
    animation: none !important;
    transform: none !important;
}

.top-bar.nav-collapsed .nav-toggle {
    display: inline-flex;
    flex-direction: column;
}

@media (prefers-reduced-motion: reduce) {
    .nav-toggle-bar {
        transition: none;
    }

    .top-bar.nav-collapsed .nav-links {
        transition: none;
    }
}