/* =====================================================================
   mujun.dev — the spear and the shield
   palette: muted (warm canvas + faded vinyl)
   aesthetic: inflated-3d (pool-toy vinyl, welded seams, valve nipples)
   layout: diagonal-sections (consistent +17° rake)
   ===================================================================== */

:root {
  --canvas:        #EAE3D2;  /* Stall Canvas */
  --canvas-deep:   #D9CDB6;  /* Sandbar */
  --ink:           #2E2A24;  /* Brushed Ink */
  --coral:         #C97A5B;  /* Faded Coral */
  --coral-deep:    #B7563C;  /* Deep Coral */
  --teal:          #5E8C84;  /* Dusty Teal */
  --teal-deep:     #3F5D57;  /* Deep Teal */
  --vinyl:         #F4EFE2;  /* Highlight Vinyl */

  --rake: 17deg;
  --rake-rad: 0.2967rad;

  --font-display: 'Fredoka', system-ui, sans-serif;
  --font-body:    'Nunito', system-ui, sans-serif;
  --font-code:    'Space Mono', ui-monospace, monospace;
  --font-hand:    'Caveat', cursive;

  --shadow-pillow: 0 18px 38px -12px rgba(63, 93, 87, 0.32),
                   0 6px 14px -4px rgba(46, 42, 36, 0.18);
  --shadow-coral:  0 18px 36px -14px rgba(183, 86, 60, 0.45),
                   0 4px 12px -2px rgba(46, 42, 36, 0.18);

  --section-h: 100vh;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(244, 239, 226, 0.55), transparent 40%),
    radial-gradient(circle at 82% 78%, rgba(217, 205, 182, 0.4), transparent 45%),
    var(--canvas);
}

main#page { display: block; position: relative; z-index: 1; }

/* =====================================================================
   PROGRESS LANCE — pinned to right edge
   ===================================================================== */
#progress-lance {
  position: fixed;
  top: 0;
  right: 26px;
  height: 100vh;
  width: 4px;
  z-index: 50;
  pointer-events: none;
  transform: rotate(var(--rake));
  transform-origin: top right;
}

.lance-rail {
  position: absolute;
  inset: 6vh 0 6vh 0;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(46, 42, 36, 0.18) 8%,
    rgba(46, 42, 36, 0.32) 50%,
    rgba(46, 42, 36, 0.18) 92%,
    transparent 100%);
  border-radius: 4px;
  overflow: hidden;
}

.lance-rail::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 18%;
  background: linear-gradient(to bottom, transparent, rgba(244, 239, 226, 0.85), transparent);
  animation: lance-sheen 9s linear infinite;
}

@keyframes lance-sheen {
  0%   { top: -20%; }
  100% { top: 120%; }
}

.lance-tip {
  position: absolute;
  left: -6px;
  width: 16px;
  height: 16px;
  background: var(--coral);
  border-radius: 50% 50% 50% 10%;
  box-shadow: 0 0 14px rgba(201, 122, 91, 0.55), inset -2px -3px 4px rgba(46, 42, 36, 0.25);
  top: 6vh;
  transition: top 0.18s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.lance-glow {
  position: absolute;
  left: -10px;
  right: -10px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 122, 91, 0.5), transparent 70%);
  filter: blur(6px);
  top: 6vh;
  transition: top 0.18s ease, background 0.4s ease;
}

[data-current-accent="teal"] .lance-tip {
  background: var(--teal);
  box-shadow: 0 0 14px rgba(94, 140, 132, 0.55), inset -2px -3px 4px rgba(46, 42, 36, 0.25);
}
[data-current-accent="teal"] .lance-glow {
  background: radial-gradient(circle, rgba(94, 140, 132, 0.5), transparent 70%);
}

/* =====================================================================
   CURSOR SHEEN — soft highlight tracking the cursor
   ===================================================================== */
