/* ==========================================================
   addrproxy.com — Design Language v1
   blobitecture / immersive-scroll / grotesque-neo
   navy-metallic on aged paper / elastic / dreamy-ethereal
   ========================================================== */

/* ---------- TOKENS ---------- */
:root {
    /* Palette (exact hex from DESIGN.md) */
    --c-midnight:    #0F1A2E; /* deep midnight ink — blob silhouette, chamber titles */
    --c-slate:       #3A4A66; /* slate navy — secondary type, depth gauge rules */
    --c-pewter:      #A8B4C2; /* pewter gleam — specular highlight */
    --c-steel:       #7A8FA8; /* brushed steel — mid-tone blob gradient */
    --c-paper:       #E9DCC4; /* aged paper ground — chamber background */
    --c-paper-fold:  #D4C4A8; /* darker paper crease — fold shadows */
    --c-sepia:       #8B6F47; /* foxed-paper sepia — herbarium stamps */
    --c-ink:         #1A1410; /* iron-gall ink — body text (never #000) */

    /* Type stack */
    --f-display: "Space Grotesk", system-ui, sans-serif;
    --f-body:    "Inter", system-ui, sans-serif;
    --f-mono:    "JetBrains Mono", ui-monospace, monospace;
    --f-italic:  "Cormorant Garamond", Georgia, serif;

    /* Motion variables (updated by JS) */
    --highlight-x: 50%;
    --highlight-y: 50%;
    --blob-stretch: 1.0;
    --paper-drift-x: 0px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--c-paper);
    color: var(--c-ink);
    font-family: var(--f-body);
    font-size: 18px;
    line-height: 30px;
    font-weight: 400;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: default;
}

/* Hide the inline SVG defs container */
.defs {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* ==========================================================
   PAPER GRAIN — fixed mulberry-paper noise field
   ========================================================== */
.paper-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.55;
    mix-blend-mode: multiply;
    will-change: transform;
    transform: translate3d(var(--paper-drift-x), 0, 0);
}

.paper-grain svg {
    width: 110%;
    height: 110%;
    margin-left: -5%;
    margin-top: -5%;
}

/* Brown age-speckles container (dots placed via JS) */
.speckles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.speckle {
    position: absolute;
    background: var(--c-sepia);
    border-radius: 50%;
    opacity: 0.3;
}

/* ==========================================================
   DEPTH GAUGE — the only constant scaffold, right margin
   ========================================================== */
.depth-gauge {
    position: fixed;
    top: 0;
    right: 4vw;
    bottom: 0;
    width: 110px;
    z-index: 50;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5vh 0;
}

.gauge-rule {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 16px;
    width: 1px;
    background: var(--c-slate);
    opacity: 0.55;
}

.gauge-ticks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
    z-index: 2;
}

.gauge-ticks li {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-family: var(--f-mono);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.14em;
    color: var(--c-slate);
    text-transform: uppercase;
}

.tick-num {
    font-variant-numeric: tabular-nums;
}

.tick-mark {
    display: inline-block;
    width: 10px;
    height: 1px;
    background: var(--c-slate);
    opacity: 0.8;
}

.tick-unit {
    display: inline-block;
    width: 14px;
    text-align: left;
    opacity: 0.7;
}

.gauge-current {
    position: fixed;
    right: 4vw;
    bottom: 5vh;
    transform: translateX(115px);
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--c-slate);
    text-transform: uppercase;
    text-align: right;
    line-height: 1.5;
    pointer-events: none;
    z-index: 51;
    background: var(--c-paper);
    padding: 8px 10px;
    border: 1px solid rgba(58, 74, 102, 0.25);
    min-width: 96px;
}

.gauge-current-label {
    display: block;
    opacity: 0.55;
    font-size: 9px;
}

