/* ===========================================================
   chika.quest — translucent frost / cinematic descent
   =========================================================== */

:root {
    --c-abyss:   #0b1014;
    --c-thawed:  #1a2530;
    --c-glacial: #2d3e4d;
    --c-breath:  #7a9eb1;
    --c-iceveil: #a8c5d4;
    --c-vellum:  #d4e4ec;
    --c-rime:    #f0f4f3;
    --c-cyan:    #3a5566;

    --frost-bg:   rgba(168, 197, 212, 0.06);
    --frost-blur: blur(28px) saturate(1.1);
    --frost-border: 1px solid rgba(212, 228, 236, 0.08);
    --frost-inset:  inset 0 1px 0 rgba(240, 244, 243, 0.06);

    --gutter: 32px;
    --ease-thaw: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bloom: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    font-family: 'EB Garamond', Georgia, serif;
    font-feature-settings: "liga", "dlig", "kern";
    -webkit-font-smoothing: antialiased;
    color: var(--c-vellum);
    background: linear-gradient(180deg, #0b1014 0%, #1a2530 30%, #0b1014 60%, #1a2530 100%);
    background-attachment: fixed;
    line-height: 1.75;
    overflow-x: hidden;
}

.defs-svg { position: absolute; }

/* --- click-spawned bubbles overlay --- */
.click-bubbles {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 60;
    overflow: visible;
}

/* ===================== CHAMBERS ===================== */

.strata { position: relative; z-index: 1; }

.chamber {
    position: relative;
    width: 100%;
    overflow: hidden;
    scroll-snap-align: start;
    padding: clamp(2rem, 6vw, 6rem) clamp(1.25rem, 5vw, 5rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chamber-inner,
.longhall-layout {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}

/* massive recessed roman numeral */
.chamber-numeral {
    position: absolute;
    top: -0.18em;
    left: 0.02em;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: 22vw;
    line-height: 1;
    color: var(--c-thawed);
    opacity: 0.92;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    letter-spacing: -0.04em;
}

.chamber-id {
    font-family: 'Cormorant SC', 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-breath);
    margin-bottom: 1.6rem;
}

/* frosted panel base */
.frost {
    background: var(--frost-bg);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    border: var(--frost-border);
    box-shadow: var(--frost-inset);
}

/* frost-grow reveal mask */
.chamber {
    --reveal: 0;
    -webkit-mask-image: radial-gradient(140% 140% at 50% 50%, #000 calc(var(--reveal) * 1%), transparent calc(var(--reveal) * 1% + 14%));
    mask-image: radial-gradient(140% 140% at 50% 50%, #000 calc(var(--reveal) * 1%), transparent calc(var(--reveal) * 1% + 14%));
    transition: -webkit-mask-image 1200ms var(--ease-thaw), mask-image 1200ms var(--ease-thaw);
}
.chamber.thawed {
    --reveal: 100;
}
/* first chamber is visible immediately */
.chamber--threshold {
    -webkit-mask-image: none;
    mask-image: none;
}

/* ============ CHAMBER 1 — THRESHOLD ============ */

.chamber--threshold { min-height: 100vh; }

.threshold-grid {
    display: grid;
    grid-template-columns: 65fr 35fr;
    gap: var(--gutter);
    align-items: stretch;
}

.threshold-text {
    align-self: center;
    padding-right: clamp(0rem, 3vw, 3rem);
}

.site-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--c-rime);
    text-shadow: -0.5px 0 var(--c-breath), 0.5px 0 rgba(255, 200, 180, 0.4);
}

.site-sub {
    font-size: clamp(1.1rem, 2.4vw, 1.6rem);
    color: var(--c-iceveil);
    margin-top: 0.6rem;
    letter-spacing: 0.01em;
}
.site-sub em { font-style: italic; }

.threshold-note {
    margin-top: 2.4rem;
    max-width: 26ch;
    color: var(--c-cyan);
    font-size: 0.95rem;
    line-height: 1.7;
}

.threshold-panel {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    min-height: 60vh;
}
.blob-field {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.panel-veil {
    position: absolute;
    inset: 0;
    background: rgba(11, 16, 20, 0.18);
    backdrop-filter: blur(40px) saturate(0.8);
    -webkit-backdrop-filter: blur(40px) saturate(0.8);
}

/* drifting blobs */
.drift { transform-origin: center; }
.drift--a { animation: drift-a 26s ease-in-out infinite; }
.drift--b { animation: drift-b 33s ease-in-out infinite; }
.drift--c { animation: drift-c 41s ease-in-out infinite; }

@keyframes drift-a {
    0%,100% { transform: translate(0,0) scale(1); }
    50%     { transform: translate(28px,-22px) scale(1.06); }
}
@keyframes drift-b {
    0%,100% { transform: translate(0,0) scale(1); }
    50%     { transform: translate(-26px,18px) scale(0.94); }
}
@keyframes drift-c {
    0%,100% { transform: translate(0,0) scale(1); }
    50%     { transform: translate(18px,24px) scale(1.08); }
}

.scroll-whisper {
    position: absolute;
    left: 50%;
    bottom: clamp(1.2rem, 4vh, 3rem);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    z-index: 3;
}
.scroll-whisper span:first-child {
    font-family: 'Cormorant SC', serif;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--c-breath);
}
.scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, var(--c-breath), transparent);
    animation: scroll-pulse 3s var(--ease-thaw) infinite;
}
@keyframes scroll-pulse {
    0%,100% { opacity: 0.3; transform: scaleY(0.7); }
    50%     { opacity: 1;   transform: scaleY(1); }
}

