:root {
  --paper: #F3E2BD;
  --honey: #D99B2B;
  --brass: #A86D1E;
  --ink: #2B2118;
  --graphite: #5D5245;
  --copper: #6F7B52;
  --glow: #FFC65A;
  --vellum: #FFF1CF;
  --spring: cubic-bezier(.2, 1.35, .32, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Mono", "Space Mono", monospace;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 198, 90, .28), transparent 22rem),
    radial-gradient(circle at 82% 34%, rgba(111, 123, 82, .18), transparent 24rem),
    linear-gradient(135deg, var(--vellum), var(--paper) 46%, #e8cf99);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(93, 82, 69, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93, 82, 69, .07) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, #000 0 68%, transparent 100%);
  z-index: 0;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .23;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(43, 33, 24, .35) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, rgba(168, 109, 30, .25) 0 1px, transparent 1.6px),
    radial-gradient(circle at 40% 80%, rgba(93, 82, 69, .22) 0 1px, transparent 1.4px);
  background-size: 19px 23px, 31px 29px, 43px 37px;
  mix-blend-mode: multiply;
}

.bench-marks span {
  position: fixed;
  z-index: 2;
  width: 54px;
  height: 54px;
  border-color: rgba(43, 33, 24, .38);
  pointer-events: none;
}
.bench-marks span:nth-child(1) { top: 24px; left: 28px; border-top: 2px solid; border-left: 2px solid; }
.bench-marks span:nth-child(2) { top: 24px; right: 28px; border-top: 2px solid; border-right: 2px solid; }
.bench-marks span:nth-child(3) { bottom: 24px; left: 28px; border-bottom: 2px solid; border-left: 2px solid; }
.bench-marks span:nth-child(4) { bottom: 24px; right: 28px; border-bottom: 2px solid; border-right: 2px solid; }

.inspection-sequence { position: relative; z-index: 3; }

.plate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 6vh 4vw;
  position: relative;
}

.worktable {
  width: min(1180px, 100%);
  min-height: 76vh;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto 1fr auto;
  align-items: center;
  position: relative;
  border: 1px solid rgba(168, 109, 30, .38);
  background:
    linear-gradient(90deg, transparent 0 calc(8.333% - 1px), rgba(168, 109, 30, .09) calc(8.333% - 1px) 8.333%),
    radial-gradient(ellipse at center, rgba(255, 241, 207, .72), rgba(243, 226, 189, .58));
  box-shadow: 0 28px 70px rgba(43, 33, 24, .18), inset 0 0 0 10px rgba(255, 241, 207, .22);
  padding: clamp(22px, 4vw, 52px);
}

.worktable::before,
.worktable::after {
  content: "";
  position: absolute;
  width: 86px;
  height: 24px;
  background: rgba(255, 241, 207, .72);
  border: 1px solid rgba(168, 109, 30, .22);
  box-shadow: 0 6px 10px rgba(43, 33, 24, .12);
}
.worktable::before { top: -11px; left: 18%; transform: rotate(-3deg); }
.worktable::after { bottom: -12px; right: 16%; transform: rotate(2deg); }

.plate-label {
  grid-column: 1 / -1;
  align-self: start;
  margin: 0;
  font: 700 12px/1 "Space Mono", monospace;
  letter-spacing: .08em;
  color: var(--brass);
  text-transform: uppercase;
}

h1, h2 {
  grid-column: 3 / 11;
  justify-self: center;
  text-align: center;
  margin: 28px 0 0;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: .92;
  color: var(--ink);
}
h1 { font-size: clamp(42px, 8vw, 104px); max-width: 900px; }
h2 { font-size: clamp(34px, 6vw, 76px); max-width: 820px; }

.artifact {
  grid-column: 4 / 10;
  grid-row: 2;
  justify-self: center;
  align-self: center;
  width: min(560px, 76vw);
  height: min(430px, 54vh);
  position: relative;
  transform-style: preserve-3d;
  transition: transform .9s var(--spring), filter .6s ease;
}

.plate:not(.active) .artifact { transform: translateY(36px) scale(.96) rotate(-1deg); filter: saturate(.84); }
.plate.active .artifact { transform: translateY(0) scale(1); }

