/* Core tone and structure */
:root {
    color-scheme: dark;
    --bg: #050505;
    --text: #f5f5f5;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: radial-gradient(circle at top, #101010 0%, #050505 45%, #050505 100%);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    min-height: 100vh;
}

body.scroll-enabled {
    overflow: auto;
    overflow-x: hidden;
    scroll-snap-type: y proximity;
}

#mouse-light {
    position: fixed;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    pointer-events: none;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.04), transparent 65%);
    transition: left 0.15s linear, top 0.15s linear;
    z-index: -1;
}

#ambient-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    animation: drift 18s linear infinite;
    opacity: 0.18;
}

.particle--a { left: 9%; top: 28%; animation-duration: 18s; }
.particle--b { left: 22%; top: 68%; animation-duration: 20s; }
.particle--c { left: 35%; top: 18%; animation-duration: 21s; }
.particle--d { left: 48%; top: 78%; animation-duration: 19s; }
.particle--e { left: 62%; top: 28%; animation-duration: 22s; }
.particle--f { left: 76%; top: 12%; animation-duration: 17s; }
.particle--g { left: 86%; top: 58%; animation-duration: 23s; }

.progress-indicator {
    display: none;
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%) translateX(22px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
    z-index: 80;
}

.progress-indicator.visible {
    opacity: 0.78;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

button.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

button.progress-dot.is-active {
    transform: scale(1.4);
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.55);
}

button.progress-dot:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.65);
    outline-offset: 4px;
}

main {
    position: relative;
}

section {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: relative;
    padding: 0 5vw;
}

#intro,
#landing,
#narration-screen {
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.2s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 1.2s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.2s cubic-bezier(0.22, 0.61, 0.36, 1), filter 1.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#intro.is-visible,
#landing.is-visible,
#narration-screen.is-visible {
    display: flex;
    opacity: 1;
    visibility: visible;
}

#intro.is-hidden,
#landing.is-hidden,
#narration-screen.is-hidden {
    display: none;
    opacity: 0;
    visibility: hidden;
}

#intro {
    background: var(--bg);
}

#typing {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2rem;
    text-align: center;
    line-height: 1.9;
    white-space: pre-wrap;
    max-width: 720px;
}

.cursor {
    display: inline-block;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

#landing {
    background: var(--bg);
}

#landing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: calc(100vw - 32px);
    transition: opacity 1.2s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.2s cubic-bezier(0.22, 0.61, 0.36, 1), filter 1.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#landing-content.is-leaving {
    transform: scale(1.04);
    filter: blur(10px);
    opacity: 0;
}

#logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 6rem;
    letter-spacing: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

#logo span {
    display: inline-block;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.9s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#logo span.is-visible {
    opacity: 1;
    transform: translateY(0);
}

#logo.is-breathing {
    animation: breathe 6s ease-in-out infinite;
}

.subtitle {
    margin-top: 18px;
    font-size: 1rem;
    letter-spacing: 5px;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.9s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.subtitle.is-visible {
    opacity: 0.72;
    transform: translateY(0);
}

#enterBtn {
    margin-top: 60px;
    padding: 14px 44px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.18);
    letter-spacing: 4px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    transition: background 0.5s ease-out, transform 0.5s ease-out, opacity 0.8s ease;
    position: relative;
    overflow: hidden;
}

#enterBtn.is-visible {
    opacity: 1;
    transform: translateY(0);
}

#enterBtn.is-pressed {
    transform: translateY(3px) scale(0.98);
}

#enterBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(0) scale(1.02);
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.008); }
}

#transition-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 1.2s ease-out;
}

#transition-overlay.is-visible {
    opacity: 1;
}

#transition-overlay.is-releasing {
    opacity: 0;
    transition: opacity 1.4s ease-out;
}

.story-fade {
    position: fixed;
    inset: 0;
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
    z-index: 120;
    transition: opacity 8s ease-out;
}

.story-fade.is-visible {
    opacity: 1;
}

.narration-screen {
    position: fixed;
    inset: 0;
    justify-content: center;
    align-items: center;
    background: rgba(5, 5, 5, 0.98);
    opacity: 0;
    z-index: 110;
    transform: translateY(12px);
    filter: blur(16px);
    transition: opacity 1.1s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.1s cubic-bezier(0.22, 0.61, 0.36, 1), filter 1.1s cubic-bezier(0.22, 0.61, 0.36, 1);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8vh 6vw 10vh;
}

.narration-screen.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    pointer-events: auto;
}

