/* =====================================================================
   Human Idiot — the page is the room. Only the 3D scene and the reader
   controls live here; headings and copy can be layered on later.
   ===================================================================== */

:root {
  --room: #1a100b;
  --cream: #f1e6d6;
  --cream-dim: rgba(241, 230, 214, 0.6);
  --line: rgba(241, 230, 214, 0.22);
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--room);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* ---------- the room ---------- */
.stage { position: fixed; inset: 0; background: var(--room); }
#bookCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: grab;
  outline: none;
  touch-action: none;
}
#bookCanvas.is-grabbing { cursor: grabbing; }
#bookCanvas.is-opening  { cursor: default; }
#bookCanvas:focus-visible { box-shadow: inset 0 0 0 2px var(--cream-dim); }
.vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
  transition: opacity 0.9s;
}
/* while reading, the spread fills the frame: a screen vignette darkens the page edges and reads as a hotspot of glare in the middle */
body.is-reading .vignette { opacity: 0; }
.fallback-cover {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(70%, 440px);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}
.stage-hint {
  position: absolute; bottom: 18px; left: 22px; z-index: 2;
  margin: 0; text-align: left;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cream-dim);
  transition: opacity 0.4s;
  pointer-events: none;
}
.stage.is-quiet .stage-hint { opacity: 0; }
.stage-hint { animation: hintFade 1.2s ease 9s forwards; }        /* the caption leaves once you've had a look */
@keyframes hintFade { to { opacity: 0; } }

/* ---------- reader controls ---------- */
.reader-ui {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px 18px;
  font-size: 13px;
  color: var(--cream);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.reader-ui.is-in { opacity: 1; transform: none; }
.reader-nav { display: flex; align-items: center; gap: 6px; }
.page-label { min-width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
.reader-tools { display: flex; align-items: center; gap: 6px; }
.kbd-hint { color: var(--cream-dim); font-size: 12px; margin-right: 10px; }
kbd {
  font: inherit; font-size: 11px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px;
  padding: 1px 6px;
}
.ui-btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(26, 16, 11, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 3px;
  padding: 7px 12px;
  font-size: 13px; font-weight: 500;
  line-height: 1.2;
  transition: border-color 0.15s, background 0.15s;
}
.ui-btn:hover { border-color: var(--cream); background: rgba(26, 16, 11, 0.8); }
#prevBtn, #nextBtn { font-size: 20px; padding: 2px 12px 5px; }
.ui-btn.is-active { background: var(--cream); color: var(--room); border-color: var(--cream); }
.ui-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- responsive ---------- */
@media (max-width: 900px) { .kbd-hint { display: none; } }
@media (max-width: 520px) {
  .reader-ui { flex-wrap: wrap; justify-content: center; padding: 10px 12px 14px; }
  .ui-btn { padding: 6px 9px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-ui { transition-duration: 0.01s !important; }
}
