:root {
    --stone-blue: #586A73;
    --ink: #202522;
    --warm-paper: #DDD3C2;
    --mist: #AEBCC2;
    --clay: #B56A4A;
    --ash: #B8B1A6;
    --hanji: #F6F1E8;
    --serif-kr: 'Noto Serif KR', serif;
    --dodum: 'Gowun Dodum', sans-serif;
    --plex: 'IBM Plex Sans KR', sans-serif;
    --instrument: 'Instrument Serif', serif;
}

/* Typography note: IBM Plex Sans KR** for the few practical notes and metadata; IBM Plex Sans KR—with a restrained Instrument Serif accent instead of the batch’s common mono/condensed tech voice. */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--hanji);
    color: var(--ink);
    font-family: var(--plex);
    font-weight: 300;
}

button {
    font: inherit;
    color: inherit;
}

.hanji-grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: .44;
    background:
        radial-gradient(circle at 12% 18%, rgba(88, 106, 115, .08) 0 1px, transparent 1.8px),
        radial-gradient(circle at 78% 22%, rgba(181, 106, 74, .07) 0 1px, transparent 1.7px),
        radial-gradient(circle at 45% 81%, rgba(32, 37, 34, .06) 0 1px, transparent 1.5px),
        repeating-linear-gradient(92deg, rgba(32, 37, 34, .026) 0 1px, transparent 1px 18px),
        repeating-linear-gradient(178deg, rgba(184, 177, 166, .035) 0 1px, transparent 1px 23px);
    background-size: 180px 180px, 220px 220px, 160px 160px, auto, auto;
    mix-blend-mode: multiply;
    animation: paperBreath 18s ease-in-out infinite alternate;
}

@keyframes paperBreath {
    from {
        opacity: .36;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: .52;
        transform: translate3d(6px, -4px, 0);
    }
}

.paper-door {
    position: fixed;
    inset: 0;
    z-index: 12;
    pointer-events: none;
    transition: opacity 1200ms ease, visibility 1200ms ease;
}

.door-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50.2%;
    background:
        linear-gradient(90deg, rgba(174, 188, 194, .10), transparent 22%, rgba(246, 241, 232, .95)),
        var(--hanji);
    box-shadow: inset 0 0 90px rgba(184, 177, 166, .28);
    transition: transform 1600ms cubic-bezier(.77, 0, .18, 1);
}

.door-left {
    left: 0;
    transform-origin: left center;
}

.door-right {
    right: 0;
    transform-origin: right center;
}

.door-seam {
    position: absolute;
    top: 6vh;
    bottom: 7vh;
    left: 50%;
    width: 1px;
    background: linear-gradient(transparent, rgba(88, 106, 115, .4), rgba(181, 106, 74, .28), transparent);
    box-shadow: 0 0 34px rgba(88, 106, 115, .2);
}

body.door-open .door-left {
    transform: translateX(-55vw) scaleX(.97);
}

body.door-open .door-right {
    transform: translateX(55vw) scaleX(.97);
}

body.door-open .paper-door {
    opacity: 0;
    visibility: hidden;
}

.rooms {
    position: relative;
    z-index: 2;
}

.room {
    position: relative;
    min-height: 100vh;
    padding: clamp(34px, 6vw, 86px);
    overflow: hidden;
    display: grid;
    background: var(--hanji);
}

.room::before {
    content: "";
    position: absolute;
    inset: 7vh 8vw;
    border: 1px solid rgba(184, 177, 166, .18);
    opacity: .48;
    pointer-events: none;
}

.room-label {
    margin: 0 0 24px;
    color: var(--stone-blue);
    font-family: var(--dodum);
    font-size: clamp(12px, 1.2vw, 15px);
    letter-spacing: .16em;
}

h1, h2, p {
    margin-top: 0;
}

h1 {
    font-family: var(--serif-kr);
    font-weight: 400;
    letter-spacing: .18em;
    font-size: clamp(38px, 7vw, 104px);
    line-height: 1;
}

h2 {
    font-family: var(--serif-kr);
    font-size: clamp(34px, 5vw, 82px);
    line-height: 1.08;
    font-weight: 300;
    letter-spacing: -.025em;
    max-width: 760px;
}

p {
    font-size: clamp(15px, 1.45vw, 19px);
    line-height: 1.9;
    letter-spacing: .025em;
}

.threshold {
    align-items: end;
    justify-items: start;
    padding-bottom: 14vh;
}

.fold-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 38vw;
    width: 1px;
    background: linear-gradient(transparent 3%, rgba(88, 106, 115, .32), rgba(181, 106, 74, .18), transparent 96%);
}

.fold-line::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 5px;
    width: 34px;
    background: linear-gradient(90deg, rgba(88, 106, 115, .04), transparent);
}