.narration-screen.is-fading {
    opacity: 0;
    transform: translateY(-12px);
    filter: blur(8px);
    transition: opacity 1.6s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.6s cubic-bezier(0.22, 0.61, 0.36, 1), filter 1.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.narration-inner {
    max-width: 760px;
    padding: 0 24px;
    text-align: center;
}

.narration-line {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    line-height: 1.6;
    color: #f2f2f2;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.9s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
    margin-bottom: 14px;
}

.narration-line--pause {
    font-size: 1.8rem;
    letter-spacing: 0.15em;
}

.narration-line--emphasis {
    font-size: 2.6rem;
    font-weight: 600;
    margin-bottom: 0;
}

.narration-line.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.story-section {
    display: none;
    background: var(--bg);
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 100vh;
    padding: 8vh 6vw 10vh;
    opacity: 0;
    transform: translateY(28px);
    filter: blur(12px);
    transition: opacity 1.4s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.4s cubic-bezier(0.22, 0.61, 0.36, 1), filter 1.4s cubic-bezier(0.22, 0.61, 0.36, 1);
    pointer-events: none;
    scroll-snap-align: start;
    align-items: flex-start;
    justify-content: flex-start;
}

.story-section.is-visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    pointer-events: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.story-section.is-visible::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.story-section.is-leaving {
    display: flex;
    opacity: 0;
    transform: translateY(28px);
    filter: blur(12px);
    pointer-events: none;
}

.memory-section--centered {
    justify-content: flex-start;
    align-items: center;
    padding-top: 10vh;
}

.memory-section--left {
    justify-content: flex-start;
    align-items: center;
    padding-left: clamp(28px, 7vw, 88px);
    padding-right: clamp(32px, 8vw, 112px);
    padding-top: 10vh;
}

.memory-section--spacious {
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding: 12vh 8vw 14vh;
}

.memory-section--offset {
    justify-content: flex-start;
    align-items: center;
    padding: 10vh clamp(28px, 8vw, 104px) 14vh clamp(28px, 8vw, 96px);
}

.memory-inner {
    text-align: center;
    max-width: 820px;
    padding: 0 24px 4rem;
}

.memory-inner--centered {
    max-width: 640px;
    padding-top: 2rem;
}

.memory-inner--left {
    text-align: center;
    max-width: 560px;
    width: 100%;
    padding: 1rem 0 5rem;
    margin-left: auto;
    margin-right: auto;
}

.memory-inner--spacious {
    max-width: 480px;
    padding: 6rem 24px 8rem;
}

.memory-inner--offset {
    text-align: center;
    max-width: 560px;
    padding: 2rem 0 3rem;
    margin-left: auto;
    margin-right: auto;
}

.memory-label {
    color: #a8a8a8;
    letter-spacing: 8px;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.memory-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3.8rem;
    letter-spacing: 5px;
    margin-bottom: 22px;
    font-weight: 500;
    line-height: 1.02;
}

.memory-copy {
    color: #d0d0d0;
    line-height: 1.85;
    font-size: 1.05rem;
    margin-bottom: 40px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.memory-copy p {
    margin-bottom: 0.85em;
}

.memory-copy p:last-child {
    margin-bottom: 0;
}

.memory-copy--spacious p {
    margin-bottom: 1.4em;
}

.memory-copy--spacious p:last-child {
    margin-bottom: 0;
}

.memory-copy--offset {
    max-width: 100%;
    margin-left: 0;
    line-height: 2;
}

.memory-inner--left .memory-copy,
.memory-inner--offset .memory-copy {
    margin-left: 0;
    margin-right: 0;
}

.ending-screen {
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 8vh 24px 10vh;
}

.ending-label {
    font-size: 0.9rem;
    letter-spacing: 7px;
    color: #8c8c8c;
    margin-bottom: 18px;
    text-transform: uppercase;
}

.ending-copy {
    margin-bottom: 0.38em;
    max-width: 560px;
    color: #d9d9d9;
    line-height: 1.9;
    font-size: 1.05rem;
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
    transition: opacity 0.9s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1), filter 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ending-copy.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.ending-copy--quiet {
    margin-bottom: 0.95rem;
    margin-top: 0.95rem;
}

.ending-copy--quiet.is-visible {
    opacity: 0.45;
}

.ending-copy--thanks.is-visible {
    opacity: 1;
}

.ending-copy--thanks {
    margin-top: 1.25rem;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
}

.ending-credit {
    margin-top: 2.2rem;
    color: #8e8e8e;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.9s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ending-credit.is-visible {
    opacity: 0.78;
    transform: translateY(0);
}

.continue-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-height: 44px;
    padding: 12px 6px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    line-height: 1;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1), color 0.3s ease;
    cursor: pointer;
    pointer-events: none;
}

