:root {
  /* IBM Plex Mono sparingly for tiny abstract-tech readouts. */
  --mist-wash: #E8DDCC;
  --rice-shadow: #F5F0E7;
  --mist-clay: #D6BFA8;
  --pale-chartreuse: #C7D9A6;
  --bruised-lavender: #AEB7DA;
  --rice-paper: #FFF8EA;
  --vellum: #FFF8EA;
  --warm-clay: #D6BFA8;
  --moss: #4F6F52;
  --soil: #3A3028;
  --fern-ink: #203C32;
  --ghost-violet: #B99CFF;
  --pollen-gold: #E8C85B;
  --apparition-blue: #9FD7E5;
  --font-clean: "Nunito Sans", ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Fraunces, Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow-soft: 0 28px 80px rgba(58, 48, 40, 0.18);
  --shadow-card: 8px 13px 0 rgba(79, 111, 82, 0.10), 0 22px 55px rgba(32, 60, 50, 0.13);
  --tilt-x: 0px;
  --tilt-y: 0px;
}

* { box-sizing: border-box; }

html,
body { margin: 0; min-height: 100%; overflow-x: hidden; }

body {
  font-family: var(--font-clean);
  color: var(--fern-ink);
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 248, 234, 0.96) 0 18%, transparent 40%),
    radial-gradient(circle at 74% 70%, rgba(185, 156, 255, 0.30) 0 18%, transparent 42%),
    linear-gradient(135deg, var(--mist-clay) 0%, var(--pale-chartreuse) 43%, var(--bruised-lavender) 72%, var(--rice-paper) 100%);
}

button { font: inherit; }

.specimen-cabinet {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 3vw, 46px);
  isolation: isolate;
  overflow: hidden;
}

.ambient-grain,
.ambient-grain::before,
.ambient-grain::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ambient-grain {
  opacity: 0.47;
  z-index: -2;
  background-image:
    radial-gradient(circle at 12% 17%, rgba(58, 48, 40, 0.10) 0 1px, transparent 1.5px),
    radial-gradient(circle at 66% 42%, rgba(79, 111, 82, 0.11) 0 1px, transparent 1.7px),
    radial-gradient(circle at 41% 78%, rgba(232, 200, 91, 0.14) 0 1px, transparent 1.6px);
  background-size: 33px 31px, 47px 43px, 29px 37px;
}

.ambient-grain::before {
  background:
    linear-gradient(105deg, transparent 0 22%, rgba(255, 248, 234, 0.23) 22.2% 23%, transparent 23.2% 100%),
    radial-gradient(ellipse at 50% 50%, transparent 0 55%, rgba(58, 48, 40, 0.12) 100%);
}

.ambient-grain::after {
  opacity: .38;
  background-image: repeating-linear-gradient(92deg, rgba(32, 60, 50, 0.045) 0 1px, transparent 1px 9px);
}

.pollen-field { position: absolute; inset: 0; pointer-events: none; transform: translate3d(var(--tilt-x), var(--tilt-y), 0); transition: transform 800ms cubic-bezier(.2, .8, .2, 1); }

.pollen-pixel {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 2px 50% 50% 50%;
  background: var(--pollen-gold);
  box-shadow: 0 0 18px rgba(232, 200, 91, 0.55);
  opacity: .66;
  animation: drift 8s ease-in-out infinite alternate;
}

.p1 { left: 10%; top: 18%; animation-delay: -1s; } .p2 { left: 22%; top: 76%; animation-delay: -4s; }
.p3 { left: 82%; top: 18%; animation-delay: -2s; } .p4 { left: 76%; top: 82%; animation-delay: -6s; }
.p5 { left: 48%; top: 9%; animation-delay: -3s; } .p6 { left: 56%; top: 90%; animation-delay: -5s; }
.p7 { left: 4%; top: 50%; animation-delay: -7s; } .p8 { left: 91%; top: 54%; animation-delay: -2.5s; }
.p9 { left: 36%; top: 31%; animation-delay: -8s; } .p10 { left: 64%; top: 35%; animation-delay: -4.8s; }
.p11 { left: 42%; top: 69%; animation-delay: -6.3s; } .p12 { left: 69%; top: 63%; animation-delay: -3.7s; }