.annotation {
  position: relative;
  z-index: 6;
  padding: 13px 14px;
  max-width: 260px;
  font: 400 13px/1.45 "Roboto Mono", monospace;
  background: rgba(255, 241, 207, .78);
  border: 1px solid rgba(168, 109, 30, .42);
  box-shadow: 8px 11px 0 rgba(93, 82, 69, .12);
}
.note-left { grid-column: 1 / 4; grid-row: 2; justify-self: end; transform: rotate(-2deg); }
.note-right { grid-column: 10 / 13; grid-row: 2; justify-self: start; transform: rotate(2deg); }
.taped::before, .ledger::before, .vellum-slip::before, .solder::before, .etched::before, .formula::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 22px;
  width: 58px;
  height: 18px;
  background: rgba(255, 241, 207, .64);
  border: 1px solid rgba(168, 109, 30, .22);
  transform: rotate(-5deg);
}
.formula { font-family: "Space Mono", monospace; font-weight: 700; color: var(--copper); }

.iso-shadow {
  position: absolute;
  left: 17%; right: 13%; bottom: 12%; height: 32%;
  background: radial-gradient(ellipse, rgba(43, 33, 24, .34), transparent 70%);
  filter: blur(12px);
  transform: rotate(-8deg);
}

.iso-plane {
  position: absolute;
  left: 18%; top: 18%;
  width: 64%; height: 46%;
  border: 2px solid var(--brass);
  background: linear-gradient(135deg, rgba(255, 241, 207, .95), rgba(217, 155, 43, .28));
  transform: rotateX(55deg) rotateZ(-45deg);
  box-shadow: 20px 24px 0 rgba(168, 109, 30, .22), inset 0 0 0 9px rgba(255, 198, 90, .16);
}
.base-plane { top: 34%; border-color: var(--graphite); }
.mid-plane { top: 26%; background: rgba(243, 226, 189, .78); }
.top-plane { top: 17%; background: rgba(255, 241, 207, .88); }

.chip {
  position: absolute;
  padding: 6px 9px;
  border: 1px solid var(--copper);
  background: rgba(255, 198, 90, .45);
  font: 700 12px/1 "Space Mono", monospace;
  color: var(--ink);
  transform: rotateZ(45deg) rotateX(-55deg);
}
.chip-a { left: 18%; top: 22%; }
.chip-b { right: 20%; top: 34%; }
.chip-c { left: 42%; bottom: 18%; }

.trace-map {
  position: absolute;
  inset: 9% 6%;
  overflow: visible;
  pointer-events: none;
}
.trace {
  fill: none;
  stroke: var(--brass);
  stroke-width: 3;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-dasharray: var(--dash, 720);
  stroke-dashoffset: var(--draw, 720);
  transition: stroke-dashoffset .9s var(--spring), stroke .35s ease, opacity .35s ease;
  filter: drop-shadow(0 0 3px rgba(255, 198, 90, .18));
}
.trace.copper { stroke: var(--copper); }
.trace.brass { stroke: var(--honey); }
.plate.active .trace { stroke-dashoffset: 0; }
.via { fill: var(--glow); stroke: var(--ink); stroke-width: 2; opacity: .88; }

.brass-plaque {
  position: absolute;
  left: 31%; top: 48%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--honey), var(--brass));
  border: 2px solid var(--ink);
  box-shadow: 7px 8px 0 rgba(43, 33, 24, .25);
  transform: rotate(-1deg);
  font-weight: 600;
}

.stack { perspective: 900px; }
.assumption-card {
  position: absolute;
  left: 19%;
  width: 62%; height: 118px;
  border: 2px solid var(--brass);
  background: rgba(255, 241, 207, .78);
  color: var(--ink);
  font: 600 18px/1 "IBM Plex Mono", monospace;
  box-shadow: 16px 18px 0 rgba(93, 82, 69, .14);
  transform-style: preserve-3d;
  transition: transform .8s var(--spring), top .8s var(--spring), background .4s ease;
  cursor: pointer;
}
.card-one { top: 14%; transform: rotateX(55deg) rotateZ(-45deg) translateZ(70px); }
.card-two { top: 34%; transform: rotateX(55deg) rotateZ(-45deg) translateZ(35px); }
.card-three { top: 54%; transform: rotateX(55deg) rotateZ(-45deg) translateZ(0); }
.assumption-card.is-flipped { background: rgba(255, 198, 90, .42); transform: rotateX(55deg) rotateZ(-45deg) translateZ(95px) rotateY(180deg); }
.card-face { position: absolute; inset: 0; display: grid; place-items: center; backface-visibility: hidden; }
.card-face.back { transform: rotateY(180deg); font-family: "Space Mono", monospace; color: var(--brass); }
.sheet-traces { inset: 0; }

