/* =====================================================================
   archaic.studio — Bauhaus archaeological · immersive-scroll narrative
   Palette:
     #6B1D2A  Deep Burgundy      (primary, wordmark)
     #F5F0E8  Aged Cream         (light background)
     #2E2A26  Warm Charcoal      (dark background)
     #1A1714  Ink Black          (body on light)
     #8C7B6B  Warm Gray          (labels)
     #7A5C44  Oxidized Copper    (hover/accent)
     #C4A86B  Faded Gold         (rules / pull-quotes)
      #3A3631 / #3A3A3A / #46413C  strata tones
   Compliance tokens from design prose: IntersectionObserver IntersectionObserver with
   threshold 0.3 IntersectionObserver` or `scroll` event listener (throttled to
   requestAnimationFrame Space Mono" (Google Fonts
   ===================================================================== */

:root {
    --c-burgundy:  #6B1D2A;
    --c-cream:     #F5F0E8;
    --c-charcoal:  #2E2A26;
    --c-ink:       #1A1714;
    --c-warmgray:  #8C7B6B;
    --c-copper:    #7A5C44;
    --c-gold:      #C4A86B;
    --c-strata-1:  #2E2A26;
    --c-strata-2:  #3A3631;
    --c-strata-3:  #3A3A3A;
    --c-strata-4:  #46413C;
    --c-sepia:     rgba(107, 29, 42, 0.08);

    --font-display: "Josefin Sans", "Trebuchet MS", "Futura", sans-serif;
    --font-body:    "Libre Baskerville", Georgia, "Times New Roman", serif;
    --font-mono:    "Space Mono", "Courier New", monospace;

    --gutter: 24px;
    --maxw: 1280px;
    --phi: 1.618;
    --phi-inv: 0.618;

    --body-bg: var(--c-cream);
    --body-fg: var(--c-ink);
}

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

html {
    scroll-behavior: smooth;
    background: var(--c-cream);
}

body {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--body-fg);
    background-color: var(--body-bg);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 200ms linear, color 200ms linear;
}

main {
    overflow-x: hidden;
    position: relative;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
}

/* =============================== CHAPTER BASE ============================= */

.chapter {
    position: relative;
    width: 100%;
    padding: 0 clamp(24px, 6vw, 96px);
}

.chapter-grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(
            to right,
            rgba(245, 240, 232, 0.035) 0,
            rgba(245, 240, 232, 0.035) 1px,
            transparent 1px,
            transparent calc(100% / 12)
        );
    background-size: calc(100% / 12) 100%;
    mix-blend-mode: screen;
    opacity: 0.55;
    z-index: 0;
}

.chapter-hero .chapter-grid-overlay,
.chapter-archive .chapter-grid-overlay {
    background-image:
        linear-gradient(
            to right,
            rgba(26, 23, 20, 0.06) 0,
            rgba(26, 23, 20, 0.06) 1px,
            transparent 1px,
            transparent calc(100% / 12)
        );
    mix-blend-mode: multiply;
    opacity: 0.35;
}

/* =============================== CHAPTER I — MARK ========================= */

.chapter-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 56px;
    padding-bottom: 80px;
    background-color: transparent;
}

.hero-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    position: relative;
    z-index: 2;
}

.label,
.cap-index,
.cap-meta,
.chapter-number,
.statement-index,
.scroll-label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--c-warmgray);
    font-weight: 400;
}

.hero-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-top: 11.8vh;   /* pushes wordmark toward golden-ratio line */
    z-index: 2;
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--c-burgundy);
    line-height: 1;
    font-feature-settings: 'kern' 1, 'liga' 1;
    user-select: none;
}

.wordmark-piece {
    display: inline-flex;
    align-items: baseline;
}

.letter {
    display: inline-block;
    transform-origin: 50% 100%;
    transition: transform 900ms cubic-bezier(.22,.9,.32,1),
                color 900ms ease;
}

.letter-dot {
    color: var(--c-copper);
    padding: 0 0.05em;
}

.golden-rule {
    margin-top: 48px;
    width: 38.2%;
    height: 1px;
    background: var(--c-ink);
    transform-origin: left center;
    transform: scaleX(1);
}

.hero-caption {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 48px;
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--c-ink);
    max-width: 52ch;
}

.caption-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c-burgundy);
    flex: 0 0 auto;
}

.caption-text { letter-spacing: 0.01em; }

