:root {
  --bg: #05070f;
  --panel: #0c111f;
  --line: #1e2740;
  --text: #e7ecf7;
  --muted: #96a2bd;
  --accent: #8fb6ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 0 3rem;
  background: radial-gradient(circle at 50% -10%, #131c33 0%, var(--bg) 55%);
  color: var(--text);
  font: 16px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

.masthead {
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.masthead p {
  margin: 0.6rem auto 0;
  max-width: 46rem;
  color: var(--muted);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.controls {
  display: grid;
  grid-template-columns: 2fr 1.1fr 0.9fr 1fr auto;
  gap: 0.75rem;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

@media (max-width: 860px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }
  .controls button {
    grid-column: 1 / -1;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select,
button {
  font: inherit;
  color: var(--text);
  background: #131a2c;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  background: linear-gradient(180deg, #35507f, #23324f);
  border-color: #43598a;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: linear-gradient(180deg, #3e5c92, #29395a);
}

button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
  margin: 1rem 0 0.4rem;
  color: var(--muted);
}

.toggles label {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.toggles input[type='range'] {
  padding: 0;
  background: none;
  border: none;
}

.download {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.download:hover {
  border-bottom-color: var(--accent);
}

.status {
  margin: 0.2rem 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 1.4em;
}

.status[data-state='error'] {
  color: #ff9b9b;
}

.sky {
  margin: 0;
}

canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #02040c;
}

figcaption {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.details {
  margin-top: 2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.details h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.details dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1.2rem;
  margin: 0;
}

.details dt {
  color: var(--muted);
}

.details dd {
  margin: 0;
}

footer {
  max-width: 1200px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

a {
  color: var(--accent);
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 0.15rem;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.section-heading {
  margin: 2.6rem 0 0.4rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-intro {
  margin: 0 0 1.4rem;
  max-width: 52rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0.15rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Images sit on a starfield-like placeholder so a slow or failed load never
   leaves an empty hole in the layout. */
.shot {
  margin: 0;
}

.shot img,
.shot--unavailable::before {
  display: block;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 30% 25%, #1b2440 0%, #05070f 70%);
}

.shot img {
  height: auto;
  object-fit: cover;
  background: radial-gradient(circle at 30% 25%, #1b2440 0%, #05070f 70%);
}

.shot--unavailable img {
  display: none;
}

.shot--unavailable::before {
  content: '';
  aspect-ratio: 3 / 2;
}

.shot figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.credit {
  color: var(--muted);
}

.galaxy-search {
  margin: 0 0 1.4rem;
}

.galaxy-search label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.galaxy-search-row {
  display: flex;
  gap: 0.6rem;
  max-width: 32rem;
}

.galaxy-search input {
  flex: 1;
}

.galaxy-search .search-message {
  margin: 0.5rem 0 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--muted);
}

.home-galaxy {
  margin-top: 1.6rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.4rem;
}

.home-galaxy-header {
  cursor: pointer;
}

.home-galaxy-header h2 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home-galaxy-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.2rem 2rem;
  margin-top: 1.2rem;
}

.lede {
  margin: 0;
  font-size: 1.05rem;
}

.highlights {
  grid-column: 1 / -1;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.highlights li {
  margin-bottom: 0.35rem;
}

.home-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
  margin-top: 1.4rem;
}

.galaxy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}

.galaxy-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  height: max-content;
}

.galaxy-card-summary {
  cursor: pointer;
}

.galaxy-card-summary .eyebrow {
  margin: 0.15rem 0 0;
}

.galaxy-card h3 {
  margin: 0;
  display: inline;
  font-size: 1.1rem;
  font-weight: 500;
}

.galaxy-card .shot {
  margin-top: 0.9rem;
}

.galaxy-card-body p {
  margin: 0 0 0.8rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0;
  font-size: 0.9rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

@media (max-width: 720px) {
  .home-galaxy-body {
    grid-template-columns: 1fr;
  }
}

.eclipses {
  margin-top: 2rem;
}

.eclipses h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.next-up {
  margin: 0 0 1rem;
  color: var(--text);
}

.eclipse-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
}

.eclipse {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
}

.eclipse-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.eclipse-date {
  font-size: 1.05rem;
}

.eclipse-emoji {
  font-size: 1.15rem;
  line-height: 1;
}

.badge {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  color: var(--muted);
}

.badge[data-kind='solar'] {
  color: #ffd79a;
  border-color: #5a4526;
}

.badge[data-kind='lunar'] {
  color: #cdd7ff;
  border-color: #313f68;
}

.eclipse-facts,
.eclipse-where,
.eclipse-notes,
.eclipse-countdown {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.eclipse-countdown {
  color: var(--accent);
}

.on-this-day {
  margin-top: 2rem;
}

.on-this-day h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.on-this-day-intro {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1rem;
}

.event {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
}

.event-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.event-year {
  font-size: 1.05rem;
  color: var(--accent);
}

.event-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.event-note {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.event.empty {
  color: var(--muted);
  font-size: 0.9rem;
}
