:root {
  --bg-color: #080c18;
  --surface: #101830;
  --surface-hover: #16203c;
  --text-primary: #f0f4ff;
  --text-secondary: #a0aec0;
  --accent-purple: #9d4edd;
  --accent-light: #e0aaff;
  --border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(16, 24, 48, 0.6);
  --glass-border: rgba(255, 255, 255, 0.05);
  --grad-primary: linear-gradient(135deg, #9d4edd, #e0aaff);
  
  --font-sans: 'InterVariable', 'Inter', system-ui, -apple-system, sans-serif;
  --r-lg: 1.5rem;  --r-md: 1rem; --r-sm: 0.5rem;
  --sp-sm: 0.5rem; --sp-md: 1rem; --sp-lg: 1.5rem; --sp-xl: 2.5rem;
}

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

/* Form controls do not inherit the page font: without this, buttons and inputs fall
   back to the browser's own control font instead of Inter. A class rule that names
   a font still wins. */
button, input, select, textarea { font-family: var(--font-sans); }

/* The hidden attribute must win over the display rules below (.planet-grid,
   .selected-city), or hidden results and the empty city box still show. */
[hidden] { display: none !important; }

body {
  font-family: var(--font-sans); background-color: var(--bg-color);
  color: var(--text-primary); line-height: 1.6; min-height: 100vh;
  display: flex; flex-direction: column;
}

.main-container { flex: 1; display: flex; justify-content: center; padding: 2rem 1rem; }
.app-container { width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: var(--sp-xl); }

/* ── HEADER ─────────────────────────────────────────────────── */
.site-header { position: relative; border-bottom: 1px solid var(--border); padding: 3rem 1rem 2rem; overflow: hidden; text-align: center; }
.header-glow { position: absolute; inset: 0; background: radial-gradient(ellipse 60% 70% at 50% 30%, rgba(157,78,221,0.15) 0%, transparent 70%); pointer-events: none; }
.header-content { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--sp-md); }
.sun-icon { width: 80px; height: 80px; filter: drop-shadow(0 0 18px rgba(157, 78, 221, 0.5)); }
.header-text h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: -0.02em; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.1; }
.tagline { color: var(--text-secondary); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.3rem; line-height: 1.4; }

