/* The landing page. It follows docs/design.md like the app: the same
   space and type scales, roles over palette colours, and no boxes: space
   groups content, and a faint tint marks what needs marking.
   The colours themselves are in palette.css, shared with the app. */

:root {
  color-scheme: dark;

  --surface-page: var(--epic-950);
  --text: var(--white);
  --text-soft: var(--epic-200);
  --text-muted: var(--epic-400);
  --accent: var(--soft-periwinkle);
  --button-primary: var(--dusty-grape);
  --button-primary-text: var(--white);
  --warm: var(--mustard);
  /* "For free" in the hero: the good-news colour, on one phrase only. */
  --free: var(--tropical-mint);
  /* The hint by the fire: warm, so it reads as part of the scene. */
  --hint: var(--mustard);
  --bubble-bg: var(--white);
  --bubble-text: var(--epic-950);

  /* Space: the app's scale. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --gutter: clamp(var(--space-4), 6vw, var(--space-7));

  /* Sizes: the app's Major Third scale, two steps further up for the
     landing page's hero (55, 69). The page body reads at 18. */
  --text-sm: 12px;
  --text-base: 14px;
  --text-md: 18px;
  --text-lg: 22px;
  --text-xl: 28px;
  --text-2xl: 34px;
  --text-3xl: 44px;
  --text-4xl: 55px;
  --text-5xl: 69px;
  --weight-regular: 400;
  --weight-medium: 600;
  --weight-strong: 700;
  --weight-display: 800;

  --radius-control: 10px;
  --radius: 14px;
  /* Hearth's own column in the comparison: a faint tint, not a box. */
  --ours: color-mix(in srgb, var(--soft-periwinkle) 12%, transparent);

  /* Type: a pixel face for headings, like the logo and the scene, and a
     rounded face for reading. Both are SIL Open Font License, served from
     this site (fonts/). */
  --font-display: "Pixelify Sans", ui-monospace, monospace;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --duration-quick: 0.15s;

  /* The night scene reads these when it starts. */
  --scene-sky-top: var(--night-990);
  --scene-sky-middle: var(--indigo-800);
  --scene-sky-horizon: var(--dusk-800);
  --scene-star: var(--moon-100);
  --scene-moon: var(--moon-100);
  --scene-crater: var(--moon-300);
  --scene-hill-far: var(--indigo-900);
  --scene-hill-near: var(--night-900);
  --scene-ground: var(--grass-800);
  --scene-grass: var(--grass-700);
  --scene-glow: var(--ember-600);
  --scene-log: var(--dirt-600);
  --scene-log-shadow: var(--dirt-800);
}

@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/pixelify-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface-page);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: var(--weight-regular) var(--text-md) / 1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* The night scene sits behind everything and stays put while the page
   scrolls, so the fire is always in view. */
#night {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  z-index: 0;
}

/* A scrim behind the words, not a box: the left darkens so text reads over
   the stars, and the fire on the right stays bright. On a narrow screen
   the words cover the width, so the scrim does too. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  /* Above the scene, below the words. */
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--surface-page) 88%, transparent) 0%,
    color-mix(in srgb, var(--surface-page) 70%, transparent) 50%,
    transparent 78%
  );
}

@media (max-width: 900px) {
  body::before {
    background: color-mix(in srgb, var(--surface-page) 88%, transparent);
  }

  /* The fire sits under the words here, so its hint would cover them. */
  .poke {
    display: none;
  }
}

.top,
main,
footer {
  position: relative;
  z-index: 2;
}

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

/* ---- Top bar ---- */

.top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--gutter);
}

.brand {
  font: var(--weight-strong) var(--text-xl) / 1 var(--font-display);
}

/* Said plainly where it is always in view: this is early software. */
.stage {
  margin-left: var(--space-2);
  color: var(--warm);
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
}

main {
  padding: 0 var(--gutter);
}

/* ---- Hero: what it is, and the download. ---- */

.hero {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-4);
  min-height: calc(100vh - 88px);
  max-width: 680px;
  padding-bottom: var(--space-7);
}

h1 {
  font: var(--weight-strong) clamp(var(--text-3xl), 5.6vw, var(--text-5xl)) / 1.02 var(--font-display);
  text-wrap: balance;
}

.free {
  color: var(--free);
}

.lead {
  max-width: 540px;
  color: var(--text-soft);
  font-size: var(--text-lg);
  line-height: 1.45;
}

.download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.button {
  display: inline-block;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-control);
  font-size: var(--text-md);
  font-weight: var(--weight-display);
  text-decoration: none;
  transition: filter var(--duration-quick) ease;
}

.primary {
  background: var(--button-primary);
  color: var(--button-primary-text);
  box-shadow: 0 12px 40px -12px color-mix(in srgb, var(--button-primary) 90%, transparent);
}

