/* The home page: a title with live counts, then the world at night — the observatories on a map
   with the night side drawn live — and a rail of observatories beside it; List swaps the map for
   the rentals list. The map's own colours are set here, on the page. */
.home {
  --ok: #8fd19e;
  --ocean: #070b0d;
  --ocean-edge: #0f171a;
  --land: #343a2c;
  --border: #5c6350;
  --night: #02040a;
}

/* Title and live counts */
.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 40px;
  align-items: center;
  margin-bottom: 22px;
}
.home .home-intro h1 {
  margin: 0;
  max-width: 22ch;
}
/* What the page offers, in the words people search with. */
.home-lede {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--text-base);
}
.counts {
  display: grid;
  grid-template-columns: repeat(4, auto);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  overflow: hidden;
}
.count {
  min-width: 0;
  padding: 12px 18px;
  border-left: 1px solid var(--line);
}
.count:first-child {
  border-left: 0;
}
.count b {
  display: block;
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.count small {
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.count.live b {
  color: var(--gold);
}

/* The view switch, and the hemispheres the list can show */
.home-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 14px;
}
.switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.switch button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 600 var(--text-sm) var(--font-site);
  cursor: pointer;
}
.switch button[aria-pressed="true"] {
  background: var(--gold);
  color: #1a1708;
}
.switch svg {
  width: 15px;
  height: 15px;
}
.hemis {
  display: none;
  gap: 6px;
  margin-left: auto;
}
.home.list .hemis {
  display: flex;
}
.hemis button {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: var(--text-sm) var(--font-site);
  cursor: pointer;
}
.hemis button[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--text);
}

/* The map and the rail of observatories beside it */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
  margin-bottom: 40px;
}
.map-col {
  min-width: 0;
}
.map {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: radial-gradient(120% 90% at 50% 40%, var(--ocean-edge), var(--ocean) 70%);
  touch-action: none;
}
.map svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
}
.map svg:active {
  cursor: grabbing;
}
.sphere {
  fill: none;
  stroke: color-mix(in srgb, var(--gold) 22%, transparent);
  stroke-width: 1;
}
.grat {
  fill: none;
  stroke: color-mix(in srgb, var(--gold) 7%, transparent);
  stroke-width: 0.6;
}
.grat.major {
  stroke: color-mix(in srgb, var(--gold) 16%, transparent);
  stroke-dasharray: 2 4;
}
.land {
  fill: var(--land);
}
.borders {
  fill: none;
  stroke: var(--border);
  stroke-width: 0.7;
  stroke-linejoin: round;
}
.provinces {
  fill: none;
  stroke: color-mix(in srgb, var(--gold) 30%, transparent);
  stroke-width: 0.5;
  stroke-dasharray: 1.5 2;
}
.map .day {
  fill: var(--softgold);
  fill-opacity: 0.07;
  pointer-events: none;
}
.map .night {
  fill: var(--night);
  fill-opacity: 0.13;
  pointer-events: none;
}
.terminator {
  fill: none;
  stroke: var(--ok);
  stroke-width: 0.7;
  stroke-opacity: 0.55;
  stroke-dasharray: 4 3;
  pointer-events: none;
}
.non-scaling {
  vector-effect: non-scaling-stroke;
}