/* ── PANELS ─────────────────────────────────────────────────── */
.glass-panel { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--r-md); padding: var(--sp-lg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ── ORRERY (2D MAP) ────────────────────────────────────────── */
.orrery-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: var(--r-md);
  margin-bottom: 1rem;
}
.orrery-container {
  position: absolute;
  width: 90%; height: 90%;
  border-radius: 50%;
  transform: rotate(-90deg); /* align 0 degrees to East or Standard mapping */
}
.celestial-body { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; }
.sun { width: 14px; height: 14px; background: #FFD700; box-shadow: 0 0 12px #FFD700; z-index: 10; }

.orbit {
  position: absolute; top: 50%; left: 50%;
  transform-origin: center center;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 50%;
  pointer-events: none; /* orbit rings must never intercept mouse — only the planet dots should */
}
.orbit-mercury { width: 25%; height: 25%; margin-top: -12.5%; margin-left: -12.5%; }
.orbit-venus { width: 38%; height: 38%; margin-top: -19%; margin-left: -19%; }
.orbit-earth { width: 52%; height: 52%; margin-top: -26%; margin-left: -26%; }
.orbit-mars { width: 66%; height: 66%; margin-top: -33%; margin-left: -33%; }
.orbit-jupiter { width: 84%; height: 84%; margin-top: -42%; margin-left: -42%; }
.orbit-saturn { width: 100%; height: 100%; margin-top: -50%; margin-left: -50%; }

/* Planet dot sizes — all uniform for readability, not dimensional accuracy */
.orbit-mercury .planet { left: 100%; width: 14px; height: 14px; }
.orbit-venus   .planet { left: 100%; width: 14px; height: 14px; }
.orbit-earth   .planet { left: 100%; width: 14px; height: 14px; }
.orbit-mars    .planet { left: 100%; width: 14px; height: 14px; }
.orbit-jupiter .planet { left: 100%; width: 14px; height: 14px; }
.orbit-saturn  .planet { left: 100%; width: 14px; height: 14px; box-shadow: 0 0 0 3px rgba(255, 235, 179, 0.35); }

.bg-mercury { background: #B3B3B3; }
.bg-venus { background: #FFD27D; }
.bg-earth { background: #4B90FF; }
.bg-mars { background: #FF5A36; }
.bg-jupiter { background: #FF9E6F; }
.bg-saturn { background: #FFEBB3; }

/* ── GRID & LIST ──────────────────────────────────────────────── */
.timeline-header { text-align: center; margin-bottom: calc(var(--sp-lg) * -1); }
.timeline-header h3 { font-size: 1.2rem; margin-bottom: 0.2rem; }
.timeline-header p { color: var(--text-secondary); font-size: 0.9rem; }

.planet-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-sm); }
.planet-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.03); }
.planet-row:last-child { border-bottom: none; }
.p-name { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.1rem; }
.p-dot { width: 10px; height: 10px; border-radius: 50%; }
.p-status { font-size: 0.85rem; padding: 0.2rem 0.6rem; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.p-visible { background: rgba(76, 175, 80, 0.15); color: #81C784; }
.p-hidden { background: rgba(255,255,255,0.05); color: var(--text-secondary); }
.p-coords { display: flex; flex-direction: column; text-align: right; font-size: 0.85rem; color: var(--text-secondary); font-family: monospace; }
.p-coords span { line-height: 1.2; white-space: nowrap; }
.p-coords .p-alt { color: var(--accent-light); }
/* Phones: "Below the horizon" and a full Dec line must each stay on one line */
@media (max-width: 420px) {
  .planet-row { padding: 0.85rem 0.75rem; }
  .p-name { font-size: 1rem; }
  .p-coords { font-size: 0.78rem; }
  .p-status { font-size: 0.75rem; padding: 0.2rem 0.5rem; }
}

/* Button */
.btn { width: 100%; display: flex; justify-content: center; align-items: center; gap: 0.5rem; padding: 1rem 1.5rem; border-radius: var(--r-sm); outline: none; border: none; font-weight: 600; font-size: 1rem; font-family: var(--font-sans); cursor: pointer; transition: all 0.2s ease; }
.btn-primary { background: linear-gradient(135deg, var(--accent-purple), var(--accent-light)); color: #000; }
.btn-primary:active { transform: translateY(0); }

/* ---- App switcher carousel ---------------------------------------- */
/* Stormberry chrome, the MetadataScrubber design (2026-10). The track
   holds 10 identical sets of cards and slides by exactly one set
   (-10%), so the loop is seamless. Change the number of sets and the
   shift together. The page's own app is the last card of each set. */
.app-switcher-container {
  padding: 3rem 0;
  margin-top: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  line-height: 1.6;
  color-scheme: dark;
}

.switcher-title {
  margin: 0 0 1.5rem;
  padding: 0 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--text-secondary);
}

.app-switcher-marquee {
  display: flex;
  width: 100%;
  overflow: hidden;
  padding: 0.5rem 1rem 1.5rem;
}

.app-switcher-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
}

.app-switcher-marquee:hover .app-switcher-track,
.app-switcher-marquee:focus-within .app-switcher-track { animation-play-state: paused; }

@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-10%); }
}

.switcher-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-right: 1rem;
  padding: 1rem 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.switcher-card:hover {
  transform: translateY(-3px);
  background: var(--surface-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
}

.switcher-card img {
  width: 32px;
  height: 32px;
  opacity: 0.9;
}

/* A visible focus ring on the dark chrome, whatever the page does elsewhere */
.app-switcher-container a:focus-visible,
.site-footer a:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

/* ---- Carousel and footer access (2026-10-10) ---------------------- */
/* The page's own app, the last card of every set, is marked for screen
   readers (aria-current) and for the eye (an accent border). */
.switcher-card[aria-current="page"] { border-color: var(--accent-light); }

/* Rounded focus ring, whatever corner radius the page's own ring uses */
.switcher-card:focus-visible { border-radius: 12px; }

/* Keyboard focus stops the slide and the row scrolls to the focused card,
   so it is never off-screen. :focus-visible and not :focus-within, so a
   mouse click does not move the card from under the pointer. */
.app-switcher-marquee:has(.switcher-card:focus-visible) { overflow-x: auto; }
.app-switcher-marquee:has(.switcher-card:focus-visible) .app-switcher-track { animation: none; }

/* The pause tick box (WCAG 2.2.2): ticked, the slide stops and the row
   scrolls by hand. Plain CSS, no script. `all: revert` keeps the page's
   own form styles off it. */
.app-switcher-container input.switcher-pause {
  all: revert;
  margin: 0 0.5rem 0.75rem 0;
  vertical-align: middle;
  accent-color: var(--accent-light);
  cursor: pointer;
}

.app-switcher-container label.switcher-pause-label {
  all: revert;
  display: inline-block;
  margin-bottom: 0.75rem;
  vertical-align: middle;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
}

.app-switcher-container input.switcher-pause:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.switcher-pause:checked ~ .app-switcher-marquee { overflow-x: auto; }
.switcher-pause:checked ~ .app-switcher-marquee .app-switcher-track { animation: none; }

/* A footer link never breaks inside itself (the org.nr. did at 320 px) */
.footer-bottom p a { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  /* Nothing slides, so there is nothing to pause. */
  .app-switcher-container input.switcher-pause,
  .app-switcher-container label.switcher-pause-label { display: none; }
}

/* ---- Footer -------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  padding: 4rem 1.5rem 2rem;
  background: var(--bg-color);
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

.site-footer p { margin: 0; }

.footer-inner {
  max-width: 680px;
  margin: 0 auto 3rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.footer-brand { max-width: 320px; }

.footer-logo {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.footer-logo:hover { color: var(--text-primary); }
.footer-dot { background: linear-gradient(135deg, #E21E26, #FF4D54); -webkit-background-clip: text; background-clip: text; color: transparent; }

.footer-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.footer-powered p {
  max-width: 250px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* Credit links read as links, as the legal links do */
.footer-powered a,
.footer-bottom p a {
  color: var(--accent-light);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 150ms ease;
}

.footer-powered a:hover,
.footer-bottom p a:hover { color: var(--text-primary); }

.footer-bottom {
  max-width: 680px;
  margin: 0 auto;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.footer-social { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
.footer-social a { color: var(--text-secondary); transition: color 150ms ease, transform 150ms ease; }
.footer-social a:hover { color: var(--text-primary); transform: translateY(-2px); }
.footer-social svg { display: block; }

.footer-bottom p { color: var(--text-secondary); font-size: 0.85rem; }

/* The public test of an app's privacy claim, where it makes one */
.footer-bottom .footer-offline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
}

.footer-privacy, .footer-ai { opacity: 0.85; }

@media (min-width: 720px) {
  .switcher-title { padding: 0 2rem; }
  .app-switcher-marquee { padding: 0.5rem 2rem 1.5rem; }
  .footer-powered p { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  /* No sliding: the carousel becomes a row the reader scrolls. */
  .app-switcher-track { animation: none; }
  .app-switcher-marquee { overflow-x: auto; }
  .switcher-card,
  .footer-social a { transition: none; }
  .switcher-card:hover,
  .footer-social a:hover { transform: none; }
}

/* ── ORRERY TOOLTIP ─────────────────────────────────────────── */
.orrery-tooltip {
  position: absolute;
  background: rgba(20, 30, 60, 0.95);
  color: var(--accent-light);
  border: 1px solid rgba(157, 78, 221, 0.4);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  z-index: 100;
}
.orrery-tooltip.visible { opacity: 1; transform: translateY(0); }

/* Planets — pointer-events: auto to override parent orbit's none */
.celestial-body.planet { cursor: pointer; pointer-events: auto; transition: transform 0.2s, filter 0.2s; }
.celestial-body.planet:hover { transform: translate(-50%, -50%) scale(1.8); filter: brightness(1.5); }
.celestial-body.sun { cursor: default; pointer-events: auto; }

/* ── LOCATION CARD ──────────────────────────────────────────── */
.tab-group {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: var(--sp-lg);
}
.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--sp-sm) 4px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.tab svg { width: 14px; height: 14px; flex-shrink: 0; }
.tab.active {
  background: linear-gradient(135deg, rgba(157,78,221,0.2), rgba(224,170,255,0.12));
  color: var(--accent-light);
  box-shadow: 0 0 12px rgba(157,78,221,0.15);
}
.tab:hover:not(.active) { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.tab-panel { animation: fadeIn 0.2s forwards; }

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.field-group { margin-bottom: var(--sp-md); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }

.text-input, .search-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.text-input:focus, .search-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(157,78,221,0.15);
}
/* Inline message under a coordinate field when it cannot be read */
.field-error { color: #FF5A5A; font-size: 0.8rem; line-height: 1.4; margin-top: 4px; }
.text-input[aria-invalid="true"] { border-color: rgba(255, 90, 90, 0.6); }

/* Echo of the coordinates actually used, e.g. "Using 60.39, 5.32" */
.field-note { color: var(--text-secondary); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.search-wrapper { position: relative; }
.search-icon {
  position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-secondary); pointer-events: none;
}
.search-input { padding-left: 2.4rem; }

.dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #0e1628;
  border: 1px solid rgba(157,78,221,0.3);
  border-radius: var(--r-md);
  max-height: 220px; overflow-y: auto;
  z-index: 200; list-style: none;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
  scrollbar-width: thin;
}
.dropdown li {
  padding: 0.55rem 1rem; cursor: pointer; font-size: 0.9rem;
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-sm);
  border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.1s, color 0.1s;
}
.dropdown li:last-child { border-bottom: none; }
.dropdown li:hover, .dropdown li.highlighted { background: rgba(157,78,221,0.12); color: var(--accent-light); }
.dropdown li .city-name { font-weight: 500; }
.dropdown li .city-country { font-size: 0.75rem; color: var(--text-secondary); }

.selected-city {
  display: flex; align-items: center; gap: var(--sp-sm);
  background: rgba(157,78,221,0.08); border: 1px solid rgba(157,78,221,0.25);
  border-radius: var(--r-sm); padding: var(--sp-sm) var(--sp-md);
  font-size: 0.88rem; color: var(--accent-light); margin-top: var(--sp-sm);
}
.clear-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 4px; margin-left: auto; transition: color 0.2s; }
.clear-btn:hover { color: #FF5A5A; }

.city-missing-note { font-size: 0.75rem; color: var(--text-secondary); opacity: 0.7; margin-top: 4px; text-align: right; }
.city-missing-note a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

.fade-in { animation: fadeIn 0.5s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Visible keyboard focus (WCAG 2.4.7) */
:focus-visible{outline:2px solid currentColor;outline-offset:2px;border-radius:4px}