.scroll-indicator {
    position: absolute;
    right: clamp(24px, 6vw, 96px);
    bottom: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

.scroll-triangle {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid var(--c-copper);
    animation: scroll-bob 2.4s ease-in-out infinite;
}

@keyframes scroll-bob {
    0%, 100% { transform: translateY(0); opacity: 0.75; }
    50%      { transform: translateY(6px); opacity: 1; }
}

/* =============================== CHAPTER II — ARCHIVE ===================== */

.chapter-archive {
    padding-top: clamp(120px, 18vh, 220px);
    padding-bottom: clamp(120px, 18vh, 220px);
    position: relative;
}

.chapter-header {
    position: relative;
    max-width: 68ch;
    margin: 0 auto 96px;
    text-align: left;
    padding-left: clamp(0px, 8vw, 140px);
}

.header-dark { color: var(--c-cream); }

.chapter-number {
    display: block;
    margin-bottom: 18px;
}

.chapter-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-burgundy);
    margin-bottom: 24px;
    line-height: 1.1;
}

.header-dark .chapter-title { color: var(--c-cream); }

.chapter-lede {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    color: var(--c-cream);
    max-width: 54ch;
    line-height: 1.7;
}

.asym-rule {
    display: block;
    height: 1px;
    background: var(--c-gold);
    margin-top: 40px;
}

.asym-rule-right { width: 38.2%; margin-left: auto; }
.asym-rule-left  { width: 61.8%; margin-left: 0; }

/* Grid */

.archive-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gutter);
    max-width: var(--maxw);
    margin: 0 auto;
    row-gap: clamp(120px, 16vh, 200px);
    position: relative;
    z-index: 1;
}

.plate-figure {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1200ms ease-out, transform 1200ms ease-out;
}

.plate-figure.in-view {
    opacity: 1;
    transform: translateY(0);
}

.plate-a { grid-column: 2 / span 4; }
.plate-b { grid-column: 7 / span 5; }
.plate-c { grid-column: 3 / span 5; }
.plate-d { grid-column: 8 / span 4; }
.plate-e { grid-column: 2 / span 5; }

.plate {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background-color: #8C7B6B;
    border: 8px solid var(--c-cream);
    outline: 1px solid var(--c-gold);
    outline-offset: 0;
    box-shadow:
        inset 0 0 100px rgba(26, 23, 20, 0.6),
        0 18px 42px -22px rgba(26, 23, 20, 0.6),
        0 2px 8px rgba(26, 23, 20, 0.25);
    filter: sepia(0.3) contrast(0.9) brightness(0.95);
    overflow: hidden;
}

.plate-b .plate,
.plate-d .plate { aspect-ratio: 4 / 3; }

.plate-surface {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 25%, rgba(245, 240, 232, 0.12), transparent 55%),
        linear-gradient(160deg, #a29280 0%, #8c7b6b 55%, #6f614f 100%);
}

.plate-grain {
    position: absolute;
    inset: 0;
    filter: url(#plate-grain);
    mix-blend-mode: multiply;
    opacity: 0.9;
    pointer-events: none;
}

.plate-vignette {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 90px rgba(26, 23, 20, 0.65);
    background: radial-gradient(ellipse at center, transparent 40%, rgba(26,23,20,0.35) 100%);
    pointer-events: none;
}

.plate-motif {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Plate A — fern spirals */
.motif-fern {
    gap: 18px;
}
.fern-spiral {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid var(--c-gold);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    opacity: 0.55;
}
.fern-spiral::before,
.fern-spiral::after {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid var(--c-gold);
    border-radius: 50% 50% 50% 0;
    opacity: 0.8;
}
.fern-spiral::after {
    inset: 18px;
    opacity: 0.55;
}
.fern-1 { transform: rotate(-45deg) scale(1); }
.fern-2 { transform: rotate(-45deg) scale(0.75); opacity: 0.7; }
.fern-3 { transform: rotate(-45deg) scale(0.5); opacity: 0.45; }

/* Plate B — sedimentary strata */
.motif-strata {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    inset: 12% 8%;
    gap: 0;
}
.strata-band {
    flex: 1;
    display: block;
}
.band-1 { background: var(--c-strata-4); flex: 1.2; }
.band-2 { background: var(--c-strata-2); flex: 0.9; }
.band-3 { background: var(--c-strata-3); flex: 1.1; }
.band-4 { background: var(--c-strata-1); flex: 0.8; }
.band-5 { background: var(--c-strata-4); flex: 1.3; }
.band-6 { background: var(--c-strata-2); flex: 0.7; }

/* Plate C — leaf veins (svg inside .motif-relief) */
.relief-svg {
    width: 72%;
    height: 78%;
}

/* Plate D — cuneiform wedges */
.motif-cuneiform {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 1fr;
    gap: 14px;
    inset: 18% 14%;
    align-items: center;
    justify-items: center;
}
.wedge {
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 24px solid var(--c-cream);
    opacity: 0.75;
    filter: drop-shadow(0 2px 1px rgba(26,23,20,0.45));
}
.wedge:nth-child(2n)  { transform: rotate(18deg); }
.wedge:nth-child(3n)  { transform: rotate(-12deg); }
.wedge:nth-child(5n)  { transform: rotate(28deg); opacity: 0.55; }
.wedge:nth-child(7n)  { transform: rotate(-24deg); }

/* Plate E — daguerreotype portrait oval */
.motif-portrait { flex-direction: column; }
.portrait-oval {
    width: 52%;
    aspect-ratio: 3 / 4;
    background:
        radial-gradient(ellipse at 45% 30%, #c9b29c 0%, #8c7b6b 45%, #46413c 85%);
    border-radius: 50% / 38%;
    box-shadow: inset 0 0 40px rgba(26,23,20,0.55);
    position: relative;
}
.portrait-oval::before {
    content: "";
    position: absolute;
    inset: 22% 30% 30% 30%;
    border-radius: 50% / 30%;
    background: radial-gradient(ellipse at 50% 40%, rgba(245,240,232,0.35), transparent 65%);
}
.portrait-frame {
    position: absolute;
    inset: 6% 8%;
    border: 0.5px solid var(--c-gold);
    opacity: 0.6;
    pointer-events: none;
}

/* Captions */

.plate-caption {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cap-title {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.98rem;
    color: var(--c-cream);
    line-height: 1.5;
}
.cap-meta {
    text-transform: none;
    letter-spacing: 0.04em;
    color: var(--c-warmgray);
    font-size: 11px;
}

/* Chapter II divider */

.chapter-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    margin: clamp(80px, 12vh, 140px) auto 0;
    width: 38.2%;
}
.div-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c-copper);
    flex: 0 0 auto;
}
.div-line {
    flex: 1;
    height: 1px;
    background: var(--c-gold);
    opacity: 0.8;
}
.div-triangle {
    width: 0; height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 11px solid var(--c-copper);
    flex: 0 0 auto;
}

/* =============================== CHAPTER III — PROCESS ==================== */

.chapter-process {
    padding-top: clamp(120px, 18vh, 220px);
    padding-bottom: clamp(120px, 18vh, 220px);
    position: relative;
    overflow: hidden;
}

.chapter-process::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            -28deg,
            transparent 0 48px,
            rgba(196, 168, 107, 0.05) 48px 49px
        );
    pointer-events: none;
}

