/* yesang.xyz - Dark-academia horizontal scroll */

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

:root {
    --midnight-ink: #0F0F23;
    --charcoal-dusk: #1A1A2E;
    --slate-veil: #2C2C3A;
    --rose-quartz: #FFB3BA;
    --mint-whisper: #BAFFC9;
    --periwinkle: #BAE1FF;
    --lemon-haze: #FFFFBA;
    --lavender: #E8BAFF;
    --parchment: #F0E6D3;
    --dusty-rose: #D4A5A5;
    --faded-lilac: #C4B4D0;
}

html,body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.75;
    color: var(--parchment);
    background: var(--midnight-ink);
}

/* Progress bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--rose-quartz), var(--periwinkle), var(--lavender));
    z-index: 100;
    transition: width 100ms ease;
}

/* Scroll track */
.scroll-track {
    display: flex;
    height: 100vh;
    width: 700vw;
    transition: transform 400ms cubic-bezier(0.23,1,0.32,1);
}

.folio {
    position: relative;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(30px, 5vw, 60px);
}

/* Gradient mesh base */
.gradient-mesh {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.mesh-bg {
    background:
        radial-gradient(ellipse at 25% 30%, rgba(255,179,186,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(186,225,255,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(232,186,255,0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 20%, rgba(186,255,201,0.15) 0%, transparent 45%);
    animation: meshShift 20s ease-in-out infinite;
}

@keyframes meshShift {
    0%,100% { background-position: 0% 0%, 100% 100%, 50% 50%, 80% 20%; }
    33% { background-position: 30% 20%, 70% 80%, 20% 60%, 90% 40%; }
    66% { background-position: 60% 40%, 40% 50%, 80% 30%, 50% 70%; }
}

/* Folio I: Threshold */
.folio-threshold { background: var(--midnight-ink); }

.folio-title {
    position: relative;
    z-index: 2;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(6rem, 12vw, 14rem);
    letter-spacing: 0.08em;
    line-height: 0.95;
    color: var(--parchment);
    text-align: left;
    margin-left: -15%;
}

.title-rule {
    position: relative;
    z-index: 2;
    width: 60%;
    height: 1px;
    background: var(--dusty-rose);
    margin: 1.5rem 0;
    align-self: flex-end;
}

.forecast-carousel {
    position: relative;
    z-index: 2;
    height: 3.5em;
    overflow: hidden;
    text-align: center;
}

.forecast {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--dusty-rose);
    position: absolute;
    width: 100%;
    opacity: 0;
    transition: opacity 1s ease;
}

.forecast.active {
    opacity: 1;
}

.forecast em {
    color: var(--faded-lilac);
}

/* Folio II: Archive */
.folio-archive {
    background: var(--charcoal-dusk);
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 8vh;
}

.archive-upper {
    position: relative;
    width: 80%;
    height: 55vh;
}

.archive-panel {
    position: absolute;
    width: 35%;
    height: 45%;
    left: var(--pan-x);
    top: var(--pan-y);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mesh-panel {
    background:
        radial-gradient(ellipse at 40% 40%, rgba(255,179,186,0.4) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(186,255,201,0.3) 0%, transparent 50%),
        rgba(26,26,46,0.6);
    animation: meshShift 15s ease-in-out infinite;
}

.panel-text {
    position: relative;
    z-index: 2;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    letter-spacing: 0.12em;
    color: var(--parchment);
    opacity: 0.9;
}

.archive-lower {
    width: 70%;
    margin-top: 3vh;
}

.archive-lower p {
    font-size: clamp(0.88rem, 1.2vw, 1rem);
    color: var(--faded-lilac);
    line-height: 1.8;
}

/* Folio III: Observatory */
.folio-observatory { background: var(--midnight-ink); }

.observatory-sphere {
    width: 60vmin;
    height: 60vmin;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, rgba(255,179,186,0.5) 0%, transparent 40%),
        radial-gradient(circle at 65% 65%, rgba(186,255,201,0.4) 0%, transparent 40%),
        radial-gradient(circle at 50% 30%, rgba(186,225,255,0.5) 0%, transparent 45%),
        radial-gradient(circle at 70% 40%, rgba(255,255,186,0.3) 0%, transparent 35%),
        radial-gradient(circle at 30% 70%, rgba(232,186,255,0.4) 0%, transparent 40%);
    animation: sphereRotate 15s ease-in-out infinite;
    filter: blur(2px);
}

@keyframes sphereRotate {
    0%,100% { background-position: 35% 35%, 65% 65%, 50% 30%, 70% 40%, 30% 70%; }
    50% { background-position: 65% 45%, 35% 55%, 60% 70%, 30% 60%, 70% 30%; }
}

.cardinal-text {
    position: absolute;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(0.9rem, 1.8vw, 1.4rem);
    letter-spacing: 0.15em;
    color: var(--dusty-rose);
}

.cardinal-n { top: 8%; left: 50%; transform: translateX(-50%); }
.cardinal-e { right: 5%; top: 50%; transform: translateY(-50%); }
.cardinal-s { bottom: 8%; left: 50%; transform: translateX(-50%); }
.cardinal-w { left: 5%; top: 50%; transform: translateY(-50%); }

/* Folio IV: Reading Room */
.folio-reading {
    background: var(--charcoal-dusk);
    flex-direction: row;
    padding: 0;
}

.bookshelf {
    display: flex;
    width: 100%;
    height: 100%;
}

.spine {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--spine-color, var(--parchment));
    border-right: 1px solid var(--slate-veil);
    padding: 20px 10px;
    transition: background 200ms ease;
    cursor: pointer;
}

.spine-wide { flex: 3; }
.spine-narrow { flex: 1; }

.spine:last-child { border-right: none; }

@media(hover:hover){
    .spine:hover {
        background: rgba(255,179,186,0.06);
    }
}

/* Folio V: Manuscript */
.folio-manuscript {
    background: var(--charcoal-dusk);
    justify-content: center;
}

.manuscript-page {
    position: relative;
    max-width: 600px;
    padding: clamp(30px, 5vw, 60px);
}

.manuscript-page p {
    margin-bottom: 1.5rem;
    color: var(--parchment);
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.8;
}

.drop-cap {
    float: left;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4em;
    line-height: 0.8;
    padding-right: 0.1em;
    background: linear-gradient(180deg, var(--rose-quartz), var(--periwinkle));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.margin-note {
    position: absolute;
    left: -60px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--faded-lilac);
    writing-mode: vertical-rl;
    opacity: 0.6;
}

/* Folio VI: Engine */
.folio-engine { background: var(--midnight-ink); }

.engine-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: clamp(8px, 1.5vw, 16px);
    width: 80vw;
    height: 75vh;
}

.engine-card {
    position: relative;
    border: 1px solid var(--slate-veil);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 300ms ease;
}

.mesh-card {
    background:
        radial-gradient(ellipse at 40% 40%, rgba(255,179,186,0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 60%, rgba(186,225,255,0.3) 0%, transparent 50%),
        var(--midnight-ink);
    transition: background-position 300ms ease;
}

.engine-card span {
    position: relative;
    z-index: 2;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1rem, 2vw, 1.6rem);
    letter-spacing: 0.1em;
    color: var(--parchment);
}

@media(hover:hover){
    .engine-card:hover {
        box-shadow: 0 0 20px rgba(255,179,186,0.15), 0 0 40px rgba(186,225,255,0.1);
    }
}

/* Folio VII: Colophon */
.folio-colophon {
    background: #12121F;
}

.colophon-domain {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 0.8rem;
    color: #FFE5E5;
    letter-spacing: 0.1em;
}

.colophon-rule {
    width: 60px;
    height: 1px;
    background: var(--slate-veil);
    margin: 2rem 0;
}

.colophon-char {
    position: absolute;
    right: 10%;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20vw;
    line-height: 1;
    background: linear-gradient(180deg, var(--rose-quartz), var(--lavender));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.15;
}

/* Navigation */
.folio-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 100;
    background: rgba(15,15,35,0.8);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--slate-veil);
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--dusty-rose);
    background: transparent;
    cursor: pointer;
    position: relative;
    padding: 0;
    transition: all 200ms ease;
}

.nav-dot.active {
    background: var(--rose-quartz);
}

.nav-tooltip {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--parchment);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.nav-dot:hover .nav-tooltip {
    opacity: 1;
}

.nav-dot:hover {
    width: 12px;
    height: 12px;
}

/* Mobile fallback: vertical scroll */
@media (max-width: 768px) {
    html, body { overflow: auto; }
    .scroll-track {
        flex-direction: column;
        width: 100vw;
        height: auto;
        transform: none;
    }
    .folio {
        width: 100vw;
        min-height: 100vh;
        height: auto;
    }
    .folio-nav { display: none; }
    .progress-bar { display: none; }
    .engine-grid { grid-template-columns: repeat(2, 1fr); width: 90vw; height: auto; }
    .bookshelf { flex-wrap: wrap; height: auto; min-height: 100vh; }
    .spine { writing-mode: horizontal-tb; flex: auto; width: 100%; border-right: none; border-bottom: 1px solid var(--slate-veil); }
    .cardinal-text { position: static; transform: none; margin: 1rem 0; }
    .folio-observatory { flex-direction: column; gap: 1rem; }
    .margin-note { position: static; writing-mode: horizontal-tb; margin-bottom: 0.5rem; }
}