#cursor-sheen {
  position: fixed;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(circle, rgba(244, 239, 226, 0.22), rgba(244, 239, 226, 0.06) 35%, transparent 65%);
  mix-blend-mode: lighten;
  transform: translate(-50%, -50%);
  filter: blur(2px);
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.cursor-ready #cursor-sheen { opacity: 1; }

/* =====================================================================
   BANDS — diagonal sections at +17°
   ===================================================================== */
.band {
  position: relative;
  min-height: var(--section-h);
  width: 100%;
  padding: 8vh 6vw;
  overflow: hidden;
  isolation: isolate;
}

.band-inner {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  z-index: 2;
}

.band-0 { background: var(--canvas); }
.band-1 {
  background: var(--canvas-deep);
  clip-path: polygon(0 6%, 100% 0, 100% 94%, 0 100%);
  margin-top: -6vh;
  padding-top: 14vh;
  padding-bottom: 14vh;
}
.band-2 {
  background: var(--canvas);
  clip-path: polygon(0 6%, 100% 0, 100% 94%, 0 100%);
  margin-top: -6vh;
  padding-top: 14vh;
  padding-bottom: 14vh;
}
.band-3 {
  background: var(--canvas-deep);
  clip-path: polygon(0 6%, 100% 0, 100% 94%, 0 100%);
  margin-top: -6vh;
  padding-top: 14vh;
  padding-bottom: 14vh;
}
.band-4 {
  background: var(--canvas);
  clip-path: polygon(0 6%, 100% 0, 100% 100%, 0 100%);
  margin-top: -6vh;
  padding-top: 14vh;
}

/* diagonal seam sheen */
.band::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    calc(90deg - var(--rake)),
    transparent 0%,
    transparent 48%,
    rgba(244, 239, 226, 0.0) 50%,
    rgba(244, 239, 226, 0.18) 51%,
    transparent 53%,
    transparent 100%);
  background-size: 200% 100%;
  animation: seam-sheen 18s linear infinite;
  z-index: 1;
}

@keyframes seam-sheen {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =====================================================================
   SECTION 0 — HERO / MARKET STALL
   ===================================================================== */
.band-0 { padding-top: 6vh; padding-bottom: 6vh; }

.stall-canvas {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  align-items: center;
  gap: 4vw;
  height: 70vh;
  margin-top: 4vh;
}

.inflatable {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 26px 30px rgba(46, 42, 36, 0.18));
  will-change: transform;
}

.spear-svg {
  max-width: 480px;
  transform: rotate(calc(-1 * var(--rake)));
  animation: bob-spear 6.4s ease-in-out infinite;
}

.shield-svg {
  max-width: 320px;
  margin: 0 auto;
  animation: bob-shield 6.8s ease-in-out infinite;
}

@keyframes bob-spear {
  0%, 100% { transform: rotate(calc(-1 * var(--rake))) translateY(0); }
  50%      { transform: rotate(calc(-1 * var(--rake))) translateY(-10px); }
}

@keyframes bob-shield {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-8px) rotate(1.5deg); }
}

.speech-bubble {
  position: relative;
  background: var(--vinyl);
  border-radius: 36px;
  padding: 22px 28px 26px;
  box-shadow: var(--shadow-pillow);
  text-align: center;
  transform: translateY(0);
  transition: transform 1.2s ease;
  max-width: 340px;
  margin: 0 auto;
}

.speech-bubble.sagging { transform: translateY(8px) rotate(-0.8deg); }

.speech-bubble::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 32px;
  background: radial-gradient(ellipse at 30% 20%, rgba(244, 239, 226, 0.9), transparent 55%);
  pointer-events: none;
}

.speech-bubble .bubble-inner { position: relative; z-index: 1; }

.boast {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.6vw, 1.4rem);
  font-weight: 500;
  margin: 0.28em 0;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.25;
  min-height: 1.3em;
}

.bubble-tail {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 22px;
  background: var(--vinyl);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 4px 4px rgba(46, 42, 36, 0.14));
}

