/* ===============================================================
   bvb.tools — burnt-orange constructivist collage workshop
   palette: tracing-paper cream substrate, burnt-orange tonic,
            iron-oxide shadow, saffron highlight, toner-black,
            sepia pencil, verdigris accent (live links only)
   =============================================================== */

:root {
    --orange-prime: #c14a17;
    --iron-oxide:  #7a2a0a;
    --saffron:     #e89052;
    --paper:       #f5ead6;
    --toner:       #1c1408;
    --sepia:       #5a4b35;
    --verdigris:   #0d6e6a;
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    background: var(--paper);
}

body {
    background: var(--paper);
    color: var(--toner);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.95rem;
    line-height: 1.55;
    overflow-x: hidden;
    position: relative;
}

.defs-svg { position: absolute; width: 0; height: 0; pointer-events: none; }

/* paper-grain overlay (very subtle) */
.paper-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 90;
    opacity: 0.32;
    background-image:
        radial-gradient(circle at 13% 22%, rgba(122,42,10,0.05) 0 1px, transparent 2px),
        radial-gradient(circle at 78% 41%, rgba(90,75,53,0.06) 0 1px, transparent 2px),
        radial-gradient(circle at 32% 79%, rgba(193,74,23,0.04) 0 1px, transparent 2px),
        radial-gradient(circle at 61% 11%, rgba(28,20,8,0.05) 0 1px, transparent 2px);
    background-size: 17px 17px, 23px 23px, 19px 19px, 29px 29px;
    mix-blend-mode: multiply;
}

.sawdust {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}
.sawdust .speck {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--sepia);
    border-radius: 50%;
    opacity: 0.45;
}

/* ===============================================================
   STATIONS — full-viewport scroll-snap stages
   =============================================================== */
.station {
    scroll-snap-align: start;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    padding: 4vh 5vw;
}

.station-meta {
    position: absolute;
    bottom: 1.6rem;
    left: 1.6rem;
    font-family: "Special Elite", monospace;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--sepia);
    opacity: 0.78;
    z-index: 5;
}
.meta-bottom { bottom: 1.6rem; right: 1.6rem; left: auto; }

.scroll-prompt {
    position: absolute;
    bottom: 1.6rem;
    right: 1.6rem;
    font-family: "Special Elite", monospace;
    font-size: 0.78rem;
    color: var(--orange-prime);
    letter-spacing: 0.06em;
    z-index: 5;
    animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob {
    0%,100% { transform: translateY(0); opacity: 0.78; }
    50%     { transform: translateY(4px); opacity: 1; }
}

/* engineer's grid — only on technical stations */
.station-2 .engineer-grid,
.station-1 .engineer-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(to right, rgba(90,75,53,0.13) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(90,75,53,0.13) 1px, transparent 1px);
    background-size: 16px 16px;
    opacity: 0.6;
}

/* ===============================================================
   STATION TITLES (jittered)
   =============================================================== */
.station-title {
    font-family: "Major Mono Display", monospace;
    font-size: clamp(3rem, 9vw, 8rem);
    letter-spacing: 0.04em;
    color: var(--toner);
    line-height: 0.92;
    text-transform: lowercase;
    position: relative;
    z-index: 4;
}

.jitter { animation: jitter 0.18s steps(3) infinite; }
@keyframes jitter {
    0%   { transform: translate(0.5px, 0); }
    33%  { transform: translate(-0.5px, 0); }
    66%  { transform: translate(0, 0.4px); }
    100% { transform: translate(0, 0); }
}

/* ===============================================================
   STATION 1 — THE CRATE
   =============================================================== */
.station-1 {
    background: var(--paper);
}
.crate-stage {
    position: absolute;
    inset: 0;
    z-index: 2;
    transform-origin: 22% 78%;
    will-change: transform;
}

.crate {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-3deg);
    width: clamp(320px, 64vw, 880px);
    padding: 2.4rem 3.2rem 2.6rem;
    background: var(--paper);
    border: 3px solid var(--toner);
    box-shadow: 14px 14px 0 -2px var(--iron-oxide);
    filter: url(#tear);
    z-index: 3;
}
.crate::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1.5px dashed rgba(28,20,8,0.5);
    pointer-events: none;
}
.crate-stencil {
    display: block;
    font-family: "Special Elite", monospace;
    font-size: 0.86rem;
    letter-spacing: 0.18em;
    color: var(--iron-oxide);
    text-transform: uppercase;
    padding-bottom: 0.6rem;
}
.crate-bottom { padding-top: 0.6rem; padding-bottom: 0; text-align: right; }