.wabi-bento {
  width: min(1160px, 96vw);
  min-height: min(760px, 88vh);
  display: grid;
  grid-template-columns: 1.12fr .44fr .82fr .62fr;
  grid-template-rows: 1fr .88fr .72fr;
  gap: clamp(13px, 1.6vw, 23px);
  position: relative;
  filter: drop-shadow(var(--shadow-soft));
  transform: translate3d(calc(var(--tilt-x) * -0.22), calc(var(--tilt-y) * -0.20), 0);
  transition: transform 700ms cubic-bezier(.2, .8, .2, 1);
}

.ceramic-tile {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  border: 1px solid rgba(58, 48, 40, 0.14);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 248, 234, 0.78) 0 12%, transparent 30%),
    linear-gradient(145deg, rgba(255, 248, 234, 0.88), rgba(245, 240, 231, 0.78) 44%, rgba(232, 221, 204, 0.80));
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(9px);
}

.ceramic-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(58, 48, 40, .12) 0 1px, transparent 1.3px),
    radial-gradient(circle at 60% 70%, rgba(185, 156, 255, .12) 0 1px, transparent 1.4px),
    linear-gradient(115deg, transparent 0 46%, rgba(214, 191, 168, .22) 46.5% 47%, transparent 47.5%);
  background-size: 25px 29px, 37px 31px, 100% 100%;
  mix-blend-mode: multiply;
  opacity: .46;
}

.ceramic-tile::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -42px;
  bottom: -52px;
  border-radius: 50%;
  background: rgba(159, 215, 229, 0.22);
  filter: blur(2px);
}

.reveal-card { opacity: 0; transform: translateY(18px) rotate(var(--start-rot, 0deg)); animation: cardArrive 900ms cubic-bezier(.2, .9, .18, 1) forwards; }
.reveal-card:nth-child(2) { animation-delay: 90ms; } .reveal-card:nth-child(3) { animation-delay: 180ms; }
.reveal-card:nth-child(4) { animation-delay: 260ms; } .reveal-card:nth-child(5) { animation-delay: 350ms; }
.reveal-card:nth-child(6) { animation-delay: 450ms; }

.wordmark-tile {
  grid-column: 1 / 3;
  grid-row: 1 / 3;
  border-radius: 44px 28px 52px 34px;
  padding: clamp(28px, 4.2vw, 60px);
  transform: rotate(-1.6deg);
  --start-rot: -1.6deg;
}

.field-label {
  position: relative;
  z-index: 2;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(32, 60, 50, .72);
  background: rgba(255, 248, 234, .50);
  border: 1px solid rgba(32, 60, 50, .11);
  border-radius: 100px 80px 90px 70px;
  padding: 7px 10px;
}

.mono { font-family: var(--font-mono); }

h1,
h2,
p { position: relative; z-index: 2; }

h1 {
  margin: clamp(16px, 3vh, 34px) 0 0;
  font-family: var(--font-clean);
  font-size: clamp(74px, 12vw, 172px);
  line-height: .82;
  letter-spacing: -.08em;
  color: var(--soil);
  text-shadow: 3px 4px 0 rgba(232, 200, 91, 0.20), -2px 0 0 rgba(185, 156, 255, 0.20);
}

h2 {
  margin: 14px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.1vw, 42px);
  line-height: 1.02;
  color: var(--fern-ink);
  font-weight: 700;
}

p {
  color: rgba(58, 48, 40, .84);
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.58;
}

.poem-line {
  max-width: 480px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 34px);
  line-height: 1.13;
  color: var(--moss);
}