.wordmark {
  position: absolute;
  left: 50%;
  bottom: -8vh;
  transform: translateX(-50%) rotate(calc(-1 * var(--rake)));
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  letter-spacing: -0.02em;
  line-height: 0.98;
  color: var(--ink);
  text-shadow:
    0 1px 0 rgba(244, 239, 226, 0.9),
    0 2px 0 rgba(244, 239, 226, 0.7),
    0 6px 12px rgba(46, 42, 36, 0.18);
  pointer-events: none;
  white-space: nowrap;
}

.wordmark .dot { color: var(--coral); }

.hero-hint {
  position: absolute;
  bottom: 2vh;
  left: 50%;
  transform: translateX(-50%) rotate(var(--rake));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-size: 1.4rem;
  color: var(--coral-deep);
  opacity: 0.85;
  animation: hint-bob 2.8s ease-in-out infinite;
}

@keyframes hint-bob {
  0%, 100% { transform: translateX(-50%) rotate(var(--rake)) translateY(0); }
  50%      { transform: translateX(-50%) rotate(var(--rake)) translateY(6px); }
}

/* =====================================================================
   SECTION 1 — THE PIERCE TEST
   ===================================================================== */
.pierce-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 4vw;
  align-items: center;
  min-height: 70vh;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4.4vw, 3.8rem);
  letter-spacing: -0.015em;
  line-height: 1;
  margin: 0 0 0.55em;
  color: var(--ink);
}

.pierce-text p {
  margin: 0.55em 0;
  font-size: 1.05rem;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.pierce-text p.lede {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--ink);
}

.pierce-text p.aside {
  font-style: italic;
  color: rgba(46, 42, 36, 0.75);
  font-size: 1rem;
}

.pierce-text p[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.caveat {
  font-family: var(--font-hand);
  font-size: 1.25em;
  color: var(--coral-deep);
  font-weight: 600;
}

.pierce-stage {
  position: relative;
  perspective: 1200px;
}

.collision { width: 100%; height: auto; max-width: 600px; margin: 0 auto; display: block; }

#c-spear-group {
  transform-origin: 30px 185px;
  transform: rotate(calc(-1 * var(--rake))) translateX(0);
  transition: transform 0.06s linear;
}

#c-shield-crack { transition: opacity 0.4s ease; }

/* =====================================================================
   SECTION 2 — THE LAB / REPL
   ===================================================================== */
.lab-header { max-width: 760px; margin-bottom: 2.4rem; }

.lab-header .aside {
  font-family: var(--font-body);
  font-style: italic;
  color: rgba(46, 42, 36, 0.7);
  font-size: 0.98rem;
}

.repl-shell {
  position: relative;
  background: var(--vinyl);
  border-radius: 28px;
  padding: 22px 26px 26px;
  box-shadow: var(--shadow-pillow);
  max-width: 880px;
  overflow: hidden;
}

.repl-shell::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 24px;
  background: radial-gradient(ellipse at 20% 12%, rgba(255, 255, 255, 0.6), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.repl-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
  padding: 1.5px;
  background: linear-gradient(115deg, transparent 0%, transparent 40%, var(--coral) 50%, transparent 60%, transparent 100%);
  background-size: 250% 100%;
  animation: border-travel 6s linear infinite;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

@keyframes border-travel {
  0%   { background-position: 250% 0; }
  100% { background-position: -250% 0; }
}

.repl-prompt {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-code);
  font-size: 0.92rem;
  color: var(--teal-deep);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  margin-bottom: 12px;
}

.prompt-glyph {
  display: inline-block;
  transform: rotate(var(--rake));
  font-size: 1.05em;
  color: var(--coral);
}

.repl-pillow {
  position: relative;
  z-index: 1;
  background: var(--canvas);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: inset 0 2px 6px rgba(46, 42, 36, 0.16),
              inset 0 -2px 4px rgba(244, 239, 226, 0.7);
}