.threshold-copy {
    margin-left: 8vw;
    transform: translateY(-1vh);
}

.domain-note {
    max-width: 360px;
    color: rgba(32, 37, 34, .62);
    font-family: var(--dodum);
}

.open-seam {
    position: absolute;
    right: 11vw;
    top: 44vh;
    border: 0;
    background: transparent;
    color: var(--clay);
    font-family: var(--dodum);
    letter-spacing: .18em;
    font-size: 13px;
    cursor: pointer;
    padding: 18px 4px;
    writing-mode: vertical-rl;
}

.open-seam::before {
    content: "";
    display: block;
    width: 1px;
    height: 80px;
    margin: 0 auto 18px;
    background: var(--clay);
    opacity: .6;
}

.hint {
    position: absolute;
    left: 9vw;
    bottom: 5vh;
    color: rgba(32, 37, 34, .38);
    font-family: var(--plex);
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.desk {
    background: linear-gradient(180deg, var(--hanji), #DDD3C2 220%);
    align-items: center;
}

.desk-line {
    position: absolute;
    left: 12vw;
    right: 27vw;
    top: 61vh;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(32, 37, 34, .68), transparent);
    transform: rotate(-1.2deg);
}

.moon-jar {
    position: absolute;
    right: 15vw;
    bottom: 15vh;
    width: clamp(190px, 26vw, 370px);
    aspect-ratio: 1 / 1.12;
    border-radius: 48% 48% 44% 44% / 34% 34% 56% 56%;
    border: 1px solid rgba(88, 106, 115, .17);
    background: radial-gradient(circle at 50% 30%, rgba(246, 241, 232, .02), rgba(88, 106, 115, .08) 66%, rgba(32, 37, 34, .08));
    box-shadow: 38px 42px 80px rgba(32, 37, 34, .13);
    opacity: .75;
}

.moon-jar::before {
    content: "";
    position: absolute;
    top: 6%;
    left: 34%;
    width: 32%;
    height: 10%;
    border: 1px solid rgba(88, 106, 115, .15);
    border-bottom: 0;
    border-radius: 50% 50% 0 0;
}

.low-note {
    align-self: end;
    margin-left: 11vw;
    margin-bottom: 18vh;
    max-width: 680px;
}

.low-note p:last-child,
.window-note p:last-child,
.courtyard-note p:last-child,
.after-note p:last-child {
    max-width: 520px;
    color: rgba(32, 37, 34, .68);
    font-family: var(--dodum);
}

.pencil-ticks {
    position: absolute;
    left: 17vw;
    bottom: 22vh;
    display: flex;
    gap: 14px;
}

.pencil-ticks i {
    display: block;
    width: 1px;
    height: 18px;
    background: rgba(32, 37, 34, .35);
    transform: rotate(var(--tilt, -9deg));
}

.pencil-ticks i:nth-child(2) { --tilt: 7deg; height: 12px; }
.pencil-ticks i:nth-child(3) { --tilt: -3deg; height: 22px; }
.pencil-ticks i:nth-child(4) { --tilt: 11deg; height: 9px; }
.pencil-ticks i:nth-child(5) { --tilt: -14deg; height: 15px; }

.window {
    background: linear-gradient(160deg, #F6F1E8 0%, #F6F1E8 55%, rgba(174, 188, 194, .42) 100%);
    align-items: center;
}

.window-light {
    position: absolute;
    top: 12vh;
    right: 10vw;
    width: min(44vw, 610px);
    height: 56vh;
    border: 1px solid rgba(88, 106, 115, .18);
    background: linear-gradient(115deg, rgba(221, 211, 194, .34), rgba(246, 241, 232, .15));
    box-shadow: -36px 48px 110px rgba(174, 188, 194, .35);
}

.window-light span {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(88, 106, 115, .15);
}

.window-light span:nth-child(1) { left: 33%; }
.window-light span:nth-child(2) { left: 66%; }
.window-light span:nth-child(3) { left: 0; right: 0; top: 50%; width: auto; height: 1px; bottom: auto; }

.window-note {
    margin-left: 9vw;
    max-width: 720px;
    z-index: 2;
}

.dust-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.dust {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: rgba(181, 106, 74, .24);
    transform: translate3d(0, 0, 0);
}

.courtyard {
    background: linear-gradient(180deg, #DDD3C2 0%, #F6F1E8 80%);
    align-items: end;
}

.courtyard-grid {
    position: absolute;
    inset: 10vh 12vw 18vh 13vw;
}

.stone {
    position: absolute;
    display: block;
    border-radius: 48% 52% 45% 55%;
    background: radial-gradient(circle at 40% 32%, rgba(88, 106, 115, .46), rgba(32, 37, 34, .68));
    box-shadow: 26px 28px 60px rgba(32, 37, 34, .18);
}

.stone-a { width: 92px; height: 70px; left: 14%; top: 48%; transform: rotate(-12deg); }
.stone-b { width: 52px; height: 43px; left: 54%; top: 28%; transform: rotate(18deg); opacity: .78; }
.stone-c { width: 120px; height: 74px; right: 8%; bottom: 12%; transform: rotate(8deg); opacity: .72; }

.rake-line {
    position: absolute;
    left: 4%;
    right: 4%;
    height: 1px;
    background: rgba(184, 177, 166, .72);
    box-shadow: 0 16px 0 rgba(184, 177, 166, .45), 0 32px 0 rgba(184, 177, 166, .28);
}

.line-a { top: 22%; transform: rotate(-4deg); }
.line-b { top: 54%; transform: rotate(2deg); }
.line-c { top: 76%; transform: rotate(-1deg); }

.courtyard-note {
    margin-left: 47vw;
    margin-bottom: 11vh;
    max-width: 660px;
    position: relative;
    z-index: 2;
}

.afterimage {
    background: radial-gradient(circle at 80% 20%, rgba(88, 106, 115, .3), transparent 34%), linear-gradient(180deg, #586A73, #202522 76%);
    color: var(--hanji);
    align-items: center;
}

.afterimage::before {
    border-color: rgba(246, 241, 232, .09);
}

.night-shelf {
    position: absolute;
    left: 10vw;
    right: 12vw;
    bottom: 26vh;
    height: 120px;
}

.shelf-line {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(246, 241, 232, .34), transparent);
}

.folded-note {
    position: absolute;
    left: 16%;
    bottom: 25px;
    width: 110px;
    height: 72px;
    background: rgba(246, 241, 232, .76);
    clip-path: polygon(0 0, 78% 0, 100% 24%, 100% 100%, 0 100%);
    box-shadow: 14px 18px 38px rgba(0, 0, 0, .18);
}

.small-jar {
    position: absolute;
    right: 22%;
    bottom: 25px;
    width: 94px;
    height: 116px;
    border: 1px solid rgba(246, 241, 232, .4);
    border-radius: 48% 48% 42% 42% / 36% 36% 55% 55%;
    opacity: .55;
}

.after-note {
    margin-left: 12vw;
    margin-top: -18vh;
    max-width: 780px;
}

.after-note .room-label,
.after-note p:last-child {
    color: rgba(246, 241, 232, .72);
}

.closing {
    font-family: var(--instrument);
    font-size: clamp(22px, 3vw, 42px);
    color: #DDD3C2;
    margin-top: 44px;
    letter-spacing: .18em;
}

.room-nav {
    position: fixed;
    z-index: 9;
    top: 50%;
    right: 28px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.nav-mark {
    width: 8px;
    height: 38px;
    padding: 0;
    border: 0;
    background: rgba(88, 106, 115, .28);
    cursor: pointer;
    position: relative;
    transition: height 420ms ease, background 420ms ease;
}

.nav-mark.active {
    height: 72px;
    background: var(--clay);
}

.nav-mark span {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    opacity: 0;
    color: var(--stone-blue);
    font-family: var(--dodum);
    font-size: 12px;
    letter-spacing: .14em;
    transition: opacity 300ms ease;
}

.nav-mark:hover span {
    opacity: 1;
}

.room-counter {
    position: fixed;
    left: 28px;
    top: 28px;
    z-index: 8;
    color: rgba(32, 37, 34, .5);
    font-family: var(--plex);
    font-size: 12px;
    letter-spacing: .22em;
    transition: color 300ms ease;
}

body.in-night .room-counter,
body.in-night .nav-mark span {
    color: rgba(246, 241, 232, .7);
}

.room > article,
.threshold-copy,
.desk-line,
.moon-jar,
.window-light,
.courtyard-grid,
.night-shelf {
    opacity: .35;
    transform: translateY(28px);
    transition: opacity 900ms ease, transform 900ms ease;
}

.room.current > article,
.threshold.current .threshold-copy,
.desk.current .desk-line,
.desk.current .moon-jar,
.window.current .window-light,
.courtyard.current .courtyard-grid,
.afterimage.current .night-shelf {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 760px) {
    .room {
        padding: 28px;
    }

    .threshold-copy,
    .low-note,
    .window-note,
    .after-note {
        margin-left: 0;
    }

    .courtyard-note {
        margin-left: 0;
        margin-bottom: 16vh;
    }

    .window-light {
        right: -14vw;
        width: 82vw;
        height: 46vh;
    }

    .moon-jar {
        right: -16vw;
        bottom: 12vh;
    }

    .room-nav {
        right: 16px;
    }

    .open-seam {
        right: 24px;
    }
}
