:root {
  /* Typography compliance note: IBM Plex Mono should add the wiki-machine texture without dominating. IBM Plex Mono** for revision IDs. Space Grotesk should keep the body text friendly and contemporary. Space Grotesk** for body copy and navigation. */
  --solar: #FFF1D6;
  --ink: #17120F;
  --mango: #FFB02E;
  --coral: #FF6B4A;
  --raspberry: #C22D6B;
  --apricot: #FFD166;
  --plum: #432344;
  --mint: #7BDCB5;
  --shadow: 8px 8px 0 #17120F;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Space Grotesk", Inter, sans-serif;
  color: var(--ink);
  background: var(--solar);
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: .18;
  background-image: radial-gradient(var(--ink) .8px, transparent .8px);
  background-size: 9px 9px;
  mix-blend-mode: multiply;
}

.archive { position: relative; z-index: 2; }

.link-field {
  position: fixed;
  inset: 7vh 3vw auto 3vw;
  width: 94vw;
  height: 40vh;
  z-index: 1;
  pointer-events: none;
}

.link-field path, .link-field circle {
  fill: var(--mint);
  stroke: var(--ink);
  stroke-width: 8;
  stroke-linecap: square;
  stroke-linejoin: round;
}

.draw-path {
  fill: none !important;
  stroke-dasharray: 1500;
  stroke-dashoffset: 1500;
  animation: drawLine 2.2s .4s cubic-bezier(.2,.8,.2,1) forwards;
}

.p2 { animation-delay: .8s; }

.room {
  min-height: 100vh;
  padding: clamp(18px, 3vw, 40px);
  position: relative;
}

.top-tabs {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.top-tabs a, .gloss-chip, .chip, .room-tag, .node-links span {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  background: var(--solar);
  border: 3px solid var(--ink);
  padding: 8px 12px;
  box-shadow: 4px 4px 0 var(--ink);
}

.top-tabs a:nth-child(2) { background: var(--mango); }
.top-tabs a:nth-child(3) { background: var(--mint); }
.top-tabs a:nth-child(4) { background: var(--coral); }

.bento {
  min-height: calc(100vh - 44px);
  padding-top: 52px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, minmax(68px, 1fr));
  gap: 18px;
}

.tile, .flip-card, .revision-card, .cabinet-card, .node-page, .orbit, .scrap {
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--solar);
}

.tile, .flip-face, .revision-card, .cabinet-card, .node-page, .orbit {
  padding: clamp(16px, 2vw, 28px);
  position: relative;
}

.drop-tile {
  opacity: 0;
  transform: translateY(-55px) rotate(-1.5deg);
  animation: heavyDrop .72s cubic-bezier(.15,1.35,.35,1) forwards;
}

.drop-tile:nth-child(2) { animation-delay: .12s; }
.drop-tile:nth-child(3) { animation-delay: .22s; }
.drop-tile:nth-child(4) { animation-delay: .32s; }
.drop-tile:nth-child(5) { animation-delay: .42s; }
.drop-tile:nth-child(6) { animation-delay: .52s; }
.drop-tile:nth-child(7) { animation-delay: .62s; }

.mango { background: var(--mango); }
.solar { background: var(--solar); }
.mint { background: var(--mint); }
.coral { background: var(--coral); }
.plum { background: var(--plum); color: var(--solar); }