#repl-input {
  width: 100%;
  background: transparent;
  border: 0;
  resize: none;
  font-family: var(--font-code);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  outline: none;
  padding: 0;
  min-height: 4.6em;
}

.repl-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.repl-button {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  border: 0;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--coral);
  color: var(--vinyl);
  cursor: pointer;
  box-shadow: var(--shadow-coral),
              inset 0 2px 0 rgba(244, 239, 226, 0.45),
              inset 0 -3px 0 rgba(46, 42, 36, 0.18);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  letter-spacing: 0.01em;
}

.repl-button:hover { background: var(--coral-deep); transform: translateY(-1px); }
.repl-button:active { transform: scale(0.96) translateY(2px); box-shadow: inset 0 4px 10px rgba(46, 42, 36, 0.3); }

.repl-help {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.92rem;
  color: rgba(46, 42, 36, 0.65);
}

.repl-help code, .inline-code {
  font-family: var(--font-code);
  font-size: 0.88em;
  background: rgba(46, 42, 36, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
  font-style: normal;
}

.repl-chips {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  align-items: center;
}

.chips-label {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: rgba(46, 42, 36, 0.6);
  font-style: italic;
  margin-right: 4px;
}

.chip {
  font-family: var(--font-code);
  font-size: 0.84rem;
  border: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--canvas-deep);
  color: var(--ink);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(244, 239, 226, 0.7),
              inset 0 -2px 0 rgba(46, 42, 36, 0.12),
              0 4px 10px -4px rgba(46, 42, 36, 0.18);
  transition: transform 0.14s ease, background 0.14s ease;
}

.chip:hover { background: var(--vinyl); transform: translateY(-1px) scale(1.02); }
.chip:active { transform: scale(0.96); }

.verdict-stage {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  min-height: 90px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.verdict {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 32px;
  border-radius: 32px;
  background: var(--canvas-deep);
  box-shadow: var(--shadow-pillow);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  color: rgba(46, 42, 36, 0.55);
  transform: translateY(40px) scale(0.9);
  opacity: 0.85;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s ease,
              background 0.4s ease,
              color 0.4s ease,
              box-shadow 0.4s ease;
}

.verdict[data-state="idle"] {
  font-size: 1rem;
  font-weight: 400;
  font-family: var(--font-body);
  font-style: italic;
}

.verdict[data-state="sat"] {
  background: var(--teal);
  color: var(--vinyl);
  box-shadow: 0 0 0 1px rgba(63, 93, 87, 0.2),
              0 18px 38px -10px rgba(94, 140, 132, 0.55),
              0 0 60px -10px rgba(94, 140, 132, 0.6);
  transform: translateY(0) scale(1);
  opacity: 1;
}

.verdict[data-state="contradiction"] {
  background: var(--coral-deep);
  color: var(--vinyl);
  box-shadow: 0 0 0 1px rgba(183, 86, 60, 0.2),
              0 18px 38px -10px rgba(183, 86, 60, 0.55),
              0 0 70px -10px rgba(183, 86, 60, 0.7);
  transform: translateY(0) scale(1);
  opacity: 1;
  animation: verdict-pulse 0.55s ease 2;
}

.verdict[data-state="error"] {
  background: var(--canvas);
  color: var(--ink);
  font-size: 1.1rem;
  transform: translateY(0) scale(1);
  opacity: 1;
}

@keyframes verdict-pulse {
  0%, 100% { box-shadow: 0 18px 38px -10px rgba(183, 86, 60, 0.55), 0 0 70px -10px rgba(183, 86, 60, 0.7); }
  50%      { box-shadow: 0 22px 48px -8px rgba(183, 86, 60, 0.7),  0 0 110px -10px rgba(183, 86, 60, 0.95); }
}

.verdict-text { display: block; }
.verdict-detail {
  font-family: var(--font-code);
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.85;
  letter-spacing: 0.02em;
}

/* =====================================================================
   SECTION 3 — THE CABINET
   ===================================================================== */
.cabinet-header {
  position: relative;
  margin-bottom: 3rem;
  max-width: 760px;
}

.crystalline-backdrop {
  position: absolute;
  inset: -30px -8vw -50px -2vw;
  z-index: 0;
  pointer-events: none;
}

.crystalline-backdrop svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cabinet-header > .section-title,
.cabinet-header > .lede {
  position: relative;
  z-index: 1;
}

.lede {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.25rem;
  color: rgba(46, 42, 36, 0.78);
  margin: 0;
}

.cabinet-shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  transform: rotate(-1deg);
}