.gauge-current-num {
    display: block;
    font-size: 18px;
    font-weight: 500;
    color: var(--c-midnight);
    letter-spacing: 0.05em;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.gauge-current-unit {
    display: block;
    opacity: 0.55;
    font-size: 8px;
    margin-top: 2px;
}

/* ==========================================================
   DIVE — main scroll container
   ========================================================== */
.dive {
    position: relative;
    z-index: 10;
}

/* ==========================================================
   CHAMBER — full-viewport "page" of aged paper
   ========================================================== */
.chamber {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    overflow: hidden;
    isolation: isolate;
    /* paper-fold soft shadow from top */
    background:
        linear-gradient(180deg,
            rgba(212, 196, 168, 0.32) 0%,
            rgba(212, 196, 168, 0) 14%,
            rgba(212, 196, 168, 0) 86%,
            rgba(212, 196, 168, 0.32) 100%),
        var(--c-paper);
}

/* BLOB — the liquid-metal protagonist, full-bleed silhouette */
.chamber .blob {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: visible;
    transform-origin: center center;
    transform: scaleY(var(--blob-stretch));
    transition: transform 240ms cubic-bezier(0.32, 1.32, 0.5, 1);
}

.blob-path {
    transform-origin: center center;
    animation: breathe 18s ease-in-out infinite;
    transform-box: fill-box;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1) translate(0, 0);
    }
    25% {
        transform: scale(1.03, 0.97) translate(-1%, 1%);
    }
    50% {
        transform: scale(0.98, 1.04) translate(1%, -0.8%);
    }
    75% {
        transform: scale(1.02, 0.99) translate(-0.6%, 0.5%);
    }
}

.blob-shadow {
    opacity: 0.85;
}

/* Specular highlight band — follows cursor (CSS-var driven position) */
.blob-specular {
    pointer-events: none;
    filter: blur(28px);
    mix-blend-mode: screen;
    transform: translate(
        calc((var(--highlight-x) - 50%) * 0.6),
        calc((var(--highlight-y) - 50%) * 0.4)
    );
    transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================
   CHAMBER CONTENT — off-axis diagonal placement
   ========================================================== */
.chamber-content {
    position: absolute;
    z-index: 20;
    max-width: 52ch;
    /* default — top-left placement */
    top: 32%;
    left: 15%;
    transform: rotate(-1.8deg);
    transform-origin: top left;
}

.chamber-content.top-left {
    top: 18%;
    left: 11%;
    transform: rotate(-1.8deg);
    transform-origin: top left;
}

.chamber-content.top-right {
    top: 18%;
    right: 14vw;
    left: auto;
    transform: rotate(1.2deg);
    transform-origin: top right;
    text-align: right;
}

.chamber-content.bottom-right {
    top: auto;
    bottom: 16%;
    right: 14vw;
    left: auto;
    transform: rotate(1.6deg);
    transform-origin: bottom right;
    text-align: right;
}

.chamber-content.centered-low {
    top: auto;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%) rotate(-0.6deg);
    text-align: center;
    max-width: 36ch;
}

/* Chamber numeral — JetBrains Mono small caps style */
.numeral {
    font-family: var(--f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-slate);
    margin-bottom: 18px;
    opacity: 0.78;
}

/* Wordmark — Chamber 00 */
.wordmark {
    font-family: var(--f-display);
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 500;
    color: var(--c-midnight);
    letter-spacing: -0.022em;
    line-height: 0.95;
    text-transform: lowercase;
    margin-bottom: 18px;
}

/* Chamber title — Space Grotesk 500, lowercase */
.chamber-title {
    font-family: var(--f-display);
    font-size: clamp(2.8rem, 7vw, 6.4rem);
    font-weight: 500;
    color: var(--c-midnight);
    letter-spacing: -0.022em;
    line-height: 1.0;
    text-transform: lowercase;
    margin-bottom: 28px;
}

