/* =====================================================================
   aiice.io — wabi-sabi tea-and-ice meditation
   palette: warm linen, milk tea foam, steeped amber, clay rim,
            river-stone ink, wet sand, glacier breath, deep mint shadow
   ===================================================================== */

:root {
    --linen: #f4ece0;
    --milk-tea: #e8d9c3;
    --steeped-amber: #d6b896;
    --clay-rim: #b87d5a;
    --river-stone: #4a4038;
    --wet-sand: #8a7f72;
    --glacier: #a8c4c0;
    --deep-mint: #6d8a88;

    --ease-thaw: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html, body {
    background-color: var(--linen);
    color: var(--river-stone);
    font-family: "Newsreader", Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.18rem);
    line-height: 1.78;
    overflow-x: hidden;
    scroll-behavior: auto; /* custom smooth scroll handles it */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    position: relative;
    cursor: default;
}

/* ceramic grain — fixed, full viewport, multiply blend */
.ceramic-grain {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    opacity: 0.08;
    mix-blend-mode: multiply;
    z-index: 9000;
}

.defs-only {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ----- chamber dot navigation ------------------------------------ */
.chamber-dots {
    position: fixed;
    top: 50%;
    right: clamp(14px, 2vw, 28px);
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 8000;
    pointer-events: auto;
}

.cdot {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--wet-sand);
    transition: opacity 0.6s var(--ease-thaw);
    opacity: 0.35;
}

.cdot svg {
    width: 14px;
    height: 14px;
    overflow: visible;
    transition: width 0.8s var(--ease-thaw), height 0.8s var(--ease-thaw);
}

.cdot.active svg {
    width: 22px;
    height: 22px;
}

.cdot.active {
    opacity: 1;
}

.cdot-path {
    fill: var(--wet-sand);
    fill-opacity: 0.55;
    transition: fill-opacity 0.6s var(--ease-thaw), fill 0.6s var(--ease-thaw);
}

.cdot.active .cdot-path {
    fill: var(--clay-rim);
    fill-opacity: 0.85;
}

.cdot-label {
    font-family: "Commissioner", "Inter", sans-serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--wet-sand);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.5s var(--ease-thaw), transform 0.5s var(--ease-thaw);
    white-space: nowrap;
}

.cdot:hover .cdot-label,
.cdot.active .cdot-label {
    opacity: 0.85;
    transform: translateX(0);
}

/* ----- ripple layer (cursor meniscus) ---------------------------- */
.ripple-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 7000;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--glacier);
    background: radial-gradient(circle,
        rgba(168, 196, 192, 0.10) 0%,
        rgba(168, 196, 192, 0.03) 60%,
        transparent 100%);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    will-change: transform, opacity;
    width: 360px;
    height: 360px;
    opacity: 0;
}

/* ----- page / chambers ------------------------------------------- */
.page {
    position: relative;
    z-index: 1;
    width: 100%;
    will-change: transform;
}

.chamber {
    position: relative;
    width: 100%;
    min-height: 110vh;
    padding: clamp(40px, 8vh, 120px) clamp(24px, 7vw, 120px);
    overflow: hidden;
}

/* gradient crossfades — chamber backgrounds bleed into each other */
.chamber-1 {
    min-height: 120vh;
    background:
        radial-gradient(ellipse at 80% 20%, rgba(168, 196, 192, 0.16) 0%, transparent 55%),
        linear-gradient(180deg, var(--linen) 0%, var(--linen) 80%, var(--milk-tea) 100%);
}

.chamber-2 {
    min-height: 130vh;
    background:
        radial-gradient(ellipse at 110% 60%, rgba(214, 184, 150, 0.32) 0%, transparent 60%),
        linear-gradient(180deg, var(--milk-tea) 0%, var(--linen) 50%, var(--linen) 100%);
}

.chamber-3 {
    min-height: 115vh;
    background: linear-gradient(180deg, var(--linen) 0%, var(--linen) 100%);
}

.chamber-4 {
    min-height: 140vh;
    background: linear-gradient(180deg, var(--linen) 0%, var(--milk-tea) 40%, var(--milk-tea) 100%);
}

.chamber-5 {
    min-height: 130vh;
    background: linear-gradient(180deg, var(--milk-tea) 0%, var(--linen) 60%, var(--linen) 100%);
}

