/* 한밤 - page styles.
   One ground, one ink, one accent. Flat fields, no gradients, no shadows at rest,
   no hairlines; separation is a tone step. Square corners everywhere.
   Five type steps only: small / body / lead / head / display (fitted in JS). */

/* ------------------------------------------------------------------ base */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-body);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.01em;
  word-break: keep-all;          /* Korean wraps at spaces, never mid-word */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

:where(section[id]) { scroll-margin-top: var(--head-h); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  left: var(--margin);
  top: -80px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--step-small);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ head */
.site-head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
  height: var(--head-h);
  padding: 0 var(--margin);
  background: var(--bg);
}

.wordmark {
  margin-right: auto;
  font-family: var(--font-display);
  font-size: var(--step-body);
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink);
}
.wordmark:hover { color: var(--accent); }

.site-nav { display: flex; gap: clamp(14px, 1.8vw, 28px); }
.site-nav a {
  font-size: var(--step-small);
  color: var(--ink-soft);
  transition: color 200ms var(--ease-out);
}
.site-nav a:hover { color: var(--ink); }

.sound-toggle {
  padding: 8px 13px;
  background: var(--bg-2);
  color: var(--ink-soft);
  font-size: var(--step-small);
  line-height: 1.2;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.sound-toggle:hover { background: #1A1F27; color: var(--ink); }
.sound-toggle[aria-pressed="true"] { color: var(--accent); }

/* ---------------------------------------------------------------- button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 16px 26px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-text);
  font-size: var(--step-body);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
  transition: background-color 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.btn:hover { background: var(--accent-hover); }
.btn:active { background: #D49B32; transform: translateY(1px); }

/* --------------------------------------------------------------- reveals */
[data-reveal] { opacity: 1; transform: none; }

html.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
html.js [data-reveal].is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ------------------------------------------------------------------ hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: calc(var(--head-h) + clamp(28px, 5vh, 64px)) var(--margin) 24px;
  background: var(--bg);
  overflow: hidden;
}

.hero-top { max-width: 40ch; }
.hero-lede {
  font-size: var(--step-body);
  line-height: 1.5;
  color: var(--ink);
}
.hero-top .btn { margin-top: 22px; }

.hero-monument {
  align-self: center;
  justify-self: center;
  margin: 0;
  font-size: var(--monument-size);
  line-height: 0.88;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  transform: scale(var(--hero-scale, 1));
  transform-origin: 50% 50%;
  will-change: transform;
}
html.js .hero-monument {
  opacity: 0;
  transition: opacity 900ms var(--ease-out) 120ms;
}
html.js .hero-monument.is-in { opacity: 1; }

.hero-foot {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: var(--step-small);
  color: var(--ink-soft);
}

/* ----------------------------------------------------------------- intro */
.intro {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: calc(var(--head-h) + clamp(36px, 7vh, 84px));
  padding-inline: var(--margin);
  background: var(--bg);
}

.intro-copy {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: end;
  gap: clamp(24px, 5vw, 90px);
}

.intro-title {
  font-size: var(--step-head);
  max-width: 14ch;
}

.intro-captions {
  display: flex;
  gap: clamp(24px, 3vw, 48px);
  padding-bottom: 6px;
}
.intro-captions p {
  max-width: 190px;
  font-size: var(--step-small);
  line-height: 1.5;
  color: var(--ink-soft);
}

.intro-media {
  margin: clamp(34px, 5vh, 56px) calc(-1 * var(--margin)) 0;
  height: clamp(42svh, 56svh, 620px);
  overflow: hidden;
  background: var(--bg-2);
}
.intro-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
  animation: photo-drift 22s ease-in-out infinite alternate;
}
@keyframes photo-drift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.07) translate3d(0, -1.4%, 0); }
}

/* ----------------------------------------------------------- index table */
.chapters-index {
  padding: var(--gap-section) var(--margin);
  background: var(--bg);
}

.section-title {
  font-size: var(--step-head);
  max-width: 16ch;
}
.section-lead {
  margin-top: clamp(20px, 2.4vw, 30px);
  max-width: 44ch;
  font-size: var(--step-body);
  color: var(--ink-soft);
}

.index-head {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: end;
  gap: clamp(24px, 4vw, 80px);
}
.index-head .section-lead {
  margin-top: 0;
  justify-self: end;
  max-width: 36ch;
}

