:root {
  color-scheme: light;
  --paper: #f4ecdc;
  --ink: #26252a;
  --gold: #d7b982;
  --night: #1b1320;
  --cream: #fff2e6;
  --edge-space: clamp(20px, 6vw, 104px);
  --nav-height: 64px;
  --serif: "Nanum Myeongjo", "Batang", "AppleMyungjo", "Noto Serif KR", serif;
}
* { box-sizing: border-box; }
html { scroll-padding-top: var(--nav-height); scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.68 "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  word-break: keep-all;
}
body[data-entry], body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, figure, p { margin: 0; }
h1, h2 { font-family: var(--serif); line-height: 1.17; letter-spacing: -.055em; }
img { display: block; width: 100%; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #a27243; outline-offset: 4px; }
.wrap { max-width: 1440px; margin-inline: auto; padding-inline: var(--edge-space); }
.eyebrow { color: #825e38; font-size: .83rem; font-weight: 750; letter-spacing: .06em; }
.down, .original-next, .gate-enter, .story-actions > * {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 46px;
  padding: 9px 17px;
  font-weight: 750;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: clamp(13px, 3.2vw, 45px);
  background: #181d2b;
  color: #fff5e1;
}
.gate-copy {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-start;
  justify-content: end;
  flex-direction: column;
  width: min(1600px, 100%);
  min-height: min(790px, calc(100svh - clamp(26px, 6.4vw, 90px)));
  padding: clamp(28px, 6vw, 100px);
  border: 1px solid #dfcba87a;
  background: #242838;
}
.gate-copy::before, .gate-copy::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.gate-copy::before {
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, #151a2bd9, #151a2b19 64%),
    url("assets/castle.webp") 51% center/cover;
}
.gate-copy::after { inset: 9px; border: 1px solid #f1dcb949; }
.gate h1 {
  font-family: inherit;
  font-size: clamp(37px, 6vw, 88px);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: 1.12;
  color: #fff5e9;
  text-shadow: 0 2px 22px #0d1525d9;
}
.gate-enter {
  margin-top: clamp(19px, 2.7vw, 32px);
  min-width: 166px;
  min-height: 54px;
  padding: 8px 9px 8px 18px;
  gap: 24px;
  color: #fff6e6;
  border: 1px solid #e1c498b3;
  border-radius: 4px;
  background: #142033ed;
  box-shadow: 0 6px 22px #10142655;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -.02em;
  transition: background-color .2s, border-color .2s;
}
.gate-enter span {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #f1d4a5;
  border-radius: 2px;
  background: #ecd0a01a;
}
.gate-enter span::before {
  content: "";
  width: 13px;
  height: 1px;
  background: currentColor;
}
.gate-enter span::after {
  content: "";
  position: absolute;
  right: 10px;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 1px 1px 0 0;
  transform: rotate(45deg);
}
.gate-enter:hover { background: #243555; border-color: #ffe0aa; }
.gate-enter:focus-visible { outline-color: #ffe0aa; }
.gate-enter:disabled { cursor: wait; }

.top {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding-inline: var(--edge-space);
  background: #f4ecdcf5;
  border-bottom: 1px solid #b9a78b;
  transition: background .6s, color .6s;
}
.brand { font: 800 1.23rem var(--serif); white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: clamp(10px, 2vw, 30px); font-size: .9rem; }
.top nav a { padding-block: 10px; }
.top nav button { background: transparent; border: 1px solid currentColor; padding: 5px 9px; }
body[data-era="changed"] .top { background: #201722f6; color: var(--cream); border-color: #614551; }
.overture {
  padding: clamp(50px, 7vw, 110px) var(--edge-space);
  background: radial-gradient(ellipse at 74% 48%, #fcf7e9, transparent 58%), var(--paper);
}
.overture-inner {
  width: min(100%, 1210px);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1.06fr .94fr;
  align-items: center;
  gap: clamp(32px, 7vw, 105px);
}
.opening-copy h2 { font-size: clamp(46px, 6.4vw, 100px); }
.opening-copy h2:focus { outline: none; }
.opening-copy p { margin-top: 24px; font-size: clamp(16px, 1.45vw, 20px); color: #4d443e; }
.down { margin-top: 24px; border: 1px solid #ad9371; }
.down:hover, .original-next:hover { background: #e8d9c1; }
.hero-frame {
  position: relative;
  margin: 8px;
  outline: 1px solid #a8855e;
  outline-offset: 7px;
  border-radius: 46% 46% 0 0 / 30% 30% 0 0;
  overflow: hidden;
}
.hero-frame img { aspect-ratio: 7/8; object-fit: cover; object-position: 49% 30%; }

.original-cast, .cast { padding-block: clamp(52px, 8vw, 108px); }
.original-cast { background: #eae0d0; border-top: 1px solid #bfa987; }
.section-heading h2 { font-size: clamp(34px, 5vw, 65px); }
.original-grid, .cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 26px);
  margin-top: 28px;
}
.original-card, .card {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border: 0;
  background: #251c28;
}
.original-card img, .card img {
  grid-area: 1/1;
  aspect-ratio: 4/4.4;
  height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  transition: transform .35s;
}
.original-card::after, .card::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  background: linear-gradient(0deg, #150f1af6, #150f1a93 20%, transparent 50%);
  pointer-events: none;
}
.original-card > span, .card > span {
  z-index: 1;
  grid-area: 1/1;
  display: grid;
  gap: 3px;
  padding: clamp(10px, 1.6vw, 20px);
  color: #fff4e7;
  font: 800 clamp(16px, 1.8vw, 25px)/1.3 var(--serif);
}
.card small { font: 600 clamp(.73rem, 1.2vw, .9rem)/1.4 system-ui; color: #f3cf9e; }
.original-card:hover img, .card:hover img { transform: scale(1.035); }
.original-next { margin-top: 30px; border: 1px solid #9f875f; }

.turn {
  position: relative;
  min-height: 285svh;
  background: #eae0d0;
  --progress: 0;
  --edge: -11%;
  --zoom: 1.08;
}
.turn::before {
  position: absolute;
  inset: 0;
  background: var(--night);
  content: "";
  opacity: clamp(0, calc(var(--progress) * 2.25 - .54), 1);
}
.turn-stage {
  position: sticky;
  top: var(--nav-height);
  height: calc(100svh - var(--nav-height));
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 82px);
  padding: 25px var(--edge-space);
  max-width: 1500px;
  margin-inline: auto;
}
.turn-image {
  grid-area: 1/1;
  position: relative;
  overflow: hidden;
  border: 1px solid #c2a47c;
  box-shadow: 0 20px 64px #1d142330;
}
.turn-image img { aspect-ratio: 512/375; object-fit: cover; object-position: 50% 24%; }
.turn-image .after {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: polygon(0 0, calc(var(--edge) + 11%) 0, calc(var(--edge) - 11%) 100%, 0 100%);
}
.turn-image .after img { transform: scale(var(--zoom)); }
.turn-copy { grid-area: 1/2; transition: color .5s; }
body[data-era="changed"] .turn-copy { color: var(--cream); }
body[data-era="changed"] .turn-copy .eyebrow { color: var(--gold); }
.turn-line {
  font: 750 clamp(29px, 4vw, 62px)/1.34 var(--serif);
  letter-spacing: -.055em;
  margin-block: 14px 19px;
  opacity: var(--caption-opacity, 1);
}
.turn-copy a { display: inline-block; padding-block: 6px; border-bottom: 1px solid currentColor; }

.story {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: min(800px, 100svh);
  background: var(--night);
  color: var(--cream);
  text-align: center;
}
.story::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(0deg, var(--night) 3%, #1b1320cc 42%, #21152129 100%),
    url("assets/siege.webp") 63% top/cover;
}
.story-copy { padding-block: clamp(72px, 10vw, 136px); }
.work-logo { width: min(100%, 530px); margin-inline: auto; filter: drop-shadow(0 4px 10px #160d1ae6); }
.synopsis { margin-top: 30px; font-size: clamp(15px, 1.6vw, 20px); line-height: 1.85; }
.synopsis p:first-child { font: 750 clamp(20px, 2.6vw, 34px)/1.43 var(--serif); margin-bottom: 15px; }
.story-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.story-actions button { background: #eed2a0; border: 1px solid #eed2a0; color: #211622; }
.story-actions a { border: 1px solid #cbac8c; }
.story-actions button:hover { background: #fff0c9; }
.story-actions a:hover { background: #3d2839; }
.cast {
  max-width: none;
  padding-inline: max(var(--edge-space), calc((100% - 1250px) / 2));
  background: var(--night);
  color: var(--cream);
  border-top: 1px solid #604655;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.filters button, .expression-options button {
  padding: 7px 12px;
  min-height: 40px;
  background: transparent;
  border: 1px solid #826972;
  color: inherit;
  font-size: .88rem;
}
.filters button[aria-pressed="true"], .expression-options button[aria-pressed="true"] {
  background: #e6c797;
  border-color: #e6c797;
  color: #281e28;
}
footer { padding: 24px var(--edge-space); text-align: right; background: #130e17; color: #ebcc9e; }

dialog {
  position: fixed;
  padding: 0;
  max-height: 88dvh;
  color: var(--cream);
  background: #231a27;
  border: 1px solid #876a72;
}
dialog::backdrop { background: #100a12de; }
.close {
  width: 38px;
  height: 38px;
  border: 1px solid #b79882;
  background: #241b26;
  color: #fff2df;
  font-size: 22px;
  line-height: 1;
}
#profile { width: min(94vw, 1000px); }
#profile > .close, .archive-entry > .close { position: absolute; z-index: 2; top: 10px; right: 10px; }
.profile-content { display: grid; grid-template-columns: 1.02fr .98fr; align-items: center; }
.profile-portrait { min-width: 0; background: #19121c; }
.profile-portrait img { aspect-ratio: 1.46; object-fit: contain; }
.profile-content section { padding: clamp(24px, 4vw, 48px); }
.profile-content h2 { font-size: clamp(28px, 4.3vw, 52px); margin: 8px 0 16px; }
.profile-content .eyebrow, .profile-expressions legend { color: var(--gold); }
.profile-description { font-size: 1rem; line-height: 1.8; }
.profile-expressions { padding: 0; border: 0; margin: 19px 0 0; min-width: 0; }
.profile-expressions legend { padding: 0; margin-bottom: 8px; font-size: .86rem; font-weight: 700; }
.expression-options { display: flex; flex-wrap: wrap; gap: 6px; }
#archive { width: min(91vw, 670px); background: #f4ebdc; color: #30262a; overflow: hidden; }
.archive-entry { display: grid; grid-template-columns: 1fr 1fr; align-items: center; position: relative; }
.archive-entry img { aspect-ratio: 1; object-fit: cover; }
.archive-entry section { padding: 20px; }
.archive-entry h2 { font-size: clamp(25px, 4vw, 43px); margin-bottom: 11px; }
#archive[open] .archive-entry { animation: archive-open .52s ease both; }
#archive[data-failed] { animation: archive-collapse .98s ease-in both; }
#archive[data-failed] .archive-entry { animation: archive-glitch .29s steps(1,end) both; }
#archive[data-failed] img { filter: grayscale(1) brightness(.65); }
#archive[data-failed] p { color: #842e3b; font-weight: 750; }
@keyframes archive-open { from { opacity: .25; transform: scaleY(.08); } }
@keyframes archive-collapse { 65% { opacity: 1; } to { opacity: 0; transform: scaleY(.02); } }
@keyframes archive-glitch {
  20% { transform: translateX(7px) skewX(-4deg); }
  45% { transform: translateX(-5px) skewX(4deg); }
  70% { transform: translateX(4px); }
}
#reader { width: min(94vw, 650px); height: 88dvh; background: #100c13; }
.reader-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #231a27;
}
.reader-head h2 { font-size: 1.03rem; }
#comic-pages img { height: auto; }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }
#profile[open] .profile-content section { animation: enter .45s .22s both; }
.in-view { animation: enter .64s ease-out both; }

@media (max-width: 700px) {
  :root { --nav-height: 54px; }
  .top { padding-inline: 15px; }
  .top nav { gap: 10px; font-size: .82rem; }
  .brand { font-size: 1rem; }
  .gate-copy { background: #222638; }
  .gate-copy::before { background-position: 44% center; }
  .overture-inner { grid-template-columns: 1fr; gap: 32px; }
  .opening-copy h2 { font-size: clamp(36px, 10vw, 62px); }
  .hero-frame { max-width: 420px; width: calc(100% - 16px); justify-self: center; }
  .hero-frame img { aspect-ratio: 1.08; }
  .original-grid, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .turn-stage { grid-template-columns: 1fr; align-content: center; gap: 23px; }
  .turn-image { grid-area: 1/1; max-width: 460px; width: 100%; justify-self: center; }
  .turn-copy { grid-area: 2/1; }
  .turn-line { margin-block: 9px; }
  .story { min-height: 0; }
  .archive-entry, .profile-content { grid-template-columns: 1fr; }
  .archive-entry img, .profile-portrait img { max-height: 36dvh; }
}
@media (max-height: 485px) and (orientation: landscape) {
  .turn-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .turn-image { max-width: 42svh; }
  .turn-copy { grid-area: 1/2; }
  .turn-line { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .turn { min-height: 155svh; }
}

/* Illustrated cover */
.overture {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(18px, 3vw, 52px);
  background: #1a2530;
  color: #fff3db;
}
.overture::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #101d2af5 2%, #1b2b38e7 28%, #24344755 70%, #1524335c),
    linear-gradient(0deg, #111c29b5, transparent 70%),
    url("assets/castle.webp") center/cover;
}
.overture-inner {
  position: relative;
  width: min(100%, 1550px);
  min-height: min(720px, calc(100svh - 155px));
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr);
  gap: clamp(28px, 3.5vw, 66px);
  padding: clamp(36px, 5vw, 83px);
  border: 1px solid #dcc18a9c;
}
.cover-ornaments {
  position: absolute;
  inset: 7px;
  border: 1px solid #e6cd963d;
  pointer-events: none;
}
.cover-ornaments i {
  position: absolute;
  width: 35px;
  height: 35px;
  border: solid #e9cb8f;
  border-width: 2px 0 0 2px;
}
.cover-ornaments i::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  top: 5px;
  left: 5px;
  border: 1px solid #e9cb8f;
  transform: rotate(45deg);
}
.cover-ornaments i:nth-child(1) { top: -1px; left: -1px; }
.cover-ornaments i:nth-child(2) { top: -1px; right: -1px; transform: rotate(90deg); }
.cover-ornaments i:nth-child(3) { bottom: -1px; right: -1px; transform: rotate(180deg); }
.cover-ornaments i:nth-child(4) { bottom: -1px; left: -1px; transform: rotate(270deg); }
.opening-copy {
  position: relative;
  z-index: 1;
  padding-block: 12px;
}
.opening-copy::before {
  content: "";
  display: block;
  width: 88px;
  height: 13px;
  margin-bottom: clamp(17px, 2.4vw, 28px);
  background: linear-gradient(90deg, #f0d5a0, #f0d5a000) center/100% 1px no-repeat;
  border-left: 7px solid #eccc92;
}
.opening-copy h2 {
  font-size: clamp(33px, 4.5vw, 76px);
  line-height: 1.23;
  letter-spacing: -.052em;
  text-shadow: 0 2px 19px #0a141e;
}
.opening-copy h2 span { display: block; white-space: nowrap; }
.opening-copy h2 span + span { color: #f5d69a; }
.opening-copy p { color: #fff0d9; font-size: clamp(15px, 1.3vw, 19px); }
.down { color: #251b1c; background: #f3d5a3; border-color: #ffe6b8; }
.down:hover { background: #ffecd0; }
.hero-frame {
  border-radius: 49% 49% 2px 2px / 22% 22% 2px 2px;
  outline-color: #eccc92;
  outline-offset: 6px;
  border: 1px solid #f7dca3;
  box-shadow: 0 25px 70px #131a2366;
}
.hero-frame img { aspect-ratio: 1.08; object-position: 50% 29%; }
.top {
  background: #192632;
  color: #fff2db;
  border-color: #9a805d;
}
.top nav button { border-color: #d0b589; color: #ffebc7; }
.section-heading {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 44px);
}
.section-heading::after {
  content: "";
  flex: 1;
  height: 9px;
  background: linear-gradient(90deg, currentColor, transparent 100%) center/100% 1px no-repeat;
  border-left: 7px solid currentColor;
  opacity: .45;
}
.original-card, .card { border: 1px solid #ae9768; }
.original-card::before, .card::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: 1;
  border: 1px solid #f2d9a05e;
  pointer-events: none;
}
.turn-image { outline: 1px solid #c2a47c80; outline-offset: 6px; }
.story-copy { width: min(100% - 40px, 870px); border-block: 1px solid #e1b98772; }
.story::before {
  background: linear-gradient(0deg, var(--night), #1b1320a6 64%, #21152126),
    url("assets/siege.webp") 63% top/cover;
}
@media (max-width: 790px) {
  .overture { padding: 13px; }
  .overture::before {
    background: linear-gradient(180deg, #101d2af5, #192736ae 62%, #15243363),
      url("assets/castle.webp") 45% center/cover;
  }
  .overture-inner {
    min-height: 0;
    grid-template-columns: 1fr;
    padding: 30px clamp(19px, 7vw, 55px);
    gap: 20px;
  }
  .opening-copy h2 { font-size: clamp(27px, 8.15vw, 53px); }
  .opening-copy p { margin-top: 14px; }
  .opening-copy .down { margin-top: 15px; }
  .hero-frame { width: calc(100% - 14px); }
  .hero-frame img { aspect-ratio: 1.54; object-position: center 23%; }
  .cover-ornaments i { width: 23px; height: 23px; }
  .cover-ornaments i::after { width: 7px; height: 7px; }
  .story-copy { margin-block: 28px; }
}

.cast-thumbnail {
  position: relative;
  grid-area: 1/1;
  aspect-ratio: 4/4.4;
  overflow: hidden;
}
.cast-thumbnail img {
  position: absolute;
  top: 0;
  left: 50%;
  width: auto;
  max-width: none;
  height: var(--thumbnail-height);
  aspect-ratio: auto;
  transform: translateX(calc(-1 * var(--face-center)));
  transform-origin: var(--face-center) 35%;
}
.card:hover .cast-thumbnail img {
  transform: translateX(calc(-1 * var(--face-center))) scale(1.035);
}
