:root {
  --bg: #fdfdfb;
  --ink: #1c1c1a;
  --muted: #75756f;
  --faint: #6b6b66;
  --rule: #e4e4de;
  --plank: #f0f0ea;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); transition: background-color .7s ease; }
a { color: var(--ink); text-decoration: none; }
a:hover, [role="button"]:hover { color: #9a9a94; }
.mono { font-family: 'DM Mono', ui-monospace, monospace; letter-spacing: 0; }
.muted { color: var(--muted); }

.root {
  position: relative; min-height: 100vh; overflow: hidden;
  background-color: var(--tint, var(--bg)); color: var(--ink);
  transition: background-color .7s ease;
  font-family: 'Bricolage Grotesque', Helvetica, sans-serif;
  font-size: clamp(17px, 1.5vw, 26px); line-height: 1.08; letter-spacing: -0.01em;
}
.root.custom-cursor, .root.custom-cursor * { cursor: none !important; }

.page {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 24px; min-height: 100vh; padding: 12px 14px;
  transition: transform .7s cubic-bezier(.7,0,.2,1), opacity .5s ease;
}
.col-index { display: flex; flex-direction: column; gap: 1.6em; }
.nav { display: flex; flex-direction: column; align-items: flex-start; }
.nav a { cursor: pointer; }
.foot { margin-top: auto; }
.list-row {
  display: grid; grid-template-columns: 2.4em minmax(0,1fr); padding-left: .9em; cursor: pointer;
  transition: color .15s ease, transform .3s cubic-bezier(.3,1.5,.5,1);
}
.list-row .mono { font-size: .92em; }
.list-row.dim { color: var(--muted); }
.list-row.on { transform: translateX(.5em); }

.col-shelf { display: flex; flex-direction: column; min-width: 0; }
.shelf-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.tagline { max-width: 20em; text-wrap: balance; }
.clock { font-size: .92em; white-space: nowrap; }
.preview { margin-top: clamp(1em, 5vh, 3em); min-height: 6.6em; }
.kicker { font-size: 12px; color: var(--faint); text-transform: uppercase; }
.pv-title { font-size: 2.5em; font-weight: 500; letter-spacing: -0.035em; line-height: 1; margin-top: .15em; text-wrap: balance; }
.pv-sub { margin-top: .35em; max-width: 26em; text-wrap: pretty; }

/* ---------- 3D stage ---------- */
.stage {
  position: relative; flex: 1; min-height: 380px;
  perspective: 1400px; perspective-origin: 50% -10%;
}
.world { position: absolute; inset: 0; transform-style: preserve-3d; }
#books { position: absolute; inset: 0; transform-style: preserve-3d; }
.caption { position: absolute; left: 0; bottom: 8px; font-size: 11px; color: var(--faint); }

.plank { position: absolute; left: 0; right: 0; bottom: 70px; height: 0; transform-style: preserve-3d; }
.plank-top {
  position: absolute; left: 0; right: 0; top: 0;
  transform-origin: 50% 0;
  background: linear-gradient(to bottom, rgba(28,28,26,.08), rgba(28,28,26,.03) 70%, rgba(255,255,255,.25));
}
.plank-front { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ink); }

.bk {
  position: absolute; left: 0; bottom: 70px; transform-style: preserve-3d;
  transform-origin: 50% 100%; cursor: pointer;
  transition: transform .45s cubic-bezier(.3,1.4,.5,1);
}
.bk.pulled { transition: transform .45s cubic-bezier(.3,1.2,.5,1); }
.bk.live { transition: none; }
.bk-face { position: absolute; }
.bk-front { backface-visibility: hidden; }
.bk-front {
  inset: 0; border-radius: 3px 3px 0 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 8px 0 10px;
  box-shadow: inset -3px 0 0 rgba(0,0,0,.06), inset 3px 0 0 rgba(255,255,255,.18);
}
.bk-front .mono { font-size: 10px; }
.bk-front .spine { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-weight: 500; line-height: 1; }
.bk-top { left: 0; top: 0; transform-origin: 50% 0; transform: rotateX(-90deg); }
.bk-side { top: 0; transform-origin: 0 50%; }
.bk-side.l { left: 0; transform: rotateY(90deg); }
.bk-side.r { transform: rotateY(90deg); }

.kid { position: absolute; left: 0; bottom: 70px; transform-style: preserve-3d; will-change: transform; z-index: 2; }
.kid-canvas { position: absolute; pointer-events: none; }
.kid-shadow {
  position: absolute; left: 50%; bottom: 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(28,28,26,.28), rgba(28,28,26,0));
  transform-origin: 50% 100%;
}
.kid-hit { position: absolute; left: 0; bottom: 0; }
.bubble {
  position: absolute; left: 62%; bottom: 98%;
  background: var(--ink); color: var(--bg); font-size: 12px; line-height: 1.2;
  padding: 7px 10px; border-radius: 12px 12px 12px 2px; white-space: nowrap; pointer-events: none;
  opacity: 0; transform: scale(.6); transform-origin: 0 100%;
  transition: opacity .15s ease, transform .25s cubic-bezier(.3,1.6,.5,1);
}
.bubble.on { opacity: 1; transform: scale(1); }

