/* meltdown.quest — bronze cassette procession */
/* Palette */
:root {
    --c-amber:        #FFB347;   /* Brass-Lamp Amber */
    --c-sienna:       #C44C2E;   /* Bronze-Patina Sienna */
    --c-coal:         #E66B3C;   /* Hearth-Coal */
    --c-petrol:       #0E3E40;   /* Deep Petrol */
    --c-teal:         #0E5C5E;   /* Tarnished Teal */
    --c-verdigris:    #3A8587;   /* Verdigris-Glow */
    --c-bronze:       #A87538;   /* Foundry Bronze */
    --c-bronze-deep:  #6E4A22;   /* Smoked Brass */
    --c-cream:        #F4E9D2;   /* Lacquer-Cream */
    --c-plenum:       #0A1A1B;   /* Plenum Black */

    --max-w:          1180px;
    --gutter:         24px;
}

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

html, body {
    background: var(--c-petrol);
    color: var(--c-cream);
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 17px;
    line-height: 1.62;
    letter-spacing: 0.005em;
    -webkit-font-smoothing: antialiased;
}

body {
    overflow-x: hidden;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255,179,71,0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(58,133,135,0.06) 0%, transparent 70%),
        var(--c-petrol);
}

a { color: inherit; text-decoration: none; }

/* Right margin Roman-numeral TOC */
.margin-toc {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-weight: 300;
    color: rgba(244, 233, 210, 0.32);
    z-index: 5;
    pointer-events: none;
}
.margin-toc ol { list-style: none; }
.margin-toc li {
    font-size: 14px;
    line-height: 1.85;
    text-align: right;
    padding-right: 6px;
    border-right: 1px solid rgba(168, 117, 56, 0.28);
    transition: color 0.5s ease, border-color 0.5s ease;
}
.margin-toc li.is-active {
    color: var(--c-amber);
    border-right-color: var(--c-amber);
}

@media (max-width: 800px) {
    .margin-toc { display: none; }
}

/* Foyer */
.foyer {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* Cassette outer */
.cassette {
    position: relative;
    width: 100%;
    margin: 56px 0;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 700ms cubic-bezier(0.22,1,0.36,1),
                transform 700ms cubic-bezier(0.22,1,0.36,1);
}
.cassette.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Inner — the bronze relief panel */
.cassette__inner {
    position: relative;
    background: linear-gradient(180deg, #0E4244 0%, var(--c-petrol) 60%, #0C383A 100%);
    padding: 56px clamp(24px, 5vw, 64px);
    /* chamfered corners via clip-path */
    clip-path: polygon(
        14px 0,
        calc(100% - 14px) 0,
        100% 14px,
        100% calc(100% - 14px),
        calc(100% - 14px) 100%,
        14px 100%,
        0 calc(100% - 14px),
        0 14px
    );
    /* three-stroke bronze-leaf border via stacked box-shadows */
    box-shadow:
        inset 0 0 0 1px var(--c-bronze-deep),
        inset 0 0 0 5px var(--c-bronze),
        inset 0 0 0 6px var(--c-amber),
        inset 0 0 0 10px var(--c-petrol),
        inset 0 0 0 11px var(--c-verdigris),
        inset 0 0 22px rgba(0,0,0,0.45),
        inset 0 1px 0 rgba(255,179,71,0.18);
    transition: box-shadow 600ms ease;
}

/* Hover — inner border brightens 8%, no scale, no lift */
.cassette__inner:hover {
    box-shadow:
        inset 0 0 0 1px var(--c-bronze-deep),
        inset 0 0 0 5px var(--c-bronze),
        inset 0 0 0 6px var(--c-amber),
        inset 0 0 0 10px var(--c-petrol),
        inset 0 0 0 11px #4DA0A2,
        inset 0 0 22px rgba(0,0,0,0.45),
        inset 0 1px 0 rgba(255,179,71,0.22);
}

/* Bronze-leaf noise overlay (fed by the SVG turbulence filter) */
.bronze-noise {
    position: absolute;
    inset: 14px;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            115deg,
            rgba(168,117,56,0.04) 0 2px,
            transparent 2px 5px
        ),
        radial-gradient(circle at 30% 30%, rgba(255,179,71,0.04), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(110,74,34,0.05), transparent 60%);
    mix-blend-mode: screen;
    filter: url(#bronze-noise);
    opacity: 0.6;
}

/* Cassette header — flank glyphs, numeral, label */
.cassette__header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 36px;
    position: relative;
}

.cassette__numeral {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.05rem;
    color: rgba(244,233,210,0.55);
    letter-spacing: 0.05em;
}

.cassette__label {
    font-family: "Limelight", "Playfair Display", Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-amber);
    text-shadow: 0 0 18px rgba(255,179,71,0.18);
}

