/*
 * The tokens are the console's, by hand rather than by import: this page loads
 * no framework and there is nothing here to generate them from. Only the ones
 * the page uses are copied, so a colour that appears in neither is not sitting
 * here waiting to drift.
 */

:root {
  --bg: hsl(210 33.3% 98.8%);
  --fg: hsl(205.7 13.7% 10%);
  --muted: hsl(210 7.9% 29.8%);
  --line: hsl(210 16% 90.2%);
  --card: hsl(0 0% 100%);
  --dot: hsl(210 14% 84%);
  --accent: hsl(182.7 100% 21.6%);
  --on-accent: hsl(0 0% 100%);
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(197.1 18.9% 7.3%);
    --fg: hsl(197.1 11.9% 88.4%);
    --muted: hsl(193.8 9.8% 73.9%);
    --line: hsl(196.4 10.7% 20.2%);
    --card: hsl(195 14.8% 10.6%);
    --dot: hsl(196.4 10.7% 24%);
    --accent: hsl(184 54.9% 67.8%);
    --on-accent: hsl(182.1 100% 11.2%);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* One gutter, set once, so nothing can scroll sideways on a phone. */
.wrap {
  width: 100%;
  max-width: 58rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0;
  max-width: var(--measure);
}

/* ---- header ---- */

header {
  border-bottom: 1px solid var(--line);
}

header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.9rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand .tile {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--on-accent);
}

.brand svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* A pair of buttons, not a dropdown: there are two languages and a dropdown
   over two options is a click to find out what you already knew. */
