@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f6f8;
  --surface: #fbfcfd;
  --surface-tint: #eaeff4;
  --surface-deep: #141e29;
  --ink-deep: #eef2f5;
  --text: #161d24;
  --text-muted: #495766;
  --border: #d2dbe3;
  --border-strong: #b4c2ce;
  --accent: #9e2430;
  --accent-hover: #811b25;
  --accent-text: #9e2430;
  --accent-soft: rgba(158, 36, 48, 0.08);
  --btn-ink: #fbfcfd;
  --cover-shadow: 0 24px 54px -18px rgba(17, 29, 42, 0.34);
  --scrollbar-thumb: #c3ced8;
  --scrollbar-thumb-hover: #97a6b5;
  --radius: 4px;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-serif: "Literata", Georgia, serif;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-editorial: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d131a;
  --surface: #141d26;
  --surface-tint: #192430;
  --surface-deep: #18232f;
  --ink-deep: #eaf0f4;
  --text: #e6ecf1;
  --text-muted: #98a6b5;
  --border: #243240;
  --border-strong: #36495c;
  --accent: #9e2430;
  --accent-hover: #b62d3b;
  --accent-text: #e26470;
  --accent-soft: rgba(226, 100, 112, 0.12);
  --btn-ink: #fbfcfd;
  --cover-shadow: 0 28px 60px -16px rgba(4, 8, 13, 0.72);
  --scrollbar-thumb: #2b3a4a;
  --scrollbar-thumb-hover: #41556b;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  max-width: 100%;
  overflow-x: clip;
  transition: background-color 0.25s var(--ease-editorial), color 0.25s var(--ease-editorial);
}

.hero-grid > *,
.editions-grid > *,
.story-grid > *,
.chapter-grid > * {
  min-width: 0;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container {
    padding: 0 36px;
  }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.14em;
  line-height: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (min-width: 640px) {
  .site-nav {
    gap: 20px;
  }
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.18s ease;
}

@media (min-width: 640px) {
  .nav-link {
    font-size: 0.92rem;
  }
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
}

.hide-mobile {
  display: none;
}

@media (min-width: 640px) {
  .hide-mobile {
    display: inline-flex;
  }
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: transform 0.16s var(--ease-editorial), border-color 0.18s ease;
}

.theme-btn:hover {
  border-color: var(--border-strong);
}

.theme-btn:active {
  transform: scale(0.97);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  border: 1px solid transparent;
  transition:
    transform 0.16s var(--ease-editorial),
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: var(--btn-ink);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--text);
}

.btn-ghost-dark {
  background: rgba(251, 252, 253, 0.08);
  color: var(--ink-deep);
  border-color: rgba(238, 242, 245, 0.24);
}

.btn-ghost-dark:hover {
  background: rgba(251, 252, 253, 0.16);
  border-color: rgba(238, 242, 245, 0.45);
}

/* Hero */
.hero {
  padding: 28px 0 48px;
}

@media (min-width: 768px) {
  .hero {
    padding: 44px 0 72px;
  }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
}

@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 56px;
  }
}

.hero-cover-wrap {
  display: flex;
  justify-content: center;
}

@media (min-width: 768px) {
  .hero-cover-wrap {
    order: 2;
    justify-content: flex-end;
  }
  .hero-copy {
    order: 1;
  }
}

.cover-frame {
  width: 190px;
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--cover-shadow);
  border: 1px solid var(--border);
  background: #101923;
}

@media (min-width: 768px) {
  .cover-frame {
    width: 100%;
    max-width: 390px;
  }
}

.cover-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 848 / 1264;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-text);
}

.hero-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.1rem, 8.2vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: 0.08em;
  color: var(--text);
}

.hero-lead {
  margin: 0 0 26px;
  max-width: 44ch;
  font-family: var(--font-serif);
  font-size: clamp(1.06rem, 1.8vw, 1.24rem);
  line-height: 1.55;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 520px) {
  .hero-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

/* Editions section */
.section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .section {
    padding: 80px 0;
  }
}

.section-heading {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.95rem, 3.6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.section-sub {
  margin: 0 0 32px;
  max-width: 58ch;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.editions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .editions-grid {
    grid-template-columns: 1.35fr 1fr;
    gap: 24px;
  }
}

.edition-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.edition-card-featured {
  background: var(--surface-deep);
  color: var(--ink-deep);
  border-color: #263647;
}

.edition-card-featured .edition-desc,
.edition-card-featured .edition-stats {
  color: #a9b8c7;
}

.edition-kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-text);
  margin-bottom: 6px;
}

