/* ==========================================================================
   Geography Art
   Palette: indigo primary, coral accent, near-white ground. Deliberately no
   green — the old site leaned on it and it fought with the map's own colours.
   ========================================================================== */

:root {
  --ink:        #14161f;
  --ink-2:      #41465c;
  --muted:      #6b6f80;
  --line:       #e5e7f0;
  --line-2:     #eef0f7;
  --surface:    #ffffff;
  --canvas:     #f6f7fb;

  --brand:      #4338ca;
  --brand-600:  #4f46e5;
  --brand-700:  #3730a3;
  --brand-tint: #eef0ff;

  --accent:     #f2603c;
  --accent-tint:#fff1ec;

  --ok:         #0e9f8b;
  --warn:       #d97706;
  --bad:        #dc2626;

  --topbar-h:   64px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-1: 0 1px 2px rgba(20,22,31,.06), 0 1px 3px rgba(20,22,31,.04);
  --shadow-2: 0 4px 12px rgba(20,22,31,.07), 0 12px 32px rgba(20,22,31,.08);
  --shadow-3: 0 12px 32px rgba(20,22,31,.12), 0 32px 64px rgba(20,22,31,.16);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

/* Several classes below set `display`, which would otherwise beat the UA's
   [hidden] rule and leave empty error boxes and panels on screen. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { color: var(--ink); line-height: 1.2; letter-spacing: -0.02em; margin: 0; }

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-700); }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--surface); padding: 10px 16px; border-radius: var(--r-sm);
  box-shadow: var(--shadow-2); font-weight: 600;
}
.skip-link:focus { left: 12px; }

/* ── Top bar ─────────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 clamp(16px, 4vw, 32px);
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none; font-weight: 700;
  letter-spacing: -0.02em; font-size: 17px; flex-shrink: 0;
}
.brand-mark { width: 30px; height: 30px; color: var(--brand); flex-shrink: 0; }
.brand:hover { color: var(--brand); }

.tabs {
  position: relative;
  display: flex; align-items: center; gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative; z-index: 1;
  display: block; white-space: nowrap;
  padding: 9px 15px; border-radius: 999px;
  font-size: 14.5px; font-weight: 550;
  color: var(--muted); text-decoration: none;
  transition: color .18s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--brand-700); }

/* The pill slides between tabs; positioned from JS so it can animate. */
.tab-indicator {
  position: absolute; z-index: 0; top: 50%; left: 0;
  height: 36px; width: 0; transform: translateY(-50%);
  background: var(--brand-tint); border-radius: 999px;
  transition: transform .28s cubic-bezier(.4,0,.2,1), width .28s cubic-bezier(.4,0,.2,1);
}
.tab-indicator.no-anim { transition: none; }

/* ── Panels ──────────────────────────────────────────────────────────── */

.panel[hidden] { display: none; }

.panel-map {
  position: relative;
  height: calc(100dvh - var(--topbar-h));
  overflow: hidden;
}

.panel-scroll {
  min-height: calc(100dvh - var(--topbar-h));
  padding: clamp(32px, 6vw, 72px) clamp(16px, 5vw, 40px) 96px;
}

.wrap { max-width: 1080px; margin: 0 auto; }
.wrap-narrow { max-width: 700px; }

/* ── Map ─────────────────────────────────────────────────────────────── */

#map { position: absolute; inset: 0; background: var(--canvas); }

.map-fallback, .map-error {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 32px; text-align: center; color: var(--muted);
}

/* The selection box + its handles. Drawn by MapLibre; the handles are DOM
   markers so they stay a comfortable hit target at any zoom. */
.sel-handle {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--brand-600);
  box-shadow: 0 1px 4px rgba(20,22,31,.3);
  cursor: grab;
}
.sel-handle:active { cursor: grabbing; }
.sel-handle[data-corner="nw"], .sel-handle[data-corner="se"] { cursor: nwse-resize; }
.sel-handle[data-corner="ne"], .sel-handle[data-corner="sw"] { cursor: nesw-resize; }

.map-hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 5;
  background: var(--ink); color: #fff;
  padding: 9px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 550;
  box-shadow: var(--shadow-2);
  pointer-events: none;
}

.maplibregl-ctrl-group { border-radius: var(--r-sm) !important; box-shadow: var(--shadow-1) !important; }
.maplibregl-ctrl-attrib { font-size: 11px; }

/* ── Floating control card ───────────────────────────────────────────── */

.map-card {
  position: absolute; z-index: 10;
  top: 16px; left: 16px; width: 320px; max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 18px;
}

.map-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.map-card-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

