:root {
  --ink: #171311;
  --ink-soft: #2a2420;
  --paper: #eee7d9;
  --paper-light: #f8f2e6;
  --cream: #fff8ea;
  --red: #9c2e26;
  --red-bright: #c64032;
  --line: rgba(23, 19, 17, 0.2);
  --display: Georgia, "Times New Roman", "Noto Serif TC", serif;
  --sans: Inter, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  line-height: 1.75;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

:where(a, button):focus-visible {
  outline: 3px solid var(--red-bright);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  color: var(--cream);
  background: var(--red);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.reading-progress {
  position: fixed;
  z-index: 90;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 248, 234, 0.15);
}

.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--red-bright);
  transform: scaleX(0);
  transform-origin: left center;
}

.reader-header {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px clamp(20px, 4vw, 62px);
  color: var(--cream);
  border-bottom: 1px solid rgba(255, 248, 234, 0.2);
}

.reader-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
}

.reader-brand > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
  border-radius: 50%;
  font-family: var(--display);
  font-size: 20px;
}

.reader-brand strong,
.reader-brand small {
  display: block;
  line-height: 1.1;
}

.reader-brand strong {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.08em;
}

.reader-brand small {
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: 0.22em;
  opacity: 0.65;
}

.reader-header > p {
  margin: 0;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.16em;
}

.reader-header > a:last-child {
  justify-self: end;
  padding-bottom: 2px;
  border-bottom: 1px solid currentColor;
  font-size: 12px;
}

.reader-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: end;
  overflow: hidden;
  padding: 130px clamp(24px, 7vw, 110px) clamp(56px, 8vw, 100px);
  color: var(--cream);
  background: var(--ink);
}

.reader-hero-image,
.reader-hero-shade {
  position: absolute;
  inset: 0;
}

.reader-hero-image {
  background-image: url("../assets/darkroom-poster.jpg");
  background-position: center 48%;
  background-size: cover;
  filter: saturate(0.72) contrast(1.05);
  transform: scale(1.015);
}

.reader-hero-shade {
  background:
    linear-gradient(90deg, rgba(18, 13, 12, 0.94) 0%, rgba(18, 13, 12, 0.68) 43%, rgba(18, 13, 12, 0.1) 80%),
    linear-gradient(0deg, rgba(18, 13, 12, 0.86), transparent 55%);
}

.reader-hero-copy {
  position: relative;
  z-index: 1;
  width: min(690px, 100%);
}

.reader-kicker,
.act-heading > div > p {
  margin: 0 0 20px;
  color: var(--red-bright);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.reader-hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(66px, 9vw, 138px);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.06em;
}

.reader-deck {
  width: min(520px, 100%);
  margin: 30px 0 0;
  color: rgba(255, 248, 234, 0.75);
  font-family: var(--display);
  font-size: clamp(19px, 2vw, 26px);
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 38px;
  margin: 34px 0 0;
}

.reader-meta div {
  min-width: 120px;
}

.reader-meta dt {
  color: rgba(255, 248, 234, 0.42);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.reader-meta dd {
  margin: 2px 0 0;
  font-size: 13px;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.reader-start,
#resume-reading {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.reader-start {
  background: var(--red);
}

#resume-reading {
  color: var(--cream);
  background: rgba(23, 19, 17, 0.62);
  border: 1px solid rgba(255, 248, 234, 0.38);
}

#resume-reading[hidden] {
  display: none;
}

.reader-frame-note {
  position: absolute;
  z-index: 1;
  right: 24px;
  bottom: 50%;
  margin: 0;
  writing-mode: vertical-rl;
  font-size: 8px;
  letter-spacing: 0.24em;
  opacity: 0.5;
  transform: translateY(50%);
}

.reader-sheet {
  padding: clamp(76px, 10vw, 150px) clamp(22px, 8vw, 130px) 80px;
  background:
    linear-gradient(90deg, rgba(120, 86, 59, 0.03) 1px, transparent 1px) 0 0 / 25% 100%,
    var(--paper-light);
}