/* ---------- open book ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0; transition: opacity .3s ease .35s; }
.overlay.open { pointer-events: auto; opacity: 1; transition-delay: 0s; }
.book {
  position: absolute; left: 50%; top: 50%;
  width: min(1240px, 94vw); height: min(760px, 86vh);
  margin-left: calc(min(1240px, 94vw) / -2); margin-top: calc(min(760px, 86vh) / -2);
  perspective: 2600px; transform: scale(.04);
  transition: transform .7s cubic-bezier(.7,0,.2,1);
}
.page-right {
  position: absolute; right: 0; top: 0; width: 50%; height: 100%;
  background: #fff; border: 1px solid var(--rule);
  padding: clamp(16px, 2.6vw, 40px); display: flex; flex-direction: column; gap: clamp(10px, 1.3vw, 18px);
  overflow: auto; box-shadow: 0 30px 80px rgba(28,28,26,.16);
}
.shot {
  flex: 1; min-height: 110px; background: repeating-linear-gradient(135deg, #f3f3ee 0 10px, #e9e9e3 10px 20px);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; font-size: 11px; color: var(--faint);
}
.stat { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1em .5em; }
.stat-n { font-size: clamp(34px, 5vw, 84px); font-weight: 600; letter-spacing: -0.045em; line-height: .9; }
.stat-l { color: var(--faint); font-size: clamp(13px, 1.1vw, 17px); }
.small-cap { font-size: 11px; color: var(--faint); text-transform: uppercase; }
.points { display: flex; flex-direction: column; gap: .5em; }
.point {
  display: grid; grid-template-columns: 2em minmax(0,1fr); font-size: clamp(13px, 1.1vw, 17px); line-height: 1.25; letter-spacing: 0;
  border-top: 1px solid var(--rule); padding-top: .5em;
}
.point .mono { font-size: .8em; color: var(--faint); padding-top: .15em; }
.book-nav { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; font-size: 12px; }
.book-nav span { cursor: pointer; padding: 6px 0; }
.leaf {
  position: absolute; left: 50%; top: 0; width: 50%; height: 100%;
  transform-origin: 0 50%; transform-style: preserve-3d;
  transition: transform .75s cubic-bezier(.6,0,.2,1);
}
.leaf-front, .leaf-back {
  position: absolute; inset: 0; backface-visibility: hidden;
  padding: clamp(16px, 2.6vw, 40px); display: flex; flex-direction: column;
}
.leaf-front { justify-content: space-between; box-shadow: 0 30px 80px rgba(28,28,26,.16); }
.leaf-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.cover-title { font-size: clamp(34px, 5.4vw, 92px); font-weight: 600; line-height: .92; letter-spacing: -0.045em; text-wrap: balance; }
.cover-sub { margin-top: .7em; font-size: clamp(14px, 1.25vw, 20px); }
.leaf-back { transform: rotateY(180deg); background: #fff; border: 1px solid var(--rule); gap: clamp(10px, 1.4vw, 20px); overflow: auto; }
.back-title { font-size: clamp(26px, 3.6vw, 58px); font-weight: 500; line-height: .98; letter-spacing: -0.035em; text-wrap: balance; }
.back-blurb { font-size: clamp(14px, 1.25vw, 19px); line-height: 1.28; letter-spacing: 0; text-wrap: pretty; }
.rows { margin-top: auto; display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: 5.5em minmax(0,1fr); gap: 10px; border-top: 1px solid var(--rule);
  padding: .5em 0; font-size: clamp(13px, 1.05vw, 16px); line-height: 1.25; letter-spacing: 0;
}
.row .mono { font-size: .8em; color: var(--faint); text-transform: uppercase; padding-top: .15em; }

/* ---------- cursor ---------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 99; pointer-events: none; opacity: 0;
  display: flex; align-items: center; gap: 6px; mix-blend-mode: difference; will-change: transform;
}
.cursor-dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; margin: -6px 0 0 -6px; transition: transform .2s ease; }
.cursor-label {
  font-size: 11px; line-height: 1; background: #fff; color: #000; padding: 6px 9px; border-radius: 99px; white-space: nowrap;
  opacity: 0; transform: scale(.5); transform-origin: 0 50%;
  transition: opacity .15s ease, transform .2s cubic-bezier(.3,1.5,.5,1);
}
.cursor.has-label .cursor-dot { transform: scale(.6); }
.cursor.has-label .cursor-label { opacity: 1; transform: scale(1); }

@media (hover: none) { .cursor { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .page, .bk, .book, .leaf, .overlay { transition-duration: .01s !important; }
}
