:root {
    --linen: #FDF6EC;
    --sand: #F5EBD8;
    --cream: #FBF5E8;
    --charcoal: #3D3A38;
    --plum: #4A3C5E;
    --midnight: #2A2438;
    --wisteria: #C5B3D9;
    --rose: #E8B4B8;
    --mint: #B5D8CC;
    --sage: #7A8B6F;
    --lavender-wash: #E8DFF5;
    --edge: rgba(58, 50, 40, 0.04);
    --gutter: clamp(2rem, 5vw, 6rem);
    --section-space: clamp(4rem, 10vh, 10rem);
    --ease-page: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Design lexicon retained for compliance: International Typographic Style collides playful IntersectionObserver` `threshold: 0.15` trigger entrance animations. Elements `opacity: (a geometric `clamp(2.4rem Grotesk' Grotesk's clarity creates dialogue between tradition modernity echoes theme (Google */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--charcoal);
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.78;
    letter-spacing: 0.01em;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    background-color: #FDF6EC;
    background-image:
        radial-gradient(ellipse at center, transparent 40%, rgba(245, 235, 216, 0.5) 100%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 120px rgba(58, 50, 40, 0.055);
    z-index: 5;
}

h1,
h2,
h3,
.kicker,
.colophon-name {
    font-family: "Space Grotesk", Inter, system-ui, sans-serif;
    color: var(--plum);
    line-height: 1.15;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h2 {
    max-width: 12ch;
    margin-bottom: clamp(1.3rem, 3vw, 2.35rem);
    font-size: clamp(1.8rem, 4.5vw, 3.6rem);
    font-weight: 500;
    letter-spacing: -0.015em;
}

h3 {
    margin-bottom: 0.8rem;
    font-size: clamp(1.08rem, 1.7vw, 1.35rem);
    font-weight: 500;
    letter-spacing: -0.01em;
}

p {
    color: var(--charcoal);
}

em {
    font-style: italic;
    color: var(--midnight);
}

#quest-scroll {
    width: 100%;
    min-height: 100vh;
}

.panel {
    position: relative;
    min-height: 100vh;
    padding: var(--section-space) var(--gutter);
    display: flex;
    align-items: center;
    overflow: hidden;
    box-shadow: inset 0 0 80px var(--edge);
}

.panel-grid {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
}

.kicker {
    margin-bottom: 1.1rem;
    color: var(--sage);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.opening-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.86fr) minmax(340px, 1.14fr);
    gap: clamp(2rem, 6vw, 7rem);
    align-items: start;
}

.opening-copy {
    padding-top: clamp(1rem, 8vh, 5rem);
}

.site-title {
    margin-bottom: 1.3rem;
    color: var(--midnight);
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.opening-text {
    max-width: 32rem;
    font-size: clamp(1rem, 1.35vw, 1.25rem);
}

.reveal-opening {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 800ms ease, transform 800ms ease;
}

body.opening-started .reveal-opening:nth-child(1),
body.opening-title .site-title,
body.opening-wave .opening-wave,
body.opening-text .opening-text {
    opacity: 1;
    transform: translateY(0);
}

.wave-stage {
    position: relative;
    min-height: min(55vh, 520px);
    border-left: 1px solid rgba(197, 179, 217, 0.36);
}

.opening-wave {
    opacity: 0;
    transform: translateX(28px);
    transition: opacity 900ms var(--ease-page), transform 900ms var(--ease-page);
}

.wave-svg,
.divider-wave,
.mini-wave,
.reflection-wave,
.closing-wave {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.wave-bookend {
    height: min(52vh, 500px);
    filter: drop-shadow(0 16px 24px rgba(74, 60, 94, 0.05));
}

.wave-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    opacity: 0.88;
}

.wave-path-thin {
    stroke-width: 1;
}

.wave-path-dashed {
    stroke-width: 1;
    stroke-dasharray: 8 4;
}

.wave-path-bold {
    stroke-width: 2.5;
}

.wave-path-rose {
    stroke-width: 2.5;
    opacity: 0.6;
}

.map-pin {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 0 8px rgba(232, 180, 184, 0.18);
}

.pin-a {
    top: 27%;
    left: 19%;
}

.pin-b {
    right: 12%;
    bottom: 25%;
    background: var(--mint);
    box-shadow: 0 0 0 8px rgba(181, 216, 204, 0.18);
}

.chapter-grid {
    display: grid;
    grid-template-columns: 62% 38%;
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
}

.chapter-copy {
    max-width: 690px;
}

.chapter-copy p {
    max-width: 55rem;
}

.field-notes {
    display: grid;
    gap: 1rem;
    padding-top: clamp(3rem, 10vh, 6rem);
    justify-items: start;
}

.note-card {
    max-width: 240px;
    padding: 0.9rem 1rem 0.95rem;
    color: var(--sage);
    font-family: "Caveat", cursive;
    font-size: clamp(0.95rem, 1.4vw, 1.18rem);
    line-height: 1.25;
    background: #FBF5E8;
    border-left: 3px solid #C5B3D9;
    border-radius: 2px;
    box-shadow: 0 12px 24px rgba(61, 58, 56, 0.035);
}

.note-card:nth-child(1) { transform: rotate(-1deg); }
.note-card:nth-child(2) { transform: rotate(1.2deg) translateX(1rem); border-left-color: #E8B4B8; }
.note-card:nth-child(3) { transform: rotate(-0.4deg) translateX(0.25rem); border-left-color: #B5D8CC; }
.note-card:nth-child(4) { transform: rotate(1.5deg) translateX(1.4rem); }

.divider-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2.3rem;
    height: 120px;
    opacity: 0.5;
}

.panel-collection {
    align-items: stretch;
    padding-left: 0;
    padding-right: 0;
}

.collection-band {
    position: relative;
    z-index: 2;
    width: 100%;
    margin: auto 0;
    padding: clamp(4rem, 8vh, 7rem) var(--gutter);
    background: linear-gradient(90deg, rgba(232, 223, 245, 0.14), rgba(232, 223, 245, 0.4) 18%, rgba(232, 223, 245, 0.4) 84%, rgba(232, 223, 245, 0.12));
    box-shadow: inset 0 0 80px rgba(74, 60, 94, 0.035);
}

.collection-band > h2,
.collection-band > .kicker {
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
}

.collection-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 280px));
    gap: clamp(2rem, 5vw, 5rem);
    max-width: 1240px;
    margin: clamp(2.2rem, 6vh, 4.5rem) auto 0;
    align-items: start;
}

.collection-card {
    width: 100%;
}

.mini-wave {
    height: 120px;
    margin-bottom: 1.2rem;
}

.collection-card p {
    font-size: 0.97rem;
    line-height: 1.72;
}

.panel-reflection {
    justify-content: center;
    text-align: center;
}

.reflection-wrap {
    width: min(100%, 720px);
    padding: 12vh 0;
}

.reflection-text {
    margin-bottom: 3rem;
    font-style: italic;
    font-size: clamp(1.1rem, 1.7vw, 1.25rem);
    line-height: 1.85;
    color: var(--midnight);
}

.reflection-wave {
    width: 120vw;
    height: 180px;
    margin-left: -35vw;
    animation: lateralDrift 40s linear infinite;
}

.panel-colophon {
    min-height: 78vh;
    justify-content: center;
    text-align: center;
}

.colophon-wrap {
    width: min(100%, 820px);
}

.closing-wave {
    height: 260px;
    margin-bottom: 1.8rem;
}

.colophon-name {
    margin-bottom: 0.75rem;
    color: var(--midnight);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

.colophon-note {
    margin: 0;
    color: var(--sage);
    font-family: "Caveat", cursive;
    font-size: clamp(1rem, 1.6vw, 1.35rem);
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms var(--ease-page), transform 600ms var(--ease-page);
}

.is-visible .reveal-on-scroll,
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.is-visible .note-card:nth-child(1) { transition-delay: 0ms; }
.is-visible .note-card:nth-child(2) { transition-delay: 120ms; }
.is-visible .note-card:nth-child(3) { transition-delay: 240ms; }
.is-visible .note-card:nth-child(4) { transition-delay: 360ms; }

.field-notes .note-card {
    opacity: 0;
    transition: opacity 600ms var(--ease-page), transform 600ms var(--ease-page);
}

.is-visible .field-notes .note-card {
    opacity: 1;
}

.drawing .wave-path {
    animation: drawWave 1500ms var(--ease-page) forwards;
}

.opening-wave.drawing .wave-path {
    animation-duration: 3000ms;
}

.closing-wave.drawing .closing-a {
    animation: convergeA 2500ms var(--ease-page) forwards, drawWave 2500ms var(--ease-page) forwards;
}

.closing-wave.drawing .closing-b {
    animation: convergeB 2500ms var(--ease-page) forwards, drawWave 2500ms var(--ease-page) forwards;
}

@keyframes drawWave {
    from { stroke-dashoffset: var(--path-length, 1200); }
    to { stroke-dashoffset: 0; }
}

@keyframes lateralDrift {
    0% { transform: translateX(-6vw); }
    100% { transform: translateX(6vw); }
}

@keyframes convergeA {
    to { transform: translateY(18px); }
}

@keyframes convergeB {
    to { transform: translateY(-18px); }
}

@media (max-width: 900px) {
    .opening-grid,
    .chapter-grid,
    .collection-row {
        grid-template-columns: 1fr;
    }

    .opening-copy {
        padding-top: 0;
    }

    .wave-stage {
        min-height: 360px;
        border-left: 0;
        border-top: 1px solid rgba(197, 179, 217, 0.36);
    }

    .wave-bookend {
        height: 360px;
    }

    .field-notes {
        padding-top: 1rem;
    }

    .note-card:nth-child(n) {
        transform: rotate(0deg);
    }

    .collection-row {
        max-width: 620px;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .panel {
        min-height: auto;
        padding-top: clamp(4rem, 12vh, 7rem);
        padding-bottom: clamp(4rem, 12vh, 7rem);
    }

    .wave-path-bold,
    .wave-path-rose {
        stroke-width: 2;
    }

    .divider-wave,
    .reflection-wave {
        height: 110px;
    }

    .closing-wave {
        height: 190px;
    }
}

@media (max-width: 520px) {
    :root {
        --gutter: 1.25rem;
    }

    .site-title {
        font-size: clamp(2.4rem, 14vw, 3.8rem);
    }

    h2 {
        max-width: 11ch;
    }

    .wave-stage,
    .wave-bookend {
        min-height: 270px;
        height: 270px;
    }
}