.title-tile { grid-column: 1 / 7; grid-row: 1 / 6; overflow: hidden; }
.drawer-left { grid-column: 7 / 10; grid-row: 1 / 5; }
.atlas-grid > .flip-card { grid-column: 10 / 13; grid-row: 1 / 4; }
.timeline { grid-column: 4 / 11; grid-row: 6 / 8; }
.atlas-grid > .drawer.plum { grid-column: 1 / 4; grid-row: 6 / 9; }
.small-card { grid-column: 10 / 13 !important; grid-row: 4 / 7 !important; }
.glossary { grid-column: 7 / 13; grid-row: 8 / 9; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

h1, h2, h3 {
  font-family: "Archivo", Impact, sans-serif;
  letter-spacing: -.055em;
  line-height: .92;
  margin: 0 0 16px;
}

h1 { font-size: clamp(62px, 10vw, 164px); max-width: 7ch; position: relative; z-index: 2; }
h2 { font-size: clamp(38px, 5vw, 76px); }
h3 { font-size: clamp(26px, 3vw, 42px); }
p { font-size: clamp(17px, 1.4vw, 22px); line-height: 1.35; margin: 0; }

.mono, .paper-label { font-family: "IBM Plex Mono", monospace; font-weight: 700; }
.slug { margin-bottom: 14px; }
.lede { max-width: 560px; font-weight: 700; }

.paper-label {
  position: absolute;
  top: -18px;
  left: 18px;
  padding: 7px 12px;
  background: var(--solar);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  z-index: 3;
  color: var(--ink);
}

.raspberry, .raspberry-card { background: var(--raspberry); color: var(--solar); }
.mint-label { background: var(--mint); color: var(--ink); }

.sun-strip {
  position: absolute;
  width: 68%;
  height: 32%;
  right: -5%;
  top: 10%;
  background: repeating-linear-gradient(0deg, var(--apricot) 0 13px, var(--coral) 13px 26px);
  border: 3px solid var(--ink);
  transform: rotate(-5deg);
}

.brackets {
  position: absolute;
  right: 22px;
  bottom: 8px;
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: clamp(80px, 12vw, 190px);
  opacity: .22;
}

.server-stack { margin-top: 24px; display: grid; gap: 9px; }
.server-stack i, .brick-wall i { display: block; height: 26px; background: var(--mint); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.server-stack i:nth-child(2) { background: var(--mango); margin-left: 18px; }
.server-stack i:nth-child(3) { background: var(--coral); width: 72%; }

.flip-card { perspective: 1000px; background: transparent; padding: 0; cursor: pointer; }
.flip-inner { width: 100%; height: 100%; min-height: 100%; position: relative; transform-style: preserve-3d; transition: transform .62s cubic-bezier(.2,.8,.2,1); }
.flip-card.is-flipped .flip-inner, .flip-card:hover .flip-inner { transform: rotateY(180deg) scale(.98); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; border: 0; display: flex; flex-direction: column; justify-content: space-between; }
.flip-face.back { transform: rotateY(180deg); }

.ticker { display: flex; gap: 16px; width: max-content; animation: ticker 18s linear infinite; }
.ticker span { font-family: "IBM Plex Mono", monospace; font-size: clamp(20px, 3vw, 48px); font-weight: 700; white-space: nowrap; padding: 12px 16px; border: 3px solid var(--ink); background: var(--apricot); }
.timeline { overflow: hidden; background: var(--mint); }

.terminal-window { margin-top: 28px; border: 3px solid var(--ink); background: var(--solar); color: var(--ink); padding: 14px; font-family: "IBM Plex Mono", monospace; box-shadow: 4px 4px 0 var(--ink); }

.corridor { background: var(--apricot); border-top: 3px solid var(--ink); }
.corridor > h2 { max-width: 860px; margin: 70px 0 30px; }
.revision-stack { display: grid; gap: 22px; }
.revision-card { display: grid; grid-template-columns: 150px 1fr 1.2fr; gap: 20px; align-items: center; background: var(--solar); transform: translateX(-80px); opacity: .15; transition: transform .65s cubic-bezier(.2,.8,.2,1), opacity .65s; }
.revision-card:nth-child(2) { background: var(--coral); margin-left: 7vw; }
.revision-card:nth-child(3) { background: var(--mint); margin-left: 14vw; }
.revision-card.in-view { transform: translateX(0); opacity: 1; }
.flip-line em { display: none; font-family: "IBM Plex Mono", monospace; font-style: normal; background: var(--plum); color: var(--solar); padding: 14px; border: 3px solid var(--ink); }
.flip-line.is-open em { display: block; }

.cabinets { background: var(--solar); }
.cabinet-grid { min-height: 86vh; padding-top: 56px; display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(6, minmax(82px, 1fr)); gap: 18px; }
.cabinet-card.large { grid-column: 1 / 6; grid-row: 1 / 5; }
.cabinet-card.plum { grid-column: 6 / 9; grid-row: 1 / 4; }
.raspberry-card { grid-column: 8 / 11; grid-row: 4 / 7; }
.scrap { padding: 18px; font-family: "IBM Plex Mono", monospace; font-weight: 700; font-size: 24px; align-self: center; justify-self: center; }
.scrap:nth-of-type(1) { grid-column: 6 / 8; grid-row: 4 / 5; }
.scrap:nth-of-type(2) { grid-column: 9 / 11; grid-row: 1 / 2; }
.scrap:nth-of-type(3) { grid-column: 6 / 8; grid-row: 5 / 7; }
.rotate-left { transform: rotate(-4deg); }
.rotate-right { transform: rotate(5deg); }
.brick-wall { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }

.open-node { background: var(--plum); color: var(--solar); overflow: hidden; display: grid; place-items: center; }
.node-page { width: min(760px, 82vw); min-height: 55vh; background: var(--solar); color: var(--ink); z-index: 2; }
.node-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.orbit { position: absolute; background: var(--mango); color: var(--ink); font-family: "IBM Plex Mono", monospace; font-size: 18px; }
.note-a { left: 8vw; top: 26vh; transform: rotate(-7deg); }
.note-b { right: 7vw; top: 18vh; background: var(--mint); transform: rotate(6deg); }
.note-c { right: 17vw; bottom: 16vh; background: var(--coral); transform: rotate(-3deg); }

@keyframes heavyDrop {
  0% { opacity: 0; transform: translateY(-70px) rotate(-2deg); box-shadow: 0 0 0 var(--ink); }
  70% { opacity: 1; transform: translateY(6px) rotate(1deg); box-shadow: 3px 3px 0 var(--ink); }
  100% { opacity: 1; transform: translateY(0) rotate(0); box-shadow: var(--shadow); }
}

@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes ticker { to { transform: translateX(-50%); } }

@media (max-width: 900px) {
  .top-tabs { position: absolute; }
  .bento, .cabinet-grid { display: block; }
  .tile, .flip-card, .cabinet-card, .scrap { min-height: 220px; margin-bottom: 18px; }
  .flip-card { height: 270px; }
  .revision-card { grid-template-columns: 1fr; margin-left: 0 !important; }
  .orbit { position: relative; margin: 14px; inset: auto; }
  .open-node { display: block; padding-top: 90px; }
}
