:root {
  --bg: #171b1b;
  --surface: #1b2020;
  --raised: #252b29;
  --border: #3b4340;
  --text: #ece9e1;
  --muted: #aab3ad;
  --accent: #dabd87;
  --accent-soft: rgba(218, 189, 135, 0.14);
  --accent-strong: #e9cd9c;
  --selection: #494335;
  --radius: 10px;
  --radius-lg: 20px;
  --max: 960px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", "Pretendard", -apple-system, "Malgun Gothic", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  position: relative;
}

/* ---------- Film grain (whole page) ---------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

a { color: inherit; text-decoration: none; }
ul { padding-left: 1.1em; margin: 0.8em 0 0; }
li { margin-bottom: 0.4em; color: var(--muted); }
h1, h2, h3 { line-height: 1.3; margin: 0; }

.section-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.accent-text { color: var(--accent); }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(23, 27, 27, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  margin-right: auto;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  gap: 22px;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.92rem;
  transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--text); }
.nav-links a.is-active { color: var(--accent); }

@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #1a1612;
}

.btn-primary:hover { transform: translateY(-1px); background: var(--accent-strong); }

.btn-small {
  padding: 9px 16px;
  font-size: 0.88rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-small:hover { transform: translateY(-1px); background: var(--selection); }

.btn-small.is-loading { opacity: 0.6; pointer-events: none; }

.btn-secondary {
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  font-size: 0.88rem;
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-secondary.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ================================================================
   Scroll-driven stage (aperture scrollytelling)
   Base rules below are the no-JS / reduced-motion fallback:
   chapters stack in normal document flow, fully visible.
   Everything under html.js-scrolly turns that into the pinned,
   iris-driven experience.
   ================================================================ */

.scroll-track {
  height: calc(var(--chapters, 5) * 140vh);
}

html:not(.js-scrolly) .scroll-track { display: none; }

.stage {
  position: static;
}

.stage-iris,
.stage-dots {
  display: none;
}

.stage-viewport {
  position: static;
}

html.js-scrolly .stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: #0a0c0b;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

html.js-scrolly .stage.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html.js-scrolly .stage-viewport {
  position: absolute;
  inset: 0;
  /* clip-path is a rotating polygon, not a circle — set per scroll frame by
     JS (setupScrollStage) so the reveal reads as camera iris blades closing
     to a point and twisting open again, rather than a plain circular wipe. */
}

html.js-scrolly .stage-iris {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.iris-polygon {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  opacity: 0.6;
  filter: drop-shadow(0 0 16px rgba(218, 189, 135, 0.35));
}

.iris-hinges line {
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.45;
}

/* ---------- Chapters ---------- */

.chapter {
  position: static;
  padding: 56px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

html.js-scrolly .chapter {
  position: absolute;
  inset: 0;
  padding: calc(var(--nav-h) + 26px) 24px 40px;
  opacity: 0;
  pointer-events: none;
}

html.js-scrolly .chapter[data-chapter="0"] {
  opacity: 1;
}

/* overflow-y:auto is a safety net for short viewports (e.g. the 4-card
   feature grid on a short phone screen) — it only engages when content
   actually exceeds the chapter's height, so it never captures wheel input
   meant for the page's own scroll. The earlier bug here was
   overscroll-behavior:contain, which explicitly blocks chaining to the
   parent scroller even when an auto-overflow element has nothing of its
   own to scroll; without it, default chaining applies and wheel scroll
   passes straight through to the document as expected. */
.chapter-inner {
  width: 100%;
  max-width: var(--max);
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}

.chapter-inner::-webkit-scrollbar { width: 6px; }
.chapter-inner::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.hero-inner { text-align: left; max-width: 760px; }

.eyebrow {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 16px;
}

.hero-inner h1 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hero-sub {
  margin-top: 20px;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 48ch;
}

.scroll-hint {
  margin-top: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.scroll-hint svg { color: var(--accent); }

html:not(.js-scrolly) .scroll-hint { display: none; }

@media (prefers-reduced-motion: no-preference) {
  html.js-scrolly .scroll-hint svg { animation: bounceDown 1.8s ease-in-out infinite; }
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 800;
}

.section-sub {
  color: var(--muted);
  margin-top: 8px;
  font-size: 0.95rem;
  max-width: 60ch;
}

/* ---------- Stage dots (chapter nav) ---------- */

html.js-scrolly .stage-dots {
  display: flex;
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 760px) {
  html.js-scrolly .stage-dots { display: none; }
}

.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.stage-dot.is-active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
}

/* ---------- Features ---------- */

.feature-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 960px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feature-grid { grid-template-columns: 1fr; } }

.feature-card {
  position: relative;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -20px rgba(0, 0, 0, 0.6);
}

.feature-card h3 { font-size: 1.02rem; margin-top: 14px; }
.feature-card p { color: var(--muted); font-size: 0.88rem; margin-top: 6px; }

.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  position: relative;
}