.wordmark {
    font-family: "Major Mono Display", monospace;
    font-size: clamp(3.4rem, 10vw, 8.8rem);
    color: var(--orange-prime);
    line-height: 0.88;
    letter-spacing: 0.02em;
    text-transform: lowercase;
    text-shadow:
        2px 2px 0 var(--iron-oxide),
        4px 4px 0 rgba(122,42,10,0.35);
}
.wm-line { display: inline-block; }
.wm-dot  { color: var(--saffron); display: inline-block; }

/* tools floating around crate */
.tool {
    position: absolute;
    width: 84px;
    height: 84px;
    z-index: 2;
    filter: drop-shadow(2px 3px 0 rgba(122,42,10,0.35));
    will-change: transform;
}
.tool-allen     { top: 12%;  left: 8%;   width: 110px; height: 110px; animation: drift-a 17s ease-in-out infinite; }
.tool-divider   { top: 18%;  right: 11%; width: 96px;  height: 96px;  animation: drift-b 13s ease-in-out infinite; }
.tool-plumb     { bottom: 20%; left: 14%; width: 78px;  height: 78px;  animation: drift-c 19s ease-in-out infinite; }
.tool-square    { bottom: 11%; right: 18%; width: 120px; height: 120px; animation: drift-d 23s ease-in-out infinite; }
.tool-shutter   { top: 64%;  left: 48%;  width: 92px;  height: 92px;  animation: drift-e 11s ease-in-out infinite; }
.tool-microscope{ top: 9%;   left: 46%;  width: 88px;  height: 88px;  animation: drift-f 21s ease-in-out infinite; }

@keyframes drift-a {
    0%,100% { transform: translate(0,0) rotate(-8deg); }
    50%     { transform: translate(18px, -22px) rotate(6deg); }
}
@keyframes drift-b {
    0%,100% { transform: translate(0,0) rotate(12deg); }
    50%     { transform: translate(-22px, 18px) rotate(-4deg); }
}
@keyframes drift-c {
    0%,100% { transform: translate(0,0) rotate(2deg); }
    50%     { transform: translate(14px, 24px) rotate(-9deg); }
}
@keyframes drift-d {
    0%,100% { transform: translate(0,0) rotate(-4deg); }
    50%     { transform: translate(-26px, -16px) rotate(8deg); }
}
@keyframes drift-e {
    0%,100% { transform: translate(0,0) rotate(0deg); }
    50%     { transform: translate(20px, 14px) rotate(11deg); }
}
@keyframes drift-f {
    0%,100% { transform: translate(0,0) rotate(-6deg); }
    50%     { transform: translate(-16px, 22px) rotate(4deg); }
}

.stamp-corner {
    position: absolute;
    bottom: 6%;
    right: 8%;
    width: 110px;
    height: 110px;
    transform: rotate(var(--stamp-rot, -4deg));
    z-index: 6;
    opacity: 0.78;
}
.stamp-corner svg { width: 100%; height: 100%; }
.stamp-corner text {
    font-family: "Special Elite", monospace;
    font-size: 38px;
    fill: var(--orange-prime);
    letter-spacing: 0.12em;
}

/* ===============================================================
   STATION 2 — TOOLBOX CROSS-SECTION
   =============================================================== */
