:root {
  --ink: #111018;
  --bone: #E8DDC3;
  --brass: #A7833D;
  --teal: #2E8C82;
  --violet: #43305F;
  --vermilion: #C7372F;
  --blue: #7AA7C7;
  --title: "Bodoni Moda", serif;
  --copy: "Bricolage Grotesque", sans-serif;
  --slab: "Roboto Slab", serif;
  --mono: "Azeret Mono", monospace;
}

/* Compliance vocabulary: Interactions based on physical transactional gestures—stamping; Roboto Slab** Slabbb for drawer labels. */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--copy);
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .16;
  background-image: radial-gradient(circle at 20% 30%, rgba(232,221,195,.18) 0 1px, transparent 1px), radial-gradient(circle at 70% 60%, rgba(167,131,61,.16) 0 1px, transparent 1px);
  background-size: 21px 19px, 29px 31px;
  mix-blend-mode: overlay;
}

.ledger-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, #43305F 0%, #111018 56%);
  transition: opacity .9s ease, transform .9s ease, visibility .9s ease;
}

.ledger-gate.opened { opacity: 0; transform: scale(1.25) rotateX(26deg); visibility: hidden; }

.ledger-cover {
  width: min(72vw, 760px);
  height: min(70vh, 520px);
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #17131f, #111018 52%, #241b31);
  border: 2px solid rgba(167,131,61,.55);
  box-shadow: inset 0 0 0 18px rgba(167,131,61,.08), inset 0 0 90px rgba(0,0,0,.75), 0 30px 120px rgba(0,0,0,.88);
  transform-origin: left center;
  animation: ledgerBreath 4s ease-in-out infinite;
}

.ledger-band { position: absolute; inset: 0 46%; background: linear-gradient(90deg, transparent, rgba(167,131,61,.45), transparent); }

.embossed-domain {
  font-family: var(--title);
  font-weight: 800;
  font-size: clamp(2.8rem, 8vw, 8.5rem);
  letter-spacing: -.06em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(232,221,195,.54);
  text-shadow: 0 2px 0 rgba(167,131,61,.28), 0 -2px 26px rgba(232,221,195,.08);
}

.rivet { color: var(--brass); -webkit-text-stroke: 0; text-shadow: 0 0 18px var(--brass), 0 0 38px var(--vermilion); }

.open-ledger, .restart {
  position: absolute;
  bottom: 42px;
  font: 700 .78rem var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--brass);
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  box-shadow: 0 0 0 6px rgba(167,131,61,.13), 0 18px 38px rgba(0,0,0,.38);
}

.room-tags {
  position: fixed;
  z-index: 40;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 7px;
  border: 1px solid rgba(167,131,61,.42);
  border-radius: 999px;
  background: rgba(17,16,24,.64);
  backdrop-filter: blur(14px);
}

.room-tags button {
  border: 0;
  border-radius: 999px;
  padding: 10px 13px;
  background: transparent;
  color: var(--bone);
  font: 600 .72rem var(--slab);
  cursor: pointer;
}

.room-tags button.active { background: var(--brass); color: var(--ink); transform: translateY(3px); }

.institute { position: relative; min-height: 600vh; }

.table-orbit {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  perspective: 1200px;
  z-index: 2;
}