/* Body text */
.body-text {
    font-family: var(--f-body);
    font-size: 18px;
    line-height: 30px;
    font-weight: 400;
    color: var(--c-ink);
    letter-spacing: 0.005em;
    max-width: 52ch;
    margin-top: 12px;
}

.body-text.short {
    max-width: 36ch;
}

/* Cormorant italic inline accent (within body) */
.italic-inline,
em.italic-inline {
    font-family: var(--f-italic);
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    line-height: 32px;
    color: var(--c-slate);
    letter-spacing: 0.005em;
}

/* Italic pull-line (whispered aside) */
.italic-pull,
.italic-aside {
    font-family: var(--f-italic);
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    line-height: 38px;
    color: var(--c-slate);
    letter-spacing: 0.005em;
    margin: 22px 0;
    max-width: 38ch;
}

.italic-aside {
    color: var(--c-slate);
    opacity: 0.86;
    font-size: 22px;
    line-height: 30px;
    margin-top: 12px;
}

/* ==========================================================
   SPECIMEN TAGS — herbarium-style botanical illustration
   ========================================================== */
.specimen {
    position: absolute;
    width: 110px;
    z-index: 18;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 1.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.specimen.visible {
    opacity: 0.78;
    transform: translateY(0);
}

/* Default: bottom-right of chamber */
.specimen {
    bottom: 7vh;
    right: 14vw;
}

.specimen-bl {
    bottom: 7vh;
    left: 9vw;
    right: auto;
}

.specimen-tr {
    top: 9vh;
    right: 14vw;
    bottom: auto;
}

.specimen-tl {
    top: 9vh;
    left: 9vw;
    right: auto;
    bottom: auto;
}

.specimen-br {
    bottom: 9vh;
    right: 14vw;
}

.specimen-center {
    top: 60%;
    left: 50%;
    transform: translate(-50%, 0);
    right: auto;
    bottom: auto;
}

.specimen.visible.specimen-center {
    transform: translate(-50%, 0);
}

.specimen-svg {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 8px;
}

.specimen-label {
    font-family: var(--f-mono);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.14em;
    color: var(--c-sepia);
    text-transform: uppercase;
    line-height: 1.3;
    border-top: 1px solid rgba(139, 111, 71, 0.35);
    padding-top: 6px;
}

/* ==========================================================
   PINCH SEAM — 60vh elastic transition between chambers
   ========================================================== */
.pinch-seam {
    position: relative;
    width: 100%;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    background:
        linear-gradient(180deg,
            var(--c-paper) 0%,
            var(--c-paper-fold) 50%,
            var(--c-paper) 100%);
    overflow: hidden;
}

.pinch-svg {
    width: 100%;
    height: 60px;
    opacity: 0.45;
}

/* ==========================================================
   CHAMBER 00 — SCROLL HINT
   ========================================================== */
.scroll-hint {
    position: absolute;
    bottom: 8vh;
    left: 12vw;
    z-index: 22;
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--c-slate);
    text-transform: uppercase;
    opacity: 0.6;
    animation: hint-pulse 4s ease-in-out infinite;
}

.scroll-hint-line {
    display: inline-block;
    width: 80px;
    height: 1px;
    background: var(--c-slate);
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50%      { opacity: 0.75; transform: translateY(4px); }
}

/* ==========================================================
   CHAMBER 06 — FOOTER / SETTLING
   ========================================================== */
.chamber-footer {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12vh 0;
}

.settling-glyph {
    width: 32px;
    height: 32px;
    margin-bottom: 24px;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 1.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.chamber-footer.visible .settling-glyph {
    opacity: 1;
    transform: scale(1);
}

.settling-glyph svg {
    width: 100%;
    height: 100%;
    display: block;
}

.footer-meta {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--c-slate);
    text-transform: uppercase;
    text-align: center;
    opacity: 0.7;
}

.chamber-footer .specimen-center {
    margin-top: 8vh;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    opacity: 0;
    transition: opacity 1.6s ease-out 0.4s;
}