.station-2 {
    background: var(--paper);
}
.station-2 .station-title {
    position: absolute;
    top: 4vh;
    left: 5vw;
    color: var(--iron-oxide);
}
.exploded-diagram {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(560px, 70vw, 980px);
    transform: translate(-50%, -48%);
    z-index: 2;
}
.anno-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw-anno 2.2s ease-out 0.4s forwards;
}
@keyframes draw-anno {
    to { stroke-dashoffset: 0; }
}
.annotations {
    position: absolute;
    inset: 0;
    list-style: none;
    z-index: 3;
    pointer-events: none;
}
.anno {
    position: absolute;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
    color: var(--toner);
    letter-spacing: 0.02em;
    background: var(--paper);
    padding: 0.3rem 0.6rem;
    border-bottom: 2px solid var(--orange-prime);
}
.anno-key { color: var(--iron-oxide); font-weight: 500; }
.anno-key::after { content: " : "; color: var(--sepia); }
.anno-val { color: var(--toner); font-weight: 700; }
.anno-tr { top: 14%;  right: 8%; }
.anno-mr { top: 50%;  right: 6%; }
.anno-bl { bottom: 18%; left: 6%; }
.anno-tl { top: 26%;  left: 8%; }
.anno-br { bottom: 28%; right: 12%; }

/* ===============================================================
   STATION 3 — CALIPER READING ROOM
   =============================================================== */
.station-3 {
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
}
.station-3 .station-title {
    position: absolute;
    top: 3vh;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(2.2rem, 6vw, 5rem);
    color: var(--iron-oxide);
    z-index: 4;
}
.caliper {
    position: absolute;
    top: 0;
    height: 100%;
    width: 24vw;
    z-index: 2;
    will-change: transform;
}
.caliper-left  { left: 0;  transform: translateX(-42vw); }
.caliper-right { right: 0; transform: translateX(42vw); }

.reading-column {
    position: relative;
    z-index: 3;
    max-width: 56ch;
    margin: 0 auto;
    padding: 4rem 2rem;
}
.reading-column p {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.98rem;
    line-height: 1.65;
    color: var(--toner);
    margin-bottom: 1.2rem;
}
.reading-column .lede {
    font-size: 1.18rem;
    font-style: italic;
    color: var(--iron-oxide);
    margin-bottom: 1.6rem;
}
.reading-column em { color: var(--orange-prime); font-style: italic; }
.reading-column .hl {
    color: var(--orange-prime);
    font-weight: 500;
    background: rgba(232,144,82,0.18);
    padding: 0 0.2rem;
}
.signoff {
    margin-top: 2rem;
    font-family: "Special Elite", monospace;
    font-size: 0.92rem;
    color: var(--sepia);
}
.live-link {
    color: var(--verdigris);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    transition: color 0.2s;
}
.live-link:hover { color: var(--orange-prime); }

.coffee-ring {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    transform: scaleY(0.92) rotate(-8deg);
    background: radial-gradient(circle, transparent 55%, rgba(90,75,53,0.22) 60%, rgba(90,75,53,0.08) 70%, transparent 78%);
    z-index: 1;
}
.coffee-ring-1 { width: 80px; height: 80px; top: 18%; left: 28%; }
.coffee-ring-2 { width: 64px; height: 64px; bottom: 22%; right: 30%; transform: scaleY(0.92) rotate(14deg); }

/* ===============================================================
   STATION 4 — GENERATIVE PLOTTER FIELD
   =============================================================== */
.station-4 {
    background: var(--paper);
    overflow: hidden;
}
.plotter-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}
#plotter-path, #plotter-path-shadow {
    stroke-dasharray: 6000;
    stroke-dashoffset: 6000;
    animation: plotter-draw 12s linear infinite;
}
@keyframes plotter-draw {
    0%   { stroke-dashoffset: 6000; }
    50%  { stroke-dashoffset: 0;    }
    100% { stroke-dashoffset: -6000;}
}

.plotter-quote {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-2deg);
    font-family: "Major Mono Display", monospace;
    font-size: clamp(2rem, 5.4vw, 4.6rem);
    line-height: 1.05;
    color: var(--toner);
    text-align: center;
    text-transform: lowercase;
    z-index: 3;
    text-shadow: 2px 2px 0 rgba(193,74,23,0.18);
}
.quote-line { display: block; }
.quote-line:nth-child(2) { color: var(--orange-prime); transform: translateX(0.4rem); }
.quote-line:nth-child(3) { transform: translateX(-0.4rem); }

#plotter-seed {
    color: var(--orange-prime);
    font-weight: 500;
}

/* ===============================================================
   STATION 5 — SPECIMEN TRAY
   =============================================================== */
