/* Heimr — heimrgame.com
 *
 * One bold element: the planet's horizon. The screenshot of the world sits
 * behind the hero, and the page below rises over it as a curved edge with an
 * atmospheric rim, the same horizon the game's start menu draws. Everything
 * else stays quiet.
 */

@font-face {
  font-family: "Jost";
  src: url("/fonts/jost.woff2") format("woff2");
  font-weight: 300 500;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4.woff2") format("woff2");
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --night: #0A1424;   /* the sky above the atmosphere, and the page */
  --dusk: #1B3150;    /* the upper sky, panels */
  --haze: #8FB0D8;    /* the game's sky blue: the one accent */
  --snow: #ECF1F7;    /* text */
  --mist: #A9B8CB;    /* secondary text */
  --moss: #6E9A5A;    /* the planet's rim light, nowhere else */

  --display: "Jost", "Futura", "Century Gothic", sans-serif;
  --text: "Source Serif 4", "Iowan Old Style", Georgia, serif;

  /* Type scale: a fourth (1.333) from 18 px body. */
  --step-0: 1.125rem;
  --step-1: 1.5rem;
  --step-2: 2rem;
  --step-3: clamp(2.2rem, 1.6rem + 2.4vw, 2.67rem);
  --wordmark: clamp(3.4rem, 1.2rem + 9vw, 8.5rem);

  --measure: 34rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

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

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

body {
  margin: 0;
  background: var(--night);
  color: var(--snow);
  font-family: var(--text);
  font-size: var(--step-0);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--haze); text-underline-offset: 0.18em; }
a:hover { color: var(--snow); }
:focus-visible { outline: 2px solid var(--haze); outline-offset: 3px; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: min(96vh, 60rem);
  display: grid;
  align-content: start;
  justify-items: center;
  text-align: center;
  overflow: hidden;
  /* Its own stacking context, so the view and the sky gradient (negative
     z-index) stay above the page background. */
  isolation: isolate;
  padding: clamp(5rem, 14vh, 9rem) var(--gutter) 0;
}

/* The world itself, anchored to the bottom so the horizon sits low. */
.hero-view {
  position: absolute;
  inset: auto 0 0 0;
  width: 100%;
  height: 62%;
  object-fit: cover;
  object-position: 50% 22%;
  z-index: -2;
  /* The screenshot's own sky melts into the night above it: no edge. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 38%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 38%);
}

/* Night above, fading into the game's own sky. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom,
    var(--night) 0%,
    var(--night) 22%,
    rgba(27, 49, 80, 0.72) 42%,
    rgba(27, 49, 80, 0) 62%);
}

.hero-text {
  max-width: 44rem;
  /* A faint halo of night behind the words, so the small lines stay
     readable over the treetops without a visible box. */
  background: radial-gradient(ellipse 60% 55% at 50% 72%, rgba(10, 20, 36, 0.55), transparent 75%);
  text-wrap: balance;
}

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--wordmark);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.36em;
  /* Tracking adds space after the last letter too; give it back so the
     word is centred on its letters. */
  margin-right: -0.36em;
  color: var(--snow);
}

/* The beta marker: small, set against the wordmark's baseline, in the
   accent colour, untracked so it reads as a note, not part of the name. */
.beta {
  display: inline-block;
  vertical-align: super;
  margin-left: -0.2em;
  padding: 0.18em 0.55em 0.2em;
  border: 1px solid var(--haze);
  border-radius: 999px;
  font-size: max(0.16em, 0.8rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: none;
  color: var(--haze);
}

.tagline {
  margin: 1.1rem 0 2.2rem;
  font-style: italic;
  font-size: var(--step-1);
  line-height: 1.3;
  color: var(--mist);
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.button {
  display: inline-block;
  padding: 0.72rem 1.35rem;
  border-radius: 0.6rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--snow);
  border: 1px solid rgba(143, 176, 216, 0.45);
  background: rgba(10, 20, 36, 0.35);
  backdrop-filter: blur(6px);
}
.button:hover { border-color: var(--haze); color: var(--snow); }
.button.primary {
  background: var(--haze);
  border-color: var(--haze);
  color: var(--night);
  font-weight: 500;
}
.button.primary:hover { background: var(--snow); border-color: var(--snow); color: var(--night); }

.release-line, .invite { text-shadow: 0 1px 12px rgba(10, 20, 36, 0.9), 0 0 2px rgba(10, 20, 36, 0.8); }

.invite {
  margin: 0.4rem auto 0;
  max-width: 30rem;
  font-size: 0.95rem;
  color: var(--mist);
}

.release-line {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  color: var(--mist);
}

/* ---------- the horizon ---------- */

.surface {
  position: relative;
  margin-top: -9vw;
  padding: clamp(4rem, 10vw, 8rem) var(--gutter) 2rem;
}

/* The planet's edge: the top of a very wide dome, lit along the rim like
   an atmosphere seen from orbit. It lives in its own clipped strip, so only
   the arc shows: not the dome's sides or bottom, and no sideways scroll. */
.horizon {
  position: absolute;
  left: 0;
  right: 0;
  top: -5rem;
  height: calc(5rem + 24vw);
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.horizon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 5rem;
  width: 240vw;
  height: 120vw;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--night);
  box-shadow:
    0 -2px 0 rgba(143, 176, 216, 0.55),
    0 -10px 36px rgba(143, 176, 216, 0.35),
    0 -2px 90px rgba(110, 154, 90, 0.18);
}

.surface > *:not(.horizon) { position: relative; z-index: 1; }

/* ---------- chapters ---------- */

