:root {
  --night: #0c0812;
  --ink: #140d1c;
  --plum: #24162f;
  --plum-2: #2e1c3c;
  --gold: #e0b56a;
  --gold-2: #f3d79a;
  --gold-dim: rgba(224, 181, 106, 0.28);
  --cream: #f3ead8;
  --mute: #cbbba0;
  --rule: rgba(224, 181, 106, 0.22);
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;
  --display: "Cinzel", "Palatino Linotype", Palatino, serif;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.55;
  font-weight: 500;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(2rem, 4.4vw, 3.4rem); letter-spacing: 0.02em; }
h3 { font-size: 1.15rem; letter-spacing: 0.04em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.wrap {
  width: min(var(--max), calc(100% - var(--pad) * 2));
  margin: 0 auto;
}

.eyebrow {
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.85rem;
}

.lede {
  max-width: 38rem;
  color: var(--mute);
  font-size: 1.28rem;
  margin-top: 1rem;
}

.section {
  padding: clamp(4.5rem, 10vw, 7.5rem) 0;
}

.section-head { margin-bottom: clamp(2rem, 5vw, 3.2rem); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.55rem;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--gold);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #2a1608;
}

.btn-gold:hover { transform: translateY(-1px); filter: brightness(1.06); }

.btn-ghost {
  color: var(--gold-2);
  background: rgba(12, 8, 18, 0.35);
}

.btn-ghost:hover { background: rgba(224, 181, 106, 0.12); }

.btn-lg { min-height: 3.4rem; padding-inline: 2.2rem; font-size: 0.84rem; gap: 0.65rem; }

.os-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.os-icon-apple {
  width: 1.45rem;
  height: 1.45rem;
}

.os-icon-tux {
  width: 1.55rem;
  height: 1.55rem;
}

/* Nav */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--pad);
  transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(12, 8, 18, 0.82);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--rule);
}

.nav-mark {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold-2);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--cream);
  opacity: 0.82;
}

.nav-links a:hover,
.nav-links a.active { opacity: 1; color: var(--gold-2); }

.nav-download {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--gold);
  color: var(--gold-2) !important;
  opacity: 1 !important;
}

.nav-toggle {
  display: none;
  width: 2.4rem;
  height: 2.4rem;
  position: relative;
}

.nav-toggle span {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  height: 1px;
  background: var(--gold-2);
}

.nav-toggle span:first-child { top: 0.9rem; }
.nav-toggle span:last-child { top: 1.35rem; }
.nav-toggle span { transition: transform 0.35s ease, top 0.35s ease; }
.nav.open .nav-toggle span:first-child { top: 1.15rem; transform: rotate(45deg); }
.nav.open .nav-toggle span:last-child { top: 1.15rem; transform: rotate(-45deg); }
.nav-sub { display: none; }

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: hidden;
}

.hero-art {
  position: absolute;
  left: 0;
  right: 0;
  top: -14%;
  height: 128%;
  background: #1a0e22 url("../assets/scenes/title_screen.jpg") 72% 50% / cover no-repeat;
  will-change: transform;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(12, 8, 18, 0.72) 0%, rgba(12, 8, 18, 0.22) 42%, rgba(12, 8, 18, 0.08) 100%),
    linear-gradient(180deg, rgba(12, 8, 18, 0.42) 0%, rgba(12, 8, 18, 0.08) 38%, rgba(12, 8, 18, 0.55) 100%);
}

.hero-frame {
  position: absolute;
  inset: 14px;
  border: 1px solid var(--gold-dim);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(36rem, calc(100% - var(--pad) * 2));
  margin: clamp(5.5rem, 12vh, 8rem) auto 0 var(--pad);
}

