/* ============================================================
   Jason Sun — "city lights" theme.
   Dark navy night map + amber city lights; light mode is cool map paper.
   All sizes are rem, and the root size scales with the screen.
   ============================================================ */

@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("fonts/space-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url("fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  --font-display: "Space Grotesk", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Space Grotesk", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, "PingFang SC", monospace;

  --bg: #eef1f4;
  --grid: rgba(15, 23, 32, 0.055);
  --panel: #f8fafb;
  --ink: #0f1720;
  --muted: #5b6673;
  --line: rgba(15, 23, 32, 0.12);
  --line-strong: rgba(15, 23, 32, 0.28);
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --accent-2: #0a7c86;
  --glow: rgba(232, 89, 12, 0.32);
  --map-bg: #e4e7ea;
}

:root[data-theme="dark"] {
  --bg: #0a0f1a;
  --grid: rgba(140, 170, 210, 0.065);
  --panel: #0f1726;
  --ink: #e6edf5;
  --muted: #8b98ab;
  --line: rgba(160, 185, 220, 0.14);
  --line-strong: rgba(160, 185, 220, 0.32);
  --accent: #ffb547;
  --accent-ink: #1a1206;
  --accent-2: #5ad1c8;
  --glow: rgba(255, 181, 71, 0.45);
  --map-bg: #1c1f24;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0a0f1a;
    --grid: rgba(140, 170, 210, 0.065);
    --panel: #0f1726;
    --ink: #e6edf5;
    --muted: #8b98ab;
    --line: rgba(160, 185, 220, 0.14);
    --line-strong: rgba(160, 185, 220, 0.32);
    --accent: #ffb547;
    --accent-ink: #1a1206;
    --accent-2: #5ad1c8;
    --glow: rgba(255, 181, 71, 0.45);
    --map-bg: #1c1f24;
  }
}

* { box-sizing: border-box; }

html {
  /* 16px on laptops, up to ~24px on big / 5K screens */
  font-size: clamp(16px, 0.55vw + 8px, 24px);
  color-scheme: light dark;
  background: var(--bg);
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1.55;
  /* graticule: a faint lat/long grid behind everything */
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 3rem 3rem;
  background-position: -1px -1px;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

.mono { font-family: var(--font-mono); font-weight: 400; }
.accent { color: var(--accent); }

.link {
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 150ms, color 150ms;
}
.link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- status bar ---------- */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem clamp(1rem, 3vw, 3.5rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.statusbar .who { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); }
.statusbar .who:hover .path { color: var(--accent); }
.statusbar .path { color: var(--muted); transition: color 150ms; }
.statusbar .right { display: inline-flex; align-items: center; gap: 1.25rem; }
.live-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--glow);
  animation: beacon 2.4s ease-out infinite;
}
@keyframes beacon {
  0% { box-shadow: 0 0 0 0 var(--glow); }
  70%, 100% { box-shadow: 0 0 0 0.6rem transparent; }
}

.theme-switcher { display: inline-flex; gap: 0.15rem; }
.theme-switcher button {
  border: 1px solid transparent;
  padding: 0.15rem 0.5rem;
  border-radius: 0.35rem;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.theme-switcher button:hover { color: var(--ink); }
.theme-switcher button[aria-pressed="true"] { border-color: var(--line-strong); color: var(--ink); }

/* ---------- page shell ---------- */
.shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: clamp(2rem, 5vh, 4.5rem) clamp(1rem, 3vw, 3.5rem) 2rem;
}

.kicker {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-2);
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 7.5vw, 8.5rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
}
h1 .dot { color: var(--accent); }

h2 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* buttons */
.btns { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: background 150ms, color 150ms, border-color 150ms, transform 150ms;
}
.btn svg { width: 1rem; height: 1rem; fill: currentColor; }
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }

/* footer */
.footer {
  margin-top: auto;
  padding-top: 3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- shared map bits ---------- */
.leaflet-container { font-family: var(--font-mono); background: var(--map-bg); }
.city-dot { filter: drop-shadow(0 0 0.35rem var(--accent)) drop-shadow(0 0 0.9rem var(--accent)); }
.city-dot.lived { animation: flicker 2.6s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.leaflet-tooltip.city-tip {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.4rem;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.25);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}
.leaflet-tooltip.city-tip::before { display: none; }
.city-tip strong { font-family: var(--font-display); font-size: 0.95rem; }
.city-tip small { display: block; color: var(--muted); }

.leaflet-control-attribution { font-size: 0.6rem; }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(10, 15, 26, 0.7) !important; color: #8b98ab; }
:root[data-theme="dark"] .leaflet-control-attribution a { color: #b8c4d4; }
.leaflet-bar a { background: var(--panel); color: var(--ink); border-color: var(--line) !important; }
.leaflet-bar a:hover { background: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  .live-dot, .city-dot.lived { animation: none; }
}
@media (max-width: 560px) {
  .statusbar .path { display: none; }
}