.langs {
  display: inline-flex;
  gap: 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.langs button {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  padding: 0.3rem 0.45rem;
  border-radius: 0.375rem;
  cursor: pointer;
}

.langs button[aria-pressed="true"] {
  color: var(--fg);
  background: var(--line);
}

.langs button:focus-visible,
a:focus-visible,
.dl:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- sections ---- */

section {
  padding-block: 3.5rem;
  border-bottom: 1px solid var(--line);
}

section:last-of-type {
  border-bottom: 0;
}

.hero {
  padding-block: 4.5rem 4rem;
}

.hero h1 {
  font-size: clamp(2rem, 7vw, 3rem);
  max-width: 18ch;
}

.hero p {
  margin-top: 1.1rem;
  font-size: 1.1rem;
  color: var(--muted);
}

.route {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1.75rem;
}

/* ---- download ---- */

.dl {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.7rem 1.15rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.meta {
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.hero .aside {
  font-size: 0.9rem;
}

.note {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

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

footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem 3rem;
  font-size: 0.85rem;
  color: var(--muted);
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

.legal-links {
  display: flex;
  gap: 1.25rem;
}

.legal-links a {
  color: inherit;
}

.copyright {
  font-variant-numeric: tabular-nums;
}

/* ---- the policy pages ----
   Prose rather than the front page's cards: somebody reading this is reading,
   not scanning, and a measure wider than about 70 characters loses the line. */

.legal {
  max-width: 42rem;
}

.legal h2 {
  margin-block: 2.25rem 0.5rem;
  font-size: 1.05rem;
}

.legal p {
  margin-block: 0 0.75rem;
  line-height: 1.65;
}

/* ---- the contact form ----
   The same card as the download, because it is the same kind of thing: one
   block on an otherwise plain page that somebody has come here to use. */

.contact {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: var(--measure);
  display: grid;
  gap: 0.4rem;
}

.contact label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.75rem;
}

.contact input,
.contact textarea {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.6rem 0.7rem;
  width: 100%;
}

.contact textarea {
  resize: vertical;
  min-height: 9rem;
}

.contact input:focus-visible,
.contact textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.contact button {
  font: inherit;
  border: 0;
  cursor: pointer;
  justify-self: start;
}

.contact button[disabled] {
  opacity: 0.55;
  cursor: default;
}

.outcome {
  margin-top: 1rem;
  font-size: 0.95rem;
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

/* ---- language ----
   Both languages are in the document, each marked with its own `lang`, and the
   root says which one is showing. The page therefore reads correctly before any
   script runs — in French, which is the language of the country it is for — and
   the toggle is one attribute. */
html[data-lang="fr"] [lang="en"],
html[data-lang="en"] [lang="fr"] {
  display: none;
}

/* ---- home: one screen, the map beside the words ---- */

/* The rules below are the home page's alone; the legal pages and the contact
   form share the tokens and the header above and nothing else. */

body.landing {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  line-height: 1.55;
}

.landing .wrap {
  max-width: 72rem;
}

.landing header,
.landing footer {
  border: 0;
}

.landing header .wrap {
  padding-block: 0.8rem;
}

.landing main {
  display: grid;
  align-items: center;
}

.landing main .wrap {
  display: grid;
  gap: 1.1rem;
  padding-block: 0.25rem 0.75rem;
}

.landing .map {
  position: relative;
  aspect-ratio: 700 / 740;
  height: min(36svh, 300px);
  justify-self: center;
}

.landing .map svg {
  display: block;
  width: 100%;
  height: 100%;
}

.landing .land {
  stroke: var(--dot);
}

.landing .map .home {
  stroke: var(--accent);
}

.landing .dest {
  stroke: var(--accent);
  opacity: 0.38;
}

/* Each route draws in after the one before it, then its country lights. The
   pings run on one long cycle in a shuffled order, so the map reads as traffic
   rather than a sweep. */
.landing .arc {
  stroke: var(--accent);
  stroke-width: 4.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw 0.9s cubic-bezier(0.3, 0, 0.2, 1) both;
  animation-delay: calc(var(--i) * 90ms + 150ms);
}

.landing .from {
  fill: var(--bg);
  stroke: var(--accent);
}

.landing .to {
  fill: var(--accent);
  stroke: none;
  animation: pop 0.3s ease-out both;
  animation-delay: calc(var(--i) * 90ms + 900ms);
}

.landing .ping {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: ping 6.4s ease-out infinite;
  animation-delay: calc(var(--p) * 800ms + 2s);
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
  }
}

@keyframes ping {
  0% {
    opacity: 0.5;
    transform: scale(1);
  }
  12%,
  100% {
    opacity: 0;
    transform: scale(3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing .arc,
  .landing .to,
  .landing .ping {
    animation: none;
  }
}

.landing .r0 { --i: 0; }
.landing .r1 { --i: 1; }
.landing .r2 { --i: 2; }
.landing .r3 { --i: 3; }
.landing .r4 { --i: 4; }
.landing .r5 { --i: 5; }
.landing .r6 { --i: 6; }
.landing .r7 { --i: 7; }
.landing .p0 { --p: 0; }
.landing .p1 { --p: 1; }
.landing .p2 { --p: 2; }
.landing .p3 { --p: 3; }
.landing .p4 { --p: 4; }
.landing .p5 { --p: 5; }
.landing .p6 { --p: 6; }
.landing .p7 { --p: 7; }

/* A stroke in the page colour behind each letter keeps a label readable where it
   crosses a dot or a route. */
.landing .place {
  position: absolute;
  transform: translate(-50%, 0);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  color: var(--muted);
  -webkit-text-stroke: 5px var(--bg);
  paint-order: stroke fill;
}

.landing .place.home {
  color: var(--fg);
  font-weight: 650;
}

.landing .at0 { left: 58.6%; top: 57.8%; }
.landing .at1 { left: 15.7%; top: 36.4%; }
.landing .at2 { left: 42.1%; top: 39.5%; }
.landing .at3 { left: 69.3%; top: 36.8%; }
.landing .at4 { left: 82.4%; top: 47.4%; }
.landing .at5 { left: 82.9%; top: 62.0%; }
.landing .at6 { left: 65.0%; top: 73.4%; }

.landing h1 {
  font-size: clamp(1.7rem, 7.6vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 650;
  text-wrap: balance;
}

.landing h1 .k {
  font-style: normal;
  color: var(--accent);
}

.landing .lede {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 30rem;
}

.landing .where {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 32rem;
}

.landing .get {
  margin-top: 1.1rem;
}

.landing .dl {
  margin-top: 0;
  padding: 0.75rem 1.2rem;
}

.landing .missing {
  color: var(--muted);
}

/* Until the description beside the APK has been read, neither the details button nor
   the refusal shows: a button that then 404s is worse than one that never was. */
.landing [data-apk-missing],
.landing [data-apk-ready] {
  display: none;
}

html[data-apk="missing"] .landing [data-apk-ok] {
  display: none;
}

html[data-apk="missing"] .landing [data-apk-missing] {
  display: block;
}

html[data-apk="ready"] .landing [data-apk-ready] {
  display: inline-flex;
}

.landing .get {
  position: relative;
}

.landing .split {
  display: inline-flex;
  gap: 1px;
}

.landing .split [data-apk-link] {
  -webkit-touch-callout: none;
  user-select: none;
}

html[data-apk="ready"] .landing .split [data-apk-link] {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.landing .more {
  padding-inline: 0.6rem;
  border: 0;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  cursor: pointer;
}

.landing .more svg {
  transition: transform 0.15s;
}

.landing .more[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* It opens upwards, over the text, so opening it never makes the page longer:
   on a phone the button sits near the bottom with only the footer below. */
.landing .file {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 0;
  z-index: 1;
  width: min(21rem, calc(100vw - 2.5rem));
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--bg);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.12);
  font-size: 0.78rem;
}

.landing .file[hidden] {
  display: none;
}

.landing .file dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 0;
}

.landing .file dl div {
  display: contents;
}

.landing .file .close {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.landing .file .close:hover {
  background: var(--line);
  color: inherit;
}

.landing .file dt {
  color: var(--muted);
}

.landing .file dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.landing .file .sha {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.landing footer {
  padding-block: 0;
  font-size: 0.8rem;
}

.landing footer .wrap {
  gap: 0.4rem 1.25rem;
  padding-block: 0.8rem 1rem;
}

@media (min-width: 56rem) {
  .landing .wrap {
    padding-inline: 3rem;
  }

  .landing header .wrap {
    padding-block: 1.25rem;
  }

  .landing main .wrap {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4rem;
  }

  .landing .text {
    order: -1;
  }

  .landing .map {
    height: min(68vh, 620px);
  }

  .landing .place {
    font-size: 0.85rem;
  }

  .landing .lede {
    font-size: 1.1rem;
    margin-top: 1.25rem;
  }

  .landing .get {
    margin-top: 1.75rem;
  }

  .landing footer .wrap {
    padding-block: 1.1rem 1.4rem;
  }
}