.chamber-footer.visible .specimen-center {
    opacity: 0.78;
    transform: none;
}

/* ==========================================================
   PAPER DRIFT — subtle 0.4% horizontal noise drift, 22s loop
   ========================================================== */
@keyframes paper-drift {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(0.4%, 0, 0); }
}

.paper-grain {
    animation: paper-drift 22s ease-in-out infinite;
}

/* ==========================================================
   CHAMBER ENTRY — fade-up when in viewport
   ========================================================== */
.chamber-content {
    opacity: 0;
    transition: opacity 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s,
                transform 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.chamber.visible .chamber-content {
    opacity: 1;
}

.chamber.visible .chamber-content.top-left {
    transform: rotate(-1.8deg) translateY(0);
}

.chamber.visible .chamber-content.top-right {
    transform: rotate(1.2deg) translateY(0);
}

.chamber.visible .chamber-content.bottom-right {
    transform: rotate(1.6deg) translateY(0);
}

.chamber.visible .chamber-content.centered-low {
    transform: translateX(-50%) rotate(-0.6deg) translateY(0);
}

/* Initial off-state (subtle lift) */
.chamber:not(.visible) .chamber-content.top-left {
    transform: rotate(-1.8deg) translateY(12px);
}

.chamber:not(.visible) .chamber-content.top-right {
    transform: rotate(1.2deg) translateY(12px);
}

.chamber:not(.visible) .chamber-content.bottom-right {
    transform: rotate(1.6deg) translateY(12px);
}

.chamber:not(.visible) .chamber-content.centered-low {
    transform: translateX(-50%) rotate(-0.6deg) translateY(12px);
}

/* ==========================================================
   PINCH-ACTIVE (when scrolling rapidly through a seam)
   ========================================================== */
.chamber.pinching .blob {
    transform: scaleY(0.35) scaleX(1.12);
    transition: transform 480ms cubic-bezier(0.32, 1.42, 0.4, 1);
}

/* ==========================================================
   RESPONSIVE — small screens
   ========================================================== */
@media (max-width: 760px) {
    .chamber-content,
    .chamber-content.top-left,
    .chamber-content.top-right,
    .chamber-content.bottom-right,
    .chamber-content.centered-low {
        left: 8vw;
        right: 8vw;
        top: 20%;
        max-width: none;
        transform: rotate(-1deg);
        text-align: left;
    }

    .chamber-content.centered-low {
        bottom: 18%;
        top: auto;
        transform: rotate(-0.6deg);
    }

    .chamber.visible .chamber-content,
    .chamber.visible .chamber-content.top-left,
    .chamber.visible .chamber-content.top-right,
    .chamber.visible .chamber-content.bottom-right {
        transform: rotate(-1deg) translateY(0);
    }

    .chamber.visible .chamber-content.centered-low {
        transform: rotate(-0.6deg) translateY(0);
    }

    .depth-gauge {
        right: 2vw;
        width: 60px;
    }

    .gauge-current {
        right: 2vw;
        transform: translateX(60px);
        min-width: 72px;
        font-size: 9px;
    }

    .specimen,
    .specimen-bl,
    .specimen-br,
    .specimen-tr,
    .specimen-tl {
        width: 70px;
        right: 8vw;
        left: auto;
    }

    .specimen-bl, .specimen-tl {
        left: 8vw;
        right: auto;
    }

    .body-text {
        font-size: 16px;
        line-height: 26px;
    }

    .italic-aside, .italic-pull, .italic-inline,
    em.italic-inline {
        font-size: 22px;
        line-height: 30px;
    }
}

/* ==========================================================
   REDUCED MOTION — collapse elastic eases to linear fade
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 200ms !important;
        transition-timing-function: linear !important;
    }

    .blob-path {
        animation: none;
    }

    .paper-grain {
        animation: none;
    }

    .scroll-hint {
        animation: none;
    }
}