.index-body {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.45fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
  margin-top: clamp(44px, 5.5vw, 80px);
}

.index-table { margin: 0; width: 100%; grid-column: 2; grid-row: 1; }

.index-photo { margin: 0; grid-column: 1; grid-row: 1; }
.index-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--bg-2);
}
.index-photo figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  font-size: var(--step-small);
  color: var(--ink-soft);
}

.index-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) 150px 26px;
  align-items: baseline;
  gap: 18px;
  padding: 22px 10px;
  transition: background-color 220ms var(--ease-out);
}
.index-row:hover { background: var(--bg-2); }
.index-time {
  font-size: var(--step-small);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.index-name {
  font-size: var(--step-body);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.index-place {
  font-size: var(--step-small);
  color: var(--ink-soft);
  text-align: right;
}
.index-go {
  font-size: var(--step-body);
  color: var(--ink-soft);
  justify-self: end;
  transition: transform 220ms var(--ease-out), color 220ms var(--ease-out);
}
.index-row:hover .index-go { transform: translateX(6px); color: var(--accent); }
.index-row:focus-visible { outline-offset: -2px; }

/* --------------------------------------------------------------- chapter */
.chapter {
  position: relative;
  height: 100svh;
  min-height: 540px;
  overflow: hidden;
  background: var(--field, var(--bg));
  isolation: isolate;
}
.chapter--christmas { --field: var(--field-christmas); }
.chapter--bell { --field: var(--field-bell); }
.chapter--fireworks { --field: var(--field-fireworks); }
.chapter--sunrise { --field: var(--field-sunrise); }

.chapter-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.chapter-copy {
  position: absolute;
  z-index: 2;
  top: calc(var(--head-h) + clamp(30px, 5vh, 64px));
  left: var(--margin);
  width: min(34rem, 40vw);
  pointer-events: none;
}
.chapter-copy .btn { pointer-events: auto; }

.chapter-title {
  font-size: var(--step-head);
  line-height: 0.98;
}
.chapter-time {
  margin-top: clamp(14px, 1.8vw, 20px);
  font-size: var(--step-small);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.chapter-lead {
  margin-top: 12px;
  max-width: 32ch;
  font-size: var(--step-body);
  line-height: 1.55;
}
.scene-action { margin-top: 22px; }
.scene-readout {
  margin-top: 12px;
  min-height: 1.55em;
  font-size: var(--step-small);
  color: var(--accent);
}

/* the sunrise plate is a bright morning: desktop/tablet copy switches to dark ink so the
   lead, time line and readout stay readable over the peach sky (phones use a dark dock) */
.chapter--sunrise .chapter-copy { color: var(--accent-ink); }
.chapter--sunrise .chapter-time { color: rgba(21, 16, 10, 0.72); }
.chapter--sunrise .chapter-lead { color: var(--accent-ink); }
.chapter--sunrise .scene-readout { color: #6B4410; }
.chapter--sunrise .btn { background: var(--accent-ink); color: var(--ink); }
.chapter--sunrise .btn:hover { background: #2B2214; }
.chapter--sunrise .btn:active { background: #3A2E1C; }

/* ------------------------------------------------------------------ real */
.real {
  padding: var(--gap-section) var(--margin);
  background: var(--bg);
}

.real-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 2.6vw, 44px);
  margin-top: var(--gap-block);
  align-items: start;
}
.real-item:nth-child(2),
.real-item:nth-child(5) { margin-top: clamp(26px, 4vw, 70px); }

.real-item img,
.real-item video {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--bg-2);
  transition: filter 320ms var(--ease-out);
}
.real-item--video video { display: block; }
@media (hover: hover) {
  .real-item:hover img,
  .real-item:focus-within img { filter: brightness(1.06) saturate(1.03); }
}

figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 13px;
}
.real-place {
  font-family: var(--font-display);
  font-size: var(--step-body);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.real-when,
.real-credit {
  font-size: var(--step-small);
  line-height: 1.45;
  color: var(--ink-soft);
}

/* ----------------------------------------------------------------- about */
.about {
  padding: var(--gap-section) var(--margin);
  background: var(--bg);
}

.about-row {
  display: grid;
  grid-template-columns: 34% minmax(0, 1fr);
  gap: clamp(26px, 3vw, 48px);
  align-items: start;
  margin-top: var(--gap-block);
}

.about-facts { display: flex; flex-direction: column; gap: 18px; }
.about-facts div { max-width: 220px; }
.about-facts dt {
  font-size: var(--step-small);
  color: var(--ink-soft);
}
.about-facts dd {
  margin-top: 2px;
  font-size: var(--step-small);
}
.about-lede {
  grid-column: 2;
  max-width: 34ch;
  font-size: var(--step-lead);
  line-height: 1.38;
  letter-spacing: -0.015em;
}

.about-row--records {
  margin-top: clamp(56px, 8vw, 110px);
  grid-template-columns: 34% minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bg-2);
  padding: clamp(26px, 3.4vw, 44px);
}
.about-word {
  font-size: var(--step-small);
  color: var(--ink-soft);
}
.record-head {
  font-size: var(--step-small);
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.about-record ul { display: flex; flex-direction: column; gap: 10px; }
.about-record li {
  max-width: 320px;
  font-size: var(--step-small);
}
.about-record li a { display: flex; justify-content: space-between; gap: 16px; }
.about-record li a:hover { color: var(--accent); }
.about-record li span { color: var(--ink-soft); white-space: nowrap; }

/* --------------------------------------------------------------- closing */
.closing {
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 6vh, 72px);
  padding: calc(var(--head-h) + clamp(40px, 7vh, 90px)) var(--margin) clamp(52px, 7vh, 84px);
  background: var(--ink);
  color: var(--bg);
}
.closing-title {
  font-size: var(--monument-size);
  line-height: 0.9;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--bg);
}
.closing-foot {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: clamp(24px, 3vw, 52px);
}
.closing-foot p {
  max-width: 36ch;
  font-size: var(--step-body);
  color: var(--bg);
}
.closing .btn { flex: none; }

/* ---------------------------------------------------------------- footer */
.site-foot {
  display: flex;
  flex-direction: column;
  min-height: 90svh;
  padding: clamp(96px, 11vw, 150px) var(--margin) 26px;
  background: var(--bg);
  overflow: hidden;
}

.foot-cut {
  position: relative;
  height: 0.8em;
  overflow: hidden;
  margin: 0 0 clamp(40px, 5.4vw, 70px);
  font-size: var(--monument-size);
}
.foot-monument {
  font-size: 1em;
  line-height: 0.92;
  letter-spacing: 0;
  white-space: nowrap;
  transform: translateY(0.11em);
}

.foot-body {
  display: grid;
  grid-template-columns: 34% minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 3vw, 48px);
  align-items: start;
}
.foot-places { display: flex; flex-direction: column; gap: 4px; }
.foot-places li {
  font-family: var(--font-display);
  font-size: var(--step-lead);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.foot-links { display: contents; }
.foot-links > div { grid-column: span 1; }
.foot-links p {
  margin-bottom: 12px;
  font-size: var(--step-small);
  color: var(--ink-soft);
}
.foot-links ul { display: flex; flex-direction: column; gap: 9px; }
.foot-links a,
.foot-sound { font-size: var(--step-small); color: var(--ink); }
.foot-links a:hover,
.foot-sound:hover { color: var(--accent); }

.foot-credits {
  margin-top: clamp(52px, 7vw, 100px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px clamp(28px, 4vw, 64px);
  font-size: var(--step-small);
  line-height: 1.5;
  color: var(--ink-soft);
  word-break: normal;
  overflow-wrap: anywhere;
}
.foot-credits a { text-decoration: underline; text-underline-offset: 3px; }
.foot-credits a:hover { color: var(--ink); }

.foot-legal {
  margin-top: auto;
  padding-top: clamp(44px, 6vw, 76px);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: var(--step-small);
  color: var(--ink-soft);
}
.foot-legal a { color: var(--ink); }
.foot-legal a:hover { color: var(--accent); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .index-head { grid-template-columns: 1fr; gap: 18px; }
  .index-head .section-lead { justify-self: start; max-width: 44ch; }
  .index-body { grid-template-columns: 1fr; gap: 28px; }
  .index-photo { width: min(100%, 420px); margin-left: auto; }
  .index-row { grid-template-columns: 118px minmax(0, 1fr) 26px; }
  .index-place { display: none; }

  .real-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .real-item:nth-child(2),
  .real-item:nth-child(5) { margin-top: 0; }
  .real-item:nth-child(3),
  .real-item:nth-child(4) { margin-top: clamp(18px, 3vw, 40px); }

  .about-row { grid-template-columns: 1fr; }
  .about-lede { grid-column: 1; max-width: 46ch; }
  .about-facts { flex-direction: row; flex-wrap: wrap; gap: 18px 40px; }
  .about-row--records { grid-template-columns: 1fr 1fr; }
  .about-word { grid-column: 1 / -1; }

  .foot-cut { height: 0.82em; }
}

@media (max-width: 760px) {
  .site-nav { display: none; }
  .hero { padding-top: calc(var(--head-h) + 24px); }
  .hero-top { max-width: 32ch; }
  .hero-foot { flex-direction: column; gap: 4px; }

  /* monument type gets its own phone composition: two lines, bigger, not crushed to one */
  .hero-monument {
    white-space: normal;
    font-size: clamp(58px, 18.5vw, 96px);
    line-height: 0.92;
    max-width: 100%;
  }
  .closing-title {
    white-space: normal;
    font-size: clamp(58px, 18.5vw, 96px);
    line-height: 0.92;
  }

  .intro-copy { grid-template-columns: 1fr; align-items: start; gap: 22px; }
  .intro-captions { flex-direction: column; gap: 8px; }
  .intro-media { height: 46svh; }

  .index-body { margin-top: 32px; }
  .index-photo { width: min(100%, 340px); margin-top: 26px; }
  .index-row {
    grid-template-columns: minmax(0, 1fr) 24px;
    grid-template-areas: "time go" "name name" "place place";
    gap: 4px 12px;
    padding: 18px 0;
  }
  .index-time { grid-area: time; }
  .index-name { grid-area: name; }
  .index-place { grid-area: place; display: block; text-align: left; }
  .index-go { grid-area: go; }

  .chapter-copy {
    top: calc(var(--head-h) + 20px);
    left: var(--margin);
    right: var(--margin);
    width: auto;
  }
  /* on a phone the plates crop tight: these two chapters put the copy in a full-bleed
     bottom dock over the quiet part of the plate (bell snow floor / dawn sea) */
  .chapter--sunrise .chapter-copy {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 22px var(--margin) calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--field-sunrise);
    color: var(--ink);
  }
  .chapter--sunrise .chapter-time { color: var(--ink-soft); }
  .chapter--sunrise .chapter-lead { color: var(--ink); }
  .chapter--sunrise .scene-readout { color: var(--accent); }
  .chapter--sunrise .btn { background: var(--accent); color: var(--accent-ink); }
  .chapter--sunrise .btn:hover { background: var(--accent-hover); }
  .chapter--sunrise .btn:active { background: #D49B32; }
  .chapter--bell .chapter-copy {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 22px var(--margin) calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--field-bell);
  }
  .chapter-lead { max-width: 34ch; }
  .scene-action { width: 100%; }

  .real-grid { grid-template-columns: 1fr; gap: 26px; }
  .real-item:nth-child(3),
  .real-item:nth-child(4) { margin-top: 0; }

  .about-row--records { grid-template-columns: 1fr; gap: 34px; }
  .about-facts { flex-direction: column; gap: 14px; }

  .closing-foot { flex-direction: column; align-items: flex-start; }
  .closing .btn { width: 100%; }

  .foot-cut { height: 0.84em; margin-bottom: 34px; }
  .foot-body { grid-template-columns: 1fr; gap: 32px; }
  .foot-links { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .foot-places li { font-size: 24px; }
  .foot-credits { grid-template-columns: 1fr; }
  .foot-legal { flex-direction: column; gap: 10px; }
}

@media (max-width: 420px) {
  :root { --margin: 18px; }
}

/* -------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .intro-media img { animation: none; }
  .real-item img,
  .real-item video { transition: none; }
  html.js [data-reveal] {
    transform: none;
    transition: opacity 240ms linear;
    transition-delay: 0ms;
  }
  .btn,
  .index-go,
  .sound-toggle,
  .site-nav a { transition: none; }
  .hero-monument { transform: none !important; }
}