.mahogany-table {
  width: min(86vw, 940px);
  height: min(58vw, 620px);
  min-height: 410px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(ellipse at center, rgba(232,221,195,.12), transparent 34%), radial-gradient(ellipse at 50% 50%, #3a1d1d, #1b1117 68%, #111018 72%);
  border: 2px solid rgba(167,131,61,.5);
  box-shadow: inset 0 0 0 22px rgba(167,131,61,.12), inset 0 0 95px rgba(0,0,0,.8), 0 0 130px rgba(67,48,95,.55);
  transform: rotateX(60deg) rotateZ(var(--table-rot, 0deg));
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}

.guilloche { position: absolute; inset: 11%; border-radius: 50%; border: 1px dashed rgba(232,221,195,.22); }
.ring-two { inset: 24%; border-color: rgba(122,167,199,.36); transform: rotate(19deg); }

.specimen-token {
  position: absolute;
  left: 50%; top: 50%;
  width: 230px; height: 72px;
  transform: translate(-50%, -50%) rotate(var(--token-rot, 0deg));
  filter: drop-shadow(0 18px 24px rgba(0,0,0,.5));
  transition: transform .8s ease;
}

.left-hand, .right-hand { position: absolute; top: 22px; width: 74px; height: 28px; background: var(--bone); opacity: .82; border-radius: 30px 8px 8px 30px; }
.left-hand { left: 0; transform: rotate(7deg); }
.right-hand { right: 0; transform: scaleX(-1) rotate(7deg); }
.token-core { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; transform: translate(-50%,-50%); border-radius: 50%; background: radial-gradient(circle, var(--brass), var(--vermilion)); box-shadow: 0 0 0 10px rgba(199,55,47,.14), 0 0 40px rgba(167,131,61,.7); }
.witness-mark { position: absolute; left: 50%; top: -20px; color: var(--blue); font-size: 24px; }

.ribbon { position: absolute; height: 8px; width: 62%; left: 19%; top: 48%; background: linear-gradient(90deg, transparent, var(--vermilion), var(--brass), transparent); opacity: .78; transform-origin: center; }
.ribbon-b { transform: rotate(68deg); background: linear-gradient(90deg, transparent, var(--teal), var(--blue), transparent); }
.ribbon-a { transform: rotate(-21deg); }

.room {
  height: 100vh;
  position: sticky;
  top: 0;
  display: grid;
  overflow: hidden;
  padding: clamp(70px, 9vw, 120px);
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(122,167,199,.12), transparent 28%), var(--ink);
  opacity: .25;
  transition: opacity .5s ease, background-color .5s ease;
}

.room.active { opacity: 1; }
.room h1, .room h2 { font-family: var(--title); font-size: clamp(3.4rem, 8vw, 8.5rem); line-height: .82; margin: 0; letter-spacing: -.055em; color: var(--bone); }
.room p { font-size: clamp(1.05rem, 1.55vw, 1.35rem); line-height: 1.45; margin: 18px 0 0; max-width: 570px; }
.serial { font-family: var(--mono); color: var(--brass); font-size: .74rem !important; letter-spacing: .18em; text-transform: uppercase; }

.ledger-flap, .chapter-copy, .notary-card, .glass-plate {
  align-self: center;
  position: relative;
  z-index: 5;
  width: min(650px, 70vw);
  padding: 34px;
  background: linear-gradient(135deg, rgba(232,221,195,.94), rgba(232,221,195,.72));
  color: var(--ink);
  border: 1px solid var(--brass);
  box-shadow: 18px 22px 0 rgba(67,48,95,.55), 0 30px 80px rgba(0,0,0,.4);
  transform-origin: left top;
}

.ledger-flap { transform: rotate(-3deg); }
.chapter-copy.right { justify-self: end; transform: rotate(2deg); }
.chapter-copy h2, .notary-card h2 { color: var(--ink); }