.readout {
  margin: 0 0 14px; display: grid; gap: 1px;
  background: var(--line-2); border-radius: var(--r-sm); overflow: hidden;
}
.readout > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  background: var(--surface); padding: 9px 12px;
}
.readout dt { font-size: 13px; color: var(--muted); }
.readout dd {
  margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; text-align: right;
}
.readout-lg > div { padding: 12px 14px; }
.readout-lg dt, .readout-lg dd { font-size: 14.5px; }

.status {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--ink-2);
  min-height: 20px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  margin-top: 6px; background: var(--muted);
}
.status-dot[data-state="idle"]    { background: var(--line); }
.status-dot[data-state="loading"] { background: var(--brand-600); animation: pulse 1.2s ease-in-out infinite; }
.status-dot[data-state="ok"]      { background: var(--ok); }
.status-dot[data-state="warn"]    { background: var(--warn); }
.status-dot[data-state="bad"]     { background: var(--bad); }

@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

.legend {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0 0; font-size: 12px; color: var(--muted);
}
.legend-swatch {
  width: 22px; height: 0; flex-shrink: 0;
  border-top: 1.5px dashed var(--brand-600); opacity: .7;
}

.fineprint {
  margin: 12px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted);
}
.fineprint a { color: var(--muted); text-decoration: underline; }
.fineprint a:hover { color: var(--brand); }

/* ── Buttons ─────────────────────────────────────────────────────────── */

.primary-btn {
  display: inline-block; width: 100%; text-align: center;
  padding: 12px 20px; border: none; border-radius: var(--r-md);
  background: var(--brand); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: -0.005em;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(67,56,202,.28), 0 4px 12px rgba(67,56,202,.22);
  transition: background .16s ease, transform .1s ease, box-shadow .16s ease;
}
.primary-btn:hover:not(:disabled) {
  background: var(--brand-600);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(67,56,202,.3), 0 8px 20px rgba(67,56,202,.26);
  color: #fff;
}
.primary-btn:active:not(:disabled) { transform: translateY(0); }
.primary-btn:disabled {
  background: var(--line); color: var(--muted);
  box-shadow: none; cursor: not-allowed;
}

.ghost-btn {
  padding: 8px 14px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-2); font-family: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.ghost-btn:hover { background: var(--canvas); border-color: #d5d8e6; color: var(--ink); }

/* ── Page headers & prose ────────────────────────────────────────────── */

.page-head { max-width: 720px; margin-bottom: clamp(32px, 5vw, 56px); }

.eyebrow {
  margin: 0 0 10px; font-size: 12.5px; font-weight: 650;
  letter-spacing: .1em; text-transform: uppercase; color: var(--brand);
}

.page-head h1 {
  font-size: clamp(32px, 5.5vw, 52px); font-weight: 700;
  letter-spacing: -0.035em; margin-bottom: 16px;
}

.lede { margin: 0; font-size: clamp(17px, 2vw, 19px); line-height: 1.6; color: var(--ink-2); }

.prose h2 {
  font-size: 21px; font-weight: 650; margin: 44px 0 12px;
  padding-top: 20px; border-top: 1px solid var(--line);
}
.prose h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.prose p { margin: 0 0 16px; }

/* ── Gallery ─────────────────────────────────────────────────────────── */

.gallery { display: grid; gap: clamp(28px, 4vw, 44px); }

.art {
  margin: 0;
  display: grid;
  gap: clamp(20px, 3vw, 36px);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: clamp(16px, 2.5vw, 24px);
  box-shadow: var(--shadow-1);
  transition: box-shadow .25s ease, transform .25s ease;
}
.art:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }

@media (min-width: 800px) {
  .art { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .art:nth-child(even) > .art-img { order: 2; }
}

.art-img {
  border-radius: var(--r-lg); overflow: hidden; background: var(--canvas);
  aspect-ratio: 4 / 3;
}
.art-img img { width: 100%; height: 100%; object-fit: cover; }

.art figcaption { padding: clamp(4px, 1vw, 12px) 4px; }
.art figcaption h2 { font-size: 24px; font-weight: 650; margin-bottom: 6px; }
.art figcaption p { margin: 0 0 12px; font-size: 15px; }

.art-meta {
  font-size: 12.5px !important; font-weight: 600; color: var(--accent);
  letter-spacing: .04em; text-transform: uppercase;
}

/* ── Link lists ──────────────────────────────────────────────────────── */

.org-list, .social-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; }

.org-list a {
  display: block; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); text-decoration: none;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.org-list a:hover {
  border-color: var(--brand-600); transform: translateX(3px); box-shadow: var(--shadow-1);
}
.org-name { display: block; font-weight: 650; color: var(--ink); margin-bottom: 3px; }
.org-desc { display: block; font-size: 14px; color: var(--muted); line-height: 1.5; }

