:root {
  --bg: #12141a;
  --surface: #1b1e27;
  --surface-2: #262a36;
  --line: #353a4a;
  --text: #ece8e1;
  --muted: #a3a2ab;
  --accent: #f08a3c; /* orange: the colour of the 16 Days campaign */
  --accent-ink: #1d1105;
  --me: #f08a3c;
  --witness: #7fb4e0;
  --helped: #86d39b; /* green: ways forward */
  --radius: 14px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  overflow: hidden;
}

[hidden] { display: none !important; }

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

button, select, textarea, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Map ---------- */

#map { position: fixed; inset: 0; background: #dfe3e6; }

.maplibregl-map { font-family: var(--sans); }
.maplibregl-ctrl-bottom-right { margin-bottom: 64px; }

.bubble {
  appearance: none;
  padding: 0;
  font-family: inherit;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #e8761f;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 6px rgba(232, 118, 31, .25), 0 2px 10px rgba(0, 0, 0, .35);
  cursor: pointer;
  transition: transform .15s ease;
}
.bubble:hover { transform: scale(1.1); }
.bubble.is-open { transform: scale(1.3); }
.bubble.is-open { background: #1d1105; box-shadow: 0 0 0 6px rgba(29, 17, 5, .25), 0 2px 10px rgba(0, 0, 0, .35); }

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: #f79b54; }

.btn-ghost { background: transparent; }

.btn-exit { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.btn-exit:hover { background: #fff; }
.btn-small { padding: 5px 11px; font-size: 13px; }

/* Keeps the exit button in view at the top of a dialog, even when the dialog scrolls. */
.dialog-top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; margin: -10px -10px 2px 0; }

.lang {
  width: auto;
  background: rgba(27, 30, 39, .9);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 8px 9px 12px;
  cursor: pointer;
}
.lang option { background: var(--surface); color: var(--text); }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

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

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(to bottom, rgba(18, 20, 26, .95) 55%, rgba(18, 20, 26, 0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-right { display: flex; gap: 8px; flex: none; }

.brand {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.brand-name { font-family: var(--serif); font-size: 20px; letter-spacing: .02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.filters::-webkit-scrollbar { display: none; }

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(27, 30, 39, .9);
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--muted)); }
.chip[data-cat="all"]::before { display: none; }
.chip[data-cat="me"] { --dot: var(--me); }
.chip[data-cat="witness"] { --dot: var(--witness); }
.chip[data-cat="helped"] { --dot: var(--helped); }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }

.demo {
  position: fixed;
  left: 16px;
  bottom: 74px;
  z-index: 900;
  font-size: 12px;
  color: var(--muted);
  background: rgba(27, 30, 39, .9);
  border: 1px dashed var(--line);
  padding: 4px 10px;
  border-radius: 999px;
}

/* ---------- Bottom actions ---------- */

.actions {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 24px 12px 16px;
  background: linear-gradient(to top, rgba(18, 20, 26, .95) 50%, rgba(18, 20, 26, 0));
  pointer-events: none;
}
.actions > * { pointer-events: auto; }

/* ---------- Story reader ---------- */

.reader {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  width: min(600px, calc(100vw - 32px));
  max-height: min(60dvh, 520px);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  background: rgba(27, 30, 39, .98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  overflow: hidden;
}

.reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 6px 24px;
}
.reader-head h2 { font-family: var(--serif); font-size: 21px; font-weight: 500; }
.reader-head p { color: var(--muted); font-size: 13px; }

.reader-body { overflow-y: auto; padding: 10px 24px 18px; }

.reader-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.story {
  --cat: var(--muted);
  border-left: 3px solid var(--cat);
  padding-left: 18px;
}
.story[data-cat="me"] { --cat: var(--me); }
.story[data-cat="witness"] { --cat: var(--witness); }

.story-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--cat); margin-bottom: 8px; }
.tag { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }

.story-text { font-family: var(--serif); font-size: 18.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

.reactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.react {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13.5px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.react:hover { color: var(--text); border-color: var(--muted); }
.react[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); cursor: default; }
.react-count { opacity: .7; font-variant-numeric: tabular-nums; }

.report { appearance: none; display: block; margin: 14px 0 0 auto; border: 0; background: none; padding: 4px; color: var(--muted); font-size: 12px; cursor: pointer; opacity: .7; }
.report:hover { opacity: 1; text-decoration: underline; }

.pause { text-align: center; padding: 14px 8px 6px; }
.pause h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 8px; }
.pause p { color: var(--muted); }
.pause .dialog-actions { justify-content: center; }

/* ---------- Dialogs ---------- */

.dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 28px;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.dialog::backdrop { background: rgba(10, 11, 15, .72); backdrop-filter: blur(6px); }
.dialog-intro::backdrop { background: rgba(10, 11, 15, .9); }

.dialog h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; letter-spacing: .02em; margin-bottom: 10px; }
.dialog h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin-bottom: 14px; }
.dialog h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 8px; }

.lead { font-size: 16px; color: var(--text); }

.warning {
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(240, 138, 60, .45);
  background: rgba(240, 138, 60, .1);
}

.promises { margin: 0; padding-left: 20px; color: var(--muted); }
.promises li { margin: 4px 0; }

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

.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.helpline-country { font-weight: 600; margin-top: 12px; }
.helpline { display: flex; gap: 12px; align-items: baseline; padding: 3px 0; }
.helpline a { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; min-width: 108px; }
.helpline a:hover { text-decoration: underline; }
.helpline span { color: var(--muted); font-size: 14px; }

/* ---------- Form ---------- */

.field { display: block; border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.field > span, .field > legend { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { resize: vertical; font-family: var(--serif); font-size: 16px; line-height: 1.55; }

.counter { display: block; text-align: right; color: var(--muted); font-size: 12px; margin-top: 4px; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-flex; }
.choice input:checked + .chip { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }
.choice input:focus-visible + .chip { outline: 2px solid var(--accent); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); flex: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.error { color: #ffb4a8; background: rgba(255, 110, 90, .12); border: 1px solid rgba(255, 110, 90, .4); border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .brand-name { font-size: 18px; }
  .btn { padding: 9px 13px; font-size: 14px; }
  .actions { gap: 6px; }
  .actions .btn { flex: 0 1 auto; min-width: 0; white-space: normal; line-height: 1.2; }

  .reader {
    left: 0; right: 0; bottom: 0;
    transform: none;
    width: auto;
    max-height: 62dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
  }
  .reader-head { padding-left: 18px; }
  .reader-body { padding: 10px 18px 16px; }
  .story-text { font-size: 17.5px; }

  .dialog { padding: 22px 18px; }
  .dialog h1 { font-size: 28px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .demo { bottom: 70px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Purpose: headline numbers and the second part of a story ---------- */

.headline {
  align-self: flex-start;
  background: rgba(27, 30, 39, .92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  color: var(--muted);
}
.headline strong { color: var(--text); font-variant-numeric: tabular-nums; }
.headline-sep { margin: 0 4px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 12px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 12px 10px; text-align: center; }
.stat strong { display: block; font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat:last-child strong { color: var(--helped); }
.stat span { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.3; color: var(--muted); }

.purpose { font-family: var(--serif); font-size: 17px; line-height: 1.5; }

.story-extra {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
}
.story-extra h4 { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cat); }
.story[data-cat="me"] .story-extra { background: rgba(134, 211, 155, .1); }
.story[data-cat="me"] .story-extra h4 { color: var(--helped); }
.story-extra p { font-family: var(--serif); font-size: 16.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

.hint { display: block; margin-top: 5px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