.specimen-card {
  position: relative;
  background: var(--vinyl);
  border-radius: 24px;
  padding: 22px 24px 26px;
  box-shadow: var(--shadow-pillow);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
  opacity: 0;
  transform: translateY(36px) rotate(0deg);
  overflow: hidden;
  isolation: isolate;
}

.specimen-card[data-stagger="0"] { transform: translateY(36px) rotate(-2deg); }
.specimen-card[data-stagger="1"] { transform: translateY(36px) rotate( 1.5deg); }
.specimen-card[data-stagger="2"] { transform: translateY(36px) rotate(-1deg); }
.specimen-card[data-stagger="3"] { transform: translateY(36px) rotate( 2deg); }
.specimen-card[data-stagger="4"] { transform: translateY(36px) rotate(-1.6deg); }
.specimen-card[data-stagger="5"] { transform: translateY(36px) rotate( 0.8deg); }

.specimen-card.is-visible[data-stagger="0"] { transform: translateY(0) rotate(-2deg); opacity: 1; }
.specimen-card.is-visible[data-stagger="1"] { transform: translateY(0) rotate( 1.5deg); opacity: 1; }
.specimen-card.is-visible[data-stagger="2"] { transform: translateY(0) rotate(-1deg); opacity: 1; }
.specimen-card.is-visible[data-stagger="3"] { transform: translateY(0) rotate( 2deg); opacity: 1; }
.specimen-card.is-visible[data-stagger="4"] { transform: translateY(0) rotate(-1.6deg); opacity: 1; }
.specimen-card.is-visible[data-stagger="5"] { transform: translateY(0) rotate( 0.8deg); opacity: 1; }

.specimen-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 18px;
  background: radial-gradient(ellipse at 25% 18%, rgba(255,255,255,0.55), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.specimen-card .card-seam {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(115deg, transparent 0%, transparent 42%, var(--coral) 50%, transparent 58%, transparent 100%);
  background-size: 280% 100%;
  animation: border-travel 9s linear infinite;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  padding: 1.5px;
  opacity: 0.65;
}

.specimen-card:hover {
  transform: translateY(-8px) scale(1.04) rotate(0deg) !important;
  box-shadow:
    0 28px 50px -14px rgba(63, 93, 87, 0.4),
    0 8px 20px -6px rgba(46, 42, 36, 0.22);
}

.specimen-card:hover .card-seam {
  animation-duration: 2.4s;
  opacity: 1;
}

.specimen-card > * { position: relative; z-index: 1; }

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.1em;
  color: var(--ink);
}

.card-meta {
  font-family: var(--font-code);
  font-size: 0.78rem;
  color: rgba(46, 42, 36, 0.6);
  letter-spacing: 0.04em;
  margin: 0 0 0.8em;
}

.card-claim {
  font-family: var(--font-code);
  font-size: 0.92rem;
  background: var(--canvas);
  border-radius: 14px;
  padding: 10px 14px;
  margin: 0 0 0.7em;
  box-shadow: inset 0 2px 4px rgba(46, 42, 36, 0.14),
              inset 0 -1px 0 rgba(244, 239, 226, 0.6);
  white-space: pre-wrap;
  color: var(--ink);
  line-height: 1.5;
  overflow-x: auto;
}