.station-5 {
    background: linear-gradient(180deg, #1c1408 0%, #0d0a05 100%);
    color: var(--paper);
}
.station-5 .station-title {
    color: var(--saffron);
    text-shadow: 2px 2px 0 var(--iron-oxide);
    position: absolute;
    top: 4vh;
    left: 5vw;
    z-index: 4;
}

.felt-tray {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: 86vw;
    max-width: 1200px;
    height: 64vh;
    background:
        radial-gradient(circle at 30% 20%, rgba(232,144,82,0.04), transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(13,110,106,0.05), transparent 50%),
        repeating-linear-gradient(135deg, #2a1c0c 0 2px, #1c1408 2px 5px),
        #1c1408;
    border: 2px solid #0d0a05;
    box-shadow:
        inset 0 0 60px rgba(0,0,0,0.7),
        0 18px 0 -2px rgba(0,0,0,0.5);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    padding: 1.6rem;
    z-index: 2;
}

.specimen {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
    --lift-deg: -3deg;
    cursor: pointer;
}
.specimen:nth-child(2n)   { --lift-deg:  4deg; animation: spec-rotate 6s ease-in-out infinite; }
.specimen:nth-child(3n)   { --lift-deg: -5deg; animation: spec-rotate 6s ease-in-out infinite -1.2s; }
.specimen:nth-child(5n)   { --lift-deg:  2deg; animation: spec-rotate 6s ease-in-out infinite -2.4s; }
.specimen:nth-child(7n)   { --lift-deg: -2deg; animation: spec-rotate 6s ease-in-out infinite -3.6s; }

@keyframes spec-rotate {
    0%,100% { transform: rotate(0deg); }
    50%     { transform: rotate(2deg); }
}

.specimen svg {
    width: 78px;
    height: 78px;
    margin-bottom: 0.7rem;
    filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.5));
}
.specimen figcaption {
    font-family: "Special Elite", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--saffron);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s, transform 0.4s;
}
.specimen .pin {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--verdigris);
    border-radius: 50%;
    box-shadow:
        0 0 0 2px #1c1408,
        2px 3px 4px rgba(0,0,0,0.7);
    z-index: 3;
}
.specimen .tape {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%) rotate(var(--tape-rot, -6deg));
    width: 60px;
    height: 14px;
    background: rgba(232,144,82,0.7);
    border-radius: 2px;
    filter: url(#tear);
    z-index: 1;
}
.specimen:nth-child(2n) .tape { --tape-rot:  9deg; }
.specimen:nth-child(3n) .tape { --tape-rot: -11deg; }
.specimen:nth-child(5n) .tape { --tape-rot:  4deg; }

.specimen:hover {
    transform: translateY(-12px) rotate(var(--lift-deg)) scale(1.06);
    z-index: 5;
}
.specimen:hover figcaption {
    opacity: 1;
    transform: translateY(0);
}
.specimen:hover svg {
    filter: drop-shadow(4px 6px 0 rgba(0,0,0,0.7));
}

/* ===============================================================
   STATION 6 — MARGINALIA SPREAD
   =============================================================== */
.station-6 {
    background: var(--paper);
}
.station-6 .station-title {
    position: absolute;
    top: 3vh;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--iron-oxide);
    z-index: 4;
}
.spread {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: 90vw;
    max-width: 1100px;
    height: 70vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    z-index: 2;
}
.page {
    position: relative;
    padding: 2.4rem 2.6rem;
    background: var(--paper);
    border: 1px solid rgba(90,75,53,0.3);
    box-shadow: inset 0 0 30px rgba(90,75,53,0.06);
}
.page-left {
    border-right: 1px dashed rgba(90,75,53,0.4);
    background-image:
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(90,75,53,0.13) 27px 28px);
}
.page-right {
    background-image:
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(90,75,53,0.13) 27px 28px);
}
.hand {
    font-family: "Special Elite", monospace;
    font-size: 0.95rem;
    line-height: 1.85;
    color: var(--sepia);
    margin-bottom: 0.9rem;
    transform: rotate(-0.6deg);
}
.hand.small { font-size: 0.82rem; text-align: right; opacity: 0.8; }
.hand-sketch {
    width: 200px;
    height: 120px;
    margin: 0.6rem 0 1rem;
    transform: rotate(-2deg);
}
.mirrored {
    transform: scaleY(-1) rotate(0.4deg);
    color: var(--sepia);
}
.hand-sketch.mirrored { transform: scaleY(-1) rotate(-1deg); }
.margin-arrow {
    color: var(--orange-prime);
    font-size: 1.2rem;
    padding: 0 0.3rem;
}
.coffee-ring-3 {
    position: absolute;
    width: 72px;
    height: 72px;
    bottom: 12%;
    right: 14%;
    border-radius: 50%;
    transform: scaleY(0.92) rotate(-12deg);
    background: radial-gradient(circle, transparent 55%, rgba(90,75,53,0.24) 60%, rgba(90,75,53,0.1) 70%, transparent 78%);
    pointer-events: none;
}
.dog-ear {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 56px;
    height: 56px;
    background:
        linear-gradient(135deg, transparent 50%, var(--paper) 50%),
        linear-gradient(135deg, rgba(90,75,53,0.4) 49%, rgba(90,75,53,0.4) 51%, transparent 51%);
    background-size: 100% 100%;
    box-shadow: -3px -3px 6px rgba(90,75,53,0.25);
}

