/* Berlin Chess — landing page.
   Palette and type follow privacy.html, so the whole site reads as one thing.
   No external requests: system fonts only, every asset served from this origin. */

:root {
  --ground: #f4f0f0;
  --surface: #ffffff;
  --ink: #171213;
  --muted: #6b5f61;
  --line: #e2dadb;
  --accent: #b00202;
  --accent-ink: #ffffff;
  --shadow: 0 18px 40px rgba(23, 18, 19, 0.14);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0c0a0b;
    --surface: #151112;
    --ink: #efe8e8;
    --muted: #9c8d8f;
    --line: #2a2223;
    --accent: #e85147;
    --accent-ink: #1a0101;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Nothing here is wide enough to need sideways scrolling, and a page that
     slides under the thumb on a phone feels broken. */
  overflow-x: hidden;
}

h1,
h2 {
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  /* Without this the width/height attributes hold the height at its full value
     while max-width shrinks the width, and every screenshot renders squeezed. */
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 10;
  background: var(--surface);
  padding: 10px 16px;
  border-radius: 8px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
}

.brand img {
  width: 30px;
  height: 30px;
}

.lang {
  display: flex;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.lang a {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
}

.lang a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

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

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
  padding: 40px 0 72px;
}

/* The app icon itself — the white knight on its red tile — rather than the bare
   white mark, which disappeared into the light background. */
.hero-mark {
  width: 78px;
  height: 78px;
  margin-bottom: 22px;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(176, 2, 2, 0.26);
}

.brand img {
  border-radius: 7px;
}

h1 {
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}

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

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 12px;
}

/* ---------- store buttons ---------- */

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Deliberately not the official App Store / Play badges. Those carry mandatory
   wording ("Download on the App Store") that would be a lie before release, and
   neither may be altered. They get swapped in at launch — see README. */
.store {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  /* Grows to share the row, wraps when there is not room for two, and never
     forces the page wider than the screen on a small phone. */
  flex: 1 1 190px;
  min-width: 0;
  cursor: default;
}

.store b {
  font-size: 16px;
  color: var(--ink);
  font-weight: 700;
}

.store span {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.store[href] {
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: rgba(255, 255, 255, 0.82);
}

.store[href] b {
  color: #fff;
}

.note {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
}

/* ---------- phone frames ---------- */

.phone {
  border: 9px solid #1c1c1e;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #1c1c1e;
  max-width: 310px;
}

/* The hero shows a whole phone, so its screenshot is the full 1080x2400 frame at
   its true ratio — nothing cropped, or the device reads as the wrong shape. The
   width is chosen so the phone stands about as tall as the text beside it. */
.hero .phone {
  margin-left: auto;
  max-width: 232px;
}

/* A phone screenshot is nearly twice as tall as it is wide, which leaves the
   paragraph beside it floating in a field of nothing. The feature rows show the
   top of the screen and crop the rest. */
.feature .phone {
  max-width: 290px;
}

.feature .phone img {
  max-height: 460px;
  object-fit: cover;
  object-position: top;
}

/* ---------- stats band ----------
   Filled by tools/generate-stats.mjs from the live collections. The colours are
   the app's own category colours, so the two read as one product. */

.stats-band {
  border-top: 1px solid var(--line);
  padding: 40px 0 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat {
  border-left: 3px solid var(--line);
  padding-left: 16px;
}

.stat strong {
  display: block;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 14.5px;
}

/* The map's own key: club blue, park green, café brown. */
.stat-venues {
  border-left-color: #2e7d32;
}

.stat-clubs {
  border-left-color: #1565c0;
}

.stat-events {
  border-left-color: var(--accent);
}

.stats-asof {
  color: var(--muted);
  font-size: 12.5px;
  margin: 22px 0 0;
}

/* ---------- feature rows ---------- */

section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}

h2 {
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

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

.feature + .feature {
  margin-top: 72px;
}

.feature.flip .feature-text {
  order: 2;
}

.feature p {
  color: var(--muted);
  margin: 0 0 12px;
  max-width: 34em;
}

.feature ul {
  color: var(--muted);
  margin: 0;
  padding-left: 20px;
}

.feature li {
  margin-bottom: 6px;
}

/* ---------- saved spots ----------
   Deliberately not another phone beside another paragraph: a detail of the real
   screen, centred, to break the rhythm of the two rows above it. */

.saved .wrap {
  text-align: center;
}

.saved-lede {
  color: var(--muted);
  max-width: 54ch;
  margin: 0 auto 32px;
}

.saved-shot {
  margin: 0 auto;
  max-width: 520px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  background: var(--surface);
}

/* ---------- sources ---------- */

.sources p {
  color: var(--muted);
  max-width: 62ch;
}

.flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin: 28px 0 30px;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.flow-step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px 20px;
}

/* The arrow between steps, drawn rather than fetched. Hidden once the cards
   stack, where it would point sideways into nothing. */
.flow-step + .flow-step::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--line);
  border-right: 2px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
}

.flow-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.flow-step strong {
  display: block;
  font-size: 16px;
  margin-bottom: 5px;
}

.flow-text {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .flow-step + .flow-step::before {
    display: none;
  }
}

/* ---------- play with us ---------- */

.play-lede {
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 4px;
}

.play-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card strong {
  display: block;
  font-size: 17px;
  margin-bottom: 4px;
}

.card span {
  color: var(--muted);
  font-size: 14.5px;
}

a.card:hover {
  border-color: var(--accent);
}

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

footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 56px;
  color: var(--muted);
  font-size: 14.5px;
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  justify-content: space-between;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.social a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.social svg {
  width: 19px;
  height: 19px;
}

.colophon {
  margin: 22px 0 0;
  font-size: 13px;
}

/* ---------- reveal on scroll ----------
   Scoped to .js, which a one-line inline script in the head sets. Without it
   nothing is ever hidden: a page whose text is invisible when a script fails to
   run is worse than a page that simply does not animate. */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js .reveal.in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- narrow screens ---------- */

@media (max-width: 820px) {
  .hero,
  .feature {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .hero {
    padding-bottom: 48px;
  }

  .hero .phone,
  .feature .phone {
    margin: 0 auto;
  }

  /* Text before picture on every row once they stack, whatever the desktop order. */
  .feature.flip .feature-text {
    order: 0;
  }

  section {
    padding: 48px 0;
  }
}

/* ---------- error page ---------- */

.center-page {
  min-height: 70vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
}