.continue-button.is-visible {
    opacity: 0.84;
    transform: translateY(0);
    pointer-events: auto;
}

.continue-button.is-pressed {
    transform: translateY(1px) scale(0.985);
}

.continue-button:hover,
.continue-button:focus-visible {
    color: rgba(255, 255, 255, 1);
}

.continue-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 6px;
}

.continue-button--center {
    margin-left: auto;
    margin-right: auto;
    margin-top: 2.8rem;
}

.continue-button--left {
    margin-left: 0;
    margin-right: auto;
    margin-top: 2.6rem;
}

.continue-button--right {
    margin-left: auto;
    margin-right: 0;
    margin-top: 2.6rem;
}

.narration-inner .continue-button {
    margin-top: 3rem;
}

@keyframes drift {
    0% {
        transform: translate3d(0, 0, 0);
        opacity: 0;
    }
    10% { opacity: 0.35; }
    100% {
        transform: translate3d(0, -100vh, 0);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .narration-line {
        font-size: 1.7rem;
    }

    .narration-line--pause {
        font-size: 1.4rem;
    }

    .narration-line--emphasis {
        font-size: 2rem;
    }

    .memory-section--left {
        padding-left: 24px;
        padding-right: 24px;
    }

    .memory-section--offset {
        justify-content: flex-start;
        align-items: center;
        padding: 10vh 24px 12vh;
    }

    .memory-inner--offset {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    #logo {
        font-size: 3rem;
        letter-spacing: 8px;
    }

    #typing {
        font-size: 1.2rem;
        padding: 30px;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .memory-title {
        font-size: 2.8rem;
    }

    .memory-copy {
        font-size: 0.95rem;
    }

    .continue-button {
        font-size: 0.72rem;
        letter-spacing: 0.18em;
    }

    #landing-content {
        max-width: calc(100vw - 24px);
    }

    #logo {
        font-size: clamp(1.85rem, 7.4vw, 3rem);
        letter-spacing: clamp(1px, 0.4vw, 8px);
    }

    .progress-indicator {
        right: 16px;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    #logo {
        font-size: clamp(1.7rem, 7.2vw, 2.5rem);
        letter-spacing: clamp(0.5px, 0.35vw, 6px);
    }

    #enterBtn {
        padding: 12px 32px;
        letter-spacing: 3px;
    }

    .memory-title {
        font-size: 2.2rem;
    }

    .narration-line {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    .narration-line--pause {
        font-size: 1.2rem;
    }

    .narration-line--emphasis {
        font-size: 1.7rem;
    }

    .memory-inner--left,
    .memory-inner--offset {
        max-width: min(100%, 500px);
        margin-left: auto;
        margin-right: auto;
    }

    .memory-inner--left {
        max-width: min(100%, 520px);
    }

    .memory-inner--offset {
        max-width: min(100%, 500px);
    }

    .narration-screen {
        padding: 7vh 5vw 9vh;
    }

    .narration-inner {
        padding: 0 14px;
    }

    .memory-section--left,
    .memory-section--offset {
        align-items: center;
    }

    .memory-inner--left,
    .memory-inner--offset {
        max-width: min(100%, 520px);
        margin-left: auto;
        margin-right: auto;
    }

    .ending-screen {
        padding: 7vh 20px 9vh;
    }

    .ending-copy {
        margin-bottom: 0.32em;
    }

    .ending-copy--quiet {
        margin-top: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .ending-copy--thanks {
        margin-top: 1rem;
    }

    .ending-credit {
        margin-top: 1.8rem;
        font-size: 0.72rem;
        letter-spacing: 0.14em;
    }

    .continue-button--center,
    .continue-button--left,
    .continue-button--right,
    .narration-inner .continue-button {
        margin-top: 2.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .cursor {
        display: none;
    }
}
#audio-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;

    width: 38px;
    height: 38px;

    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;

    background: rgba(0, 0, 0, 0.28);
    color: rgba(255, 255, 255, 0.65);

    font-size: 14px;
    cursor: pointer;

    opacity: 0.55;
    transition: opacity 0.3s ease, background 0.3s ease;
}

#audio-toggle:hover {
    opacity: 0.9;
}

@media (max-width: 600px) {
    #audio-toggle {
        right: 14px;
        bottom: 14px;
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
}