.chamber-6 {
    min-height: 130vh;
    background:
        radial-gradient(circle at 30% 70%, rgba(184, 125, 90, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 75% 30%, rgba(214, 184, 150, 0.10) 0%, transparent 50%),
        linear-gradient(180deg, var(--linen) 0%, var(--milk-tea) 100%);
}

.chamber-7 {
    min-height: 130vh;
    background: linear-gradient(180deg, var(--milk-tea) 0%, var(--linen) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ----- CHAMBER I — the held ice ---------------------------------- */
.blob {
    position: absolute;
    pointer-events: none;
}

.blob-1-cool {
    top: 6vh;
    right: 8vw;
    width: clamp(280px, 36vw, 520px);
    height: clamp(280px, 36vw, 520px);
}

.word-aiice {
    position: absolute;
    bottom: 22vh;
    left: clamp(24px, 8vw, 120px);
    font-family: "Fraunces", Georgia, serif;
    font-weight: 300;
    font-variation-settings: "opsz" 144, "SOFT" 0;
    font-size: clamp(4rem, 9vw, 10rem);
    letter-spacing: -0.015em;
    color: var(--river-stone);
    line-height: 0.92;
    transition: font-variation-settings 3.2s var(--ease-thaw);
}

.word-aiice.melted {
    font-variation-settings: "opsz" 144, "SOFT" 100;
}

.chamber-1-trace {
    position: absolute;
    bottom: 14vh;
    left: clamp(24px, 8vw, 120px);
    font-family: "Cormorant Infant", "Lora", Georgia, serif;
    font-style: italic;
    font-weight: 300;
    color: var(--wet-sand);
    font-size: clamp(1.05rem, 1.4vw, 1.3rem);
    max-width: 28ch;
}

/* ----- CHAMBER II — the first drop ------------------------------- */
.blob-2-amber {
    position: absolute;
    top: 8vh;
    right: -6vw;
    width: clamp(440px, 56vw, 800px);
    height: clamp(440px, 60vw, 820px);
    z-index: 1;
}

.prose-2 {
    position: relative;
    z-index: 2;
    margin-top: 22vh;
    margin-left: clamp(24px, 6vw, 100px);
    max-width: min(680px, 86vw);
    font-family: "Newsreader", Georgia, serif;
    font-size: clamp(1.05rem, 1.3vw, 1.28rem);
    line-height: 1.82;
    color: var(--river-stone);
}

/* shape-outside floats — text wraps around blob's left edge */
.prose-2::before {
    content: "";
    float: right;
    width: clamp(220px, 36vw, 480px);
    height: clamp(360px, 56vw, 660px);
    shape-outside: path("M 480 0 C 320 20, 200 80, 160 220 C 120 360, 180 500, 280 580 C 380 660, 460 660, 480 660 L 480 0 Z");
    shape-margin: 18px;
    margin-right: -40px;
}

.chamber-prelude {
    display: block;
    font-family: "Commissioner", "Inter", sans-serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: var(--wet-sand);
    margin-bottom: 1.4em;
}

.alice {
    font-family: "Newsreader", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    color: var(--clay-rim);
}

em {
    font-style: italic;
}

/* ----- CHAMBER III — three whispers ------------------------------ */
.hairline-crack {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.whisper {
    position: absolute;
    z-index: 2;
    max-width: 28ch;
    font-family: "Cormorant Infant", "Lora", Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.6rem, 2.8vw, 2.4rem);
    letter-spacing: 0.005em;
    line-height: 1.32;
    color: var(--river-stone);
}

.whisper p {
    position: relative;
    z-index: 2;
}

.whisper .blob-shadow {
    position: absolute;
    z-index: -1;
    width: 280px;
    height: 280px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.whisper-a {
    top: 18vh;
    left: 8vw;
}

.whisper-b {
    top: 50vh;
    left: 38vw;
}

.whisper-c {
    bottom: 14vh;
    right: 8vw;
    text-align: right;
}

/* ----- CHAMBER IV — the melt ------------------------------------- */
.blob-4-vast {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.prelude-iv {
    position: absolute;
    top: 6vh;
    left: clamp(24px, 6vw, 80px);
    z-index: 2;
}

.marginalia {
    position: absolute;
    z-index: 2;
    font-family: "Newsreader", Georgia, serif;
    font-size: clamp(0.9rem, 1.05vw, 1.05rem);
    line-height: 1.7;
    color: var(--river-stone);
    max-width: 32ch;
    font-style: italic;
}

.marginalia-tl {
    top: 18vh;
    left: clamp(40px, 9vw, 140px);
    max-width: 30ch;
}

.marginalia-bl {
    bottom: 18vh;
    left: clamp(60px, 14vw, 220px);
    max-width: 28ch;
}

.marginalia-br {
    bottom: 8vh;
    right: clamp(40px, 10vw, 160px);
    max-width: 26ch;
    text-align: right;
}

/* ----- CHAMBER V — Alice's doorway ------------------------------- */
.blob-5-portal {
    position: absolute;
    top: 0;
    left: -2vw;
    width: clamp(260px, 30vw, 460px);
    height: 100%;
    z-index: 0;
}

.margin-column {
    position: relative;
    z-index: 2;
    margin-left: clamp(280px, 36vw, 520px);
    margin-top: 18vh;
    max-width: min(420px, 58vw);
    display: flex;
    flex-direction: column;
    gap: 1.6em;
}

.cormorant {
    font-family: "Cormorant Infant", "Lora", Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.15rem, 1.5vw, 1.5rem);
    line-height: 1.55;
    letter-spacing: 0.005em;
    color: var(--river-stone);
}

.hare-shadow {
    position: absolute;
    bottom: 0;
    right: clamp(30px, 6vw, 100px);
    width: clamp(46px, 5vw, 80px);
    height: auto;
    z-index: 1;
    pointer-events: none;
}

/* ----- CHAMBER VI — warm residue --------------------------------- */
.prelude-vi {
    position: absolute;
    top: 6vh;
    left: clamp(24px, 6vw, 80px);
    z-index: 2;
}

.residue-pair {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.3em;
    max-width: 32ch;
}

.r-key {
    font-family: "Commissioner", "Inter", sans-serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: var(--wet-sand);
}

.r-val {
    font-family: "Newsreader", Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.2vw, 1.18rem);
    line-height: 1.6;
    color: var(--river-stone);
}

.pair-1 { top: 16vh; left: 9vw; }
.pair-2 { top: 24vh; right: 11vw; text-align: right; align-items: flex-end; }
.pair-3 { top: 50vh; left: 22vw; }
.pair-4 { top: 60vh; right: 18vw; text-align: right; align-items: flex-end; }
.pair-5 { bottom: 22vh; left: 12vw; }
.pair-6 { bottom: 10vh; right: 10vw; text-align: right; align-items: flex-end; }

/* ----- CHAMBER VII — the rim ------------------------------------- */
.blob-7-settle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(520px, 70vw, 1100px);
    height: clamp(520px, 70vw, 1100px);
    z-index: 0;
}

.rim-phrase {
    position: relative;
    z-index: 2;
    text-align: center;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 300;
    font-variation-settings: "opsz" 96, "SOFT" 80;
    font-size: clamp(1.4rem, 2.4vw, 2.2rem);
    letter-spacing: -0.005em;
    line-height: 1.55;
    color: var(--river-stone);
    max-width: 36ch;
}

.rim-link {
    color: var(--clay-rim);
    text-decoration: none;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    position: relative;
    display: inline-block;
}

.rim-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background: var(--clay-rim);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.7s var(--ease-thaw);
}

.rim-link:hover::after {
    transform: scaleX(1);
}

.page-foot {
    position: absolute;
    bottom: 4vh;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s var(--ease-thaw);
}

.page-foot:hover {
    opacity: 1;
}

.foot-credit {
    font-family: "Commissioner", "Inter", sans-serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--wet-sand);
}