.story-prompt {
  position: relative;
  z-index: 3;
  margin-top: 18px;
  border: 1px solid rgba(58, 48, 40, .18);
  color: var(--fern-ink);
  background: linear-gradient(135deg, rgba(232, 200, 91, .58), rgba(185, 156, 255, .24));
  border-radius: 999px 760px 880px 690px;
  padding: 12px 18px;
  box-shadow: 4px 6px 0 rgba(79, 111, 82, .13);
  cursor: pointer;
  transition: transform 280ms cubic-bezier(.22, 1.2, .36, 1), box-shadow 280ms ease;
}

.story-prompt:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 7px 9px 0 rgba(79, 111, 82, .12); }

.tile-crack {
  position: absolute;
  inset: 18% auto auto 52%;
  width: 2px;
  height: 130px;
  background: linear-gradient(var(--pollen-gold), transparent);
  transform: rotate(24deg);
  opacity: .65;
  z-index: 1;
}

.tile-crack::before,
.tile-crack::after { content: ""; position: absolute; width: 2px; height: 44px; background: inherit; transform-origin: top; }
.tile-crack::before { top: 34px; left: 0; transform: rotate(-38deg); }
.tile-crack::after { top: 72px; left: 0; transform: rotate(46deg); }

.hero-fern {
  position: absolute;
  right: -16px;
  bottom: -8px;
  width: min(42%, 290px);
  z-index: 1;
  opacity: .64;
  transform: rotate(8deg);
}

.pressed-fern path,
.fern-stem {
  fill: none;
  stroke: var(--moss);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(2px 2px 0 rgba(159, 215, 229, .20));
}

.pressed-fern.slim { width: 100%; height: 80%; margin-top: 18px; }

.flip-specimen { perspective: 1300px; min-height: 180px; animation-name: flipArrive; }
.flip-inner { position: relative; width: 100%; height: 100%; min-height: 100%; transform-style: preserve-3d; transition: transform 780ms cubic-bezier(.2, .88, .18, 1.12); }
.flip-specimen.is-flipped .flip-inner { transform: rotateY(180deg) rotateZ(.7deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; padding: clamp(18px, 2vw, 28px); display: flex; flex-direction: column; justify-content: space-between; }
.flip-back { transform: rotateY(180deg); background: linear-gradient(140deg, rgba(255, 248, 234, .92), rgba(185, 156, 255, .24), rgba(159, 215, 229, .22)); }

.ghost-packet-tile { grid-column: 3 / 4; grid-row: 1 / 2; transform: rotate(2.8deg); --start-rot: 2.8deg; }
.stem-tile { grid-column: 4 / 5; grid-row: 1 / 3; transform: rotate(-2.2deg); --start-rot: -2.2deg; }
.circuit-tile { grid-column: 2 / 4; grid-row: 3 / 4; border-radius: 34px 58px 26px 44px; padding: clamp(18px, 2vw, 30px); transform: rotate(.8deg); --start-rot: .8deg; }
.mushroom-tile { grid-column: 1 / 2; grid-row: 3 / 4; transform: rotate(2deg); --start-rot: 2deg; }
.story-drawer { grid-column: 3 / 5; grid-row: 2 / 4; border-radius: 30px 54px 46px 28px; padding: clamp(24px, 3vw, 42px); transform: rotate(-.9deg); --start-rot: -.9deg; }

.ghost-packet-tile .ceramic-tile { border-radius: 24px 34px 28px 42px; }
.stem-tile .ceramic-tile { border-radius: 46px 24px 56px 28px; }
.mushroom-tile .ceramic-tile { border-radius: 52px 30px 34px 25px; }

.washi {
  position: absolute;
  z-index: 3;
  width: 68px;
  height: 23px;
  background: rgba(232, 200, 91, .52);
  box-shadow: 0 1px 0 rgba(58, 48, 40, .12);
}
.tape-a { top: 15px; right: 18px; transform: rotate(9deg); }

.ghost-seed {
  position: relative;
  z-index: 2;
  width: clamp(84px, 9vw, 125px);
  height: clamp(104px, 11vw, 150px);
  margin: 14px auto 7px;
  border-radius: 52% 52% 35% 35% / 44% 44% 32% 32%;
  background: linear-gradient(155deg, rgba(255,248,234,.95), rgba(185,156,255,.34) 60%, rgba(159,215,229,.42));
  border: 1px solid rgba(58, 48, 40, .12);
  box-shadow: inset -10px -14px 24px rgba(174, 183, 218, .28), 0 14px 28px rgba(58, 48, 40, .12);
  animation: floatSmall 3.8s ease-in-out infinite alternate;
}

.ghost-seed::before,
.ghost-seed::after { content: ""; position: absolute; bottom: -1px; width: 30%; height: 28%; background: inherit; border-radius: 50% 50% 20% 20%; }
.ghost-seed::before { left: 14%; } .ghost-seed::after { right: 14%; }
.eye { position: absolute; top: 42%; width: 9px; height: 12px; border-radius: 50%; background: var(--fern-ink); z-index: 2; }
.eye.left { left: 35%; } .eye.right { right: 35%; }

.binary-constellation {
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--soil);
  letter-spacing: .12em;
}

