:root {
  --ink: #14202b;
  --muted: #5b6875;
  --paper: #ffffff;
  --glass: rgba(255, 255, 255, 0.82);
  --glass-line: rgba(20, 32, 43, 0.08);
  --red: #e2001a;
  --red-dark: #b30015;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

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

body {
  background: #0b1a2b;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--paper); padding: 8px 12px; border-radius: 8px; }

/* ---------- Landing (full-bleed map) ---------- */

.landing { position: fixed; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; }

.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 16px 0;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 10px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  text-decoration: none;
}
.brand img { width: 40px; height: auto; display: block; flex: none; }
.brand-name { display: block; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-place { display: block; font-size: 13px; color: var(--muted); line-height: 1.3; }

.login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  transition: background 0.15s ease, transform 0.15s ease;
}
.login:hover { background: var(--red-dark); }
.login:active { transform: translateY(1px); }

/* Entrance: header + login slide in once the globe is up */
.brand, .login { animation: drop-in 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.login { animation-delay: 0.15s; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* House pin */
.pin { display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0; transform: translateY(8px); transition: opacity 0.6s ease, transform 0.6s ease; }
.pin.is-visible { opacity: 1; transform: none; }
.pin-label {
  order: -1;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 13px/1.3 var(--font);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}
.pin-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(226, 0, 26, 0.6); animation: pulse 2s ease-out infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 18px rgba(226, 0, 26, 0); } }

/* Photo blend-over: a soft circle opens from the pin while the photo eases out of a slight zoom */
@property --reveal { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.photo {
  --px: 50%;
  --py: 50%;
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  --reveal: 0%;
  -webkit-mask-image: radial-gradient(circle at var(--px) var(--py), #000 calc(var(--reveal) - 18%), transparent var(--reveal));
  mask-image: radial-gradient(circle at var(--px) var(--py), #000 calc(var(--reveal) - 18%), transparent var(--reveal));
  transition: --reveal 1.1s ease-in, visibility 0s linear 1.1s;
}
.photo img { transform: scale(1.18); transform-origin: var(--px) var(--py); transition: transform 2.6s cubic-bezier(0.22, 0.8, 0.2, 1); }
.photo-shown .photo {
  --reveal: 160%;
  visibility: visible;
  pointer-events: auto;
  transition: --reveal 2.2s cubic-bezier(0.45, 0, 0.2, 1), visibility 0s;
}
.photo-shown .photo img { transform: none; }
.photo-instant .photo { transition: --reveal 0.5s ease, visibility 0s; }
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; display: block; }
.photo::before,
.photo::after { content: ''; position: absolute; left: 0; right: 0; pointer-events: none; }
.photo::before { top: 0; height: 160px; background: linear-gradient(to bottom, rgba(8, 18, 28, 0.45), rgba(8, 18, 28, 0)); }
.photo::after { bottom: 0; height: 140px; background: linear-gradient(to top, rgba(8, 18, 28, 0.55), rgba(8, 18, 28, 0)); }
/* Map softens while the photo takes over */
#map { transition: filter 1.6s ease; }
.photo-shown #map { filter: blur(6px) saturate(0.8); }
.photo-shown .pin { opacity: 0; }

/* View chips (replay / map / photo) */
.views {
  position: absolute;
  left: 16px;
  bottom: 64px;
  z-index: 3;
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.has-arrived .views { opacity: 1; pointer-events: auto; }
.chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink);
  font: 500 13px/1 var(--font);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.chip:hover { background: #fff; }
.chip-photo-only { display: none; }
.photo-shown .chip-photo-only { display: inline-flex; align-items: center; }
.photo-shown .chip-map-only { display: none; }
.photo-shown .maplibregl-ctrl-bottom-right { opacity: 0; pointer-events: none; }

/* Footer overlay on the landing page */
.site-footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(8, 18, 28, 0.78), rgba(8, 18, 28, 0));
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* MapLibre controls clear of the footer */
.landing .maplibregl-ctrl-bottom-right,
.landing .maplibregl-ctrl-bottom-left { bottom: 44px; }
.landing .maplibregl-ctrl-attrib { font-size: 11px; }

@media (min-width: 720px) {
  .topbar { padding: max(24px, env(safe-area-inset-top)) 28px 0; }
  .brand { gap: 14px; padding: 12px 22px 12px 12px; }
  .brand img { width: 48px; }
  .brand-name { font-size: 22px; }
  .brand-place { font-size: 14px; }
  .site-footer { padding: 16px 28px 18px; }
  .views { left: 28px; }
}

@media (max-width: 380px) {
  .brand-place { font-size: 12px; }
  .login { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .brand, .login { animation: none; }
  .pin-dot { animation: none; }
  .photo, .photo-shown .photo { transition: visibility 0s; }
  .photo img { transition: none; transform: none; }
}

/* ---------- Legal pages ---------- */

.doc { background: #f5f7f9; color: var(--ink); min-height: 100%; display: flex; flex-direction: column; }
.doc .topbar { position: static; padding: 24px 16px 0; max-width: 820px; width: 100%; margin: 0 auto; }
.doc .brand { box-shadow: none; background: var(--paper); }
.doc .brand, .doc .login { animation: none; }
.doc main { flex: 1; max-width: 820px; width: 100%; margin: 0 auto; padding: 32px 16px 48px; }
.doc h1 { font-size: 32px; letter-spacing: -0.02em; margin: 0 0 24px; }
.doc h2 { font-size: 18px; margin: 32px 0 8px; }
.doc p, .doc li { color: #2c3a47; max-width: 68ch; }
.doc a { color: var(--red-dark); }
.doc .site-footer { position: static; background: none; color: var(--muted); max-width: 820px; width: 100%; margin: 0 auto; border-top: 1px solid #dfe5ea; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc th, .doc td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid #dfe5ea; vertical-align: top; }
@media (min-width: 720px) { .doc .topbar { padding: 32px 28px 0; } .doc main { padding: 40px 28px 64px; } .doc .site-footer { padding: 16px 28px 24px; } }
.doc a.login { color: #fff; }
.doc a.brand { color: var(--ink); }

/* Phones: the footer wraps to three lines, so lift the chips and map controls above it */
@media (max-width: 719px) {
  .views { bottom: 112px; }
  .landing .maplibregl-ctrl-bottom-right,
  .landing .maplibregl-ctrl-bottom-left { bottom: 104px; }
}

/* Globe still: on screen from the first paint, fades into the live map once it is painted.
   Captured at the map's start view (1000 × 1000 CSS px viewport via landing.js ?still, cropped to the centre 600 × 600 at 2×); the live globe has a fixed pixel size, so at its natural
   size it lines up with the live globe. */
#map { z-index: 0; }
.still {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0b1a2b;
  pointer-events: none;
  transition: opacity 0.7s ease, visibility 0s linear 0.7s;
}
.still img { width: 600px; height: 600px; max-width: none; display: block; }
.still-gone .still { opacity: 0; visibility: hidden; }
.map-loading .chip { cursor: progress; opacity: 0.7; }

/* Dev capture mode (localhost ?still): the bare globe */
.capture .topbar,
.capture .site-footer,
.capture .views,
.capture .maplibregl-control-container { display: none; }
