/* map.css — The Global Om · live map page.
   Dark, sacred, gold. Matches the landing-page palette and serif elegance. */

:root {
  --gold: #c9a84c;
  --deep: #0a0a1a;
  --mid: #12122a;
  --soft: #1e1e3f;
  --text: #e8e0d0;
  --muted: #8a8070;
  --glow: rgba(201, 168, 76, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  background: var(--deep);
  color: var(--text);
  font-family: 'Georgia', serif;
  overflow: hidden;
}

/* ── Full-screen map ─────────────────────────────────────────────────────── */

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--deep);
  z-index: 0;
}

/* Tame Leaflet's default light controls to fit the dark/gold theme. */
.leaflet-container {
  background: var(--deep);
  font-family: 'Georgia', serif;
}

.leaflet-control-zoom a {
  background: var(--mid);
  color: var(--gold);
  border-color: rgba(201, 168, 76, 0.25);
}

.leaflet-control-zoom a:hover {
  background: var(--soft);
  color: var(--text);
}

.leaflet-control-attribution {
  background: rgba(10, 10, 26, 0.7) !important;
  color: var(--muted) !important;
  font-size: 10px;
}

.leaflet-control-attribution a {
  color: var(--gold) !important;
}

/* ── Top bar: version stamp + nav ───────────────────────────────────────── */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none;
}

.top-bar a {
  pointer-events: auto;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  text-decoration: none;
}

.brand-mark .om {
  font-size: 26px;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 16px rgba(201, 168, 76, 0.5);
}

.brand-mark .name {
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text);
}

.version-stamp {
  font-family: monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 2px;
  text-align: right;
  line-height: 1.6;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

/* ── Live counter overlay ───────────────────────────────────────────────── */

.counter {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(18, 18, 42, 0.72);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* ── Center Om button ───────────────────────────────────────────────────── */

.om-stage {
  position: fixed;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  pointer-events: none;
}

.om-intro {
  font-size: 15px;
  font-style: italic;
  color: var(--text);
  text-align: center;
  max-width: 320px;
  line-height: 1.6;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  opacity: 0.92;
}

#om-btn {
  pointer-events: auto;
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.6);
  background: radial-gradient(
    circle at 50% 45%,
    rgba(201, 168, 76, 0.22),
    rgba(18, 18, 42, 0.9) 70%
  );
  color: var(--gold);
  font-family: 'Georgia', serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease,
    background 0.3s ease;
  box-shadow: 0 0 40px rgba(201, 168, 76, 0.25),
    inset 0 0 30px rgba(201, 168, 76, 0.08);
  animation: pulse 4s ease-in-out infinite;
  /* A real button: never select/highlight the glyph, never show the iOS
     long-press callout, and don't let a touch-hold scroll the page. */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#om-btn-label {
  font-size: 54px;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(201, 168, 76, 0.6);
  user-select: none;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 40px rgba(201, 168, 76, 0.25),
      inset 0 0 30px rgba(201, 168, 76, 0.08);
  }
  50% {
    box-shadow: 0 0 80px rgba(201, 168, 76, 0.55),
      0 0 120px rgba(201, 168, 76, 0.2),
      inset 0 0 40px rgba(201, 168, 76, 0.14);
  }
}

#om-btn:hover:not(:disabled) {
  transform: scale(1.05);
  border-color: var(--gold);
}

#om-btn:active:not(:disabled) {
  transform: scale(0.97);
}

#om-btn:disabled {
  cursor: default;
}

/* Recording states */

/* RECORDING — the button turns solid gold and glows with the live mic level.
   --rec-level (0..1) is set continuously by om-map.js's onLevel callback. */
#om-btn.recording {
  animation: none;
  border-color: var(--gold);
  color: var(--deep);
  background: radial-gradient(
    circle at 50% 45%,
    #f2d98a,
    var(--gold) 60%,
    #b8973f 100%
  );
  transform: scale(calc(1.06 + 0.06 * var(--rec-level, 0)));
  box-shadow: 0 0 calc(60px + 90px * var(--rec-level, 0))
      rgba(201, 168, 76, calc(0.55 + 0.4 * var(--rec-level, 0))),
    0 0 160px rgba(201, 168, 76, calc(0.2 + 0.3 * var(--rec-level, 0))),
    inset 0 0 40px rgba(255, 240, 200, 0.35);
}

#om-btn.recording #om-btn-label {
  color: var(--deep);
  text-shadow: 0 0 24px rgba(255, 240, 200, 0.7);
}

#om-btn.listening {
  animation: breathe 2s ease-in-out infinite;
  border-color: var(--gold);
}

#om-btn.locating,
#om-btn.planting {
  animation: none;
}

#om-btn.landed {
  animation: none;
  border-color: var(--gold);
  box-shadow: 0 0 90px rgba(201, 168, 76, 0.7),
    inset 0 0 40px rgba(201, 168, 76, 0.2);
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 40px rgba(201, 168, 76, 0.35);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 90px rgba(201, 168, 76, 0.6);
  }
}

/* ── Status line below the button ───────────────────────────────────────── */

.om-status {
  min-height: 22px;
  font-size: 16px;
  color: var(--text);
  text-align: center;
  max-width: 340px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.4s ease;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.om-status.visible {
  opacity: 1;
}

/* ── Open-archive opt-in (default OFF) ─────────────────────────────────────── */
.om-archive {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  pointer-events: auto;
  max-width: 320px;
  text-align: left;
  line-height: 1.4;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  user-select: none;
}
.om-archive input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1px solid rgba(201, 168, 76, 0.5);
  border-radius: 5px;
  background: rgba(18, 18, 42, 0.6);
  cursor: pointer;
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.om-archive input[type='checkbox']:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.om-archive input[type='checkbox']:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--deep);
  font-size: 13px;
  font-weight: bold;
}
.om-archive:hover { color: var(--text); }

/* ── Invite / share affordance (appears with the come-back-soon beat) ──────── */
.om-share {
  min-height: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.om-share.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.share-btn {
  pointer-events: auto;
  background: transparent;
  border: 1px solid rgba(201, 168, 76, 0.5);
  color: var(--gold);
  font-family: 'Georgia', serif;
  font-size: 14px;
  letter-spacing: 0.5px;
  padding: 9px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

.share-btn:hover {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ── Bottom links ───────────────────────────────────────────────────────── */

.footer-links {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 24px;
  font-size: 12px;
  font-family: monospace;
  letter-spacing: 1px;
  pointer-events: none;
}

.footer-links a {
  pointer-events: auto;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--gold);
}

/* ── RTL support ────────────────────────────────────────────────────────── */

html[dir='rtl'] .top-bar {
  flex-direction: row-reverse;
}

html[dir='rtl'] .version-stamp {
  text-align: left;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .brand-mark .name {
    display: none;
  }

  .version-stamp {
    font-size: 9px;
    letter-spacing: 1px;
  }

  .counter {
    top: 58px;
    font-size: 11px;
    padding: 7px 14px;
  }

  #om-btn {
    width: 108px;
    height: 108px;
  }

  #om-btn-label {
    font-size: 44px;
  }

  .om-stage {
    bottom: 16%;
    gap: 14px;
  }

  .om-intro {
    font-size: 13px;
    max-width: 260px;
  }

  .om-status {
    font-size: 14px;
    max-width: 280px;
  }

  .footer-links {
    gap: 18px;
    font-size: 11px;
  }
}

@media (max-height: 520px) {
  .om-stage {
    bottom: 8%;
    gap: 10px;
  }

  .om-intro {
    display: none;
  }
}