/* ============ CHAMBER 2 — ANTECHAMBER ============ */

.chamber--antechamber { min-height: 140vh; }

.pebble-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.25rem, 3vw, 2.5rem);
    align-items: start;
}

.pebble {
    position: relative;
    border-radius: 60% / 50%;
    padding: clamp(1.6rem, 3vw, 2.6rem);
    min-height: 200px;
    overflow: hidden;
    cursor: default;
    transition: border-radius 800ms var(--ease-bloom),
                min-height 800ms var(--ease-bloom),
                transform 800ms var(--ease-bloom),
                box-shadow 600ms var(--ease-thaw);
}
.pebble-shape {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.5;
    transition: opacity 800ms var(--ease-thaw);
    z-index: 0;
}
.pebble-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}
.pebble-num {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 2.4rem;
    color: var(--c-iceveil);
    line-height: 1;
}
.pebble-noun {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 1.5rem;
    color: var(--c-rime);
    letter-spacing: 0.02em;
}
.pebble-body {
    position: relative;
    z-index: 1;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 800ms var(--ease-bloom), opacity 700ms var(--ease-thaw), margin-top 800ms var(--ease-bloom);
}
.pebble-body p {
    font-size: 1.0625rem;
    color: var(--c-vellum);
    max-width: 40ch;
}

.pebble.open {
    border-radius: 38% / 24%;
    min-height: 320px;
    box-shadow: var(--frost-inset), 0 0 60px rgba(122, 158, 177, 0.12);
}
.pebble.open .pebble-shape { opacity: 0.72; }
.pebble.open .pebble-body {
    max-height: 400px;
    opacity: 1;
    margin-top: 1.4rem;
}

/* ============ CHAMBER 3 — THE LONG HALL ============ */

.chamber--longhall { min-height: 200vh; padding-top: clamp(3rem, 8vw, 7rem); }

.longhall-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: clamp(2rem, 5vw, 5rem);
}

.rail {
    position: sticky;
    top: 14vh;
    height: 72vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}
.rail-id, .rail-label {
    margin-bottom: 0;
    writing-mode: vertical-rl;
    font-family: 'Cormorant SC', serif;
    font-size: 0.7rem;
    letter-spacing: 0.24em;
    color: var(--c-cyan);
}
.rail-label { color: var(--c-breath); }
.rail-track {
    position: relative;
    flex: 1;
    width: 6px;
    border-radius: 3px;
    background: rgba(168, 197, 212, 0.06);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    border: var(--frost-border);
    box-shadow: var(--frost-inset);
    overflow: hidden;
}
.rail-bubble {
    position: absolute;
    left: 50%;
    bottom: 0%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-bottom: -7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(240,244,243,0.85), rgba(168,197,212,0.4) 60%, rgba(122,158,177,0.15));
    box-shadow: 0 0 14px rgba(168, 197, 212, 0.4);
    transition: bottom 200ms linear;
}

.longhall-text {
    max-width: 58ch;
    padding-top: 1rem;
}
.stanza {
    font-size: 1.0625rem;
    line-height: 1.85;
    color: var(--c-vellum);
    margin-bottom: 1.6rem;
    text-align: left;
}
.stanza em { font-style: italic; font-weight: 500; color: var(--c-iceveil); }

.dropcap {
    float: left;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 3.6rem;
    line-height: 0.8;
    padding: 0.18em 0.12em 0 0;
    color: var(--c-rime);
}

.sigil-sep {
    display: flex;
    justify-content: center;
    margin: 2.6rem 0;
}
.sigil-sep svg { width: 46px; height: 46px; opacity: 0.6; }
.sigil-spin {
    transform-origin: 30px 30px;
    animation: sigil-rotate 8s linear infinite;
}
@keyframes sigil-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============ CHAMBER 4 — THE POOL ============ */

.chamber--pool {
    min-height: 100vh;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
    padding-bottom: clamp(3rem, 12vh, 8rem);
}
.pool-bubbles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}
.pool-inner {
    position: relative;
    z-index: 2;
    border-radius: 8px;
    padding: clamp(2rem, 5vw, 4rem) clamp(2rem, 7vw, 6rem);
    max-width: 640px;
}
.pool-line {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    color: var(--c-rime);
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-shadow: -0.5px 0 var(--c-breath), 0.5px 0 rgba(255, 200, 180, 0.4);
}
.pool-line--soft { color: var(--c-iceveil); margin-top: 0.3rem; }
.pool-coda {
    margin-top: 1.8rem;
    font-size: 0.98rem;
    color: var(--c-cyan);
    font-style: italic;
    line-height: 1.8;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 880px) {
    .threshold-grid { grid-template-columns: 1fr; }
    .threshold-panel { min-height: 42vh; order: -1; }
    .threshold-text { padding-right: 0; }
    .pebble-row { grid-template-columns: 1fr; }
    .longhall-layout { grid-template-columns: 1fr; }
    .rail {
        position: relative;
        top: 0;
        height: auto;
        flex-direction: row;
        width: 100%;
        margin-bottom: 2rem;
    }
    .rail-id, .rail-label { writing-mode: horizontal-tb; }
    .rail-track { flex: 1; height: 6px; width: auto; }
    .rail-bubble {
        left: 0%;
        bottom: 50%;
        margin-bottom: -7px;
        margin-left: -7px;
        transition: left 200ms linear;
    }
    .chamber-numeral { font-size: 30vw; }
    .chamber--antechamber, .chamber--longhall { min-height: auto; }
}

@media (max-width: 480px) {
    .chamber { padding: 3rem 1.1rem; }
}