.social-list a {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); text-decoration: none; color: var(--ink);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.social-list a:hover {
  border-color: var(--brand-600); transform: translateX(3px); box-shadow: var(--shadow-1);
}
.social-list svg { width: 20px; height: 20px; color: var(--brand); flex-shrink: 0; }
.social-name { font-weight: 600; font-size: 15px; }
.social-handle { margin-left: auto; font-size: 13.5px; color: var(--muted); text-align: right; }

/* ── Wizard ──────────────────────────────────────────────────────────── */

.wizard {
  width: min(520px, calc(100vw - 32px));
  padding: 0; border: none; border-radius: var(--r-xl);
  background: var(--surface); color: var(--ink-2);
  box-shadow: var(--shadow-3);
  overflow: visible;
}
.wizard::backdrop { background: rgba(20,22,31,.42); backdrop-filter: blur(3px); }

.wizard[open] { animation: wizard-in .22s cubic-bezier(.2,.8,.3,1); }
@keyframes wizard-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.wizard-close-form { position: absolute; top: 12px; right: 12px; margin: 0; }
.wizard-close {
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.wizard-close:hover { background: var(--canvas); color: var(--ink); }

.steps {
  display: flex; gap: 6px; align-items: center;
  list-style: none; margin: 0; padding: 20px 24px 0;
  font-size: 12px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted);
}
.steps li { display: flex; align-items: center; gap: 6px; }
.steps li::before {
  content: attr(data-step);
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--line-2); color: var(--muted);
  font-size: 11px;
}
.steps li + li::after { content: none; }
.steps li:not(:last-child) { padding-right: 6px; border-right: 1px solid var(--line); margin-right: 2px; }
.steps li.is-current { color: var(--brand-700); }
.steps li.is-current::before { background: var(--brand); color: #fff; }
.steps li.is-done::before { background: var(--ok); color: #fff; content: "✓"; }

.wizard-step { padding: 18px 24px 24px; }
.wizard-step[hidden] { display: none; }
.wizard-step h2 { font-size: 22px; font-weight: 650; margin-bottom: 8px; }
.wizard-lede { margin: 0 0 18px; font-size: 14.5px; color: var(--muted); line-height: 1.55; }
.wizard-note { margin: 14px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }

.callout {
  margin: 0 0 4px; padding: 11px 14px;
  background: var(--accent-tint); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.5; color: #8a3a22;
}

.wizard-actions {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  margin-top: 22px;
}
.wizard-actions .primary-btn { width: auto; min-width: 150px; }

.field { display: block; margin-bottom: 16px; }
.field-label {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px;
}
.req, .opt {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
}
.req { background: var(--brand-tint); color: var(--brand-700); }
.opt { background: var(--line-2); color: var(--muted); }

.field input[type="email"], .field textarea {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 15px; line-height: 1.5;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
.field input[aria-invalid="true"] { border-color: var(--bad); }

.field-hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.field-error { display: block; margin-top: 6px; font-size: 13px; color: var(--bad); font-weight: 500; }
.form-error {
  padding: 10px 13px; background: #fef2f2; border-radius: var(--r-sm);
  border-left: 3px solid var(--bad); margin: 0 0 4px;
}

/* Off-screen rather than display:none — a bot reading the DOM sees a normal
   field, while nobody using the page ever reaches it. */
.hp {
  position: absolute; left: -9999px; width: 1px; height: 1px;
  overflow: hidden; opacity: 0;
}

.turnstile-slot:not(:empty) { margin: 4px 0 16px; }

.done-state { text-align: center; padding: 16px 0 8px; }
.done-state h2 { margin-bottom: 10px; }
.done-state .primary-btn { width: auto; min-width: 200px; margin-top: 4px; }
.done-state .readout { margin-top: 20px; text-align: left; }

.spinner {
  width: 40px; height: 40px; margin: 0 auto 20px;
  border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tick {
  width: 52px; height: 52px; margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 50%; background: #e6f7f4; color: var(--ok);
}
.tick svg { width: 30px; height: 30px; }

/* ── Small screens ───────────────────────────────────────────────────── */

@media (max-width: 720px) {
  :root { --topbar-h: 58px; }

  .topbar { gap: 12px; padding: 0 14px; }
  .brand-text { display: none; }
  .tab { padding: 8px 12px; font-size: 13.5px; }

  /* The card becomes a bottom sheet so the map keeps the usable area. */
  .map-card {
    top: auto; bottom: 0; left: 0; right: 0;
    width: auto; max-width: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 24px rgba(20,22,31,.12);
  }
  .fineprint, .legend { display: none; }
  .readout { grid-template-columns: repeat(3, 1fr); gap: 1px; }
  .readout > div { flex-direction: column; align-items: flex-start; gap: 2px; }
  .readout dd { text-align: left; }

  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { display: none; }

  .wizard { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .wizard-actions { flex-direction: column-reverse; }
  .wizard-actions button, .wizard-actions .primary-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
