/* Runlings. One stylesheet for every page. */

:root {
  --bg: #ffffff;
  --ink: #0b0b0c;
  --muted: #64748b;
  --quiet: #cbd5e1;      /* nav at rest */
  --tile: #f2f4f7;
  --tile-mark: #cfd5de;  /* the ? on a mystery tile */
  --rule: #f1f5f9;
  --sprite: brightness(0);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --ink: #ffffff;
    --muted: #94a3b8;
    --quiet: #475569;
    --tile: #111317;
    --tile-mark: #2e333b;
    --rule: #16191e;
    --sprite: brightness(0) invert(1);
    color-scheme: dark;
  }
}

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

html, body { margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Google Sans Flex", ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

/* The brand face: Google Sans Flex at weight 900, slant 10. iOS Safari
   doesn't turn `oblique` into the font's slant axis, so the axis is also set
   directly. */
.black-italic,
.wordmark,
.site-header nav { font-style: oblique 10deg; font-variation-settings: "slnt" -10; }
.black-italic { font-weight: 900; }

/* ---------- Header ---------- */

.site-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(28px, env(safe-area-inset-top)) clamp(20px, 4vw, 48px) 0;
}

.site-header nav {
  display: flex;
  gap: clamp(16px, 2vw, 24px);
  font-size: 14px;
  font-weight: 700;
}

.site-header nav a {
  color: var(--quiet);
  text-decoration: none;
  transition: color .2s;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--ink); }

/* ---------- Wordmark ---------- */

.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}

/* The paw-R, sized to the font's cap height with a hair of side bearing,
   as RunlingsRGlyph sets it in the app. */
.wordmark svg {
  height: .72em;
  width: .757em;
  margin-inline: .0072em;
  fill: currentColor;
  overflow: visible;
}

/* The launch title's reveal: each letter slides in from slightly behind the
   one before it, 50 ms apart, on the app's spring. */
.wordmark .letter {
  display: inline-block;
  opacity: 0;
  transform: translateX(-.28em);
  transition: opacity .35s ease-out, transform .45s cubic-bezier(.22, 1.12, .4, 1);
  transition-delay: calc(.15s + var(--i) * .05s);
}

.wordmark.revealed .letter { opacity: 1; transform: none; }

/* ---------- Home ---------- */

.home { height: 100dvh; overflow: hidden; overscroll-behavior: none; }

.hero {
  height: 100dvh;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  padding: 96px clamp(20px, 5vw, 80px) 72px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(40px, 5.6vw, 76px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.hero p {
  margin: 24px 0 40px;
  max-width: 30em;
  font-size: clamp(17px, 1.7vw, 24px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}

.hero p strong { color: var(--ink); font-weight: 500; }

.hero-copy > * {
  opacity: 0;
  transform: translateY(12px);
  animation: rise .7s cubic-bezier(.2, .9, .3, 1) forwards;
}
.hero-copy > :nth-child(1) { animation-delay: .55s; }
.hero-copy > :nth-child(2) { animation-delay: .7s; }
.hero-copy > :nth-child(3) { animation-delay: .85s; }

@keyframes rise { to { opacity: 1; transform: none; } }

/* The video: 9:16, transparent around the phone, so it sits on white or
   black without a box. Sized by the screen's height so the page never
   scrolls. */
.hero-video {
  display: block;
  height: min(calc(100dvh - 150px), 900px);
  aspect-ratio: 9 / 16;
  width: auto;
  max-width: 44vw;
  object-fit: contain;
  pointer-events: none;   /* no tap-to-fullscreen, no long-press menu */
  /* Compressing the alpha leaves a faint line along the bottom edge. The
     phone ends well above it. */
  clip-path: inset(0 0 .5% 0);
  opacity: 0;
  animation: rise .9s cubic-bezier(.2, .9, .3, 1) .6s forwards;
}

/* iOS draws a play button over a video it refused to autoplay (Low Power
   Mode). The poster frame shows instead. */
.hero-video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.hero-video::-webkit-media-controls { display: none !important; }

/* On a phone the page scrolls: the copy first, then the video at the
   screen's full width. */
@media (max-width: 760px) {
  .home { height: auto; overflow: visible; }
  .hero {
    height: auto;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 20px;
    padding: 197px 20px 24px;
  }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero h1 { font-size: clamp(32px, 9vw, 44px); }
  .hero p { margin: 12px auto 20px; font-size: 16px; }
  .hero-video { width: 100%; height: auto; max-width: none; }
  .runners { display: none; }
}

/* ---------- App Store button ---------- */

.store {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: 15px 28px 15px 24px;
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .45);
  transition: transform .3s, opacity .3s;
}

.store:hover { transform: scale(1.04); }
.store:focus-visible { outline: 3px solid var(--quiet); outline-offset: 3px; }

.store svg { width: 1em; height: 1em; fill: currentColor; flex: none; margin-top: -.15em; }
.store span { font-weight: 500; opacity: .7; }
.store b { font-weight: 700; }

/* ---------- Inner pages ---------- */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 128px clamp(20px, 5vw, 80px) 140px;
}

.page h1 {
  margin: 0 0 clamp(28px, 4vw, 44px);
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -.01em;
  text-transform: uppercase;
}

/* Creatures */

.known {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.6vw, 20px);
}

.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: clamp(14px, 2vw, 24px);
  background: var(--tile);
  display: flex;
  align-items: center;
  justify-content: center;
}

.known .tile { margin: 0; flex-direction: column; padding-bottom: 12%; }
.known img { width: 78%; height: auto; }
.known .name {
  position: absolute;
  bottom: 7%;
  left: 8px;
  right: 8px;
  text-align: center;
  font-size: clamp(11px, 1.9vw, 22px);
  line-height: 1.1;
  text-transform: uppercase;
}

.discover {
  margin: clamp(40px, 6vw, 64px) 0 clamp(24px, 3vw, 32px);
  text-align: center;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.2;
}

.discover span {
  display: block;
  margin-top: 6px;
  font-size: clamp(15px, 1.5vw, 18px);
  font-weight: 500;
  font-style: normal;
  font-variation-settings: normal;
  color: var(--muted);
}

.mystery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: clamp(8px, 1.2vw, 14px);
}

.mystery .tile {
  border-radius: clamp(12px, 1.4vw, 18px);
  font-size: clamp(40px, 5vw, 60px);
  color: var(--tile-mark);
  user-select: none;
}

@media (max-width: 560px) {
  .mystery { grid-template-columns: repeat(4, 1fr); }
}

/* About and privacy */

.prose p {
  max-width: 680px;
  margin: 0 0 20px;
  font-size: clamp(17px, 1.8vw, 20px);
  font-weight: 500;
  line-height: 1.65;
  color: var(--muted);
}
.prose .small-link { font-size: 14px; color: var(--muted); text-underline-offset: 3px; }
.prose .small-link:hover { color: var(--ink); }

/* Rush: the page a challenge link lands on anywhere but an iPhone. */

.prose .rush-who { margin: 0 0 4px; font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; line-height: 1.25; color: var(--ink); }
.prose .rush-tries { font-size: 15px; }
.rush .store { margin-top: 12px; }

/* ---------- Running creatures ---------- */

.runners {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 64px;
  overflow: hidden;
  pointer-events: none;
  z-index: 20;
}

.runners div { position: absolute; bottom: 0; width: 64px; height: 64px; }

.runners img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: var(--sprite);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .wordmark .letter, .hero-copy > *, .hero-video { transition: none; animation: none; opacity: 1; transform: none; }
}