.edition-card-featured .edition-kicker {
  color: #e4747f;
}

.edition-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.15;
}

.edition-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 46ch;
}

.edition-footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edition-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.edition-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compat-note {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Story & Cast section */
.story-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
}

@media (min-width: 768px) {
  .story-grid {
    grid-template-columns: 1fr 1.05fr;
    gap: 56px;
    align-items: start;
  }
}

.story-prose p {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: 1.04rem;
  line-height: 1.72;
  max-width: 58ch;
}

.story-prose p:last-child {
  margin-bottom: 0;
}

.cast-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px 28px;
}

@media (min-width: 560px) {
  .cast-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.cast-item {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.cast-name {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.28rem;
  line-height: 1.2;
}

.cast-role {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent-text);
}

.cast-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Chapter Index */
.arc-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 22px;
  -webkit-overflow-scrolling: touch;
}

.arc-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.arc-tab:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.arc-tab:active {
  transform: scale(0.98);
}

.arc-tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--btn-ink);
  border-color: var(--accent);
}

.part-heading {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--text-muted);
}

.chapter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .chapter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
  }
}

.chapter-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.16s var(--ease-editorial), border-color 0.16s ease, background-color 0.16s ease;
}

.chapter-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-tint);
}

.chapter-row:active {
  transform: scale(0.99);
}

.chapter-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-text);
  padding-top: 3px;
  min-width: 26px;
}

.chapter-meta {
  flex: 1;
  min-width: 0;
}

.chapter-row-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.24rem;
  line-height: 1.22;
  margin-bottom: 4px;
}

.chapter-row-preview {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-row-time {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 4px;
}

/* Footer */
.site-footer {
  padding: 36px 0 48px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a:hover {
  color: var(--text);
}

/* Web Reader View */
.reader-shell[hidden] {
  display: none;
}

.landing-shell[hidden] {
  display: none;
}

.reader-shell {
  min-height: 100dvh;
  background: var(--bg);
}

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.reader-progress-track {
  position: relative;
  height: 2px;
  width: 100%;
  background: transparent;
  overflow: hidden;
}

@supports (animation-timeline: scroll()) {
  .reader-progress-fill {
    height: 100%;
    width: 100%;
    background: var(--accent);
    transform-origin: left center;
    transform: scaleX(0);
    animation: read-progress linear both;
    animation-timeline: scroll(root);
  }
}

@keyframes read-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.reader-bar-inner {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (min-width: 640px) {
  .reader-bar-inner {
    padding: 10px 16px;
    gap: 10px;
  }
}

.reader-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .reader-controls {
    gap: 6px;
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 500;
  flex-shrink: 0;
  transition: border-color 0.16s ease, transform 0.14s ease;
}

@media (min-width: 640px) {
  .icon-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    font-size: 0.85rem;
  }
}

.icon-btn:hover {
  border-color: var(--border-strong);
}

.icon-btn:active {
  transform: scale(0.97);
}

.chapter-select {
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
  max-width: 320px;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .chapter-select {
    height: 38px;
    padding: 0 10px;
    font-size: 0.86rem;
  }
}

.reader-article {
  width: 100%;
  max-width: 66ch;
  margin: 0 auto;
  padding: 32px 18px 80px;
}

@media (min-width: 768px) {
  .reader-article {
    padding: 52px 24px 96px;
  }
}

.reader-part {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-text);
}

.reader-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 5vw, 2.7rem);
  line-height: 1.15;
}

.reader-stats {
  margin: 0 0 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reader-prose {
  font-family: var(--font-serif);
  font-size: var(--reader-font-size, 18px);
  line-height: 1.76;
}

.reader-prose p {
  margin: 0 0 1.05em;
}

.reader-prose ol {
  margin: 1em 0 1.2em 1.35em;
  padding-left: 0.4em;
}

.reader-prose li {
  margin-bottom: 0.6em;
}

.reader-prose hr.scene-break {
  border: none;
  text-align: center;
  margin: 2em 0;
}

.reader-prose hr.scene-break::after {
  content: "* * *";
  letter-spacing: 0.3em;
  color: var(--text-muted);
}

.reader-pager {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pager-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  transition: border-color 0.16s ease, transform 0.14s ease;
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.pager-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.pager-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.pager-btn-next {
  text-align: right;
  align-items: flex-end;
}

.pager-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-text);
}

.pager-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.2;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