/* Flank glyphs — pulse-attention */
.flank-glyph {
    width: 36px;
    height: 18px;
    display: inline-block;
    opacity: 0.7;
    animation: flank-pulse 4s ease-in-out infinite;
}
.flank-glyph svg { width: 100%; height: 100%; }
.flank-glyph--right { animation-delay: 2s; }

@keyframes flank-pulse {
    0%, 100% { opacity: 0.45; transform: scale(1); }
    50%      { opacity: 0.95; transform: scale(1.06); }
}

/* Deco glyph — rotates on enter */
.deco-glyph {
    display: block;
    margin: 0 auto 28px;
    width: 56px;
    height: 28px;
    transition: transform 600ms cubic-bezier(0.22,1,0.36,1);
    transform: rotate(-4deg);
}
.deco-glyph--sunburst { width: 64px; height: 64px; }
.deco-glyph--sunburst-mini { width: 50px; height: 50px; margin-bottom: 14px; }
.deco-glyph svg { width: 100%; height: 100%; display: block; }

.cassette.is-revealed .deco-glyph {
    transform: rotate(0deg);
}

/* ----------------------------------------------------------- */
/* 01 — The Marquee */
.cassette--marquee {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    margin-top: 0;
}
.cassette--marquee .cassette__inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px clamp(24px, 6vw, 96px);
}

.marquee {
    width: 100%;
    text-align: center;
    position: relative;
}