.act-heading {
  max-width: 1120px;
  display: grid;
  grid-template-columns: 1fr 0.72fr;
  align-items: end;
  gap: 80px;
  margin: 0 auto;
  padding-bottom: 52px;
  border-bottom: 1px solid var(--line);
}

.act-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(56px, 8vw, 104px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.act-heading > p {
  margin: 0 0 8px;
  color: rgba(23, 19, 17, 0.6);
}

.passage-index {
  max-width: 1120px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin: 0 auto;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.passage-index span {
  margin-right: auto;
  color: rgba(23, 19, 17, 0.48);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.passage-index a {
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(23, 19, 17, 0.28);
  font-size: 11px;
}

.novel {
  max-width: 930px;
  margin: 0 auto;
}

.reader-passage {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: clamp(36px, 7vw, 100px);
  padding: clamp(72px, 9vw, 126px) 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 20px;
}

.reader-passage:last-child {
  border-bottom: 0;
}

.passage-heading {
  position: sticky;
  top: 24px;
  align-self: start;
}

.passage-heading span {
  color: var(--red);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.passage-heading h2 {
  margin: 14px 0 0;
  font-family: var(--display);
  font-size: clamp(19px, 2vw, 26px);
  font-weight: 400;
  line-height: 1.45;
}

.novel-copy {
  min-width: 0;
}

.novel-copy p {
  margin: 0 0 1.35em;
  font-family: var(--display);
  font-size: clamp(18px, 1.65vw, 23px);
  line-height: 2;
  text-align: justify;
  text-justify: inter-ideograph;
}

.reader-passage:first-child .novel-copy p:first-child::first-letter {
  float: left;
  margin: 0.14em 0.12em 0 0;
  color: var(--red);
  font-family: var(--display);
  font-size: 4.3em;
  line-height: 0.72;
}

.novel-copy strong {
  font-weight: 400;
  letter-spacing: 0.08em;
}

.reader-ending {
  min-height: 78svh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 90px 24px;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 42%, rgba(156, 46, 38, 0.33), transparent 36%),
    var(--ink);
  text-align: center;
}

.reader-ending > p:first-child {
  margin: 0;
  color: rgba(255, 248, 234, 0.58);
  font-family: var(--display);
  font-size: clamp(18px, 2vw, 24px);
}

.reader-ending h2 {
  margin: 34px 0 0;
  font-family: var(--display);
  font-size: clamp(64px, 10vw, 132px);
  font-weight: 400;
  line-height: 1;
}

.ending-note {
  margin: 22px 0 0;
  color: rgba(255, 248, 234, 0.6);
}

.ending-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 34px;
}

.ending-actions button,
.ending-actions a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 22px;
  color: var(--cream);
  background: transparent;
  border: 1px solid rgba(255, 248, 234, 0.36);
  border-radius: 999px;
  cursor: pointer;
}

.ending-actions button.is-liked {
  background: var(--red);
  border-color: var(--red);
}

.reader-ending small {
  margin-top: 14px;
  color: rgba(255, 248, 234, 0.38);
}

.reader-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px clamp(22px, 5vw, 72px);
  font-size: 11px;
}

.reader-footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .reader-header {
    grid-template-columns: 1fr auto;
    padding: 14px 18px;
  }

  .reader-header > p {
    display: none;
  }

  .reader-hero {
    min-height: 92svh;
    padding: 110px 22px 58px;
  }

  .reader-hero-image {
    background-position: 58% center;
  }

  .reader-hero-shade {
    background: linear-gradient(0deg, rgba(18, 13, 12, 0.96) 0%, rgba(18, 13, 12, 0.68) 62%, rgba(18, 13, 12, 0.28));
  }

  .reader-hero h1 {
    font-size: clamp(62px, 21vw, 88px);
  }

  .reader-frame-note {
    display: none;
  }

  .reader-sheet {
    padding: 76px 22px 60px;
    background: var(--paper-light);
  }

  .act-heading {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .reader-passage {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 64px 0;
  }

  .passage-heading {
    position: static;
  }

  .passage-heading h2 {
    margin-top: 8px;
  }

  .novel-copy p {
    font-size: 19px;
    line-height: 1.95;
    text-align: left;
  }

  .reader-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
