:root {
  --cream: #f4f0e9;
  --cream-2: #ebe5da;
  --ink: #2a2826;
  --muted: #7a746c;
  --line: #cfc7ba;
  --dark: #1d1c1b;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Lato", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--dark);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- LOADER ---------- */
.loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--cream);
  padding: 24px;
  transition: opacity .7s ease, visibility .7s ease;
}
.loader.hide { opacity: 0; visibility: hidden; }

.loader-inner { width: min(420px, 100%); text-align: center; }

.loader-kicker {
  font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 22px;
  animation: rise .9s ease both;
}
.loader-title {
  font-family: var(--serif); font-weight: 400; line-height: .95;
  text-transform: uppercase; color: var(--ink);
  animation: rise .9s .15s ease both;
}
.loader-title span { display: block; font-size: clamp(26px, 7vw, 40px); letter-spacing: .02em; }
.loader-title strong { display: block; font-weight: 500; font-size: clamp(54px, 16vw, 86px); }

.loader-sub {
  margin-top: 16px; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  animation: rise .9s .3s ease both;
}

.bar { margin: 34px auto 12px; height: 1px; width: 100%; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--ink); transition: width .3s ease; }

.loader-status { font-size: 12px; color: var(--muted); letter-spacing: .08em; min-height: 18px; }

.enter-btn {
  margin-top: 26px;
  font: 700 12px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  color: var(--cream); background: var(--ink);
  border: 1px solid var(--ink); padding: 16px 30px; cursor: pointer;
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s ease, transform .5s ease, background .25s, color .25s;
}
.enter-btn.ready { opacity: 1; transform: none; }
.enter-btn:hover { background: transparent; color: var(--ink); }
.enter-btn:disabled { cursor: default; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- READER ---------- */
.reader {
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
  background: radial-gradient(circle at 50% 40%, #2c2a28 0%, var(--dark) 70%);
}

.topbar, .bottombar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; color: var(--cream);
}
.topbar { padding-top: max(12px, env(safe-area-inset-top)); }
.bottombar { padding-bottom: max(12px, env(safe-area-inset-bottom)); justify-content: center; gap: 22px; }

.brand { font-family: var(--serif); font-size: 20px; letter-spacing: .04em; text-transform: uppercase; }
.brand b { font-weight: 500; }

.tools { display: flex; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--cream); background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14); cursor: pointer;
  transition: background .2s, border-color .2s;
}
.icon-btn:hover { background: rgba(255,255,255,.14); }
.icon-btn .ico-off { display: none; }
.icon-btn.muted .ico-on { display: none; }
.icon-btn.muted .ico-off { display: block; }
.icon-btn.playing { border-color: var(--cream); }

.stage {
  position: relative; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 76px;
}

.page-wrap {
  height: 100%; width: 100%;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
}
.page {
  max-height: 100%; max-width: 100%;
  height: auto; width: auto;
  aspect-ratio: 1241 / 1754;
  object-fit: contain;
  background: var(--cream);
  box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 4px 14px rgba(0,0,0,.35);
  user-select: none; -webkit-user-drag: none;
  transition: opacity .28s ease, transform .28s ease;
}
.page.out-left  { opacity: 0; transform: translateX(-24px); }
.page.out-right { opacity: 0; transform: translateX(24px); }

.nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink); background: var(--cream);
  border: none; cursor: pointer; z-index: 5;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  transition: transform .2s, opacity .2s, background .2s;
}
.nav svg { width: 24px; height: 24px; stroke-width: 2; }
.nav:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.nav:disabled { opacity: .25; cursor: default; transform: translateY(-50%); }
.prev { left: 14px; }
.next { right: 14px; }

.dots { display: flex; gap: 8px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.25); border: none; cursor: pointer; padding: 0;
  transition: background .2s, width .2s;
}
.dot.active { background: var(--cream); width: 22px; border-radius: 4px; }

.counter { font-size: 13px; letter-spacing: .12em; color: rgba(244,240,233,.75); }

/* ---------- MOBILE ---------- */
@media (max-width: 640px) {
  .brand { font-size: 16px; }
  .topbar, .bottombar { padding-left: 16px; padding-right: 16px; }
  .stage { padding: 6px 12px; }
  .nav {
    width: 44px; height: 44px;
    background: rgba(244,240,233,.88);
  }
  .prev { left: 6px; }
  .next { right: 6px; }
}