.hero h1 {
  font-size: clamp(2.8rem, 6.4vw, 5.4rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero h1 span { display: block; }

.hero-lead {
  max-width: 28rem;
  margin: 1.2rem 0 0;
  color: var(--mute);
  font-size: 1.32rem;
}

.hero-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.6rem auto 0 var(--pad);
}

/* Tale */
.tale { background: var(--ink); }

.tale-stage {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: stretch;
}

.tale-frame {
  margin: 0;
  border: 1px solid var(--rule);
  background: #000;
  overflow: hidden;
}

.tale-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

.tale-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  border-top: 1px solid var(--rule);
  padding: 1.6rem 0;
}

.tale-kicker {
  font-family: var(--display);
  color: var(--gold);
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  margin-bottom: 1rem;
}

.tale-line {
  display: grid;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-style: italic;
  line-height: 1.4;
}

.tale-line span {
  grid-area: 1 / 1;
  visibility: hidden;
}

.tale-line span.on { visibility: visible; }

.tale-dots {
  display: flex;
  gap: 0.55rem;
  margin: 1.6rem 0 1.2rem;
}

.tale-dots button {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  padding: 0;
}

.tale-dots button.on { background: var(--gold); }

.tale-next {
  align-self: flex-start;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-2);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.2rem;
}