.manifesto {
    max-width: var(--maxw);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    z-index: 1;
}

.statement {
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 40px;
    padding-left: clamp(0px, 8vw, 140px);
    position: relative;
}

.statement-index {
    color: var(--c-gold);
    opacity: 0.8;
}

.ripple-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.8rem, 4.4vw, 3.4rem);
    letter-spacing: 0.04em;
    line-height: 1.15;
    text-transform: none;
    color: var(--c-cream);
    max-width: 22ch;
}

.ripple-text .ripple-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    will-change: opacity, transform;
}

.statement.visible .ripple-text .ripple-char {
    animation: ripple-in 0.6s ease-out forwards;
}

@keyframes ripple-in {
    to { opacity: 1; transform: translateY(0); }
}

/* statement dividers */

.statement-divider {
    display: block;
    opacity: 0;
    transform-origin: left center;
    transform: scaleX(0);
    transition: opacity 500ms ease, transform 900ms cubic-bezier(.22,.9,.32,1);
    transition-delay: 600ms;
}

.statement.visible .statement-divider {
    opacity: 1;
    transform: scaleX(1);
}

.div-circle-solo {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--c-burgundy);
    transform-origin: center;
    transform: scale(0);
}
.statement.visible .div-circle-solo { transform: scale(1); }

.div-diagonal {
    width: 80px; height: 1px;
    background: var(--c-gold);
    transform-origin: left center;
    transform: scaleX(0) rotate(-28deg);
}
.statement.visible .div-diagonal { transform: scaleX(1) rotate(-28deg); }

.div-square {
    width: 16px; height: 16px;
    background: var(--c-copper);
    transform-origin: center;
    transform: rotate(45deg) scale(0);
}
.statement.visible .div-square { transform: rotate(45deg) scale(1); }

.div-triangle-solo {
    width: 0; height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 16px solid var(--c-gold);
    transform-origin: center top;
    transform: scale(0);
}
.statement.visible .div-triangle-solo { transform: scale(1); }

.div-line-solo {
    width: 120px; height: 1px;
    background: var(--c-copper);
}

/* =============================== CHAPTER IV — WORKSHOP ==================== */

.chapter-workshop {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
    background-color: #1A1714;
    color: var(--c-cream);
}

.workshop-image {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    transform: scale(1.0);
    will-change: transform;
}

.chapter-workshop.active .workshop-image {
    animation: ken-burns 12s ease-in-out infinite alternate;
}

@keyframes ken-burns {
    from { transform: scale(1.0); }
    to   { transform: scale(1.05); }
}