.hud {
  position: absolute;
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.hud.tl {
  top: 12px;
  left: 14px;
}
.hud.tl b {
  color: var(--softgold);
  font-weight: 600;
}
.hud .ahead {
  margin-left: 6px;
  color: var(--ok) !important;
}
.hud.bl {
  bottom: 12px;
  left: 14px;
}
.play {
  position: absolute;
  top: 9px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 10px;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--softgold);
  font: 600 var(--text-xs) var(--font-site);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.play:hover {
  border-color: var(--gold);
}
.play svg {
  width: 11px;
  height: 11px;
}
.play .i-stop,
.play[aria-pressed="true"] .i-play {
  display: none;
}
.play[aria-pressed="true"] .i-stop {
  display: block;
}
.progress {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: 0 0;
  pointer-events: none;
}
.home.replaying .rail {
  opacity: 0.4;
  transition: opacity 0.3s;
}
.zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  gap: 6px;
}
.zoom button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--text);
  font: var(--text-lg) / 1 var(--font-site);
  cursor: pointer;
}
.zoom button:hover {
  border-color: var(--gold);
}
.zoom svg {
  width: 15px;
  height: 15px;
}
.scale {
  position: absolute;
  right: 56px;
  bottom: 18px;
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: var(--text-xs);
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.key {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.key.night {
  width: 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--land), #0a0c12);
}
.key.astro {
  width: 18px;
  height: 0;
  border-top: 1px dashed color-mix(in srgb, var(--ok) 70%, transparent);
  border-radius: 0;
}
.key.sun {
  width: 9px;
  height: 9px;
}
.sun-look {
  border-radius: 50%;
  background: radial-gradient(circle, #fff6dc 0 35%, var(--softgold) 60%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--softgold) 22%, transparent),
    0 0 12px 3px color-mix(in srgb, var(--softgold) 55%, transparent);
}
.partner-link {
  margin-left: auto;
  color: var(--softgold);
  text-decoration: none;
}
.partner-link:hover {
  text-decoration: underline;
}

/* Observatory markers, kept the same size at every zoom */
.pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sun-pin {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  pointer-events: none;
}
.pin {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}
.dot {
  position: absolute;
  top: -7px;
  left: -7px;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid #1a1708;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 14px color-mix(in srgb, var(--gold) 70%, transparent);
  pointer-events: auto;
  cursor: pointer;
}
.pin.dark .dot::after {
  content: "";
  position: absolute;
  inset: -9px;
  border: 1px solid var(--ok);
  border-radius: 50%;
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  from {
    transform: scale(0.5);
    opacity: 0.9;
  }
  to {
    transform: scale(1.6);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pin.dark .dot::after {
    animation: none;
    opacity: 0.6;
  }
}
.leader {
  position: absolute;
  height: 1px;
  background: color-mix(in srgb, var(--gold) 60%, transparent);
  transform-origin: 0 0;
  pointer-events: none;
}
.true-spot {
  position: absolute;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--softgold);
  pointer-events: none;
}
.tag {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 4px 7px;
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, #0d0f0c 82%, transparent);
  backdrop-filter: blur(4px);
  color: var(--text);
  font: inherit;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tag:hover,
.tag.hot {
  border-color: var(--gold);
  background: color-mix(in srgb, #15130a 92%, transparent);
}
.tag .name {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tag .country {
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.tag .sky {
  display: grid;
  place-items: center;
  flex: none;
  width: 14px;
  height: 14px;
}
.tag .sky svg {
  width: 14px;
  height: 14px;
}
.tag .sky.day {
  color: var(--softgold);
}
.tag .sky.twilight {
  color: var(--muted);
}
.tag .sky.dark {
  color: var(--ok);
}
.tag.compact .country {
  display: none;
}

/* The card that opens over a marker */
.map-card {
  position: absolute;
  z-index: 5;
  width: 270px;
  padding: 14px 16px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: #11130f;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.map-card h3 {
  margin: 0;
  font-size: var(--text-lg);
  line-height: 1.2;
}
.map-card .where {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: var(--text-sm);
}
.map-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin: 0 0 12px;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.map-card dt {
  color: var(--muted);
}
.map-card dd {
  margin: 0;
}
.map-card .free {
  color: var(--ok);
}
.map-card .open {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-control);
  background: var(--gold);
  color: #1a1708;
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
}

/* The rail of observatories */
.rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--panel);
}
.rail h2 {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 600 var(--text-xs) var(--font-site);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.rail ol {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 2px;
  min-height: 0;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}
.rail li button {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rail li button:hover,
.rail li button.hot {
  border-color: var(--line);
  background: color-mix(in srgb, var(--gold) 6%, transparent);
}
.rail .sky-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.6;
}
.rail .sky-dot.dark {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  opacity: 1;
}
.rail .r-name {
  min-width: 0;
  overflow: hidden;
  font-size: var(--text-base);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail .r-sub {
  grid-column: 2;
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}
.rail .r-num {
  grid-row: 1 / span 2;
  grid-column: 3;
  font-size: var(--text-sm);
  line-height: 1.25;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rail .r-num b {
  display: block;
  color: var(--ok);
  font-size: var(--text-lg);
}
.rail .r-num b.none {
  color: var(--muted);
}
.rail .r-num small {
  color: var(--muted);
  font-size: var(--text-xs);
}

@media (max-width: 1000px) {
  .stage {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .home-intro {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  /* A finger has no pointer to follow, and the corners are needed for the clock and the zoom. */
  .hud.bl,
  .scale {
    display: none;
  }
}
@media (max-width: 520px) {
  .counts {
    grid-template-columns: repeat(2, 1fr);
  }
  .count:nth-child(3) {
    border-left: 0;
  }
  .count:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .hemis {
    margin-left: 0;
  }
}
