:root {
  --bg: #05090f;
  --bg-logo: #0c1117;
  --ink: #e8ebf0;
  --muted: #8b93a1;
  --hairline: rgba(232, 235, 240, 0.14);
  --hairline-strong: rgba(232, 235, 240, 0.32);
  --frost: #d6e6f2;

  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;

  --gutter: max(16px, 5vw);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: dark;
}

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

html {
  background: var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  display: block;
}

/* Film grain */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Shared type */
.label {
  margin: 0 0 1.75rem;
  padding-left: 0.42em; /* balances trailing letter-spacing */
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--muted);
}

.link {
  position: relative;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  padding-bottom: 4px;
}

.link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--hairline-strong);
  transform: scaleX(0.35);
  transition: transform 0.6s var(--ease), background-color 0.6s var(--ease);
}

.link:hover::after,
.link:focus-visible::after {
  transform: scaleX(1);
  background: var(--ink);
}

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 6px;
}

/* Hero */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 480px;
  overflow: hidden;
  background: var(--bg);
}

.hero__title {
  margin: 0;
  height: 100%;
}

.hero__art,
.hero__img {
  width: 100%;
  height: 100%;
}

.hero__art {
  display: block;
  animation: arrive 2.6s var(--ease) both;
}

.hero__img {
  object-fit: cover;
  object-position: 54% 45%;
  animation: breathe 28s ease-in-out 2.6s infinite alternate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 28%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

/* Portrait screens get the stacked lockup so the wordmark never crops */
@media (max-aspect-ratio: 5/4) {
  .hero {
    background: var(--bg-logo);
  }

  .hero__img {
    object-fit: contain;
    object-position: 50% 44%;
  }
}

@keyframes arrive {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes breathe {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 4vh, 40px);
  z-index: 2;
  width: 44px;
  height: 64px;
  margin-left: -22px;
  animation: arrive 1.6s var(--ease) 2s both;
}

.scroll-cue::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--hairline-strong);
}

.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 5px;
  height: 5px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--ink);
  animation: drift 3.4s ease-in-out infinite;
}

@keyframes drift {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(51px); opacity: 0; }
}

/* Studio */
.studio {
  padding: clamp(96px, 18vh, 200px) var(--gutter) clamp(72px, 12vh, 140px);
  text-align: center;
}

.lede {
  max-width: 30ch;
  margin: 0 auto;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  line-height: 1.3;
  text-wrap: balance;
}

/* Divider, echoing the crosshair ticks in the mark */
.horizon {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(560px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
}

.horizon::before,
.horizon::after {
  content: "";
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
}

.horizon i {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--hairline-strong));
  transform-origin: right;
}

.horizon i:last-child {
  background: linear-gradient(to left, transparent, var(--hairline-strong));
  transform-origin: left;
}