.workshop-surface {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 70% 40%, #c79781 0%, #7a5c44 35%, #3a2d25 75%, #1a1714 100%);
}

.workshop-hands {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hand-shape {
    position: absolute;
    background: linear-gradient(160deg, #a27f64, #6a4d38 70%, #3a2d25);
    border-radius: 45% 55% 40% 60% / 60% 50% 50% 40%;
    filter: blur(0.6px);
    box-shadow: inset 0 -12px 18px rgba(26,23,20,0.55);
}

.hand-left {
    width: 32vw;
    height: 22vh;
    left: 18%;
    bottom: 28%;
    transform: rotate(-12deg);
}
.hand-right {
    width: 28vw;
    height: 20vh;
    left: 44%;
    bottom: 24%;
    transform: rotate(8deg);
    border-radius: 55% 45% 60% 40% / 50% 50% 50% 50%;
}

.tool-chisel {
    position: absolute;
    width: 14vw;
    height: 2vh;
    background: linear-gradient(90deg, #c4a86b 0%, #7a5c44 100%);
    left: 36%;
    bottom: 42%;
    transform: rotate(-18deg);
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.tool-press {
    position: absolute;
    width: 10vw;
    height: 6vh;
    background: linear-gradient(160deg, #46413c, #1a1714);
    left: 56%;
    bottom: 32%;
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

.workshop-desk {
    position: absolute;
    inset: auto 0 0 0;
    height: 38%;
    background: linear-gradient(180deg, #46413c 0%, #2e2a26 60%, #1a1714 100%);
    box-shadow: inset 0 40px 60px rgba(26,23,20,0.7);
}

.workshop-lamp {
    position: absolute;
    top: 8%;
    right: 14%;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 220, 160, 0.85) 0%, rgba(196,168,107,0.25) 55%, transparent 80%);
    filter: blur(2px);
}

.workshop-grain {
    position: absolute;
    inset: 0;
    filter: url(#grain-filter);
    mix-blend-mode: overlay;
    opacity: 0.85;
    pointer-events: none;
}

.workshop-duotone {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(107,29,42,0.35), rgba(26,23,20,0.55));
    mix-blend-mode: multiply;
    pointer-events: none;
}

.workshop-vignette {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 180px rgba(26,23,20,0.95);
    pointer-events: none;
}

.workshop-overlay {
    position: absolute;
    left: clamp(24px, 8vw, 140px);
    bottom: clamp(80px, 14vh, 180px);
    max-width: 46ch;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.light-chapter-number { color: var(--c-gold); }

.workshop-title {
    color: var(--c-cream);
    margin-bottom: 8px;
}

.workshop-copy {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: var(--c-cream);
    line-height: 1.7;
    max-width: 42ch;
}

.workshop-signature {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--c-gold);
    letter-spacing: 0.04em;
}

/* =============================== CHAPTER V — COLOPHON ===================== */

.chapter-colophon {
    min-height: 60vh;
    background-color: var(--c-cream);
    color: var(--c-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(120px, 18vh, 220px) clamp(24px, 6vw, 96px);
}

.colophon-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.colophon-mark {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: 0.16em;
    text-transform: lowercase;
    color: var(--c-burgundy);
}

.colophon-rule {
    width: 38.2%;
    max-width: 320px;
    height: 1px;
    background: var(--c-gold);
}

.colophon-email {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.08em;
    color: var(--c-ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: color 400ms ease, border-color 400ms ease;
}

.colophon-email:hover {
    color: var(--c-burgundy);
    border-bottom-color: var(--c-copper);
}

.colophon-line {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 14px;
    color: var(--c-ink);
    line-height: 1.6;
}

/* ============================== RESPONSIVE ================================ */

@media (max-width: 900px) {
    .plate-a, .plate-b, .plate-c, .plate-d, .plate-e {
        grid-column: 2 / span 10;
    }
    .archive-grid { row-gap: 80px; }
    .chapter-header { padding-left: 0; }
    .statement { padding-left: 0; min-height: 80vh; }
    .workshop-overlay { bottom: 48px; }
    .scroll-indicator { display: none; }
}

@media (max-width: 540px) {
    .plate-a, .plate-b, .plate-c, .plate-d, .plate-e {
        grid-column: 1 / -1;
    }
    .wordmark { letter-spacing: 0.08em; }
    .chapter-hero { padding: 32px 20px; }
    .chapter { padding: 0 20px; }
    .hero-caption { font-size: 0.85rem; }
    .workshop-overlay { left: 20px; right: 20px; max-width: none; }
}

/* ============================== REDUCED MOTION ============================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
    .plate-figure { opacity: 1; transform: none; }
    .ripple-text .ripple-char { opacity: 1; transform: none; }
    .statement-divider { opacity: 1; transform: none !important; }
    .golden-rule { transform: scaleX(1); }
}
