/* ---------- tokens ---------- */
:root {
  --cream: #F4E9D4;
  --paper: #FBF3E4;
  --bark: #3B2418;
  --bark-soft: #6b4a34;
  --moss: #2F5233;
  --moss-light: #3f6b45;
  --amber: #E2A33D;
  --dusk: #211B42;
  --dusk-deep: #151033;
  --lavender: #8d7cca;

  --bg: var(--cream);
  --ink: var(--bark);
  --accent: var(--moss);
  --accent-ink: #ffffff;
  --card-bg: var(--paper);
  --card-border: rgba(59, 36, 24, 0.18);

  --font-display: 'Luckiest Guy', cursive;
  --font-body: 'Nunito', system-ui, sans-serif;

  color-scheme: light;
}

body.night {
  --bg: #272944;
  --ink: #EFE9FF;
  --accent: var(--lavender);
  --accent-ink: #241a4d;
  --card-bg: #48496a;
  --card-border: rgba(167, 147, 238, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  transition: background 0.6s ease, color 0.6s ease;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.5px; line-height: 1.15; margin: 0; }

h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--ink); }

p { margin: 0; }

a { color: inherit; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--moss); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

section { max-width: 1080px; margin: 0 auto; padding: 50px 24px; }

.section-intro { max-width: 60ch; color: var(--ink); opacity: 0.75; margin-top: 10px; font-size: 1.05rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 800;
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--moss);
  color: #fff;
  box-shadow: 0 4px 0 #244126;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.4s ease;
}
.btn-primary:hover { box-shadow: 0 6px 0 #244126; }
body.night .btn-primary {
  background: var(--lavender);
  color: #241a4d;
  box-shadow: 0 4px 0 #6f5bc4;
}
body.night .btn-primary:hover { box-shadow: 0 6px 0 #6f5bc4; }

.btn-ghost {
  background: transparent;
  border-color: currentColor;
  color: var(--ink);
}
.btn-small {
  padding: 9px 18px; font-size: 0.9rem; border-radius: 8px;
  background: var(--moss); color: #fff; box-shadow: 0 3px 0 #244126;
  transition: transform 0.15s ease, background 0.4s ease, box-shadow 0.4s ease;
}
.btn-small:hover { transform: translateY(-1px); }
body.night .btn-small {
  background: var(--lavender);
  color: #241a4d;
  box-shadow: 0 3px 0 #6f5bc4;
}

.btn {
  font-family: inherit;
  font-size: inherit;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
}
.brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-decoration: none;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.brand-mark { font-size: 1.3em; }
.topnav { display: flex; gap: 22px; }
.topnav a {
  text-decoration: none;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.8;
  font-size: 0.95rem;
}
.topnav a:hover { opacity: 1; }

@media (max-width: 640px) {
  .topnav { display: none; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  max-width: none;
  padding: 0;
  min-height: 92vh;
  display: flex; align-items: flex-end;
  overflow: hidden;
}

.hero-sky {
  position: absolute; inset: 0;
  overflow: hidden;
  background: #151033; /* shows briefly only if images are still loading */
}

.hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center bottom;
}
.hero-bg-day { opacity: 1; z-index: 1; }
.hero-bg-night { opacity: 0; z-index: 2; transition: opacity 1.8s ease; }
body.night .hero-bg-night { opacity: 1; }

.stars { position: absolute; inset: 0; opacity: 0; transition: opacity 1.8s ease; z-index: 3; }
body.night .stars { opacity: 1; }
.stars span {
  position: absolute; width: 3px; height: 3px; background: #fff; border-radius: 50%;
  animation: twinkle 3.5s ease-in-out infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* Torn/pencil-scratch transition where the hero photo meets the solid
   page background below it. A solid block in var(--bg) (so it matches
   day/night automatically) is run through an SVG displacement filter,
   which breaks its top edge into a rough, hand-drawn line instead of a
   hard rectangle. Sits above the photo layers, below the hero copy. */
.hero-tear {
  position: absolute;
  left: -6%; right: -6%; bottom: -6%;
  height: 60px;
  background: var(--bg);
  transition: background 0.6s ease;
  filter: url(#tornEdge);
  z-index: 4;
  pointer-events: none;
}

@media (max-width: 640px) {
  .hero-tear { height: 80px; }
}

/* day/night indicator — recreated from the in-game DayNightIndicator circle.
   Sits centered at the very top of the hero; .dn-mount clips it so only the
   bottom half pokes down, like a hanging badge.

   To resize the whole thing, just change --dn-size below — everything
   else (the visible half, the ring, the circle, the arrow reach) scales
   off of it automatically. */
.dn-mount {
  --dn-size: 220px;

  position: absolute; top: -1.5%; left: 50%;
  transform: translateX(-50%) scale(1);
  transition: transform 0.25s ease;
  width: var(--dn-size);
  height: calc(var(--dn-size) * 0.55); /* how much of it pokes down */
  overflow: hidden;
  z-index: 6;
  pointer-events: none; /* re-enabled on the button itself below */
  filter: drop-shadow(0 6px 10px rgba(51,51,51,0));
}

.dn-mount:has(button:hover),
.dn-mount:has(button:focus-visible) {
  transform: translateX(-50%) scale(1.09);
}

.dn-indicator {
  position: absolute; left: 0;
  top: calc(-1 * (var(--dn-size) - (var(--dn-size) * 0.53)));
  width: var(--dn-size); height: var(--dn-size);
  background: none; border: none; padding: 0; cursor: pointer;
  pointer-events: auto;
}
.dn-indicator:focus-visible { outline-offset: 4px; }

/* .dn-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.65);
  pointer-events: none;
} */

/* This is the piece that spins — swap the <img> src to use your own art.
   It should be a square image with the "night" design on the top half and
   the "day" design on the bottom half: only the bottom half is ever
   visible at rest, and a 180deg spin swaps which half sits there.
   See README for exact steps. */
.dn-circle {
  position: absolute; inset: 6px;
  width: calc(100% - 12px); height: calc(100% - 12px);
  border-radius: 50%;
  object-fit: cover;
  display: block;
  /* box-shadow: inset 0 0 0 2px rgba(0,0,0,0.15); */
  transform-origin: center;
  will-change: transform;
}

/* the little pointer/hand, recreated from the Unity "_arrow" element —
   hangs from the center, pointing down into the visible half.
   Two identically-positioned triangles, one per color, cross-fade their
   opacity — smoother than snapping border-color directly. */
.dn-arrow {
  position: absolute; top: 25%; left: 50%;
  width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  transform: translate(-50%, -50%) rotate(0deg) translateY(calc(var(--dn-size) * 0.3));
  will-change: transform, opacity;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(51,51,51,0));
  transition: opacity 1.8s ease;
}
.dn-arrow-day { border-top: 16px solid var(--bark); opacity: 1; }
.dn-arrow-night { border-top: 16px solid #EFE9FF; opacity: 0; }

.hero-copy {
  position: relative; z-index: 3;
  padding: 40px 24px 64px;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.hero-title {
  font-size: clamp(2.6rem, 8vw, 5rem);
  color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,0.25), 0 10px 24px rgba(0,0,0,0.25);
}
.hero-tag {
  margin: 18px auto 0;
  max-width: 56ch;
  font-size: 1.15rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
/* .hero-phase {
  margin-top: 18px;
  font-weight: 800;
  color: #fff;
  background: rgba(0,0,0,0.28);
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
} */
.hero-ctas { margin-top: 30px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-ctas .btn-ghost { color: #fff; }
.hero-meta { margin-top: 18px; color: #fff; opacity: 0.85; font-size: 0.9rem; }

/* ---------- phases ---------- */
.phase-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 20px; }
@media (max-width: 720px) { .phase-grid { grid-template-columns: 1fr; } }

.phase-card {
  border-radius: 16px;
  padding: 32px;
  border: 2px solid var(--card-border);
}
.phase-card h3 { font-size: 1.3rem; margin-bottom: 16px; }
.phase-card ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }

.phase-day {
  background: linear-gradient(160deg, var(--paper), #F0DFC0);
  color: var(--bark);
}
.phase-day h3 { color: var(--moss); }

.phase-night {
  background: linear-gradient(160deg, #3A3567, #2E3849);
  color: #EFE9FF;
}
.phase-night h3 { color: var(--lavender); }

/* ---------- screenshots ---------- */
.screens-zigzag {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 0px;
}

/* The polaroid frame. box-sizing: border-box makes the border and padding
   count *inside* the width below, so when max-width shrinks the whole
   frame on narrow screens, the border/padding shrink along with it as
   one solid block — nothing gets left oversized or squished. */
.screen-frame {
  box-sizing: border-box;
  width: 650px;
  max-width: 88%;
  background: #fff;
  padding: 10px; /* fixed at normal/desktop sizes */
  border: 3px solid var(--bark);
  border-radius: 6px;
  box-shadow: 0 0px 0 var(--bark), 0 14px 26px rgba(0,0,0,0.5);
  transform: rotate(-3deg);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  align-self: flex-start; /* odd frames (1st, 3rd, 5th...) sit left */
}
.screens-zigzag .screen-frame:nth-child(2n) {
  align-self: flex-end;  /* even frames sit right */
  transform: rotate(5deg);
}
.screens-zigzag .screen-frame:nth-child(3n) { transform: rotate(-2deg); }
.screens-zigzag .screen-frame:hover {
  transform: rotate(0deg) scale(1.04) translateY(-6px);
  box-shadow: 0 0px 0 var(--bark), 0 20px 34px rgba(0,0,0,0.4);
  z-index: 2;
}

/* Only below this breakpoint does the frame actually shrink (max-width:
   88% starts biting once the viewport is narrower than the 360px base
   width) — so only there does the border need to shrink with it. Above
   this width, padding stays a fixed 10px and never grows. */
@media (max-width: 409px) {
  .screen-frame { padding: 2.8%; }
}

/* The image itself: full width of the frame's inner area, height auto so
   it always keeps its real, uncropped aspect ratio — no cover, no fixed
   height, nothing fighting over the shape. */
.screen-frame img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- trailer ---------- */
.video-frame {
  margin-top: 20px;
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid var(--bark);
  box-shadow: 0 10px 0 var(--bark);
}
body.night .video-frame { border-color: var(--lavender); box-shadow: 0 10px 0 var(--lavender); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- crew ---------- */
.crew-zigzag {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}
.crew-card {
  --crew-photo-inset: 20px;

  display: flex;
  align-items: center;
  gap: 60px;
  text-decoration: none;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 999px;
  padding: 14px 32px 14px 14px;
  width: 100%;
  max-width: 550px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.crew-zigzag .crew-card:nth-child(2n) {
  align-self: flex-end;
  flex-direction: row-reverse;
  padding: 14px 14px 14px 32px;
  text-align: right;
}
.crew-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.crew-card .crew-photo { transform: translateX(var(--crew-photo-inset)); }
.crew-zigzag .crew-card:nth-child(2n) .crew-photo {
  transform: translateX(calc(0px - var(--crew-photo-inset)));
}

.crew-photo {
  flex: 0 0 auto;
  width: 135px; height: 135px;
  border-radius: 50%;
  overflow: hidden;
  border: 0px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
}
.crew-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.crew-text { display: flex; flex-direction: column; }
.crew-name { display: block; font-family: var(--font-display); font-size: 1.25rem; color: var(--ink); }
.crew-role { display: block; margin-top: 4px; font-size: 1.0rem; opacity: 0.75; }

@media (max-width: 640px) {
  .crew-card, .crew-zigzag .crew-card:nth-child(2n) {
    align-self: stretch; max-width: none;
    flex-direction: row; padding: 12px 20px 12px 12px; text-align: left;
  }
  .crew-card .crew-photo { transform: translateX(var(--crew-photo-inset)); }
  .crew-photo { width: 84px; height: 84px; }
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 48px 24px 60px;
  text-align: center;
  color: var(--ink);
}
.footer-top { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.footer-top .brand-mark { font-size: 1.2rem; }
.footer-links { margin-top: 14px; display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.footer-links a { text-decoration: none; font-weight: 700; opacity: 0.8; }
.footer-links a:hover { opacity: 1; }
.footer-tags { margin-top: 16px; font-size: 0.85rem; opacity: 0.6; }