.horizon b {
  flex: none;
  width: 9px;
  height: 9px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

/* Providence */
.game {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 120px var(--gutter);
  overflow: hidden;
  overflow: clip;
  text-align: center;
  isolation: isolate;
}

.orbits {
  position: absolute;
  top: 70%; /* PROVIDENCE baseline within the logo image */
  left: 50%;
  z-index: -1;
  width: min(880px, 150vw);
  height: auto;
  transform: translate(-50%, -50%);
  fill: none;
  stroke: var(--hairline);
  stroke-width: 1;
  pointer-events: none;
}

.orbits__glow {
  fill: url(#glow);
  stroke: none;
}

.orbits__axis {
  stroke: var(--hairline);
}

.orbits__node {
  fill: var(--muted);
  stroke: none;
}

.orbit {
  transform-box: view-box;
  transform-origin: 50% 50%;
}

.orbit--outer circle:first-child {
  stroke-dasharray: 1 7;
  stroke: var(--hairline-strong);
}

.orbit--outer { animation: spin 240s linear infinite; }
.orbit--mid { animation: spin 160s linear infinite reverse; }
.orbit--inner { animation: spin 110s linear infinite; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.game__title {
  position: relative;
  width: min(900px, 92vw);
  margin: 0;
}

.game__link {
  display: block;
}

.game__logo {
  width: 100%;
  height: auto;
  transition: filter 0.6s var(--ease), transform 0.6s var(--ease);
}

.game__link:hover .game__logo,
.game__link:focus-visible .game__logo {
  filter: brightness(1.12) drop-shadow(0 0 18px rgba(214, 230, 242, 0.22));
  transform: scale(1.015);
}

.game__line {
  margin: 0.5rem 0 0;
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  color: var(--muted);
  text-wrap: balance;
}

/* Footer */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: clamp(48px, 8vh, 96px) var(--gutter) 48px;
  text-align: center;
}

.footer__mark {
  width: 44px;
  height: 44px;
  opacity: 0.85;
}

.footer__legal {
  margin: 12px 0 0;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Providence page */
.snow {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.topbar {
  position: absolute;
  top: clamp(16px, 3vh, 28px);
  left: var(--gutter);
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 0.4s var(--ease);
}

.topbar:hover,
.topbar:focus-visible {
  opacity: 1;
}

.topbar img {
  width: 22px;
  height: 22px;
}

.page-providence .hero {
  background: var(--bg);
}

/* More specific than the homepage's portrait rule, so the photo always fills the frame */
.page-providence .hero__img {
  object-fit: cover;
  object-position: 25% 55%; /* keeps the lit tent in frame on narrow screens */
}

.pv-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: 38%;
  background: linear-gradient(to bottom, rgba(5, 9, 15, 0.7), transparent);
  pointer-events: none;
}

.pv-hero__title {
  position: absolute;
  top: clamp(64px, 11vh, 120px);
  left: 50%;
  z-index: 2;
  width: min(820px, 90vw);
  margin: 0;
  transform: translateX(-50%);
  animation: arrive 2.6s var(--ease) 0.6s both;
}

.pv-hero__title img {
  width: 100%;
  height: auto;
}

.pv-intro {
  padding-bottom: clamp(56px, 9vh, 96px);
}

.pv-quote {
  max-width: 24ch;
  margin: 0 auto;
  font-style: italic;
  font-size: clamp(1.8rem, 4.4vw, 3.2rem);
  line-height: 1.25;
  text-wrap: balance;
}

.pv-stills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px);
  width: min(1120px, calc(100% - 2 * var(--gutter)));
  margin: clamp(72px, 12vh, 140px) auto 0;
}

.pv-frame {
  position: relative;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--hairline);
}

.pv-frame--wide {
  grid-column: 1 / -1;
}

/* Crosshair ticks at two corners, after the mark */
.pv-frame::before,
.pv-frame::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: solid var(--frost);
  opacity: 0.6;
}

.pv-frame::before {
  top: -4px;
  left: -4px;
  border-width: 1px 0 0 1px;
}

.pv-frame::after {
  right: -4px;
  bottom: -4px;
  border-width: 0 1px 1px 0;
}

.pv-frame img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.pv-status {
  padding: clamp(80px, 14vh, 160px) var(--gutter) 0;
  text-align: center;
}

.pv-status .label {
  margin: 0;
}

@media (max-width: 640px) {
  .pv-stills {
    grid-template-columns: 1fr;
  }
}

/* 404 */
.lost {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100vh;
  min-height: 100svh;
  padding: 48px var(--gutter);
  text-align: center;
}

.lost .footer__mark {
  margin-bottom: 32px;
}

.lost__title {
  margin: 0 0 40px;
  font-weight: 300;
  font-size: clamp(2.6rem, 9vw, 5rem);
  line-height: 1.05;
}

/* Scroll reveals (only when JS is running) */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 1.4s var(--ease) var(--d, 0ms),
    transform 1.4s var(--ease) var(--d, 0ms);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.js .horizon.reveal {
  transform: none;
}

.js .horizon i {
  transform: scaleX(0);
  transition: transform 1.8s var(--ease) 0.2s;
}

.js .horizon.is-visible i {
  transform: scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .js .horizon i {
    transform: none;
  }
}