/* ----- condensation droplets ------------------------------------- */
.droplet {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(244, 236, 224, 0.85) 0%,
        rgba(214, 184, 150, 0.55) 50%,
        rgba(184, 125, 90, 0.35) 100%);
    pointer-events: none;
    z-index: 5;
    box-shadow: -1px -1px 0 rgba(244, 236, 224, 0.6) inset;
    will-change: transform, opacity;
}

/* ----- reduced motion -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .ripple-layer,
    .ripple,
    .droplet {
        display: none !important;
    }

    .word-aiice {
        font-variation-settings: "opsz" 144, "SOFT" 100 !important;
        transition: none;
    }

    * {
        animation-duration: 0s !important;
        transition-duration: 0s !important;
    }
}

/* ----- responsive tightening ------------------------------------- */
@media (max-width: 720px) {
    .chamber {
        padding: clamp(32px, 6vh, 80px) clamp(18px, 5vw, 48px);
    }

    .chamber-dots {
        right: 8px;
        gap: 12px;
    }

    .cdot-label {
        display: none;
    }

    .blob-1-cool {
        width: 60vw;
        height: 60vw;
        top: 10vh;
        right: 4vw;
    }

    .word-aiice {
        font-size: clamp(3.5rem, 16vw, 6rem);
        bottom: 20vh;
    }

    .prose-2 {
        margin-top: 30vh;
        margin-left: 0;
    }

    .prose-2::before {
        width: 50vw;
        height: 50vw;
    }

    .whisper-a, .whisper-b, .whisper-c {
        position: relative;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 4vh auto;
        text-align: left;
    }

    .blob-5-portal {
        width: 28vw;
    }

    .margin-column {
        margin-left: 32vw;
    }

    .residue-pair {
        position: relative;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 3vh auto;
        text-align: left !important;
        align-items: flex-start !important;
    }
}
