/* hanun.ai — Slow Tea, Cold Stone */
:root {
    --hanji-cream: #F4EDDC;
    --steeped-tea: #E8DEC6;
    --pine-soot: #3A342E;
    --river-stone: #A59A8A;
    --pine-mist: #7C8B7E;
    --vermilion: #C97B5A;
    --highlight-cream: #FBF6EC;
    --deep-ink: #2A2520;

    --iris-d: 12vmin;
    --idle-dilation: 0;

    --serif-display: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
    --serif-body: 'Noto Serif KR', 'Inter', 'Lora', serif;
    --hand: 'Caveat', 'Inter', cursive;
}

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

html, body {
    background: var(--hanji-cream);
    color: var(--pine-soot);
    font-family: var(--serif-body);
    font-weight: 300;
    font-size: 14.5px;
    line-height: 1.85;
    letter-spacing: 0.015em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

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

/* Hanji paper texture — long fiber threads */
.hanji-paper {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
    opacity: 0.18;
    background-image:
        repeating-linear-gradient(91deg,
            transparent 0,
            transparent 38px,
            rgba(58, 52, 46, 0.05) 38px,
            rgba(58, 52, 46, 0.05) 38.6px,
            transparent 38.6px,
            transparent 124px),
        repeating-linear-gradient(89.4deg,
            transparent 0,
            transparent 73px,
            rgba(58, 52, 46, 0.04) 73px,
            rgba(58, 52, 46, 0.04) 73.5px,
            transparent 73.5px,
            transparent 215px),
        repeating-linear-gradient(90.7deg,
            transparent 0,
            transparent 11px,
            rgba(165, 154, 138, 0.04) 11px,
            rgba(165, 154, 138, 0.04) 11.4px,
            transparent 11.4px,
            transparent 47px);
}

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

/* Masthead */
.masthead {
    position: fixed;
    top: 4vh;
    left: 4vw;
    z-index: 20;
    font-family: var(--serif-display);
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.18em;
    color: var(--river-stone);
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.domain-mark {
    color: var(--pine-soot);
    font-size: 18px;
    letter-spacing: 0.06em;
}

.dot-mark {
    color: var(--vermilion);
    opacity: 0.78;
}

.domain-gloss {
    font-family: var(--serif-body);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.4em;
    color: var(--river-stone);
    opacity: 0.72;
}

/* Iris navigation — right-edge column of seven dots */
.iris-nav {
    position: fixed;
    top: 50%;
    left: 88vw;
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.iris-nav .dot {
    appearance: none;
    background: transparent;
    border: 1px solid var(--river-stone);
    width: 4px;
    height: 4px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: background-color 240ms cubic-bezier(0.16, 1, 0.3, 1),
                border-color 240ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.iris-nav .dot.is-active {
    background: var(--pine-soot);
    border-color: var(--pine-soot);
    transform: scale(1.06);
}

.iris-nav .dot.is-arriving {
    animation: ink-settle 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ink-settle {
    0% { transform: scale(0.4); opacity: 0.2; }
    70% { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(1.06); opacity: 1; }
}

.iris-nav .dot-numeral {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--serif-display);
    font-weight: 300;
    font-size: 13px;
    color: var(--river-stone);
    opacity: 0;
    transition: opacity 320ms ease;
    pointer-events: none;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.iris-nav .dot:hover .dot-numeral,
.iris-nav .dot.is-active .dot-numeral {
    opacity: 0.84;
}

/* The scroll container — vertical scroll painting */
.scroll {
    position: relative;
    z-index: 5;
    width: 100%;
    padding-top: 8vh;
}

.breath {
    position: relative;
    width: 100%;
    height: 118vh;
    margin-bottom: 22vh;
}

.breath:last-child {
    margin-bottom: 18vh;
}

/* Chamber name */
.chamber-name {
    position: absolute;
    left: 8vw;
    top: 18vh;
    font-family: var(--serif-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(2.4rem, 5.6vw, 4.8rem);
    letter-spacing: 0.012em;
    line-height: 1.06;
    color: var(--pine-soot);
    opacity: 0.9;
    max-width: 30vw;
}

/* Iris — the central organizing element */
.iris {
    position: absolute;
    left: 50vw;
    top: 64vh;
    width: calc(var(--iris-d) + var(--idle-dilation) * 0.6vmin);
    height: calc(var(--iris-d) + var(--idle-dilation) * 0.6vmin);
    transform: translate(-50%, -50%);
    transition: width 1800ms cubic-bezier(0.22, 1, 0.36, 1),
                height 1800ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, width, height;
    pointer-events: none;
}

.iris.iris-pulse {
    animation: iris-pulse 540ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes iris-pulse {
    0%   { transform: translate(-50%, -50%); }
    50%  { transform: translate(-50%, calc(-50% + 0.3px)); }
    100% { transform: translate(-50%, -50%); }
}

.iris-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    filter:
        drop-shadow(0 1px 0 var(--highlight-cream))
        drop-shadow(0 0 36px rgba(165, 154, 138, 0.22));
}

.iris-rim {
    fill: none;
    stroke: var(--pine-soot);
    stroke-width: 1;
    opacity: 0.42;
    vector-effect: non-scaling-stroke;
}

.iris-socket {
    fill: var(--steeped-tea);
    stroke: none;
}

.iris-socket--inverted {
    fill: var(--deep-ink);
}

.iris-spokes {
    opacity: 0.06;
    stroke: var(--pine-soot);
    stroke-width: 0.5;
    vector-effect: non-scaling-stroke;
    transition: opacity 1200ms ease;
}

.iris-spokes.is-visible {
    opacity: 0.32;
}

.iris-fog {
    opacity: 0.86;
    mix-blend-mode: multiply;
    transition: opacity 1200ms ease;
}

.iris-fog--inverted {
    mix-blend-mode: normal;
}

.iris-fog--caustic {
    opacity: 0.7;
    animation: caustic-shimmer 6.4s ease-in-out infinite;
}

@keyframes caustic-shimmer {
    0%, 100% { opacity: 0.55; transform: scale(1); transform-origin: 100px 100px; }
    50% { opacity: 0.78; transform: scale(1.015); transform-origin: 100px 100px; }
}

.iris-fog--motes {
    opacity: 0.42;
}

.iris-canvas {
    position: absolute;
    inset: 8%;
    width: 84%;
    height: 84%;
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: multiply;
    opacity: 0.78;
    -webkit-mask-image: radial-gradient(circle at center, #000 56%, transparent 76%);
            mask-image: radial-gradient(circle at center, #000 56%, transparent 76%);
}

.iris-canvas--inverted {
    mix-blend-mode: screen;
    opacity: 0.36;
}

.iris-canvas--caustic {
    opacity: 0.62;
}

.iris-canvas--motes {
    opacity: 0.34;
}

/* Neomorphic socket — recessed eye-cup beneath the SVG */
.iris::before {
    content: "";
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    background: var(--steeped-tea);
    box-shadow:
        inset 0 6px 18px rgba(58, 52, 46, 0.14),
        inset 0 -2px 6px rgba(124, 139, 126, 0.10),
        inset 0 0 0 1px rgba(58, 52, 46, 0.05),
        0 1px 0 var(--highlight-cream),
        0 0 36px rgba(165, 154, 138, 0.22);
}

.iris[data-iris-id="4"]::before {
    background: #2A2520;
    box-shadow:
        inset 0 6px 22px rgba(0, 0, 0, 0.55),
        inset 0 0 0 1px rgba(58, 52, 46, 0.30),
        0 1px 0 var(--highlight-cream),
        0 0 36px rgba(58, 52, 46, 0.14);
}

.iris.is-final::before {
    background: var(--hanji-cream);
    box-shadow:
        inset 0 4px 12px rgba(58, 52, 46, 0.06),
        inset 0 -1px 2px rgba(255, 255, 255, 0.6),
        0 1px 0 var(--highlight-cream),
        0 0 36px rgba(165, 154, 138, 0.18);
}

.iris-glyph {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--serif-display);
    font-weight: 300;
    font-size: clamp(1.4rem, 3.4vw, 2.8rem);
    color: var(--pine-soot);
    opacity: 0;
    pointer-events: none;
    z-index: 4;
    transition: opacity 600ms ease;
    text-shadow: 0 0 18px rgba(244, 237, 220, 0.6);
}

.iris-glyph.is-shown {
    opacity: 0.78;
}

.iris-glyph--final {
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    color: var(--pine-soot);
    opacity: 0.92;
    z-index: 5;
}

/* Plates — neomorphic recessed marginalia */
.plate {
    position: absolute;
    max-width: 22ch;
    padding: 14px 18px;
    background: var(--hanji-cream);
    color: var(--pine-soot);
    font-family: var(--serif-body);
    font-weight: 300;
    font-size: 13.6px;
    line-height: 1.7;
    letter-spacing: 0.012em;
    border-radius: 1px;
    box-shadow:
        inset 1px 2px 6px rgba(58, 52, 46, 0.08),
        inset -1px -1px 4px rgba(255, 255, 255, 0.7);
    opacity: 0.92;
}

.plate::before {
    content: "";
    position: absolute;
    inset: -1px;
    border: 1px solid rgba(58, 52, 46, 0.16);
    border-radius: 1px;
    pointer-events: none;
    -webkit-mask-image:
        radial-gradient(circle at 12% 18%, #000 45%, transparent 56%),
        radial-gradient(circle at 88% 32%, #000 50%, transparent 62%),
        radial-gradient(circle at 22% 86%, #000 40%, transparent 54%),
        radial-gradient(circle at 78% 94%, #000 42%, transparent 56%),
        linear-gradient(#000, #000);
    -webkit-mask-composite: xor;
    -webkit-mask-repeat: no-repeat;
    opacity: 0.55;
}

.plate p {
    margin: 0;
}

.plate p::first-letter {
    color: var(--river-stone);
}

.plate-upper-left {
    left: 18vw;
    top: 38vh;
}

.plate-lower-right {
    right: 41vw;
    top: 78vh;
}

.plate-below {
    left: 50vw;
    top: 92vh;
    transform: translateX(-50%);
    text-align: center;
}

/* Stamp — Caveat-handwritten time-of-visit */
.stamp {
    position: absolute;
    right: 41vw;
    bottom: 9vh;
    font-family: var(--hand);
    font-weight: 400;
    font-size: 13px;
    color: var(--river-stone);
    opacity: 0.62;
    letter-spacing: 0.04em;
}

/* The Hanko seal — only on chamber VII */
.hanko {
    position: absolute;
    right: 41vw;
    bottom: 14vh;
    width: 14px;
    height: 14px;
    display: block;
    z-index: 6;
}

.hanko svg {
    width: 28px;
    height: 28px;
    transform: translate(-7px, -7px);
}

.hanko-edge {
    fill: var(--vermilion);
    stroke: var(--vermilion);
    stroke-width: 0.4;
    opacity: 0.92;
}

.hanko-glyph {
    stroke: var(--hanji-cream);
    stroke-width: 1.6;
    fill: none;
    stroke-linecap: square;
    opacity: 0.96;
}

/* Final breath — 90% empty */
.breath--final .chamber-name {
    color: var(--river-stone);
    opacity: 0.6;
}

.breath--final .stamp {
    opacity: 0.5;
}

/* Reduced motion — still allow iris dilation, but slower; no displacement filter */
@media (prefers-reduced-motion: reduce) {
    .iris {
        transition-duration: 10800ms;
    }
    .iris-canvas {
        display: none;
    }
    .iris-fog--caustic {
        animation: none;
        opacity: 0.6;
    }
    html {
        scroll-behavior: auto;
    }
}

@media (max-width: 720px) {
    .masthead {
        font-size: 12px;
    }
    .iris-nav {
        left: 92vw;
    }
    .chamber-name {
        left: 6vw;
        top: 14vh;
        max-width: 70vw;
    }
    .plate {
        max-width: 70vw;
        font-size: 13px;
    }
    .plate-upper-left {
        left: 6vw;
        top: 30vh;
    }
    .plate-lower-right {
        right: 6vw;
        top: 78vh;
    }
    .plate-below {
        left: 50vw;
        top: 96vh;
    }
    .stamp, .hanko {
        right: 6vw;
    }
    :root {
        --iris-d: 26vmin;
    }
}
