/* Landmark Collector — mobile-first, self-hosted, no external fonts or assets. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #10202c;
  --muted: #5a6b7a;
  --line: #d9e1e8;
  --primary: #12695c;
  --primary-ink: #ffffff;
  --secondary: #223546;
  --danger: #a32020;
  --ok: #14663f;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(16, 32, 44, 0.09);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10171d;
    --surface: #18222b;
    --ink: #e9eff4;
    --muted: #9db0be;
    --line: #2b3947;
    --primary: #2aa08c;
    --primary-ink: #04211c;
    --secondary: #33475b;
    --danger: #ff8f8f;
    --ok: #6fd6a3;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--primary);
  color: var(--primary-ink);
  padding: env(safe-area-inset-top) 0 0;
  box-shadow: var(--shadow);
}

.app-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 18px;
}

.app-header__title { font-weight: 700; letter-spacing: 0.2px; }

.app-header__meta { font-size: 0.82rem; opacity: 0.9; }

.progress {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px 12px;
}

.progress__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.progress__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary-ink);
  transition: width 250ms ease;
}

.progress__label {
  margin: 6px 0 0;
  font-size: 0.8rem;
  opacity: 0.92;
}

/* ---------- layout ---------- */

.app-main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 32px;
}

.app-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px calc(24px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.78rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 26px;
}

h1 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  line-height: 1.22;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede { margin: 0 0 18px; color: var(--muted); }

.hint {
  margin: 10px 0 0;
  font-size: 0.83rem;
  color: var(--muted);
}

.error-text { color: var(--danger); font-weight: 600; }

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: rgba(18, 105, 92, 0.06);
}

.notice p { margin: 0 0 10px; }

/* ---------- forms ---------- */

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack--tight { gap: 10px; margin-top: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }

label { font-weight: 650; font-size: 0.92rem; }

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 13px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.field .hint { margin: 0; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  min-height: 48px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--primary-ink);
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--large { width: 100%; font-size: 1.05rem; padding: 16px 20px; }

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

.btn--link {
  background: transparent;
  color: var(--primary);
  border-color: var(--line);
}

.button-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 4px;
}

.link-row .btn { flex: 1 1 auto; }

/* ---------- coordinates ---------- */

.coords {
  margin: 4px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.coords__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 3px 0;
}

.coords dt { font-size: 0.85rem; color: var(--muted); }

.coords dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
}

.distance {
  margin: 12px 0 0;
  font-weight: 650;
  color: var(--ok);
}

/* ---------- camera ---------- */

/* No forced aspect-ratio: the box takes its shape from the camera's own frame,
   so the viewfinder shows exactly what will be stored. Fixing it to 3/4 and
   filling with object-fit:cover cropped the preview, which both hid part of the
   shot and disagreed with the full frame the canvas actually captures. */
.viewfinder {
  position: relative;
  margin: 6px 0 4px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b1116;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewfinder img {
  width: 100%;
  height: auto;
  /* Cap very tall portrait photos; `contain` letterboxes them rather than
     cropping, so the whole picture stays visible. */
  max-height: 62vh;
  object-fit: contain;
  display: block;
}

.viewfinder__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7d919f;
  font-size: 0.9rem;
}

.status {
  margin: 12px 0 0;
  min-height: 1.4em;
  font-size: 0.92rem;
  color: var(--muted);
}

.status--error { color: var(--danger); font-weight: 600; }
.status--busy { color: var(--ink); }
.status--ok { color: var(--ok); font-weight: 600; }

/* ---------- lists ---------- */

.visited {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--muted);
}

.visited li { padding: 2px 0; }

@media (min-width: 560px) {
  .button-row { flex-direction: row; flex-wrap: wrap; }
  .button-row .btn--large { width: auto; flex: 1 1 200px; }
}
