:root {
  color-scheme: light;
  --bg: #f2ead9;
  --surface: #fff8ea;
  --surface-strong: #ffffff;
  --ink: #15130f;
  --muted: #665f51;
  --line: #d8c9aa;
  --gold: #d7a441;
  --ember: #8c2f24;
  --moss: #1e7f68;
  --night: #12100d;
  --shadow: 0 18px 42px rgba(21, 19, 15, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 10% -10%, rgba(215, 164, 65, 0.34), transparent 28rem),
    linear-gradient(180deg, #fff8ea 0%, var(--bg) 48%, #e6dac1 100%);
}

body.dark-reader {
  --bg: #0e0e0d;
  --surface: #171511;
  --surface-strong: #211d17;
  --ink: #f7ecd2;
  --muted: #c8bfa8;
  --line: #3c3327;
  --shadow: none;
  background: #0e0e0d;
}

button,
input,
select,
a {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(12rem, 28rem) auto;
  gap: 1rem;
  align-items: center;
  min-height: 4.25rem;
  padding: 0.7rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 248, 234, 0.92);
  backdrop-filter: blur(16px);
}

body.dark-reader .site-header {
  background: rgba(18, 16, 13, 0.92);
}

.brand,
.site-header nav,
.meta-row,
.chapter-actions,
.reader-controls,
.reader-status,
.bottom-reader-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.65rem;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 8px;
  background: var(--night);
  color: var(--gold);
  font-size: 0.82rem;
  box-shadow: inset 0 0 0 2px var(--gold);
}

.site-header nav {
  justify-content: flex-end;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--ember);
}

.search-box input {
  width: 100%;
  min-height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.9rem;
  color: var(--ink);
  background: var(--surface-strong);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.series-card {
  display: grid;
  grid-template-columns: minmax(12rem, 19rem) 1fr;
  gap: clamp(1rem, 4vw, 2.4rem);
  align-items: stretch;
  margin: clamp(1rem, 4vw, 2.5rem) 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.6rem);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cover-frame {
  min-height: 20rem;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--night);
}

.cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  display: block;
}

.series-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  min-width: 0;
}

.breadcrumbs,
.eyebrow {
  color: var(--moss);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 17ch;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.series-copy p,
.comment-box p {
  max-width: 56rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.meta-row {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.chapter-actions,
.bottom-reader-nav {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.primary-action,
.ghost-action,
.nav-button,
.mode-button,
.chapter-item,
select {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-strong);
  font-weight: 850;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  border-color: var(--ember);
  background: var(--ember);
  color: #fff8ea;
}

.ghost-action,
.mode-button {
  padding: 0 1rem;
}

.nav-button {
  width: 2.75rem;
  font-size: 1.75rem;
  line-height: 1;
}

.chapter-strip,
.comment-box {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.4rem);
  background: var(--surface);
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.chapter-item {
  display: grid;
  align-content: center;
  gap: 0.2rem;
  min-height: 4.5rem;
  padding: 0.75rem;
  text-align: left;
}

.chapter-item.active {
  border-color: var(--moss);
  box-shadow: inset 0 0 0 2px var(--moss);
}

.chapter-item small {
  color: var(--muted);
  font-size: 0.84rem;
}

.reader-wrap {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.reader-toolbar {
  position: sticky;
  top: 4.25rem;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  padding: 0.9rem clamp(0.8rem, 2vw, 1.2rem);
  background: rgba(255, 248, 234, 0.95);
  backdrop-filter: blur(14px);
}

body.dark-reader .reader-toolbar {
  background: rgba(18, 16, 13, 0.95);
}

.reader-title .eyebrow,
.reader-title h2 {
  margin: 0;
}

.reader-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

select {
  max-width: 13rem;
  padding: 0 0.75rem;
}

.reader-status {
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(0.8rem, 2vw, 1.2rem);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.comic-pages {
  display: grid;
  justify-items: center;
  gap: 0;
  padding: 0 0 clamp(1rem, 3vw, 2rem);
  background: #0b0b0a;
}

.comic-page {
  width: min(760px, 100%);
  margin: 0;
  background: #050505;
}

.page-art {
  width: 100%;
  aspect-ratio: 0.62;
  background-image: url("assets/barbarian-adventure.png");
  background-repeat: no-repeat;
  background-size: 400% 100%;
}

.panel-one {
  background-position: 0% 50%;
}

.panel-two {
  background-position: 33.33% 50%;
}

.panel-three {
  background-position: 66.66% 50%;
}

.panel-four {
  background-position: 100% 50%;
}

.comic-page figcaption {
  margin: 0;
  padding: 0.95rem 1rem 1.15rem;
  color: #f7ecd2;
  background: #050505;
  font-size: 0.98rem;
  line-height: 1.55;
}

.comic-pages.single-mode .comic-page {
  display: none;
}

.comic-pages.single-mode .comic-page.active {
  display: block;
}

.bottom-reader-nav {
  justify-content: center;
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  max-width: min(24rem, calc(100% - 2rem));
  transform: translateY(1rem);
  opacity: 0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: #fff8ea;
  background: var(--night);
  box-shadow: var(--shadow);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 860px) {
  .site-header {
    position: static;
    grid-template-columns: 1fr;
  }

  .site-header nav {
    justify-content: flex-start;
  }

  .series-card,
  .reader-toolbar {
    grid-template-columns: 1fr;
  }

  .cover-frame {
    min-height: 16rem;
  }

  .chapter-list {
    grid-template-columns: 1fr;
  }

  .reader-toolbar {
    position: sticky;
    top: 0;
  }

  .reader-controls {
    justify-content: flex-start;
  }

  select {
    flex: 1 1 10rem;
  }
}

@media (max-width: 540px) {
  main {
    width: 100%;
  }

  .series-card,
  .chapter-strip,
  .reader-wrap,
  .comment-box {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .comic-page {
    width: 100%;
  }

  .reader-status {
    display: grid;
  }
}