.vellum-card { background: linear-gradient(180deg, rgba(255, 248, 234, .52), rgba(159, 215, 229, .18)); }

.root-circuit { position: relative; z-index: 2; width: 100%; height: min(168px, 22vh); margin: 6px 0 0; overflow: visible; }
.circuit-path {
  fill: none;
  stroke: var(--moss);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  filter: drop-shadow(0 0 6px rgba(159, 215, 229, .45));
}
.circuit-path.path-b { stroke: var(--ghost-violet); stroke-width: 2.2; }
.circuit-path.path-c { stroke: var(--fern-ink); stroke-width: 2; opacity: .78; }
.root-circuit.is-drawn .circuit-path { animation: drawRoot 1800ms cubic-bezier(.2,.8,.2,1) forwards; }
.root-circuit.is-drawn .path-b { animation-delay: 180ms; } .root-circuit.is-drawn .path-c { animation-delay: 330ms; }
.dew-node { fill: var(--apparition-blue); stroke: rgba(32, 60, 50, .35); stroke-width: 1; opacity: .92; transform-origin: center; animation: dewPulse 2.8s ease-in-out infinite; }

.mushroom-radio { position: relative; z-index: 2; width: 132px; height: 122px; margin: 15px auto; }
.mushroom-radio .cap { position: absolute; left: 12px; top: 30px; width: 112px; height: 62px; border-radius: 70px 70px 24px 24px; background: linear-gradient(145deg, var(--warm-clay), var(--ghost-violet)); box-shadow: inset 12px 8px 0 rgba(255, 248, 234, .30); }
.mushroom-radio .stem { position: absolute; left: 51px; top: 72px; width: 38px; height: 54px; border-radius: 50% 44% 20px 20px; background: var(--vellum); border: 1px solid rgba(58, 48, 40, .14); }
.mushroom-radio .antenna { position: absolute; top: 6px; width: 2px; height: 42px; background: var(--fern-ink); transform-origin: bottom; }
.mushroom-radio .antenna::after { content: ""; position: absolute; top: -5px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--apparition-blue); box-shadow: 0 0 14px rgba(159, 215, 229, .8); }
.mushroom-radio .antenna.a { left: 45px; transform: rotate(-24deg); } .mushroom-radio .antenna.b { right: 42px; transform: rotate(26deg); }

.drawer-tab {
  position: absolute;
  top: -13px;
  left: 42px;
  z-index: 4;
  padding: 9px 20px;
  border-radius: 18px 18px 8px 8px;
  background: var(--warm-clay);
  color: var(--soil);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  box-shadow: 0 -2px 0 rgba(255,248,234,.65) inset;
}

.drawer-copy { max-width: 62%; }
.story-drawer p { font-size: clamp(15px, 1.45vw, 19px); }
.drawer-note { margin-top: 10px; font-family: var(--font-mono); font-size: 12px !important; letter-spacing: .06em; color: rgba(32, 60, 50, .74); }