.sunburst {
    width: clamp(160px, 22vw, 280px);
    height: clamp(160px, 22vw, 280px);
    display: block;
    margin: 0 auto 28px;
    transition: filter 800ms ease;
}
.sunburst__rays {
    transform-origin: 0 0;
    animation: sunburst-rotate 200s linear infinite;
}
.sunburst.is-glitching { filter: url(#wave-blur); }

@keyframes sunburst-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.wordmark {
    font-family: "Limelight", "Playfair Display", Georgia, serif;
    font-weight: 400;
    font-size: clamp(3.6rem, 9.5vw, 8.4rem);
    letter-spacing: 0.14em;
    line-height: 1.05;
    color: var(--c-cream);
    text-transform: lowercase;
    text-shadow:
        0 0 28px rgba(255,179,71,0.18),
        0 0 2px rgba(244,233,210,0.5);
}

.wordmark__a, .wordmark__b { color: var(--c-cream); }
.wordmark__dot {
    display: inline-block;
    color: var(--c-amber);
    transform: translateY(-0.05em);
    animation: dot-pulse 11s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 92%, 100% { color: var(--c-amber); text-shadow: 0 0 0 rgba(255,179,71,0); }
    96%           { color: #FFD08A; text-shadow: 0 0 24px rgba(255,179,71,0.95); }
}

.chevron-base {
    margin: 28px auto 0;
    width: clamp(280px, 60vw, 600px);
    height: 28px;
    opacity: 0.85;
}
.chevron-base svg { width: 100%; height: 100%; }

.enter-directive {
    position: absolute;
    right: 8px;
    bottom: -56px;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--c-amber);
    letter-spacing: 0.08em;
    transition: color 600ms ease, letter-spacing 600ms ease;
}
.enter-directive:hover {
    color: var(--c-teal);
    letter-spacing: 0.14em;
}

/* ----------------------------------------------------------- */
/* 02 — The Threshold Inscription */
.cassette--threshold .cassette__inner {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.threshold__inscription {
    text-align: center;
    padding: 32px 0;
}
.threshold__line {
    font-family: "Libre Baskerville", Georgia, serif;
    font-style: italic;
    font-size: clamp(1.6rem, 3.4vw, 2.8rem);
    line-height: 1.4;
    color: var(--c-cream);
    max-width: 22ch;
    margin: 0 auto;
}

/* ----------------------------------------------------------- */
/* 03 — Catalogue (3x2 grid) */
.catalogue-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
@media (max-width: 760px) {
    .catalogue-grid { grid-template-columns: 1fr; }
}

.sub-cassette {
    position: relative;
    padding: 28px 22px;
    background: linear-gradient(180deg, #0E4244 0%, #0C3537 100%);
    clip-path: polygon(
        10px 0, calc(100% - 10px) 0, 100% 10px,
        100% calc(100% - 10px), calc(100% - 10px) 100%,
        10px 100%, 0 calc(100% - 10px), 0 10px
    );
    box-shadow:
        inset 0 0 0 1px var(--c-bronze-deep),
        inset 0 0 0 3px var(--c-bronze),
        inset 0 0 0 4px var(--c-amber),
        inset 0 0 0 7px #0C3537,
        inset 0 0 0 8px var(--c-verdigris);
    text-align: center;
    transition: box-shadow 600ms ease;
}
.sub-cassette:hover {
    box-shadow:
        inset 0 0 0 1px var(--c-bronze-deep),
        inset 0 0 0 3px var(--c-bronze),
        inset 0 0 0 4px var(--c-amber),
        inset 0 0 0 7px #0C3537,
        inset 0 0 0 8px #4DA0A2;
}

.catalogue__pair {
    font-family: "Libre Baskerville", Georgia, serif;
    font-style: italic;
    font-size: 1.02rem;
    line-height: 1.55;
    color: var(--c-cream);
}
.catalogue__not, .catalogue__yes { display: block; }
.catalogue__not {
    color: rgba(244,233,210,0.55);
    margin-bottom: 4px;
}
.catalogue__yes {
    color: var(--c-cream);
    border-top: 1px dotted rgba(168,117,56,0.4);
    padding-top: 6px;
    margin-top: 6px;
}

/* ----------------------------------------------------------- */
/* 04 — Phenomenology two-column */
.phenomenology__columns {
    column-count: 2;
    column-gap: 56px;
    column-rule: 1px solid rgba(168,117,56,0.22);
    max-width: 64ch;
    margin: 0 auto;
}
@media (max-width: 780px) {
    .phenomenology__columns { column-count: 1; }
}
.phenomenology__columns p {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: clamp(1rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    color: var(--c-cream);
    margin-bottom: 1.1em;
    text-align: justify;
    hyphens: auto;
    break-inside: avoid-column;
}
.phenomenology__columns p em {
    font-style: italic;
    color: #FFE0B0;
}

.phenomenology__lead { break-after: column; }

.drop-cap {
    float: left;
    font-family: "Limelight", Georgia, serif;
    font-size: 4.6em;
    line-height: 0.9;
    margin: 0.06em 0.12em -0.08em 0;
    color: var(--c-amber);
    background: linear-gradient(115deg,
        var(--c-coal) 0%,
        var(--c-amber) 35%,
        #FFE0B0 50%,
        var(--c-amber) 65%,
        var(--c-sienna) 100%);
    background-size: 220% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: dropcap-sweep 1.4s ease-out forwards;
    text-shadow: 0 0 20px rgba(255,179,71,0.18);
}

@keyframes dropcap-sweep {
    from { background-position: 100% 0; }
    to   { background-position: 0% 0; }
}

/* ----------------------------------------------------------- */
/* 05 — Wave-Form Library */
.wave-library {
    text-align: center;
    padding: 18px 0;
}
#wave-canvas {
    width: 100%;
    max-width: 720px;
    height: auto;
    display: block;
    margin: 0 auto 24px;
}
.wave-caption {
    font-family: "Libre Baskerville", Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--c-cream);
    margin-bottom: 8px;
}
.wave-harmonics {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-size: 0.95rem;
    color: rgba(244,233,210,0.6);
    letter-spacing: 0.06em;
}
.wave-harmonics span { color: var(--c-amber); margin: 0 4px; }

/* ----------------------------------------------------------- */
/* 06 — The Slow Inventory */
.inventory-window {
    max-height: 320px;
    overflow: hidden;
    position: relative;
    padding: 12px 0;
    border-top: 1px solid rgba(168,117,56,0.22);
    border-bottom: 1px solid rgba(168,117,56,0.22);
    mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
}
.inventory-list {
    list-style: none;
    padding: 0 28px;
    transform: translateY(0);
    will-change: transform;
}
.inventory-list li {
    display: grid;
    grid-template-columns: 28px 1fr 48px;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    font-family: "Libre Baskerville", Georgia, serif;
    color: var(--c-cream);
    font-style: italic;
}
.inventory-list li:nth-child(odd)   { font-size: 1rem; }
.inventory-list li:nth-child(even)  { font-size: 1.1rem; }
.inventory-list li:nth-child(3n)    { font-size: 0.95rem; }
.inventory-list li em { color: #FFE0B0; }

.inv-check {
    color: var(--c-amber);
    font-style: normal;
    text-align: center;
    font-size: 0.9rem;
}
.inv-sigil {
    width: 40px; height: 10px;
    display: inline-block;
}
.inv-sigil svg { width: 100%; height: 100%; }

/* ----------------------------------------------------------- */
/* 07 — The Hearth */
.fireplace {
    text-align: center;
    padding: 12px 0 24px;
}
.fireplace__surround {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    aspect-ratio: 600 / 380;
    background:
        linear-gradient(180deg, #1a4d4f 0%, #103a3c 100%);
}
.fireplace__mantel {
    position: absolute;
    top: 4%;
    left: 6%;
    right: 6%;
    height: 18px;
    background: linear-gradient(180deg, var(--c-amber), var(--c-bronze) 50%, var(--c-bronze-deep));
    box-shadow: 0 2px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.18);
}
.fireplace__mantel svg { position: absolute; bottom: -12px; left: 0; width: 100%; height: 14px; }

.fireplace__flute {
    position: absolute;
    top: 8%;
    bottom: 0;
    width: 7%;
    background: repeating-linear-gradient(
        90deg,
        var(--c-bronze-deep) 0 2px,
        var(--c-bronze) 2px 4px,
        var(--c-amber) 4px 5px,
        var(--c-bronze) 5px 7px,
        var(--c-bronze-deep) 7px 9px
    );
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
}
.fireplace__flute--l { left: 6%; }
.fireplace__flute--r { right: 6%; }

.fireplace__opening {
    position: absolute;
    top: 14%;
    left: 14%;
    right: 14%;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 95%, #2a0a02 0%, #100303 70%, #050100 100%);
    overflow: hidden;
    box-shadow: inset 0 0 24px rgba(0,0,0,0.85), inset 0 0 0 1px var(--c-bronze-deep);
}
.fireplace__hearth-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 90%, var(--c-amber) 0%, transparent 60%);
    opacity: 0.55;
    transition: background 1s linear;
    mix-blend-mode: screen;
}
.fireplace__flame {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 80%;
}
.fireplace__logs {
    position: absolute;
    bottom: 4%;
    left: 16%;
    right: 16%;
    height: 22%;
    pointer-events: none;
}
.log {
    position: absolute;
    background: linear-gradient(180deg, #4a2410 0%, #2a1306 60%, #150701 100%);
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255,179,71,0.18), 0 1px 0 rgba(0,0,0,0.6);
}
.log--a { left: 4%; bottom: 0; width: 70%; height: 38%; transform: rotate(-4deg); }
.log--b { left: 18%; bottom: 28%; width: 64%; height: 32%; transform: rotate(3deg); }
.log--c { left: 34%; bottom: 52%; width: 40%; height: 26%; transform: rotate(-2deg); }

.fireplace__caption {
    margin-top: 22px;
    font-family: "Libre Baskerville", Georgia, serif;
    font-style: italic;
    font-size: 1rem;
    color: rgba(244,233,210,0.7);
}

/* ----------------------------------------------------------- */
/* 08 — Glossary */
.glossary {
    column-count: 2;
    column-gap: 48px;
    column-rule: 1px solid rgba(168,117,56,0.22);
    max-width: 64ch;
    margin: 0 auto;
}
@media (max-width: 780px) { .glossary { column-count: 1; } }

.glossary__entry {
    margin-bottom: 1.6em;
    break-inside: avoid;
}
.glossary__term {
    margin-bottom: 0.4em;
    position: relative;
}
.glossary__word {
    font-family: "Limelight", "Playfair Display", Georgia, serif;
    font-size: 1.4rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-amber);
    display: block;
}
.glossary__rule {
    display: block;
    width: 100%;
    height: 4px;
    margin-top: 4px;
}
.glossary__rule path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 1s ease-out;
}
.glossary__entry.is-revealed .glossary__rule path {
    stroke-dashoffset: 0;
}

