:root {
  --bg: #f4f2ee;
  --text: #1a1a1a;
  --muted: #5f5c57;
  --border: #d9d5ce;

  /* Departure board */
  --board: #0b0b0a;
  --bezel: #2a2a28;
  --amber: #ffb000;
  --amber-dim: #a87400;
  --amber-glow: rgba(255, 176, 0, 0.45);
  --unlit: rgba(255, 176, 0, 0.07);

  /* Space */
  --space-deep: #000;
  --space-text: #fff;
  --space-red: #e2231a;

  /* Map */
  --paper: #f3ecd9;
  --contour: #b9875a;
  --grid: rgba(64, 120, 170, 0.18);
  --forest: #2f5d3a;
  --map-ink: #2b2418;
  --route: #c8322f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --text: #f2f0eb;
    --muted: #9b978f;
    --border: #2c2b29;
    --bezel: #3a3936;
    --paper: #e9e0c8;
  }
}

/* The font used in the Planet Dodger game itself */
@font-face {
  font-family: "Monster";
  src: url("fonts/monsterfont.otf") format("opentype");
  font-display: swap;
}

/* The font used in the mountain map apps */
@font-face {
  font-family: "Boucherie";
  src: url("fonts/boucherie.otf") format("opentype");
  font-display: swap;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.kicker {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Intro */

.intro { padding-top: 88px; padding-bottom: 64px; }

.intro h1 {
  margin: 0 0 14px;
  font-size: clamp(2.75rem, 9vw, 5.25rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.lede {
  margin: 0;
  max-width: 32em;
  font-size: 1.1875rem;
  color: var(--muted);
}

.zone { position: relative; padding: 88px 0; }

/* ---------- Tubemoji: departure board ---------- */

.zone-tube {
  padding-top: 0;
  background: #fff; /* continues the white masthead, in light and dark mode */
}

.board {
  padding: 24px 28px 0;
  background-color: var(--board);
  /* Grid of unlit LEDs behind the text */
  background-image: radial-gradient(circle, var(--unlit) 1px, transparent 1.6px);
  background-size: 5px 5px;
  border: 10px solid var(--bezel);
  border-radius: 14px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 30px 60px -30px rgba(0, 0, 0, 0.55);
  color: var(--amber);
  font-family: "Doto", ui-monospace, monospace;
  font-weight: 800;
  text-shadow: 0 0 6px var(--amber-glow);
  overflow: hidden;
}

.board-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px dotted var(--amber-dim);
}

.board-top h2 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.clock {
  font-size: clamp(1.25rem, 3.5vw, 1.875rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.dep {
  display: grid;
  grid-template-columns: 5.5ch 1fr auto;
  column-gap: 20px;
  row-gap: 6px;
  align-items: center;
  margin: 12px -12px 4px;
  padding: 14px 12px;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.dep:hover,
.dep:focus-visible,
.board-cta:hover,
.board-cta:focus-visible {
  background: var(--amber);
  color: var(--board);
  text-shadow: none;
  outline: none;
}

.dep-dest { display: flex; align-items: center; gap: 14px; min-width: 0; }

.dep-dest img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 22.37%; /* iOS icon corner ratio */
  box-shadow: 0 0 0 1px rgba(255, 176, 0, 0.25);
}

.dep-calling {
  grid-column: 2 / -1;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--amber-dim);
  text-shadow: none;
}

.dep:hover .dep-calling,
.dep:focus-visible .dep-calling { color: inherit; }

.dep-calling b { font-weight: 900; }

.status { padding: 4px 0 8px; }

.status-head,
.status li {
  display: grid;
  grid-template-columns: 1fr 3ch 1fr;
  column-gap: 20px;
  align-items: center;
}

.status-head {
  padding: 8px 0;
  border-top: 2px dotted var(--amber-dim);
  border-bottom: 2px dotted var(--amber-dim);
  color: var(--amber-dim);
  font-size: 0.875rem;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: none;
}

.status-head span:nth-child(2),
.status li .emoji { text-align: center; }

.status-head span:last-child,
.status li span:last-child { text-align: right; }

.status ul { list-style: none; margin: 0; padding: 0; }

.status li { padding: 7px 0; font-size: clamp(1rem, 2.4vw, 1.25rem); }

.status .emoji { font-size: 1.3em; text-shadow: none; line-height: 1; }

.board-cta {
  display: block;
  margin: 0 -12px 16px;
  padding: 12px;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
  font-size: clamp(1.125rem, 2.6vw, 1.5rem);
  font-weight: 900;
}

.board-cta span:first-child { text-decoration: underline; text-underline-offset: 5px; }

.ticker {
  margin: 0 -28px;
  padding: 12px 0;
  border-top: 2px dotted var(--amber-dim);
  overflow: hidden;
  white-space: nowrap;
  font-size: 1.0625rem;
}

.ticker-track { display: inline-flex; animation: ticker 40s linear infinite; }

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Planet Dodger: space ---------- */

.zone-space {
  color: var(--space-text);
  background-color: var(--space-deep);
  /* Two layers of scattered stars, like the game's own backdrop */
  background-image:
    radial-gradient(1px 1px at 12px 18px, #fffc, transparent),
    radial-gradient(1px 1px at 77px 51px, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 140px 110px, #fff, transparent),
    radial-gradient(1px 1px at 43px 133px, #fff8, transparent),
    radial-gradient(1px 1px at 168px 30px, #fffa, transparent),
    radial-gradient(1px 1px at 103px 170px, #fff7, transparent);
  background-size: 190px 190px;
  overflow: hidden;
}

.space-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 56px;
  align-items: center;
}

.space-icon {
  width: 88px;
  height: 88px;
  margin-bottom: 20px;
  border-radius: 22.37%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.zone-space .kicker { color: var(--space-red); }

.zone-space h2,
.space-tagline {
  font-family: "Monster", "Impact", sans-serif;
  font-weight: 400;
  text-transform: uppercase;
}

.zone-space h2 {
  margin: 0 0 14px;
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1;
  transform: rotate(-2deg);
  transform-origin: left;
}

.space-copy p:not(.kicker) {
  margin: 0 0 20px;
  max-width: 28em;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.0625rem;
}

.space-copy .space-tagline {
  margin-bottom: 28px;
  color: var(--space-text);
  font-size: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-space {
  background: var(--space-red);
  color: #fff;
}

.btn-space:hover,
.btn-space:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px #fff;
  outline: none;
}

/* Screenshots fanned out like cards */
.shots {
  position: relative;
  display: flex;
  justify-content: center;
}

.shots img {
  width: 34%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 24px 48px -12px rgba(0, 0, 0, 0.9);
  transition: transform 0.3s ease;
}

.shots img:nth-child(1) { transform: rotate(-7deg) translate(18%, 6%); }
.shots img:nth-child(2) { position: relative; z-index: 1; transform: translateY(-4%); }
.shots img:nth-child(3) { transform: rotate(7deg) translate(-18%, 6%); }

.shots:hover img:nth-child(1) { transform: rotate(-10deg) translate(4%, 6%); }
.shots:hover img:nth-child(3) { transform: rotate(10deg) translate(-4%, 6%); }

/* ---------- Mountain maps: contours and grid ---------- */

.zone-map {
  color: var(--map-ink);
  background-color: var(--paper);
  /* Kilometre grid squares */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 96px 96px;
  overflow: hidden;
}

.contours {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.contours path { fill: none; stroke: var(--contour); stroke-width: 1; opacity: 0.55; }
.contours path.index { stroke-width: 2; opacity: 0.7; }

.zone-map .wrap { position: relative; }

.zone-map .kicker { color: var(--forest); }

/* Title box, like the panel on a printed map, so contours don't run behind the text */
.map-title {
  display: inline-block;
  max-width: 34em;
  margin-bottom: 40px;
  padding: 20px 24px 22px;
  background: var(--paper);
  border: 2px solid var(--map-ink);
  outline: 1px solid var(--map-ink);
  outline-offset: 4px;
}

.zone-map h2 {
  margin: 0 0 8px;
  font-family: "Boucherie", Georgia, serif;
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--map-ink);
}

.map-lede {
  margin: 0;
  font-size: 1.125rem;
  color: var(--map-ink);
}

.peaks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.peak {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: rgba(255, 252, 243, 0.92);
  border: 2px solid var(--map-ink);
  border-radius: 6px;
  box-shadow: 6px 6px 0 var(--forest);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.peak:hover,
.peak:focus-within {
  transform: translate(-3px, -3px);
  box-shadow: 9px 9px 0 var(--forest);
}

.peak-head { display: flex; align-items: center; gap: 16px; }

.peak-head img {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 22.37%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.peak-name {
  display: block;
  margin: 0;
  font-family: "Boucherie", Georgia, serif;
  font-size: 1.625rem;
  font-weight: 400;
  line-height: 1.1;
}

.peak-welsh {
  display: block;
  font-family: "Boucherie", Georgia, serif;
  font-weight: 400;
  color: rgba(43, 36, 24, 0.7);
}

.peak-facts {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 8px 28px;
  margin: 0;
  padding: 14px 0;
  border-top: 1px dashed rgba(43, 36, 24, 0.35);
  border-bottom: 1px dashed rgba(43, 36, 24, 0.35);
}

.peak-facts > div { position: relative; }

.peak-facts dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(43, 36, 24, 0.6);
}

.peak-facts dd {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Triangulation pillar symbol (secretly a button: see main.js) */
.trig {
  position: relative;
  z-index: 1;
  width: 0;
  height: 0;
  padding: 0;
  background: none;
  border: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid var(--route);
  cursor: pointer;
}

/* Bigger invisible hit area around the little triangle */
.trig::before {
  content: "";
  position: absolute;
  inset: -10px -16px -10px -16px;
}

.trig:focus-visible { outline: 2px solid var(--map-ink); outline-offset: 6px; }

.summit-flag {
  position: absolute;
  z-index: 2;
  left: -8px;
  bottom: calc(100% + 10px);
  padding: 6px 10px;
  background: var(--map-ink);
  color: var(--paper);
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  animation: flag-up 0.35s cubic-bezier(.2, .8, .3, 1.4);
}

.summit-flag::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 100%;
  border: 6px solid transparent;
  border-top-color: var(--map-ink);
}

@keyframes flag-up {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
}

.grid-ref {
  position: relative;
  z-index: 1;
  color: inherit;
  text-decoration: none;
}

.grid-ref:hover,
.grid-ref:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--route);
  text-underline-offset: 3px;
}

.peak-cta {
  margin-top: auto;
  font-weight: 700;
  color: var(--forest);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--route);
  text-underline-offset: 5px;
}

/* The whole card clicks through to the App Store */
.peak-cta::after {
  content: "";
  position: absolute;
  inset: 0;
}

.peak-cta:focus-visible { outline: none; }

/* Footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-top: 28px;
  padding-bottom: 40px;
  font-size: 0.875rem;
  color: var(--muted);
}

.footer a {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.footer a:hover { text-decoration-color: currentColor; }

/* ---------- Easter egg: Konami code fly-by ---------- */

.egg-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  pointer-events: none;
  background-color: rgba(0, 0, 0, 0.96);
  background-image:
    radial-gradient(1px 1px at 12px 18px, #fffc, transparent),
    radial-gradient(1px 1px at 77px 51px, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 140px 110px, #fff, transparent),
    radial-gradient(1px 1px at 43px 133px, #fff8, transparent);
  background-size: 190px 190px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.egg-layer.is-on { opacity: 1; }

/* Sprites are cut from screenshots on black, so feather the edges */
.egg-sprite {
  position: absolute;
  top: 0;
  left: 0;
  height: auto;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent);
  mask-image: radial-gradient(closest-side, #000 72%, transparent);
  will-change: transform;
}

.egg-boom { animation: egg-boom 0.6s ease-out both; }

@keyframes egg-boom {
  from { transform: scale(0.2); opacity: 0; }
  40% { opacity: 1; }
  to { transform: scale(1.3); }
}

.egg-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  font-family: "Monster", "Impact", sans-serif;
  font-size: clamp(2.5rem, 10vw, 6rem);
  color: #fff;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-3deg);
  animation: egg-text 0.5s 0.2s cubic-bezier(.2, .8, .3, 1.5) both;
}

@keyframes egg-text {
  from { transform: rotate(-3deg) scale(0.4); opacity: 0; }
}

@media (max-width: 760px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .intro { padding-top: 48px; padding-bottom: 40px; }
  .lede { font-size: 1.0625rem; }
  .zone { padding: 64px 0; }
  .zone-tube { padding-top: 0; }

  .board { padding: 16px 14px 0; border-width: 6px; }
  .dep { grid-template-columns: 5.5ch 1fr auto; column-gap: 10px; margin: 8px -6px 4px; padding: 12px 6px; font-size: 1.125rem; }
  .dep-dest { gap: 8px; }
  .dep-dest img { width: 28px; height: 28px; }
  .dep-calling { grid-column: 1 / -1; font-size: 0.875rem; }
  .status-head, .status li { column-gap: 10px; }
  .status li { font-size: 0.9375rem; }
  .board-cta { margin: 0 -6px 12px; padding: 10px 6px; }
  .ticker { margin: 0 -14px; font-size: 0.9375rem; }

  .space-grid { grid-template-columns: 1fr; gap: 32px; }

  .peaks { grid-template-columns: 1fr; gap: 20px; }
  .peak { padding: 18px; }
  .peak-facts { gap: 8px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .btn, .peak { transition: none; }
}

/* ---------- Legal pages ---------- */

.legal-head { max-width: 760px; padding-top: 56px; padding-bottom: 8px; }

.legal-head h1 {
  margin: 20px 0 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.05;
}

.back {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.back:hover { color: var(--text); text-decoration: underline; }

.legal { max-width: 760px; padding-top: 24px; padding-bottom: 32px; }

.legal h2 {
  margin: 40px 0 8px;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.legal h3 {
  margin: 32px 0 6px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.legal p { margin: 0 0 14px; max-width: 70ch; }

.legal a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.legal a:hover { text-decoration-color: currentColor; }

.back-top { margin-top: 40px; font-size: 0.9375rem; }

/* Homepage masthead: always white, in light and dark mode */
.masthead {
  background: #fff;
  color: #1a1a1a;
}

.masthead .lede { color: #5f5c57; }