.primary:hover {
  filter: brightness(1.12);
}

.primary:active {
  filter: brightness(0.95);
}

/* The facts under the button, one line, set apart by dots. */
.meta {
  flex-basis: 100%;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.meta > span:not([hidden]) + span::before {
  content: "\00b7";
  margin: 0 var(--space-2);
}

.meta .other {
  margin-left: var(--space-3);
  color: var(--text-soft);
}

.download [class*="for-"],
.download .on-phone {
  display: none;
}

.download[data-platform="mac"] .for-mac,
.download[data-platform="windows"] .for-windows {
  display: inline-block;
}

/* Linux, or a computer that does not say: both buttons, side by side. */
.download[data-platform="other"] .button {
  display: inline-block;
}

.download[data-platform="other"] .meta span {
  display: inline;
}

.download[data-platform="phone"] .on-phone {
  display: block;
}

/* Before the first release, the buttons would lead nowhere. */
.download.unreleased .button,
.download.unreleased .other {
  display: none !important;
}

/* ---- Sections: a title and what it says, grouped by space alone. ---- */

.section {
  display: grid;
  gap: var(--space-5);
  max-width: 780px;
  padding: var(--space-7) 0;
}

h2 {
  font: var(--weight-strong) var(--text-3xl) / 1.1 var(--font-display);
}

h3 {
  font: var(--weight-strong) var(--text-lg) / 1.2 var(--font-display);
}

.section p,
.section li,
.section dd,
.section td {
  color: var(--text-soft);
}

.intro {
  max-width: 560px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  align-content: start;
  gap: var(--space-2);
}

.art {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-2);
  image-rendering: pixelated;
}

.steps li:hover .art {
  animation: bob 0.6s ease-in-out infinite alternate;
}

@keyframes bob {
  to {
    transform: translateY(-4px);
  }
}

/* The comparison: Hearth's column is tinted; the rest reads as plain
   text, lined up by the table alone. */
.table-scroll {
  overflow-x: auto;
}

.compare {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.compare th,
.compare td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
}

.compare thead th {
  padding-top: var(--space-3);
  color: var(--text);
  font: var(--weight-strong) var(--text-md) / 1.2 var(--font-display);
}

.compare tbody th {
  color: var(--text-muted);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

/* On a phone the table scrolls sideways; the row names stay in view. */
@media (max-width: 760px) {
  .compare tbody th,
  .compare thead td {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface-page);
  }
}

.compare .ours {
  background: var(--ours);
  color: var(--text);
  font-weight: var(--weight-strong);
}

.compare thead .ours {
  border-radius: var(--radius) var(--radius) 0 0;
}

.compare tbody tr:last-child .ours {
  padding-bottom: var(--space-3);
  border-radius: 0 0 var(--radius) var(--radius);
}

.notes {
  display: grid;
  gap: var(--space-3);
  max-width: 600px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A warm pixel square marks each note, like a spark from the fire. */
.notes li {
  position: relative;
  padding-left: var(--space-5);
}

.notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 8px;
  height: 8px;
  background: var(--warm);
}

.first-open {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  margin: 0;
}

.first-open div {
  display: grid;
  align-content: start;
  gap: var(--space-2);
}

.first-open dt {
  font: var(--weight-strong) var(--text-lg) / 1.2 var(--font-display);
}

.first-open dd {
  margin: 0;
}

.first-open b {
  color: var(--text);
  font-weight: var(--weight-strong);
}

@media (max-width: 760px) {
  .steps,
  .first-open {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
  }
}

footer {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-7) var(--gutter) var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* The pixel face draws "fi" as one glyph that reads like an "A". Last in
   the sheet, because a `font` shorthand above resets it. */
h1,
h2,
h3,
.brand,
.compare thead th,
.first-open dt {
  font-variant-ligatures: none;
}

/* Little things the scene puts on top of itself. */

.poke {
  position: fixed;
  z-index: 2;
  margin: 0;
  color: var(--hint);
  font: var(--weight-strong) var(--text-base) / 1 var(--font-display);
  font-variant-ligatures: none;
  transform: translate(-50%, 0);
  pointer-events: none;
  transition: opacity 0.6s ease;
  animation: hint 2.4s ease-in-out infinite;
}

.poke.done {
  opacity: 0;
}

@keyframes hint {
  50% {
    transform: translate(-50%, -4px);
  }
}

.bubble {
  position: fixed;
  z-index: 3;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--bubble-bg);
  color: var(--bubble-text);
  font: var(--weight-strong) var(--text-base) / 1.4 var(--font-display);
  font-variant-ligatures: none;
  transform: translate(-50%, -100%);
  pointer-events: none;
  animation: pop 1.6s ease forwards;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -80%) scale(0.6);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -110%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .poke,
  .steps li:hover .art,
  .bubble {
    animation: none;
  }
}