.planchette-leaf {
  position: absolute;
  z-index: 2;
  right: clamp(20px, 4vw, 60px);
  bottom: clamp(20px, 4vw, 48px);
  width: clamp(118px, 16vw, 210px);
  aspect-ratio: 1.8;
  border-radius: 80% 4% 80% 9% / 88% 8% 86% 12%;
  background: linear-gradient(135deg, rgba(79,111,82,.74), rgba(199,217,166,.55));
  transform: rotate(-22deg);
  box-shadow: 12px 16px 0 rgba(58,48,40,.08), inset 0 0 0 1px rgba(32,60,50,.18);
}
.planchette-leaf::before { content: ""; position: absolute; inset: 47% 8% auto 8%; height: 2px; background: rgba(255,248,234,.7); transform: rotate(-3deg); }
.planchette-leaf span { position: absolute; left: 46%; top: 34%; width: 22px; height: 22px; border: 2px solid rgba(255,248,234,.72); border-radius: 50%; }

.flip-specimen:hover .flip-inner,
.flip-specimen.hover-flip .flip-inner { transform: rotateY(180deg) rotateZ(.7deg); }

.is-floating { animation: floatTile 4.8s ease-in-out infinite alternate; }
.ghost-packet-tile.is-floating { animation-delay: -.8s; } .stem-tile.is-floating { animation-delay: -1.6s; }
.circuit-tile.is-floating { animation-delay: -2.2s; } .mushroom-tile.is-floating { animation-delay: -2.9s; }
.story-drawer.is-floating { animation-delay: -3.5s; }

@keyframes cardArrive { to { opacity: 1; transform: translateY(0) rotate(var(--start-rot, 0deg)); } }
@keyframes flipArrive { to { opacity: 1; transform: translateY(0) rotate(var(--start-rot, 0deg)); } }
@keyframes floatSmall { from { transform: translateY(0) rotate(-1deg); } to { transform: translateY(-10px) rotate(2deg); } }
@keyframes floatTile { from { margin-top: 0; } to { margin-top: -7px; } }
@keyframes drift { from { transform: translate3d(-6px, 8px, 0) rotate(0deg); } to { transform: translate3d(10px, -12px, 0) rotate(90deg); } }
@keyframes drawRoot { to { stroke-dashoffset: 0; } }
@keyframes dewPulse { 0%, 100% { opacity: .55; transform: scale(.82); } 50% { opacity: 1; transform: scale(1.08); } }

.story-drawer.note-pulse .planchette-leaf { animation: leafKnock 560ms cubic-bezier(.18,.9,.28,1); }
@keyframes leafKnock { 0%, 100% { transform: rotate(-22deg) translateY(0); } 38% { transform: rotate(-16deg) translateY(-8px); } 68% { transform: rotate(-25deg) translateY(3px); } }

@media (max-width: 900px) {
  .specimen-cabinet { min-height: auto; overflow: visible; }
  .wabi-bento { grid-template-columns: 1fr 1fr; grid-template-rows: auto; min-height: 0; }
  .wordmark-tile,
  .ghost-packet-tile,
  .stem-tile,
  .circuit-tile,
  .mushroom-tile,
  .story-drawer { grid-column: auto; grid-row: auto; min-height: 260px; }
  .wordmark-tile,
  .circuit-tile,
  .story-drawer { grid-column: 1 / -1; }
  .flip-inner { min-height: 260px; }
  .drawer-copy { max-width: 100%; padding-right: 26%; }
}

@media (max-width: 620px) {
  .specimen-cabinet { padding: 14px; }
  .wabi-bento { width: 100%; grid-template-columns: 1fr; gap: 16px; }
  .wordmark-tile,
  .circuit-tile,
  .story-drawer { grid-column: auto; }
  .wordmark-tile { padding: 28px 22px; }
  h1 { font-size: clamp(64px, 23vw, 108px); }
  .drawer-copy { padding-right: 0; }
  .planchette-leaf { position: relative; right: auto; bottom: auto; margin: 22px 0 0 auto; }
}