.card-claim code { font-family: inherit; }

.card-scribble {
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--coral-deep);
  margin: 0;
  line-height: 1.25;
  position: relative;
}

.scribble-text {
  display: inline-block;
  background-image: linear-gradient(transparent 92%, rgba(201, 122, 91, 0.3) 92%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: 0 0;
  transition: background-size 0.9s ease 0.2s;
  background-size: 0% 100%;
}

.specimen-card.is-visible .scribble-text { background-size: 100% 100%; }

/* =====================================================================
   SECTION 4 — COLOPHON / VENDOR WALKS OFF
   ===================================================================== */
.colophon-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 4vw;
  align-items: center;
  min-height: 60vh;
  padding-bottom: 6vh;
}

.deflating {
  filter: drop-shadow(0 14px 16px rgba(46, 42, 36, 0.16));
  transform-origin: center;
  animation: deflate 14s ease-in-out forwards;
  opacity: 0.82;
}

.spear-svg.deflating { max-width: 360px; transform: rotate(calc(-1 * var(--rake) - 4deg)); }
.shield-svg.deflating { max-width: 240px; }

@keyframes deflate {
  0%   { transform: scale(1); }
  60%  { transform: scale(0.96, 0.92); }
  100% { transform: scale(0.92, 0.84); }
}

.deflating .wrinkles path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: wrinkle-draw 6s ease forwards 1s;
}

@keyframes wrinkle-draw {
  to { stroke-dashoffset: 0; }
}

.crowd-frieze {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  margin-top: 2vh;
  padding-bottom: 2vh;
  flex-wrap: wrap;
}

.head {
  width: 22px;
  height: 28px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--ink);
  opacity: 0.8;
  display: inline-block;
  transform-origin: 50% 100%;
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.crowd-frieze.turning .head:nth-child(odd)  { transform: rotate(-22deg) translateX(-3px); }
.crowd-frieze.turning .head:nth-child(even) { transform: rotate( 22deg) translateX( 3px); }

.vendor-aside {
  grid-column: 1 / -1;
  text-align: center;
  font-family: var(--font-hand);
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  color: var(--coral-deep);
  margin: 1.4em 0 0.4em;
  transform: rotate(calc(-1 * var(--rake) * 0.3));
  opacity: 0.92;
}

.credits {
  grid-column: 1 / -1;
  text-align: center;
  font-family: var(--font-code);
  font-size: 0.82rem;
  color: rgba(46, 42, 36, 0.55);
  line-height: 1.6;
  margin-top: 1.6em;
  transform: rotate(calc(var(--rake) * 0.18));
}

.credits p { margin: 0.18em 0; }

.credits .signoff { margin-top: 0.8em; font-family: var(--font-body); font-size: 0.95rem; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 980px) {
  .stall-canvas { grid-template-columns: 1fr; height: auto; gap: 2vh; }
  .stall-canvas .speech-bubble { order: -1; }
  .pierce-grid { grid-template-columns: 1fr; gap: 2vh; }
  .cabinet-shelf { grid-template-columns: 1fr 1fr; }
  .colophon-stage { grid-template-columns: 1fr 1fr; }
  .wordmark { position: static; transform: rotate(calc(-1 * var(--rake))); margin: 4vh auto 0; }
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .band { padding: 6vh 5vw; }
  .cabinet-shelf { grid-template-columns: 1fr; }
  .colophon-stage { grid-template-columns: 1fr; }
  #progress-lance { display: none; }
  .repl-help { font-size: 0.85rem; }
  .chip { font-size: 0.78rem; padding: 6px 10px; }
}

/* =====================================================================
   PREFERS REDUCED MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .spear-svg, .shield-svg, .lance-rail::after, .repl-shell::after, .specimen-card .card-seam, .band::before {
    animation: none !important;
  }
}
