/* Sun & Moon: base styles. Mobile first; light and dark follow the OS. */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #1d1f24;
  --muted: #646a75;
  --line: #e4e1d8;
  --accent-sun: #e8891c;
  --accent-sun-soft: #fdf1e1;
  --accent-moon: #4a5a8c;
  --accent-moon-soft: #eceff8;
  --accent-twilight: #8a4f7d;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #181c25;
    --text: #e9eaee;
    --muted: #9aa1ad;
    --line: #2a303c;
    --accent-sun: #f4a340;
    --accent-sun-soft: #2a2116;
    --accent-moon: #9fb0e6;
    --accent-moon-soft: #1c2234;
    --accent-twilight: #d39cc6;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-wrap: break-word; }
h1, h2, h3, p { margin: 0; }

.site-header {
  padding: 16px 20px;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-nav { display: flex; gap: 18px; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.brand-mark { width: 28px; height: 28px; display: block; }

.page {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 20px 40px;
}

.place { margin: 8px 0 10px; }
.place h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); line-height: 1.15; letter-spacing: -0.01em; }
.place-meta { margin-top: 6px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.place-meta > * { min-width: 0; overflow-wrap: anywhere; }
/* While another day or place loads in place. */
.is-navigating main.page { opacity: 0.6; transition: opacity 0.15s 0.1s; }
.note { font-size: 0.9rem; }
.link-button {
  font: inherit;
  font-size: 0.9rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-moon);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.notice {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-moon-soft);
  font-size: 0.95rem;
}