.glossary dd {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--c-cream);
}
.glossary dd em { font-style: italic; color: #FFE0B0; }

/* ----------------------------------------------------------- */
/* 09 — Commonplace Book */
.commonplace {
    display: grid;
    gap: 28px;
    max-width: 64ch;
    margin: 0 auto;
}
.quote {
    position: relative;
    padding: 18px 36px;
    text-align: center;
}
.quote blockquote {
    font-family: "Libre Baskerville", Georgia, serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.55;
    color: var(--c-cream);
    margin-bottom: 8px;
}
.quote figcaption {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-style: italic;
    font-size: 0.95rem;
    color: rgba(244,233,210,0.55);
}

.quote__bracket {
    position: absolute;
    width: 22px;
    height: 60%;
    top: 20%;
    border: 1px solid var(--c-bronze);
}
.quote__bracket--l {
    left: 0;
    border-right: 0;
    border-top-left-radius: 0;
    background:
        linear-gradient(180deg, var(--c-bronze) 0 1px, transparent 1px) 0 0/100% 1px no-repeat,
        linear-gradient(180deg, var(--c-bronze) 0 1px, transparent 1px) 0 100%/100% 1px no-repeat;
}
.quote__bracket--r {
    right: 0;
    border-left: 0;
}

/* ----------------------------------------------------------- */
/* 10 — The Quiet Page */
.cassette--quiet .cassette__inner {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.quiet { text-align: center; }
.quiet__line {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 13px;
    color: rgba(244,233,210,0.65);
    letter-spacing: 0.04em;
}

/* ----------------------------------------------------------- */
/* 11 — Colophon */
.colophon {
    max-width: 64ch;
    margin: 0 auto;
    text-align: center;
}
.colophon p {
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 0.98rem;
    line-height: 1.72;
    color: var(--c-cream);
    margin-bottom: 1.2em;
}
.colophon strong {
    color: #FFE0B0;
    font-weight: 700;
}
.colophon em { color: var(--c-amber); font-style: italic; }
.colophon__sign {
    margin-top: 28px !important;
    font-style: italic;
    color: rgba(244,233,210,0.6) !important;
}
.swatch {
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin: 0 4px -1px;
    border: 1px solid var(--c-bronze);
    vertical-align: middle;
}

/* ----------------------------------------------------------- */
/* Glitch — chromatic-prose char effect */
.glitch-char {
    position: relative;
    display: inline-block;
    color: var(--c-cream);
    text-shadow:
        1px 0 0 rgba(255,107,60,0.85),
        -1px 0 0 rgba(58,133,135,0.85);
    animation: glitch-flick 200ms ease-out;
}
@keyframes glitch-flick {
    0%   { transform: translateX(0); }
    30%  { transform: translateX(0.5px); }
    60%  { transform: translateX(-0.5px); }
    100% { transform: translateX(0); }
}

/* Inner-border breathing pulse — applied to all .cassette__inner */
.cassette__inner {
    animation: inner-border-breath 7s ease-in-out infinite;
}
@keyframes inner-border-breath {
    0%, 100% { filter: brightness(1); }
    50%      { filter: brightness(1.04); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cassette {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .deco-glyph { transform: rotate(0); transition: none; }
    .flank-glyph { animation: flank-pulse 13s ease-in-out infinite; }
    .wordmark__dot { animation: none; }
    .sunburst__rays { animation: sunburst-rotate 600s linear infinite; }
    .cassette__inner { animation: none; }
    .glossary__rule path { stroke-dashoffset: 0; transition: none; }
}