.drawer-label {
  position: absolute;
  z-index: 8;
  right: 8vw;
  bottom: 12vh;
  width: 250px;
  padding: 18px;
  font-family: var(--slab);
  background: #E8DDC3;
  color: #111018;
  border-left: 10px solid #A7833D;
  transition: transform .3s ease;
}
.drawer-label:hover { transform: rotate(-4deg) translateY(-12px); }
.drawer-label b { display: block; color: #C7372F; font-size: .82rem; margin-top: 8px; }

.promise-thread { position: absolute; z-index: 4; width: 62vw; height: 62vh; right: -8vw; top: 14vh; border: 3px solid transparent; border-top-color: var(--vermilion); border-right-color: var(--brass); border-radius: 50%; transform: rotate(-25deg); animation: threadTighten 5s ease-in-out infinite; }
.wax-seal { position: absolute; z-index: 7; right: 25vw; top: 36vh; width: 150px; height: 150px; }
.wax-seal span, .seal-halves span { position: absolute; width: 82px; height: 118px; background: radial-gradient(circle at 35% 30%, #ef6c59, var(--vermilion) 55%, #641c22); }
.wax-seal span:first-child { left: 0; border-radius: 60% 36% 42% 58%; animation: sealSplitA 4s ease-in-out infinite; }
.wax-seal span:last-child { right: 0; border-radius: 36% 60% 58% 42%; animation: sealSplitB 4s ease-in-out infinite; }

.room-cabinet { background-color: #17131f; }
.cabinet-shelves { position: absolute; inset: 16vh auto auto 8vw; z-index: 5; width: 430px; transform: rotate(-2deg); }
.drawer { margin: 14px 0; padding: 22px 26px; background: linear-gradient(90deg, #E8DDC3, #cbb98e); color: #111018; border: 2px solid #A7833D; box-shadow: 9px 12px 0 rgba(17,16,24,.5); font-family: var(--slab); transition: transform .35s ease; }
.drawer:hover { transform: translateX(36px); }
.drawer span { display: block; font-weight: 800; }
.drawer em { color: #43305F; font-style: normal; font-size: .82rem; }
.glass-plate { justify-self: end; background: rgba(122,167,199,.22); color: #E8DDC3; backdrop-filter: blur(6px); border-color: #7AA7C7; box-shadow: 18px 22px 0 rgba(46,140,130,.25); }
.handshake-blot { width: 320px; height: 180px; margin: auto; background: radial-gradient(ellipse at 35% 50%, #111018 0 22%, transparent 23%), radial-gradient(ellipse at 65% 50%, #111018 0 22%, transparent 23%), radial-gradient(ellipse at 50% 52%, #C7372F 0 14%, transparent 15%); filter: blur(1px); opacity: .82; }

.receipt-strip { position: absolute; z-index: 7; top: 8vh; left: 14vw; width: 230px; background: repeating-linear-gradient(#E8DDC3 0 34px, #d7c8a9 35px 36px); color: #111018; padding: 26px 20px 120px; box-shadow: 0 20px 40px rgba(0,0,0,.45); transform-origin: top; animation: uncurl 5s ease-in-out infinite; }
.receipt-strip span { display: block; padding: 12px 0; font-family: var(--mono); font-size: .75rem; border-bottom: 1px dashed rgba(17,16,24,.3); }
.receipt-moth { position: absolute; z-index: 8; width: 92px; height: 58px; background: linear-gradient(90deg, transparent 0 45%, #A7833D 46% 54%, transparent 55%), radial-gradient(ellipse at 28% 50%, rgba(232,221,195,.86), transparent 65%), radial-gradient(ellipse at 72% 50%, rgba(232,221,195,.86), transparent 65%); animation: mothFloat 6s ease-in-out infinite; }
.receipt-moth i { position: absolute; left: 44px; top: 12px; height: 34px; border-left: 2px solid #43305F; }
.moth-one { right: 28vw; top: 32vh; }
.moth-two { right: 13vw; bottom: 18vh; animation-delay: -2s; }
.pneumatic-tube { position: absolute; right: -8vw; top: 18vh; width: 58vw; height: 78px; border: 2px solid #7AA7C7; border-radius: 999px; background: linear-gradient(90deg, transparent, rgba(122,167,199,.28), transparent); transform: rotate(-15deg); }

.clearing-bell { position: absolute; left: 14vw; top: 18vh; width: 260px; height: 260px; border-radius: 48% 48% 18% 18%; background: radial-gradient(circle at 42% 26%, #E8DDC3, #A7833D 35%, #5c3e1f 75%); box-shadow: 0 30px 80px rgba(167,131,61,.32); animation: bellRing 3.5s ease-in-out infinite; }
.clearing-bell span { position: absolute; left: 50%; bottom: -34px; width: 58px; height: 58px; transform: translateX(-50%); border-radius: 50%; background: #C7372F; }
.balance-scale { position: absolute; z-index: 6; left: 19vw; bottom: 16vh; width: 420px; height: 240px; }
.beam { position: absolute; top: 46px; left: 40px; width: 330px; height: 8px; background: #A7833D; transform-origin: center; animation: scaleTip 4s ease-in-out infinite; }
.beam:before { content: ""; position: absolute; left: 50%; top: 0; width: 8px; height: 160px; background: #A7833D; }
.pan { position: absolute; top: 70px; width: 112px; height: 32px; border-radius: 50%; border: 3px solid #A7833D; background: rgba(232,221,195,.12); }
.left-pan { left: -48px; }
.right-pan { right: -48px; }
.stamp { position: absolute; z-index: 9; left: 42vw; top: 58vh; padding: 18px 25px; border: 6px solid #C7372F; color: #C7372F; font: 800 2rem var(--slab); transform: rotate(-16deg); animation: stampPress 4s cubic-bezier(.2,.8,.2,1) infinite; }

.aquarium { position: absolute; z-index: 5; right: 12vw; top: 13vh; width: 360px; height: 560px; border: 5px solid #7AA7C7; border-radius: 46% 46% 18px 18px; overflow: hidden; background: rgba(122,167,199,.08); box-shadow: inset 0 0 60px rgba(122,167,199,.25), 0 0 90px rgba(46,140,130,.33); }
.water { position: absolute; left: 0; right: 0; bottom: 0; height: var(--water, 62%); background: linear-gradient(180deg, rgba(46,140,130,.28), rgba(46,140,130,.82)); transition: height .6s ease; }
.pearl { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; border-radius: 50%; transform: translate(-50%,-50%); background: radial-gradient(circle at 32% 28%, #E8DDC3, #7AA7C7 72%); animation: pearlFloat 4s ease-in-out infinite; }
.jar-lines { position: absolute; inset: 18px; border: 1px dashed rgba(232,221,195,.32); border-radius: inherit; }
.pawn-ticket { position: absolute; left: 13vw; bottom: 18vh; z-index: 8; padding: 25px 32px; background: #E8DDC3; color: #111018; font-family: var(--slab); transform: rotate(7deg); border: 2px dashed #C7372F; }
.pawn-ticket b { color: #2E8C82; }
.abacus { position: absolute; left: 18vw; top: 22vh; width: 360px; height: 80px; border-top: 5px solid #A7833D; border-bottom: 5px solid #A7833D; }
.abacus span { display: inline-block; width: 36px; height: 36px; margin: 17px 13px; border-radius: 50%; background: #C7372F; animation: beadSlide 5s ease-in-out infinite; }
.abacus span:nth-child(2n) { background: #7AA7C7; animation-delay: -.8s; }

.room-balance { place-items: center; }
.notary-card { text-align: center; transform: rotate(.8deg); }
.afterimage { position: absolute; inset: 14vh 12vw; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(122,167,199,.25), rgba(46,140,130,.14) 28%, transparent 65%); filter: blur(8px); animation: afterPulse 5s ease-in-out infinite; }
.seal-halves { position: absolute; width: 280px; height: 150px; bottom: 13vh; left: 12vw; }
.seal-halves span:first-child { left: 34px; transform: rotate(-19deg); border-radius: 62% 34% 48% 54%; }
.seal-halves span:last-child { right: 34px; transform: rotate(22deg); border-radius: 34% 62% 54% 48%; }
.restart { position: absolute; right: 10vw; bottom: 10vh; }

@keyframes ledgerBreath { 50% { transform: translateY(-10px) rotateX(2deg); } }
@keyframes threadTighten { 50% { transform: rotate(-17deg) scale(.92); filter: drop-shadow(0 0 18px #C7372F); } }
@keyframes sealSplitA { 50% { transform: translateX(-15px) rotate(-8deg); } }
@keyframes sealSplitB { 50% { transform: translateX(15px) rotate(8deg); } }
@keyframes uncurl { 0%,100% { transform: rotate(3deg) scaleY(.76); } 50% { transform: rotate(-2deg) scaleY(1); } }
@keyframes mothFloat { 50% { transform: translate(26px,-22px) rotate(11deg); } }
@keyframes bellRing { 8%, 18% { transform: rotate(-5deg); } 13%, 23% { transform: rotate(5deg); } 30%,100% { transform: rotate(0); } }
@keyframes scaleTip { 50% { transform: rotate(7deg); } }
@keyframes stampPress { 0%,70%,100% { transform: translateY(-24px) rotate(-16deg); opacity: .75; } 78%,86% { transform: translateY(0) rotate(-16deg); opacity: 1; } }
@keyframes pearlFloat { 50% { transform: translate(-50%,-72%) scale(1.08); } }
@keyframes beadSlide { 50% { transform: translateX(34px); } }
@keyframes afterPulse { 50% { opacity: .55; transform: scale(.92); } }

@media (max-width: 760px) {
  .room-tags { top: auto; bottom: 14px; max-width: 94vw; overflow: auto; }
  .room { padding: 82px 24px; }
  .ledger-flap, .chapter-copy, .notary-card, .glass-plate { width: 100%; padding: 24px; }
  .cabinet-shelves, .clearing-bell, .balance-scale, .abacus { opacity: .45; left: 4vw; transform: scale(.72); transform-origin: left top; }
  .aquarium { right: -70px; opacity: .62; transform: scale(.75); transform-origin: top right; }
  .room h1, .room h2 { font-size: clamp(3rem, 16vw, 5.8rem); }
}