.cards { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
/* Two columns: Sun | Moon, Twilight | Phase, then solar activity. One column keeps the page order: all Sun, then all Moon. */
@media (min-width: 820px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-sun { grid-area: 1 / 1; }
  .card-moon { grid-area: 1 / 2; }
  .card-twilight { grid-area: 2 / 1; }
  .card-phase { grid-area: 2 / 2; }
  .card-activity { grid-area: 3 / 1; }
}

/* Small cards, one topic each: a title, the key facts, then details. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
@media (max-width: 380px) { .card { padding: 16px 14px; } }

.card-section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; }
.card-caption { color: var(--muted); font-size: 0.85rem; margin-right: auto; }
.card-sun .card-header h2, .card-activity .card-header h2 { color: var(--accent-sun); }
.card-moon .card-header h2, .card-phase .card-header h2 { color: var(--accent-moon); }
.card-twilight .card-header h2 { color: var(--accent-twilight); }
.card-icon { width: 28px; height: 28px; flex: none; }
.sun-icon { fill: var(--accent-sun); stroke: var(--accent-sun); stroke-width: 1.6; stroke-linecap: round; }
.moon-glyph { fill: var(--accent-moon); }
.twilight-icon { fill: none; stroke: var(--accent-twilight); stroke-width: 1.8; stroke-linecap: round; }
.moon-icon .moon-dark { fill: var(--accent-moon-soft); stroke: var(--accent-moon); stroke-width: 1; }
.moon-icon .moon-lit { fill: var(--accent-moon); }
.card .notice { margin: 0; }
.notice[hidden] { display: none; }

/* Rise/set timeline: the previous event, "now", then the next two. */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.timeline { container-type: inline-size; }
.event {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon name time"
    "icon day  relative";
  column-gap: 12px;
  align-items: baseline;
  padding: 10px 14px;
  border-radius: 14px;
}
.event[hidden] { display: none; }
.event-icon {
  grid-area: icon;
  align-self: center;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card-sun .event-icon { color: var(--accent-sun); }
.card-moon .event-icon { color: var(--accent-moon); }
.event-name { grid-area: name; font-weight: 600; }
.event-time {
  grid-area: time;
  text-align: right;
  font-size: clamp(1.35rem, 5vw, 1.6rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.event-day { grid-area: day; font-size: 0.85rem; color: var(--muted); }
.event-day .north-true, .event-day .north-magnetic { white-space: nowrap; }
.day-label { color: var(--text); font-weight: 600; }
.event-relative {
  grid-area: relative;
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.event.is-past { opacity: 0.6; }
/* Narrow cards (small phones, large text): stack time and countdown under the name. */
@container (max-width: 300px) {
  .event {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-areas: "icon name" "icon time" "icon day" "icon relative";
  }
  .event-time, .event-relative { text-align: left; }
}
.event.is-past .event-time { font-size: 1.15rem; font-weight: 600; }
.card-sun .event.is-next { background: var(--accent-sun-soft); }
.card-moon .event.is-next { background: var(--accent-moon-soft); }

.now-marker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.now-marker::before, .now-marker::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.now-marker::before { flex: 0 0 14px; }
.now-marker time { font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; font-weight: 500; }

.details { margin: 0; display: grid; gap: 0; }
.details > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.details dt { color: var(--muted); }
.details dd { margin: 0 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }
.dt-note, .dd-note { display: block; font-size: 0.8rem; color: var(--muted); }
.dt-note { opacity: 0.85; }
.muted { color: var(--muted); }
.footnote { font-size: 0.8rem; color: var(--muted); }
.footnote a { color: inherit; }

/* Fixed layout so large text wraps inside the cells instead of widening the card. */
.twilight { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.twilight thead th:first-child { width: 40%; }
.twilight th[scope="row"] { hyphens: auto; }
.twilight th, .twilight td { padding: 8px 0; border-top: 1px solid var(--line); text-align: right; }
.twilight th[scope="row"], .twilight thead th:first-child { text-align: left; font-weight: 400; color: var(--muted); }
.twilight thead th { font-size: 0.85rem; color: var(--muted); font-weight: 500; border-top: 0; }

.phase {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--accent-moon-soft);
}
.phase .moon-icon { width: 56px; height: 56px; }
.phase .bar, .phase .footnote { grid-column: 1 / -1; }
.phase-text { min-width: 0; }
.phase-name { font-size: 1.3rem; font-weight: 650; }
.phase-meta [hidden] { display: none; }
.phase-meta { color: var(--muted); font-variant-numeric: tabular-nums; }
.phase-meta strong { color: var(--text); font-weight: 600; }
.bar { display: block; }
.bar-track { fill: var(--line); }
.bar-fill { fill: var(--accent-moon); }

.subheading { font-size: 1rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.subheading .muted { font-weight: 400; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* Solar activity level, NOAA terms. */
.activity { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.activity strong {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  background: var(--accent-sun-soft);
  color: var(--accent-sun);
}
.activity-high strong, .activity-veryhigh strong { background: #c2410c; color: #fff; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.phase-list { list-style: none; margin: 0; padding: 0; }
.phase-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  column-gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.phase-list time { color: var(--muted); }

.site-footer a { color: inherit; }
.site-footer p + p { margin-top: 4px; }
.site-footer {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---- Navigator: where and when, kept at the top while scrolling --------- */
.navigator {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -20px 20px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.navigator-bar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.navigator :is(input, button, summary, a):focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 2px; }

/* Shared look: one height, one border, one radius. */
.where-chip, .day-step, .day-pick input, .time-pick input, .reset, .day-go, .time-go {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.95rem;
}
.navigator svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* The place: a chip that opens the location panel. */
.where { min-width: 0; }
.where-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 24rem;
  padding: 0 10px 0 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  user-select: none;
}
.where-chip::-webkit-details-marker { display: none; }
.where-chip:hover { border-color: var(--muted); }
.where-pin { color: var(--accent-sun); }
.where-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.where-caret { color: var(--muted); transition: transform 0.15s; }
.where[open] > .where-chip { border-color: var(--accent-moon); }
.where[open] .where-caret { transform: rotate(180deg); }
.where-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(100%, 36rem);
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.18);
}
.where-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.where-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--accent-moon);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.where-action svg { width: 16px; height: 16px; }
.where-action:hover { border-color: var(--accent-moon); background: var(--accent-moon-soft); }
.where-action:disabled { opacity: 0.6; cursor: progress; }
.where-action.back-home { background: var(--accent-moon-soft); border-color: transparent; }
.where-action[hidden] { display: none; }
.where-actions .hint { flex-basis: 100%; }
.hint { color: var(--muted); font-size: 0.9rem; }

/* The date: ‹ picker › */
.day-nav { display: flex; align-items: center; gap: 6px; min-width: 0; }
.day-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  text-decoration: none;
}
.day-step:hover { border-color: var(--muted); }
.day-step.is-disabled { visibility: hidden; }
.day-pick, .time-pick { display: flex; gap: 6px; align-items: center; min-width: 0; }
.day-pick input, .time-pick input {
  min-width: 0;
  padding: 0 10px;
  color-scheme: light dark;
  font-variant-numeric: tabular-nums;
}
/* With JavaScript a click anywhere on the field opens the picker, so the small icon can go. */
.js .day-pick input, .js .time-pick input { cursor: pointer; }
.js .day-pick input::-webkit-calendar-picker-indicator,
.js .time-pick input::-webkit-calendar-picker-indicator { display: none; }
.day-pick input:hover, .time-pick input:hover { border-color: var(--muted); }
.day-go, .time-go { padding: 0 14px; border: 0; background: var(--accent-moon); color: var(--surface); cursor: pointer; }
.day-go[hidden], .time-go[hidden] { display: none; }

/* The way back. */
.resets { display: flex; gap: 8px; margin-left: auto; }
.reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  color: var(--accent-moon);
}
.reset:hover { border-color: var(--accent-moon); }
.reset-here { background: var(--accent-moon); border-color: var(--accent-moon); color: var(--surface); padding-left: 11px; }
.reset-here:hover { filter: brightness(1.08); }
.reset[hidden] { display: none; }

/* Phones: the place and the way back on one line, date and time on the next. */
@media (max-width: 640px) {
  .navigator { padding: 8px 20px; }
  .navigator-bar { row-gap: 4px; }
  .navigator-bar::before { content: ""; order: 2; flex-basis: 100%; }
  .where { order: 1; flex: 1 1 0; }
  .where-chip { max-width: none; }
  .where-rest { display: none; }
  .resets { order: 1; margin-left: 0; }
  /* Time moves to its own line only on the narrowest screens. */
  .day-nav { order: 3; flex: 1 1 0; min-width: 12.5rem; }
  .time-pick { order: 3; }
  .day-pick { flex: 1; }
  .day-pick input { flex: 1; width: 0; }
  .day-step { width: 38px; }
  .where-panel { width: 100%; }
  .reset { padding: 0 12px; }
  .reset-here svg { display: none; }
}

/* ---- Sky panorama and time control ------------------------------------- */
.sky-panel {
  margin: 0 0 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sky-time { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.sky-title { font-size: 1.05rem; display: flex; gap: 8px; align-items: baseline; }
.sky-title time { font-variant-numeric: tabular-nums; font-size: 1.35rem; }
.sky-slider[hidden] { display: none; }
/* The slider sits on a strip coloured by the Sun's altitude through the day. */
.sky-slider { position: relative; height: 28px; }
.day-strip { position: absolute; inset: 9px 0; width: 100%; height: 10px; border-radius: 5px; }
.sky-slider input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.sky-slider input[type="range"]::-webkit-slider-runnable-track { height: 28px; background: transparent; }
.sky-slider input[type="range"]::-moz-range-track { height: 28px; background: transparent; }
.sky-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: 3px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent-sun);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
}
.sky-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent-sun);
}
.sky-slider input[type="range"]:focus-visible { outline: 2px solid var(--accent-moon); outline-offset: 2px; border-radius: 6px; }

.day-strip .sky-day { fill: #8ec5ef; }
.day-strip .sky-golden { fill: #f2b86b; }
.day-strip .sky-civil { fill: #c77d8a; }
.day-strip .sky-nautical { fill: #4b5a92; }
.day-strip .sky-astro { fill: #2a3260; }
.day-strip .sky-night { fill: #141a36; }

svg.sky { display: block; width: 100%; height: auto; }
.sky .stop-top { stop-color: #0b1030; }
.sky .stop-horizon { stop-color: #1d2650; }
.sky-day .stop-top { stop-color: #3f8fd8; }
.sky-day .stop-horizon { stop-color: #a9d3f2; }
.sky-golden .stop-top { stop-color: #5d8fd0; }
.sky-golden .stop-horizon { stop-color: #f6c27a; }
.sky-civil .stop-top { stop-color: #33407a; }
.sky-civil .stop-horizon { stop-color: #e28c74; }
.sky-nautical .stop-top { stop-color: #1b2350; }
.sky-nautical .stop-horizon { stop-color: #4b4f88; }
.sky-astro .stop-top { stop-color: #0f1433; }
.sky-astro .stop-horizon { stop-color: #262c5c; }
.sky .stars circle { fill: #fff; opacity: 0; transition: opacity 0.4s; }
.sky-astro .stars circle { opacity: 0.35; }
.sky-night .stars circle { opacity: 0.8; }
.sky-grid line { stroke: rgb(255 255 255 / 0.18); stroke-dasharray: 2 6; }
.sky-grid text { fill: rgb(255 255 255 / 0.55); font-size: 13px; }
.sky-path { fill: none; stroke-width: 2.5; stroke-dasharray: 1 7; stroke-linecap: round; }
.sky-path-sun { stroke: #ffd27a; }
.sky-path-moon { stroke: #c9d4ff; }
.sky-ground { fill: #1c2a1f; fill-opacity: 0.82; }
.sky-day .sky-ground, .sky-golden .sky-ground { fill: #4c6b3f; }
.sky-horizon { stroke: rgb(255 255 255 / 0.55); stroke-width: 1.5; }
.sky-compass text { fill: rgb(255 255 255 / 0.85); font-size: 15px; font-weight: 600; text-anchor: middle; }
/* The panorama shrinks on phones; its labels must not. */
@media (max-width: 600px) {
  .sky-compass text { font-size: 26px; }
  .sky-grid text { font-size: 22px; }
  .sky-marker { transform: scale(1.8); }
}
.sky-sun .sun-glow { fill: #ffd27a; opacity: 0.3; }
.sky-sun .sun-disc { fill: #ffcf4d; stroke: #fff3c4; stroke-width: 2; }
.sky-moon .moon-dark { fill: #2b3150; stroke: #c9d4ff; stroke-width: 1.2; }
.sky-moon .moon-lit { fill: #f1efe4; }
.sky-sun.is-below, .sky-moon.is-below { opacity: 0.45; }

/* Where each body is at the chosen time: two blocks under the panorama,
   side by side when there is room. */
.sky-bodies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 4px 28px;
  padding: 12px 16px 4px;
}
.sky-body { min-width: 0; }
.sky-body-name { font-size: 1rem; display: flex; align-items: center; gap: 8px; padding-bottom: 4px; }
.sky-body .details dd { font-variant-numeric: tabular-nums; }
/* Altitude and bearing on one row; on a narrow card it wraps at the dot. */
.sky-position > span { white-space: nowrap; }
.sky-note { padding: 4px 16px 14px; }
.sky-note[hidden] { display: none; }
.sky-key { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.sky-key-sun { background: #ffcf4d; }
.sky-key-moon { background: #c9d4ff; border: 1px solid #7c88b8; }

/* ---- Location panel: search and map ------------------------------------- */
.place-search { position: relative; }
.place-search-row { display: flex; gap: 8px; }
.place-search input[type="search"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
}
.place-search button {
  font: inherit;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent-moon);
  color: var(--surface);
  cursor: pointer;
}
.place-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
}
.place-results[hidden] { display: none; }
.place-results a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.place-results a:hover, .place-results a.is-active { background: var(--accent-moon-soft); }
.place-name { font-weight: 600; }
.place-where { color: var(--muted); }
.place-none { padding: 10px 12px; color: var(--muted); }

.world-map { min-width: 0; }
.map-frame {
  position: relative;
  aspect-ratio: 2 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #cfe3f3;
  cursor: crosshair;
  border: 1px solid var(--line);
}
.map-frame.is-loading { opacity: 0.6; cursor: progress; }
.map-frame > svg, .map-frame > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-land { fill: #e9e3cf; stroke: #b9b29a; stroke-width: 0.6; }
.map-borders { fill: none; stroke: #b9b29a; stroke-width: 0.5; }
.map-graticule { fill: none; stroke: rgb(255 255 255 / 0.55); stroke-width: 0.5; }
.map-sun { fill: #ffcf4d; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.map-here { fill: var(--accent-sun); stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
@media (prefers-color-scheme: dark) {
  .map-frame { background: #243553; }
  .map-land { fill: #56617a; stroke: #6d7891; }
  .map-borders { stroke: #59637a; }
  .map-graticule { stroke: rgb(255 255 255 / 0.12); }
}
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; vertical-align: -1px; }
.legend:first-child { margin-left: 0; }
.legend-day { background: #e9e3cf; border: 1px solid #b9b29a; }
.legend-twilight { background: #8a8fa8; }
.legend-night { background: #2a3048; }

/* ---- Places: breadcrumbs, more places, country and place lists ----------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; font-size: 0.9rem; color: var(--muted); }
.crumbs a { color: var(--accent-moon); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.more-places { margin-top: 28px; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.more-places h2, .country-group h2 { font-size: 1rem; margin-bottom: 8px; }
.place-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
  gap: 2px 16px;
}
.place-links a, .country-links a { color: var(--accent-moon); text-decoration: none; display: inline-block; padding: 4px 0; }
.place-links a:hover, .country-links a:hover { text-decoration: underline; }
.more-link { display: inline-block; margin-top: 8px; color: var(--accent-moon); font-size: 0.9rem; }
.country-links {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 16rem;
  column-gap: 24px;
}
.country-links li { break-inside: avoid; }
.country-group + .country-group { margin-top: 20px; }

/* ---- Bearings: true north or compass ---------------------------------------
   The north island sets html[data-north]. Without it true bearings show and
   compass bearings (marked .north-optional) stay hidden. */
html[data-north="true"] .north-magnetic,
html[data-north="magnetic"] .north-true,
html:not([data-north="magnetic"]) .north-optional { display: none; }

.north-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 12px 16px 0;
  font-size: 0.9rem;
}
.north-switch[hidden], .north-hint[hidden] { display: none; }
.north-switch-label { color: var(--muted); }
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface);
}
.segmented label {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}
.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.segmented label:has(input:checked) { background: var(--accent-moon-soft); color: var(--text); font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent-moon); outline-offset: 1px; }
.segmented label:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.north-hint { flex-basis: 100%; font-size: 0.85rem; }

/* ---- Eclipses ------------------------------------------------------------ */
.eclipse-jump { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 0.92rem; }
.eclipse-jump a { color: var(--accent-moon); text-underline-offset: 3px; }

.eclipse-feature { margin: 28px 0 40px; display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 12px; }
.eclipse-feature + .eclipse-feature { padding-top: 28px; border-top: 1px solid var(--line); }
.eclipse-head h2 { font-size: clamp(1.3rem, 3.2vw, 1.75rem); line-height: 1.2; letter-spacing: -0.01em; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.eclipse-summary { margin-top: 8px; max-width: 72ch; }

.kind {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--accent-sun-soft);
  color: var(--accent-sun);
}
.kind-total { background: #1d1f24; color: #f6efe2; }
.kind-annular, .kind-hybrid { background: #fbe1bf; color: #8a4a06; }
.kind-penumbral { background: var(--accent-moon-soft); color: var(--accent-moon); }
.eclipse-lunar .kind-partial, #lunar .kind-partial { background: #f6dcd6; color: #8c2a17; }
.eclipse-lunar .kind-total, #lunar .kind-total { background: #8c2a17; color: #fff; }
@media (prefers-color-scheme: dark) {
  .kind-total { background: #f6efe2; color: #1d1f24; }
  .kind-annular, .kind-hybrid { background: #3a2a14; color: #f4c27a; }
  .eclipse-lunar .kind-partial, #lunar .kind-partial { background: #3b1f1a; color: #f0a191; }
}

/* World maps: Natural Earth land as a static background image (built by
   web/build/land-svg.ts), the eclipse as server-rendered SVG on top. */
.eclipse-map { margin: 0; min-width: 0; }
.eclipse-frame {
  position: relative;
  aspect-ratio: 2 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #cfe3f3 url("/dist/map/land-light.svg") center / 100% 100% no-repeat;
}
@media (prefers-color-scheme: dark) {
  .eclipse-frame { background-color: #1d2a44; background-image: url("/dist/map/land-dark.svg"); }
}
.eclipse-frame > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.eclipse-frame path, .eclipse-frame circle { vector-effect: non-scaling-stroke; }
.band { fill: #e8891c; fill-opacity: 0.15; }
.band-0 { stroke: #b85f06; stroke-opacity: 0.55; stroke-width: 1px; }
.central-path { fill: #3a1d00; fill-opacity: 0.6; stroke: #3a1d00; stroke-width: 1px; }
.central-total { fill: #050505; fill-opacity: 0.72; }
.central-line { fill: none; stroke: #fff; stroke-opacity: 0.85; stroke-width: 1px; }
.hour-mark circle { fill: #fff; stroke: #3a1d00; stroke-width: 1px; }
.hour-mark text, .contact-label text {
  font-size: 3.4px;
  font-weight: 650;
  text-anchor: middle;
  paint-order: stroke;
  stroke-width: 0.8px;
  stroke-linejoin: round;
}
.hour-mark text { fill: #3a1d00; stroke: rgb(255 255 255 / 0.85); }
.greatest-mark { fill: #fff; stroke: #c2410c; stroke-width: 2.5px; }
.eclipse-frame .map-here { fill: var(--accent-moon); stroke: #fff; stroke-width: 2px; }
.moon-down { fill: #0b1130; fill-opacity: 0.3; }
.contact-line { fill: none; stroke: #4a5a8c; stroke-width: 1.2px; stroke-dasharray: 5 4; }
.contact-u1, .contact-u2, .contact-u3, .contact-u4 { stroke: #8c2a17; }
.contact-label text { fill: #1d2a4f; stroke: rgb(255 255 255 / 0.8); }
.zenith-mark { fill: #f1efe4; stroke: #4a5a8c; stroke-width: 2.5px; }
@media (prefers-color-scheme: dark) {
  .band { fill: #f4a340; fill-opacity: 0.17; }
  .central-path { fill: #120900; fill-opacity: 0.75; stroke: #f4c27a; stroke-opacity: 0.5; }
  .moon-down { fill: #000; fill-opacity: 0.32; }
  .contact-line { stroke: #9fb0e6; }
  .contact-u1, .contact-u2, .contact-u3, .contact-u4 { stroke: #f0a191; }
  .contact-label text { fill: #e9eaee; stroke: rgb(0 0 0 / 0.6); }
}
/* Labels are sized in map degrees; on phones they would be unreadable. */
@media (max-width: 640px) { .hour-mark text, .contact-label { display: none; } }

.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.swatch-band { background: rgb(232 137 28 / 0.25); border: 1px solid rgb(184 95 6 / 0.6); }
.swatch-deep { background: rgb(232 137 28 / 0.6); }
.swatch-path { background: rgb(58 29 0 / 0.7); }
.swatch-total { background: #111; }
.swatch-greatest, .swatch-here, .swatch-zenith { width: 11px; height: 11px; border-radius: 50%; }
.swatch-greatest { background: #fff; border: 2px solid #c2410c; }
.swatch-here { background: var(--accent-moon); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch-zenith { background: #f1efe4; border: 2px solid #4a5a8c; }
.swatch-clear { background: transparent; border: 1px solid var(--muted); }
.swatch-partly { background: rgb(11 17 48 / 0.3); }
.swatch-none { background: rgb(11 17 48 / 0.52); }
.swatch-line { height: 0; border-top: 2px dashed #4a5a8c; border-radius: 0; }
.swatch-penumbra { background: rgb(74 90 140 / 0.25); }
.swatch-umbra { background: #8c2a17; }

.lunar-figures { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .lunar-figures { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); align-items: start; } }
.shadow-diagram { margin: 0; min-width: 0; }
.shadow-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.penumbra { fill: rgb(74 90 140 / 0.16); stroke: rgb(74 90 140 / 0.5); stroke-width: 0.008; }
.umbra { fill: rgb(140 42 23 / 0.55); stroke: #8c2a17; stroke-width: 0.008; }
.moon-track { stroke: var(--muted); stroke-width: 0.012; stroke-dasharray: 0.05 0.035; }
.diagram-arrow { fill: var(--muted); }
.moon-disk circle { fill: #f1efe4; fill-opacity: 0.8; stroke: #4a5a8c; stroke-width: 0.01; }
.moon-disk.is-greatest circle { fill: #d8c7b1; fill-opacity: 1; stroke-width: 0.016; }
.diagram-label { font-size: 0.11px; font-weight: 650; fill: var(--text); text-anchor: middle; }
.diagram-time { font-size: 0.09px; fill: var(--muted); text-anchor: middle; font-variant-numeric: tabular-nums; }
.diagram-compass { font-size: 0.085px; fill: var(--muted); }
@media (prefers-color-scheme: dark) {
  .penumbra { fill: rgb(159 176 230 / 0.12); stroke: rgb(159 176 230 / 0.4); }
  .moon-disk circle { fill: #e6e2d3; fill-opacity: 0.6; stroke: #9fb0e6; }
}

.eclipse-columns { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 820px) { .eclipse-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.eclipse-columns h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; }
.eclipse-solar .eclipse-columns h3 { color: var(--accent-sun); }
.eclipse-lunar .eclipse-columns h3 { color: var(--accent-moon); }
.eclipse-facts .details > div:first-child { border-top: 0; }
.here-headline { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 1.1rem; }
.here-headline span { color: var(--muted); font-size: 1rem; }

.contacts { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.contacts th, .contacts td { padding: 8px 0; border-top: 1px solid var(--line); text-align: right; }
.contacts th[scope="row"] { text-align: left; font-weight: 400; color: var(--muted); }
.contacts thead th { border-top: 0; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.contacts td + td, .contacts th + td { padding-left: 12px; }
.contacts tr.is-below td:not(.muted) { color: var(--muted); }

.eclipse-cities h3 { font-size: 1rem; margin-bottom: 8px; }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.eclipse-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.eclipse-table th, .eclipse-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); white-space: nowrap; }
.eclipse-table thead th { border-top: 0; font-size: 0.8rem; color: var(--muted); font-weight: 600; vertical-align: bottom; }
.eclipse-table th[scope="row"] { font-weight: 600; }
.eclipse-table th[scope="row"] .muted { font-weight: 400; }
.eclipse-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.eclipse-table thead th.num { text-align: right; }
.eclipse-table .where { white-space: normal; min-width: 14rem; }
.eclipse-table .here { white-space: normal; min-width: 10rem; }
.eclipse-table .where span, .eclipse-table .here span, .eclipse-table .muted { display: block; }
.eclipse-table th .muted { font-weight: 400; }
.eclipse-table thead th .muted { font-weight: 500; }
.eclipse-table .here.is-not { color: var(--muted); }
.eclipse-table tbody tr:target { background: var(--accent-sun-soft); }
.eclipse-table.compact th, .eclipse-table.compact td { padding: 8px 12px; }

.eclipse-list { margin-top: 40px; scroll-margin-top: 12px; }
.eclipse-list h2 { font-size: 1.3rem; margin-bottom: 12px; }
.eclipse-countries summary { cursor: pointer; color: var(--accent-moon); text-underline-offset: 3px; }
.country-magnitudes { list-style: none; padding: 0; margin: 12px 0; columns: 15rem; column-gap: 28px; font-size: 0.9rem; }
.country-magnitudes li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; break-inside: avoid; border-bottom: 1px dotted var(--line); }
.safety { padding: 10px 14px; border-radius: 12px; background: #fff4e5; border: 1px solid #f3c98b; color: #7a4100; font-size: 0.92rem; }
@media (prefers-color-scheme: dark) { .safety { background: #2a2116; border-color: #5c4420; color: #f4c27a; } }

.eclipse-notes { margin-top: 44px; }
.eclipse-notes h2 { font-size: 1.2rem; margin-bottom: 12px; }
.eclipse-notes dl { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: 8px 20px; margin: 0 0 12px; }
.eclipse-notes dt { font-weight: 600; }
.eclipse-notes dd { margin: 0; color: var(--muted); }
@media (max-width: 600px) { .eclipse-notes dl { grid-template-columns: minmax(0, 1fr); } .eclipse-notes dd { margin-bottom: 8px; } }