.feature-icon::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1.6px solid var(--accent);
  border-radius: 4px;
}

.feature-icon[data-icon="films"]::after { border-radius: 50%; }
.feature-icon[data-icon="stamp"]::after { inset: 13px 10px; border-radius: 3px; }
.feature-icon[data-icon="offline"]::after { border-style: dashed; }

/* ---------- Modes ---------- */

.mode-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 760px) { .mode-grid { grid-template-columns: 1fr; } }

.mode-card {
  position: relative;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.mode-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -20px rgba(0, 0, 0, 0.6);
}

.mode-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.mode-card h3 { margin-top: 12px; font-size: 1.12rem; }

.mode-flow {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ---------- Films ---------- */

.film-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: start;
}

@media (max-width: 760px) { .film-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .film-grid { grid-template-columns: 1fr; } }

.mood-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--raised);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.mood-card.is-open { border-color: var(--accent); }

.mood-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.mood-name { font-size: 0.88rem; font-weight: 600; }

.mood-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.25s ease;
}

.mood-card.is-open .mood-chevron { transform: rotate(180deg); color: var(--accent); }

.mood-body {
  flex-shrink: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), padding 0.35s ease;
}

.mood-card.is-open .mood-body { max-height: 320px; padding: 0 16px 14px; }

.mood-desc { margin: 0 0 8px; color: var(--muted); font-size: 0.8rem; }

.mood-films { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.mood-films li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
}

.mood-films li:first-child { border-top: none; padding-top: 0; }

.film-name { color: var(--text); font-weight: 600; letter-spacing: 0.01em; }
.film-type { color: var(--muted); font-size: 0.72rem; flex-shrink: 0; }

.film-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Download ---------- */

.chapter-inner-scroll { text-align: left; }

.version-badge {
  color: var(--accent);
  font-weight: 700;
}

.platform-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
}

.platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.platform-row.is-loading { opacity: 0.6; }

.platform-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.platform-name { font-weight: 700; font-size: 0.92rem; }
.platform-detail {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hash-details {
  margin-top: 18px;
  max-width: 560px;
  color: var(--muted);
  font-size: 0.85rem;
}

.hash-details summary { cursor: pointer; color: var(--accent); }

.hash-details code {
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  word-break: break-all;
  font-size: 0.78rem;
  color: var(--text);
}

/* ---------- Release notes ---------- */

.release-notes {
  margin-top: 28px;
  max-width: 640px;
}

.release-notes-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.release-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.release-item {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--raised);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.release-item.is-open { border-color: var(--accent); }

.release-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.release-version {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

.release-date {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.release-headline {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.release-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.25s ease;
}

.release-item.is-open .release-chevron { transform: rotate(180deg); color: var(--accent); }

.release-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 14px;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), padding 0.4s ease;
}

.release-item.is-open .release-body {
  max-height: 1200px;
  padding: 0 14px 14px;
}

.release-section { margin-top: 12px; }
.release-section:first-child { margin-top: 0; }

.release-section h4 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

.release-section ul { margin: 0; padding-left: 1.05em; }

.release-section li {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
  margin-bottom: 5px;
}

/* ---------- Footer ---------- */

.footer {
  position: relative;
  padding: 40px 24px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand { font-size: 0.95rem; font-weight: 700; margin-right: 0; }

.footer-copy {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}