.chapter {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) 0;
  display: grid;
  gap: clamp(1.75rem, 4vw, 4rem);
  grid-template-columns: minmax(0, var(--measure)) minmax(0, 1fr);
  align-items: center;
}
.chapter.together { grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)); }
.chapter.together .chapter-text { order: 2; }
.chapter.plain { grid-template-columns: minmax(0, var(--measure)); }

.chapter h2 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--step-3);
  line-height: 1.12;
  letter-spacing: 0.01em;
}

.chapter p { margin: 0 0 1rem; max-width: var(--measure); }

.chapter-image { margin: 0; }
.chapter-image img {
  width: 100%;
  border-radius: 0.9rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* The one real sequence on the page. */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 1.5rem 0 1.5rem;
  padding: 0;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.4rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(143, 176, 216, 0.5);
  font-family: var(--display);
  font-size: 1rem;
  color: var(--haze);
}
.steps h3 {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.3;
}
.steps p { margin: 0; }

/* A join code, drawn like the game's invite pill. */
.code {
  display: inline-block;
  padding: 0.05em 0.6em;
  border-radius: 999px;
  background: var(--dusk);
  border: 1px solid rgba(143, 176, 216, 0.4);
  font-family: var(--display);
  font-size: 0.95em;
  letter-spacing: 0.03em;
  white-space: nowrap;
  color: var(--snow);
}

.aside { color: var(--mist); font-size: 1rem; }

/* ---------- footer ---------- */

.footer {
  padding: 3rem var(--gutter) 4rem;
  text-align: center;
  color: var(--mist);
  font-size: 0.95rem;
}
.footer p { margin: 0 auto; max-width: 40rem; }

/* ---------- the access-key dialog ---------- */

button.button { cursor: pointer; font: inherit; font-family: var(--display); font-size: 1.05rem; }
button.button:disabled { opacity: 0.55; cursor: progress; }

.key-dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: 1.75rem 1.75rem 1.5rem;
  border: 1px solid rgba(143, 176, 216, 0.45);
  border-radius: 0.9rem;
  background: var(--dusk);
  color: var(--snow);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.key-dialog::backdrop { background: rgba(10, 20, 36, 0.72); backdrop-filter: blur(3px); }
.key-dialog h2 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--step-1);
  line-height: 1.2;
}
.key-help { margin: 0 0 1.25rem; color: var(--mist); font-size: 1rem; }
.key-label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--mist);
}
.key-dialog input {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(143, 176, 216, 0.45);
  border-radius: 0.5rem;
  background: var(--night);
  color: var(--snow);
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.key-dialog input::placeholder { color: rgba(169, 184, 203, 0.45); }
.key-dialog input:focus { outline: 2px solid var(--haze); outline-offset: 1px; border-color: var(--haze); }
.key-message { min-height: 1.6em; margin: 0.6rem 0 0.9rem; font-size: 0.95rem; color: var(--haze); }
.key-buttons { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }

/* ---------- the releases page ---------- */

.page-head, .releases, .verify {
  max-width: 46rem;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.page-head { padding-top: clamp(3rem, 9vh, 6rem); padding-bottom: 1rem; }
.wordmark.small {
  display: inline-block;
  font-size: 1.1rem;
  letter-spacing: 0.36em;
  text-decoration: none;
  animation: none;
}
.page-head h1 {
  margin: 1.5rem 0 0.75rem;
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--step-3);
  line-height: 1.1;
}
.lede { margin: 0; color: var(--mist); }
.muted { color: var(--mist); }

.release {
  padding: 2rem 0;
  border-top: 1px solid rgba(143, 176, 216, 0.2);
}
.release:first-child { border-top: 0; }
.release-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 1rem; }
.release-head h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--step-2);
  line-height: 1.2;
}
.release-head .beta { margin-left: 0.6rem; font-size: 0.8rem; vertical-align: middle; }
.release-head p { margin: 0; font-size: 0.95rem; }
.release-notes { margin: 0.75rem 0 0; white-space: pre-line; }
.release-files { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 0.9rem; }
.release-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.release-files .button { min-width: 8.5rem; text-align: center; }
.file-meta { display: grid; min-width: 0; font-size: 0.9rem; color: var(--mist); }
.sha {
  font-size: 0.72rem;
  color: rgba(169, 184, 203, 0.7);
  overflow-wrap: anywhere;
}

.verify { padding-top: 2rem; padding-bottom: 1rem; font-size: 1rem; color: var(--mist); }
.verify h2 { font-family: var(--display); font-weight: 400; font-size: var(--step-1); color: var(--snow); margin: 0 0 0.6rem; }
.verify pre {
  margin: 0.75rem 0 0;
  padding: 0.8rem 1rem;
  border-radius: 0.5rem;
  background: var(--dusk);
  overflow-x: auto;
  font-size: 0.8rem;
  color: var(--snow);
}

/* ---------- the one moment ----------
   On load the planet's edge rises into place and the wordmark's letters
   settle together, once. */

@media (prefers-reduced-motion: no-preference) {
  .surface { animation: rise 1.6s cubic-bezier(0.2, 0.7, 0.1, 1) both; }
  .wordmark { animation: settle 1.8s cubic-bezier(0.2, 0.7, 0.1, 1) both; }
}
@keyframes rise {
  from { transform: translateY(6vw); }
  to { transform: none; }
}
@keyframes settle {
  from { letter-spacing: 0.62em; margin-right: -0.62em; opacity: 0; }
  to { letter-spacing: 0.36em; margin-right: -0.36em; opacity: 1; }
}

/* ---------- small screens ---------- */

@media (max-width: 52rem) {
  .chapter,
  .chapter.together { grid-template-columns: minmax(0, 1fr); }
  .chapter.together .chapter-text { order: 0; }
  .hero { min-height: 88vh; }
  .hero-view { height: 58%; }
  .surface { margin-top: -14vw; }
}