/* Bleed scenes */
.bleed {
  position: relative;
  min-height: min(88vh, 820px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.bleed-art {
  position: absolute;
  left: 0;
  width: 100%;
  top: -14%;
  height: 128%;
  object-fit: cover;
  object-position: 50% 50%;
  will-change: transform;
}

.bleed-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48%;
  background: linear-gradient(180deg, transparent, rgba(12, 8, 18, 0.78));
  pointer-events: none;
}

.bleed-caption {
  position: relative;
  z-index: 1;
  width: min(var(--max), calc(100% - var(--pad) * 2));
  margin: 0 auto;
  padding: 5rem 0 3.4rem;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.village-bleed .bleed-caption {
  max-width: 26rem;
  margin-left: var(--pad);
  width: auto;
  padding: 2.2rem 0 2.6rem;
}

.ending-bleed {
  min-height: min(92vh, 900px);
  align-items: flex-start;
}

.ending-caption {
  text-align: center;
  margin: 0 auto;
  max-width: 36rem;
  padding-top: clamp(5.5rem, 12vh, 7.5rem);
}

/* Interiors */
.village-life { background: #110b17; }

.interior-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
}

.interior {
  margin: 0;
  cursor: zoom-in;
  border: 1px solid var(--rule);
  overflow: hidden;
  background: var(--plum);
}

.interior img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.interior:hover img { transform: scale(1.04); }

.interior figcaption {
  padding: 0.65rem 0.75rem 0.8rem;
  font-size: 0.95rem;
  color: var(--mute);
  background: var(--plum);
}

/* Play */
.play { background: var(--ink); }

.steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 3rem;
}

.steps li {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 1rem;
  padding: 1.35rem 0;
  border-top: 1px solid var(--rule);
}

.step-num {
  font-family: var(--display);
  color: var(--gold);
  letter-spacing: 0.12em;
  padding-top: 0.2rem;
}

.steps h3 { margin-bottom: 0.35rem; }
.steps p { color: var(--mute); font-size: 1.12rem; }

/* Heroes */
.heroes { background: radial-gradient(circle at 50% 0%, #2a1638, var(--night) 60%); }

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.hero-card {
  position: relative;
  padding: 1.4rem 1.2rem 1.2rem;
  background: rgba(20, 12, 28, 0.72);
  border: 1px solid var(--rule);
  text-align: center;
}

.hero-card .portrait {
  width: 148px;
  height: 148px;
  margin: 0 auto 0.85rem;
  object-fit: contain;
}

.hero-card .role {
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0.35rem 0 0.6rem;
}

.hero-card p:last-of-type {
  color: var(--mute);
  font-size: 1.05rem;
}

.hero-card .weapon {
  width: 36px;
  height: 36px;
  margin: 0.9rem auto 0;
  opacity: 0.9;
}

/* Traits */
.traits { background: #120c19; }

.trait-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.trait {
  padding: 1.1rem 1.1rem 1.15rem;
  border: 1px solid var(--rule);
  border-top-width: 3px;
  background: rgba(36, 22, 47, 0.45);
}

.trait.good { border-top-color: #6fb37a; }
.trait.bad { border-top-color: #c8616a; }
.trait.mixed { border-top-color: var(--gold); }

.trait-tag {
  display: block;
  font-family: var(--display);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.trait h3 { margin-bottom: 0.3rem; }
.trait p { color: var(--mute); font-size: 1.02rem; }

/* Jobs */
.jobs { background: var(--ink); }

.job-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4rem;
}

.job-label {
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

.job-list li {
  display: grid;
  grid-template-columns: 40px 1fr 36px;
  gap: 0.85rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.job-list img { width: 40px; height: 40px; object-fit: contain; }
.job-list span { display: block; color: var(--mute); font-size: 1rem; }

.brew-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.4rem;
  margin-top: 2.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
}

.brew-row li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--mute);
  font-size: 1rem;
}

.brew-row img { width: 32px; height: 32px; }

/* World */
.world { background: #100b16; }

.map-frame {
  margin: 0;
  border: 1px solid var(--rule);
  overflow: hidden;
}

.map-frame img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.chain {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem 0;
  margin-top: 1.6rem;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-2);
}

.chain li:not(:last-child)::after {
  content: "—";
  margin: 0 0.8rem;
  color: var(--gold);
  opacity: 0.55;
}

/* Features */
.features { background: var(--ink); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.feature-grid li {
  padding: 1.5rem 1.3rem 1.4rem;
  border: 1px solid var(--rule);
  background: rgba(36, 22, 47, 0.45);
}

.feature-grid img { width: 40px; height: 40px; margin-bottom: 0.9rem; }
.feature-grid h3 { margin-bottom: 0.45rem; }
.feature-grid p { color: var(--mute); font-size: 1.08rem; }

/* Download */
.download { background: #0f0a15; }

.download-box {
  text-align: center;
  padding: 3.2rem 1.4rem;
  border: 1px solid var(--rule);
  background:
    linear-gradient(180deg, rgba(36, 22, 47, 0.55), rgba(12, 8, 18, 0.2)),
    url("../assets/scenes/intro_4.jpg") center / cover;
  box-shadow: inset 0 0 0 2000px rgba(12, 8, 18, 0.72);
}

.download-box .lede { margin: 0.9rem auto 1.8rem; }

.download-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 42rem;
  margin-inline: auto;
}

.download-actions .btn {
  width: 100%;
  padding-inline: 0.9rem;
}

/* Platforms */
.platforms { background: var(--night); }
.platforms .section-head { text-align: center; }
.platforms .section-head .lede { margin-inline: auto; }

.platform-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.platform-list li { width: min(22rem, 100%); }

.platform-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  height: 100%;
  padding: 1.5rem 1.6rem 1.4rem;
  border: 1px solid var(--rule);
  border-top: 3px solid #fa5c5c;
  background: rgba(36, 22, 47, 0.45);
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.platform-card:hover { transform: translateY(-2px); background: rgba(46, 28, 60, 0.6); }

.platform-name {
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: var(--cream);
}

.platform-note { color: var(--mute); font-size: 1.05rem; }

.platform-go {
  margin-top: 0.4rem;
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-2);
}

.fine {
  margin-top: 1.1rem;
  font-size: 0.95rem;
  color: var(--mute);
}

.fine code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  color: var(--gold-2);
}

.foot {
  border-top: 1px solid var(--rule);
  padding: 1.4rem 0 2rem;
}

.foot-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

.foot-mail {
  color: var(--gold-2);
  text-decoration: none;
}

.foot-mail:hover { color: var(--gold); }

.to-top {
  position: fixed;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 35;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  background: rgba(12, 8, 18, 0.88);
  color: var(--gold-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.to-top svg { width: 1.15rem; height: 1.15rem; }

.to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.to-top:hover { transform: translateY(-2px); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 5, 12, 0.92);
  display: grid;
  place-items: center;
  padding: 3rem 1.2rem;
}

.lightbox[hidden] { display: none; }

.lightbox img {
  max-width: min(1200px, 94vw);
  max-height: 86vh;
  border: 1px solid var(--rule);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  font-family: var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold-2);
}

@media (max-width: 900px) {
  .tale-stage,
  .steps,
  .job-cols,
  .hero-grid,
  .feature-grid { grid-template-columns: 1fr; }
  .interior-grid { grid-template-columns: 1fr 1fr; }
  .hero-grid,
  .trait-grid { grid-template-columns: 1fr 1fr; }
  .hero-card:last-child { grid-column: 1 / -1; max-width: 22rem; justify-self: center; width: 100%; }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; z-index: 2; }
  .nav-mark { position: relative; z-index: 2; }
  /* Full-screen menu: the night sky of the title painting, big serif links, the download at the foot. */
  .nav-links {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 5rem var(--pad) 2.5rem;
    background:
      radial-gradient(ellipse at 50% 18%, rgba(224, 181, 106, 0.14), transparent 55%),
      linear-gradient(180deg, #24162f, #08050c);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0s linear 0.35s;
  }
  .nav.open .nav-links {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease;
  }
  .nav.open { background: transparent; backdrop-filter: none; border-bottom-color: transparent; }
  .nav-links a {
    display: block;
    width: min(18rem, 100%);
    padding: 0.85rem 0;
    text-align: center;
    font-size: 1.15rem;
    letter-spacing: 0.22em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease, color 0.2s;
    border-bottom: 1px solid var(--rule);
  }
  .nav-links a:last-of-type { border-bottom: 0; }
  .nav.open .nav-links a { opacity: 0.88; transform: none; }
  .nav.open .nav-links a:nth-child(1) { transition-delay: 0.05s; }
  .nav.open .nav-links a:nth-child(2) { transition-delay: 0.09s; }
  .nav.open .nav-links a:nth-child(3) { transition-delay: 0.13s; }
  .nav.open .nav-links a:nth-child(4) { transition-delay: 0.17s; }
  .nav.open .nav-links a:nth-child(5) { transition-delay: 0.21s; }
  .nav.open .nav-links a:nth-child(6) { transition-delay: 0.25s; }
  .nav.open .nav-links a:nth-child(7) { transition-delay: 0.29s; }
  .nav-links a.nav-download {
    margin-top: 1.8rem;
    width: auto;
    padding: 0.8rem 2.2rem;
    font-size: 0.9rem;
    border: 1px solid var(--gold);
    background: rgba(224, 181, 106, 0.08);
  }
  .nav-sub {
    display: block;
    margin-top: 1.4rem;
    font-style: italic;
    font-size: 1rem;
    color: var(--mute);
    opacity: 0;
    transition: opacity 0.4s ease 0.3s;
  }
  .nav.open .nav-sub { opacity: 1; }
  body.menu-open { overflow: hidden; }
  .hero { justify-content: space-between; }
  .hero-copy,
  .hero-actions { margin-left: var(--pad); margin-right: auto; width: auto; }
  .hero-copy { margin-top: clamp(9rem, 28vh, 16rem); }
  .hero-actions { margin-top: 0; margin-bottom: 2.2rem; }
  .hero-art { background-position: 80% 50%; }
  .village-bleed .bleed-art { object-position: 35% 50%; }
  .village-bleed .bleed-caption { margin-left: var(--pad); margin-right: var(--pad); }
  .feature-grid { grid-template-columns: 1fr; }
  .foot-row { flex-direction: column; }
  .download-actions {
    grid-template-columns: 1fr;
    max-width: 16.5rem;
  }
}

@media (max-width: 520px) {
  .interior-grid,
  .hero-grid,
  .trait-grid { grid-template-columns: 1fr; }
  .hero-card:last-child { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .parallax { transform: none !important; }
}
