:root {
  --bg: #0e0d0c;
  --surface: #181614;
  --surface-2: #221f1c;
  --line: #34302b;
  --text: #ece6dc;
  --muted: #a39a8c;
  --accent: #c9a24a;
  --accent-ink: #1a1408;
  --danger: #a33a2a;
  --radius: 10px;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }

/* ---------- site header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
  background: rgba(14, 13, 12, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.12em;
  font-size: 1.2rem; color: var(--text); text-decoration: none;
}
.nav { display: flex; gap: 18px; font-size: 0.95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  font: 600 0.95rem var(--body); text-decoration: none; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn[disabled], .btn.disabled { opacity: .4; pointer-events: none; }

/* ---------- homepage ---------- */
.hero {
  position: relative; min-height: min(78vh, 680px);
  display: flex; align-items: flex-end;
  background: #000 url("img/hero.jpg") center 30% / cover no-repeat;
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14,13,12,.15) 0%, rgba(14,13,12,.35) 45%, rgba(14,13,12,.97) 100%);
}
.hero-inner {
  position: relative; z-index: 1; width: 100%; max-width: 1100px; margin: 0 auto;
  padding: 0 20px 56px;
}
.eyebrow { text-transform: uppercase; letter-spacing: .2em; font-size: .8rem; font-weight: 600; color: #e2bf6a; margin: 0 0 10px; text-shadow: 0 1px 8px rgba(0,0,0,.95), 0 0 2px rgba(0,0,0,.9); }
.hero h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.8rem, 9vw, 6rem); line-height: 1; letter-spacing: .08em;
  margin: 0 0 16px; text-shadow: 0 2px 24px rgba(0,0,0,.7);
}
.hero p.tagline { max-width: 560px; font-size: 1.1rem; color: #d8d1c5; margin: 0 0 26px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }

main.wrap, .wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
section { padding: 56px 0; }
section + section { border-top: 1px solid var(--line); }
h2.section-title { font-family: var(--display); font-size: 1.6rem; letter-spacing: .06em; margin: 0 0 24px; }

.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; }
.about p { color: #d6cfc3; margin: 0 0 14px; }
.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.facts dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.chapter-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .15s, border-color .15s;
}
.chapter-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.chapter-card .thumb { aspect-ratio: 2 / 3; overflow: hidden; background: #000; }
.chapter-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.chapter-card .meta { padding: 14px 16px 16px; }
.chapter-card h3 { font-family: var(--display); font-size: 1.15rem; margin: 0 0 2px; letter-spacing: .04em; }
.chapter-card .sub { color: var(--muted); font-size: .88rem; }
.chapter-card .badge {
  display: inline-block; margin-top: 8px; font-size: .75rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
}

.continue {
  display: none; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 28px;
}
.continue.show { display: flex; }
.continue span { color: var(--muted); }
.continue strong { color: var(--text); }

.site-footer { border-top: 1px solid var(--line); padding: 28px 20px; text-align: center; color: var(--muted); font-size: .88rem; }

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; gap: 24px; }
  section { padding: 40px 0; }
  .hero-inner { padding-bottom: 36px; }
  .nav { gap: 14px; }
}

/* ---------- reader ---------- */
body.reader { background: #050505; }
.reader-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: rgba(14,13,12,.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: transform .25s;
}
.reader-bar.hidden { transform: translateY(-100%); }
.reader-bar .brand { font-size: 1rem; margin-right: 6px; }
.reader-bar .spacer { flex: 1; }
.reader-bar select, .reader-bar button {
  font: 500 .9rem var(--body); color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; cursor: pointer;
}
.reader-bar button:hover, .reader-bar select:hover { border-color: var(--muted); }
.reader-bar button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.seg { display: inline-flex; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }

.progress { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.08); z-index: 30; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* single page mode */
.stage { position: relative; display: flex; justify-content: center; padding: 16px 12px 70px; user-select: none; }
.stage img.page {
  max-height: calc(100vh - 140px); width: auto; max-width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,.6); background: #111;
}
.stage.fit-width img.page { max-height: none; width: min(100%, 900px); }
.stage .zone { position: absolute; top: 0; bottom: 0; width: 35%; cursor: pointer; z-index: 2; }
.stage .zone.prev { left: 0; cursor: w-resize; }
.stage .zone.next { right: 0; cursor: e-resize; }
.page-nav {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 25;
  display: flex; align-items: center; gap: 10px;
  background: rgba(14,13,12,.92); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px;
  transition: opacity .25s;
}
.page-nav.hidden { opacity: 0; pointer-events: none; }
.page-nav button {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 1.1rem; cursor: pointer;
}
.page-nav button:disabled { opacity: .35; cursor: default; }
.page-nav .count { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); min-width: 64px; text-align: center; }

/* scroll mode */
.strip { display: none; flex-direction: column; align-items: center; gap: 10px; padding: 16px 12px 40px; }
.strip img { width: min(100%, 900px); height: auto; background: #111; aspect-ratio: 1696 / 2528; }
.strip img.loaded { aspect-ratio: auto; }
body.mode-scroll .strip { display: flex; }
body.mode-scroll .stage, body.mode-scroll .page-nav { display: none; }

.chapter-end {
  display: none; max-width: 640px; margin: 0 auto 80px; padding: 28px 22px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.chapter-end.show { display: block; }
.chapter-end h2 { font-family: var(--display); margin: 0 0 6px; letter-spacing: .05em; }
.chapter-end p { color: var(--muted); margin: 0 0 18px; }
.chapter-end .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.hint { color: var(--muted); font-size: .8rem; }
@media (max-width: 760px) {
  .reader-bar { padding: 8px 10px; gap: 8px; }
  .reader-bar .hide-sm { display: none; }
  .stage { padding: 8px 0 70px; }
  .stage img.page { max-height: none; width: 100%; }
}
