:root {
  --bg: #07090c;
  --ink: #2b1d0e;
  --paper: #e9dcb8;
  --paper-dark: #cdb98a;
  --leather: #4a2a14;
  --leather-dark: #2c170a;
  --white-eye: #f4fbff;
  --cyan: #3fd0d4;
  --grass: #5d9b2f;
  --stone: #8b8b8b;
  --text: #e6e6e6;
  --muted: #9aa3ad;
  --pixel: "Press Start 2P", monospace;
  --vt: "VT323", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--vt);
  font-size: 22px;
  line-height: 1.3;
  overflow-x: hidden;
  -webkit-font-smoothing: none;
}
img { image-rendering: auto; display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ---------- Minecraft buttons ---------- */
.mc-btn {
  --b: #727272;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--pixel); font-size: 13px; color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
  padding: 16px 26px;
  background: linear-gradient(#8f8f8f, #6f6f6f);
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 #b5b5b5, inset -3px -3px 0 #4a4a4a;
  cursor: pointer; user-select: none;
  transition: transform .08s;
}
.mc-btn:hover { background: linear-gradient(#8a97c9, #6b78ad); box-shadow: inset 3px 3px 0 #b8c3ef, inset -3px -3px 0 #3f4a7a; color: #ffffa0; }
.mc-btn:active { transform: translateY(2px); }
.mc-btn--dark { background: linear-gradient(#2d2d2d, #1b1b1b); box-shadow: inset 3px 3px 0 #4a4a4a, inset -3px -3px 0 #0d0d0d; }
.mc-btn--sm { font-size: 10px; padding: 11px 16px; }
.mc-btn--icon { width: 56px; height: 56px; padding: 0; font-size: 16px; }
.mc-btn[disabled] { opacity: .4; pointer-events: none; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 32px;
  background: linear-gradient(rgba(5,7,10,.85), rgba(5,7,10,0));
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--pixel); font-size: 14px; }
.brand img { width: 34px; height: 34px; image-rendering: pixelated; border: 2px solid #000; }
.nav nav { display: flex; gap: 28px; font-family: var(--pixel); font-size: 10px; }
.nav nav a { color: var(--muted); }
.nav nav a:hover { color: #fff; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: end center; text-align: center;
  overflow: hidden; padding: 120px 16px 110px;
}
.hero__bg {
  position: absolute; inset: -2% -2% 26% -2%;
  background-size: cover; background-position: center 45%;
  filter: saturate(.85);
  animation: drift 30s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: scale(1.08) translateX(-1.5%); } }
.hero__fog {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(7,9,12,0) 0, rgba(7,9,12,.55) 65%),
    linear-gradient(transparent 40%, rgba(7,9,12,.9) 70%, var(--bg) 76%);
}

.hero__content { position: relative; z-index: 2; max-width: 900px; }
.title {
  font-family: var(--pixel);
  font-size: clamp(28px, 7.4vw, 92px);
  letter-spacing: 2px;
  color: #c6c6c6;
  text-shadow:
    0 4px 0 #6b6b6b, 0 8px 0 #3d3d3d, 0 12px 0 #1e1e1e,
    0 0 50px rgba(255,255,255,.25);
  position: relative;
}
.splash {
  position: absolute; right: -30px; top: 12px; z-index: 3;
  font-family: var(--pixel); font-size: 14px; color: #ffff55;
  text-shadow: 2px 2px 0 #3f3f15;
  transform: rotate(-18deg);
  animation: splash .55s ease-in-out infinite alternate;
  white-space: nowrap;
}
@keyframes splash { to { transform: rotate(-18deg) scale(1.08); } }
.tagline { margin: 26px auto 28px; font-size: clamp(22px, 3vw, 30px); color: #d9e2ea; text-shadow: 2px 2px 0 #000; }
.hero__cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.ca {
  margin: 32px auto 0; display: inline-flex; align-items: stretch;
  border: 3px solid #000; background: rgba(0,0,0,.7); max-width: 100%;
}
.ca__label { font-family: var(--pixel); font-size: 10px; padding: 12px; background: #373737; display: grid; place-items: center; }
.ca code { font-family: var(--vt); font-size: 22px; padding: 8px 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--white-eye); }
.ca__copy { font-family: var(--pixel); font-size: 10px; border: 0; border-left: 3px solid #000; background: var(--grass); color: #fff; padding: 0 14px; cursor: pointer; }
.ca__copy:hover { filter: brightness(1.15); }

.scroll-hint { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); font-family: var(--pixel); font-size: 10px; color: var(--muted); animation: bob 1.6s ease-in-out infinite; z-index: 2; white-space: nowrap; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- Section heads ---------- */
section { padding: 110px 16px; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.pixel-h { font-family: var(--pixel); font-size: clamp(20px, 3.4vw, 34px); line-height: 1.4; margin-bottom: 16px; text-shadow: 3px 3px 0 #000; }
.section-head p { color: var(--muted); font-size: 24px; }

/* ---------- Book ---------- */
.book-section {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(63,208,212,.08), transparent 60%),
    repeating-linear-gradient(90deg, #1a120b 0 64px, #1e150d 64px 128px),
    #1a120b;
  border-top: 6px solid #000; border-bottom: 6px solid #000;
}
.lectern { max-width: 1240px; margin: 0 auto; }
.book {
  position: relative;
  perspective: 2200px;
  padding: 18px;
  background: linear-gradient(135deg, var(--leather), var(--leather-dark));
  border: 4px solid #000;
  box-shadow: inset 0 0 0 4px #6b3d1c, 0 30px 70px rgba(0,0,0,.7);
}
.spread > * { min-width: 0; }
.spread {
  display: grid; grid-template-columns: 1fr 1fr;
  min-height: 600px;
  background: var(--paper);
  transform-origin: left center;
}
.spread.is-turning-next { animation: turnNext .55s ease-in both; }
.spread.is-turning-prev { animation: turnPrev .55s ease-in both; }
.spread.is-entering { animation: enter .45s ease-out both; }
@keyframes turnNext { to { transform: rotateY(-14deg) translateX(-30px); opacity: 0; } }
@keyframes turnPrev { to { transform: rotateY(14deg) translateX(30px); opacity: 0; } }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.page {
  position: relative; padding: 42px 44px;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(120,85,35,.28)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .15 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--paper);
  color: var(--ink);
}
.page--left { box-shadow: inset -26px 0 30px -18px rgba(60,35,10,.55); display: flex; flex-direction: column; justify-content: center; }
.page--right { box-shadow: inset 26px 0 30px -18px rgba(60,35,10,.55); display: flex; flex-direction: column; }

.plate {
  border: 4px solid var(--ink);
  outline: 2px solid var(--ink); outline-offset: 5px;
  background: #000;
  margin: 8px;
}
.plate img { width: 100%; aspect-ratio: 16/10; object-fit: cover; filter: sepia(.12) contrast(1.05); }
.caption { margin-top: 22px; text-align: center; font-size: 20px; font-style: italic; color: #5b4423; }

.chapter { font-family: var(--pixel); font-size: 11px; color: #8a1d1d; letter-spacing: 1px; }
.page h3 { font-family: var(--pixel); font-size: clamp(16px, 1.7vw, 22px); line-height: 1.5; margin: 14px 0 22px; color: var(--ink); }
.page p { font-size: 24px; line-height: 1.25; margin-bottom: 16px; }
.page--right p:first-of-type::first-letter {
  float: left; font-family: var(--pixel); font-size: 44px; line-height: 1;
  padding: 8px 10px 4px; margin: 4px 10px 0 0;
  background: var(--ink); color: var(--paper);
}
.page__num { margin-top: auto; padding-top: 16px; text-align: right; font-family: var(--pixel); font-size: 10px; color: #7a6136; }

.book__controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 30px; }
.book__dots { display: flex; gap: 10px; }
.book__dots button { width: 16px; height: 16px; border: 3px solid #000; background: #5a5a5a; cursor: pointer; padding: 0; }
.book__dots button[aria-current="true"] { background: var(--white-eye); box-shadow: 0 0 12px rgba(255,255,255,.8); }
.book__hint { text-align: center; color: #7d6a55; margin-top: 14px; font-size: 18px; }

/* ---------- Token ---------- */
.token { background: linear-gradient(#0c1015, var(--bg)); }
.inv {
  max-width: 900px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 14px; background: #c6c6c6; border: 4px solid #000;
  box-shadow: inset 4px 4px 0 #fff, inset -4px -4px 0 #555;
}
.slot {
  background: #8b8b8b; padding: 22px 16px; text-align: center;
  box-shadow: inset 3px 3px 0 #373737, inset -3px -3px 0 #fff;
  display: flex; flex-direction: column; gap: 10px;
}
.slot__k { font-family: var(--pixel); font-size: 10px; color: #3f3f3f; }
.slot__v { font-family: var(--pixel); font-size: 14px; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; word-break: break-word; }

/* ---------- How ---------- */
.how {
  background:
    linear-gradient(rgba(7,9,12,.88), rgba(7,9,12,.95)),
    url(assets/ch5-watching.jpg) center/cover fixed;
}
.steps { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.step {
  background: rgba(20,20,20,.85); border: 3px solid #000; padding: 26px 22px;
  box-shadow: inset 3px 3px 0 #3a3a3a, inset -3px -3px 0 #0a0a0a;
}
.step__n { width: 44px; height: 44px; display: grid; place-items: center; font-family: var(--pixel); font-size: 16px; background: var(--grass); border: 3px solid #000; box-shadow: inset 3px 3px 0 #86c25a, inset -3px -3px 0 #3c6a1c; margin-bottom: 18px; }
.step h3 { font-family: var(--pixel); font-size: 12px; margin-bottom: 12px; line-height: 1.5; }
.step p { color: var(--muted); }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 80px 16px 50px; border-top: 6px solid #000; background: #050608; }
.footer__head { width: 72px; height: 72px; margin: 0 auto 20px; image-rendering: pixelated; border: 3px solid #000; box-shadow: 0 0 40px rgba(255,255,255,.15); }
.footer__line { font-size: 24px; color: var(--muted); margin-bottom: 26px; }
.footer__links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.footer__fine { font-size: 16px; color: #5c636b; max-width: 640px; margin: 0 auto; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .spread { grid-template-columns: 1fr; min-height: 0; }
  .page--left { box-shadow: inset 0 -20px 26px -18px rgba(60,35,10,.5); padding-bottom: 24px; }
  .page--right { box-shadow: none; }
  .steps { grid-template-columns: 1fr 1fr; }
  .nav nav { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 20px; }
  .nav { padding: 12px 16px; }
  .brand span { display: none; }
  .book { padding: 8px; }
  .page { padding: 24px 18px; }
  .page p { font-size: 21px; }
  .inv { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; }
  .splash { right: 0; top: -30px; font-size: 9px; }
  .hero__bg { inset: -2% -2% 38% -2%; }
  .nav .mc-btn--sm { font-size: 9px; padding: 10px 12px; }
  .mc-btn { font-size: 11px; padding: 14px 18px; }
  .how { background-attachment: scroll; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