/* ===============================================================
   STATION 7 — STAMPING BENCH
   =============================================================== */
.station-7 {
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.bench {
    position: relative;
    width: 90vw;
    max-width: 720px;
    height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.bench-top {
    position: absolute;
    top: 50%;
    left: -10vw;
    width: 110vw;
    height: 1px;
    background: var(--toner);
    transform: translateY(-50%);
    box-shadow:
        0 8px 0 -1px rgba(122,42,10,0.18),
        0 16px 0 -3px rgba(90,75,53,0.12);
    z-index: 1;
}
.stamp-final {
    width: clamp(220px, 38vw, 360px);
    height: clamp(220px, 38vw, 360px);
    z-index: 3;
    transform: scale(0) rotate(var(--stamp-rot-final, 4deg));
    opacity: 0;
}
.stamp-final.stamp-on {
    animation: stamp-fall 1.2s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes stamp-fall {
    0%   { transform: scale(2.2) rotate(var(--stamp-rot-final, 4deg)); opacity: 0; }
    60%  { transform: scale(0.92) rotate(var(--stamp-rot-final, 4deg)); opacity: 1; }
    100% { transform: scale(1) rotate(var(--stamp-rot-final, 4deg)); opacity: 1; }
}
.stamp-final svg { width: 100%; height: 100%; }
.stamp-final text {
    font-family: "Special Elite", monospace;
    fill: var(--orange-prime);
}
.stamp-final text:first-of-type { font-size: 60px; letter-spacing: 0.14em; }
.stamp-final .stamp-sub  { font-size: 22px; letter-spacing: 0.18em; fill: var(--iron-oxide); }
.stamp-final .stamp-tiny { font-size: 12px; letter-spacing: 0.18em; fill: var(--sepia); }

.bench-caption {
    position: absolute;
    bottom: 12%;
    font-family: "Special Elite", monospace;
    font-size: 0.92rem;
    color: var(--sepia);
    z-index: 4;
}
.bench-foot {
    position: absolute;
    bottom: 4%;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.82rem;
    color: var(--iron-oxide);
    z-index: 4;
}
.bench-foot .live-link { color: var(--verdigris); }

/* ===============================================================
   RESPONSIVE
   =============================================================== */
@media (max-width: 760px) {
    .crate { padding: 1.4rem 1.6rem; }
    .wordmark { font-size: clamp(2.4rem, 14vw, 4.6rem); }
    .reading-column { padding: 3rem 1.4rem; }
    .felt-tray {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(5, 1fr);
        height: 76vh;
    }
    .spread { grid-template-columns: 1fr; height: auto; max-height: 80vh; }
    .page-right { display: none; }
    .tool { width: 56px; height: 56px; }
    .anno { font-size: 0.74rem; padding: 0.2rem 0.4rem; }
    .station-title { font-size: clamp(2rem, 12vw, 4rem); }
    .caliper { width: 32vw; }
}

@media (prefers-reduced-motion: reduce) {
    .jitter, .tool, #plotter-path, #plotter-path-shadow,
    .specimen, .scroll-prompt, .stamp-final {
        animation: none !important;
    }
    html { scroll-behavior: auto; }
}
