/* LocationXP — mobile-first participant app
   Plain CSS, no build step. */

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-soft: #55606e;
  --muted: #7a8694;
  --line: #d9dee4;
  --brand: #1c6e8c;
  --brand-dark: #155469;
  --brand-soft: #e3f0f4;
  --accent: #2f9e44;
  --danger: #c92a2a;
  --danger-soft: #fff0f0;
  --focus: #1971c2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 2px 10px rgba(20, 32, 48, 0.08);
  --tap: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header / progress ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 18px;
}
.app-header__brand {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--brand-dark);
}
.app-header__tag {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}
.progress { height: 4px; background: var(--bg); }
.progress__bar {
  height: 100%;
  width: 0%;
  background: var(--brand);
  transition: width 0.3s ease;
}

/* ---------- Layout ---------- */
.app-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  outline: none;
}
.screen { animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
}
.card--wide { padding: 20px 18px; }
.card--center { text-align: center; }

h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--ink);
}
.lead { font-size: 17px; color: var(--ink-soft); margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  min-height: var(--tap);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--secondary { background: var(--brand-soft); color: var(--brand-dark); border-color: #bfdde6; }
.btn--secondary:hover { background: #d4e8ee; }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg); }
.btn--block { display: block; width: 100%; margin-top: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
.btn-row .btn { flex: 1; }

/* ---------- Consent ---------- */
.consent-copy p { margin: 0 0 14px; color: var(--ink-soft); }
.consent-copy { margin-bottom: 6px; }

/* ---------- Fields ---------- */
.field { margin: 18px 0; }
.field__label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}
.field__input {
  width: 100%;
  font: inherit;
  min-height: var(--tap);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.field__input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.field__hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

/* ---------- Map ---------- */
.map-wrap { margin: 14px 0 4px; }
.map {
  width: 100%;
  height: 320px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #e9eef2;
  overflow: hidden;
}
.map-status {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 2px 0;
}
.map-status.is-set { color: var(--accent); font-weight: 600; }

/* Leaflet attribution legibility tweak only */
.leaflet-container { font: inherit; }

/* ---------- CE scale ---------- */
.ce {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 14px 16px;
  margin: 18px 0 0;
}
.ce__legend {
  font-weight: 600;
  font-size: 15.5px;
  padding: 0 4px;
  color: var(--ink);
}
/* Small grey scale-orienting prompt above the trust/defense statements. */
.ce__prompt {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
/* Cloudflare Turnstile widget container (centered on the captcha screen). */
.turnstile-box {
  display: flex;
  justify-content: center;
  min-height: 65px;
  margin: 18px 0 8px;
}
.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 12px;
}
.scale__opt { position: relative; }
.scale__opt input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.scale__opt label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  text-align: center;
  min-height: 74px;
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.scale__num {
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}
.scale__txt {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
}
.scale__opt input:hover + label { border-color: var(--brand); }
.scale__opt input:checked + label {
  background: var(--brand);
  border-color: var(--brand);
}
.scale__opt input:checked + label .scale__num,
.scale__opt input:checked + label .scale__txt { color: #fff; }
.scale__opt input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Location-type chips (multi-select, wraps to fit) ---------- */
.ce__hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.types-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.type-chip { position: relative; display: inline-flex; }
.type-chip__cb {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.type-chip__txt {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.type-chip__cb:hover + .type-chip__txt { border-color: var(--brand); }
.type-chip__cb:checked + .type-chip__txt {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.type-chip__cb:focus-visible + .type-chip__txt {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Lists (routines / review) ---------- */
.loc-list { list-style: none; margin: 16px 0 8px; padding: 0; }
.loc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}
.loc-item__main { flex: 1; min-width: 0; }
.loc-item__title { font-weight: 600; margin: 0 0 2px; }
.loc-item__meta { font-size: 13px; color: var(--muted); word-break: break-word; }
.loc-item__answers { font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }
.loc-item__actions { display: flex; flex-direction: column; gap: 6px; }
.linkbtn {
  font: inherit;
  font-size: 14px;
  background: none;
  border: none;
  padding: 6px 8px;
  min-height: 36px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--brand-dark);
}
.linkbtn:hover { background: var(--brand-soft); }
.linkbtn--danger { color: var(--danger); }
.linkbtn--danger:hover { background: var(--danger-soft); }
.linkbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

.review-group { margin-bottom: 18px; }
.review-group__h {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 0 0 8px;
}

/* ---------- Errors / status ---------- */
.form-error {
  background: var(--danger-soft);
  border: 1px solid #f3c2c2;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 16px 0 0;
  font-size: 15px;
}

.checkmark {
  width: 64px;
  height: 64px;
  margin: 6px auto 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 36px;
  line-height: 64px;
  text-align: center;
}

/* ---------- Small screens ---------- */
@media (max-width: 380px) {
  body { font-size: 16px; }
  h1 { font-size: 23px; }
  .scale__txt { font-size: 10px; }
  .map { height: 280px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .progress__bar { transition: none; }
}