.circuit-board {
  width: min(660px, 82vw);
  height: min(460px, 56vh);
  border: 2px solid var(--graphite);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 198, 90, .2), transparent 18%),
    linear-gradient(135deg, rgba(111, 123, 82, .24), rgba(255, 241, 207, .82));
  box-shadow: 20px 24px 0 rgba(43, 33, 24, .16), inset 0 0 0 12px rgba(93, 82, 69, .09);
  transform: rotateX(55deg) rotateZ(-45deg);
}
.circuit-board .trace-map { inset: 6%; transform: rotateZ(45deg) rotateX(-55deg) scale(.82); }
.token {
  position: absolute;
  border: 2px solid var(--ink);
  background: var(--vellum);
  color: var(--ink);
  padding: 9px 12px;
  font: 700 12px/1 "Space Mono", monospace;
  cursor: pointer;
  box-shadow: 5px 6px 0 rgba(43, 33, 24, .22);
  transform: rotateZ(45deg) rotateX(-55deg);
  transition: transform .45s var(--spring), background .35s ease;
}
.token:hover, .token.is-hot { transform: rotateZ(45deg) rotateX(-55deg) translateY(-8px) rotate(3deg); background: var(--glow); }
.token-risk { left: 7%; top: 18%; }
.token-time { left: 11%; bottom: 18%; }
.token-scarcity { left: 37%; top: 28%; }
.token-demand { right: 8%; top: 42%; }
.token-confidence { right: 13%; bottom: 18%; }
.reroute-line { opacity: 0; stroke: var(--glow); stroke-width: 4; }
.circuit-board.rerouting .active-line { opacity: .28; }
.circuit-board.rerouting .reroute-line { opacity: 1; stroke-dashoffset: 0; }

.output-window {
  width: min(620px, 82vw);
  height: min(430px, 54vh);
}
.readout {
  position: absolute;
  left: 18%; right: 18%; top: 26%;
  min-height: 116px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--ink);
  background: radial-gradient(circle at center, var(--glow), var(--honey) 62%, var(--brass));
  border: 3px solid var(--ink);
  box-shadow: 0 0 34px rgba(255, 198, 90, .72), 12px 14px 0 rgba(43, 33, 24, .22);
  font-family: "Space Mono", monospace;
  transform: rotate(-1deg);
}
.readout span { font-size: clamp(34px, 7vw, 74px); font-weight: 700; letter-spacing: -.08em; }
.readout small { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.output-window.connected .readout { animation: readoutPulse 1.2s ease-in-out infinite alternate; }
.fragment {
  position: absolute;
  max-width: 230px;
  padding: 11px 12px;
  background: rgba(255, 241, 207, .82);
  border: 1px solid var(--brass);
  font: 400 12px/1.4 "Roboto Mono", monospace;
  opacity: 0;
  transform: translateY(18px) rotate(-2deg);
  transition: opacity .7s ease, transform .7s var(--spring);
}
.plate.active .fragment { opacity: 1; transform: translateY(0) rotate(-2deg); }
.frag-a { left: 2%; top: 6%; transition-delay: .2s; }
.frag-b { right: 1%; top: 20%; transform: rotate(2deg); transition-delay: .38s; }
.frag-c { left: 29%; bottom: 8%; transition-delay: .56s; }

.loose-panel {
  position: absolute;
  padding: 18px 24px;
  background: rgba(255, 241, 207, .84);
  border: 2px solid var(--brass);
  box-shadow: 12px 14px 0 rgba(93, 82, 69, .14);
  font: 700 13px/1 "Space Mono", monospace;
  transform: rotateX(55deg) rotateZ(-45deg);
}
.panel-a { left: 23%; top: 21%; }
.panel-b { right: 19%; top: 29%; border-color: var(--copper); }
.panel-c { left: 38%; bottom: 18%; background: rgba(255, 198, 90, .42); }

@keyframes readoutPulse {
  from { box-shadow: 0 0 22px rgba(255, 198, 90, .5), 12px 14px 0 rgba(43, 33, 24, .22); }
  to { box-shadow: 0 0 48px rgba(255, 198, 90, .9), 12px 14px 0 rgba(43, 33, 24, .24); }
}

@media (max-width: 760px) {
  .worktable { min-height: 86vh; grid-template-columns: repeat(6, 1fr); padding: 24px 18px; }
  .artifact { grid-column: 1 / -1; width: 92vw; height: 45vh; }
  h1, h2 { grid-column: 1 / -1; }
  .annotation { max-width: 46vw; font-size: 11px; }
  .note-left { grid-column: 1 / 4; align-self: start; justify-self: start; }
  .note-right { grid-column: 4 / 7; align-self: end; justify-self: end; }
  .brass-plaque { left: 22%; }
  .circuit-board { transform: none; }
  .circuit-board .trace-map, .token { transform: none; }
}
