body {
  font-family: "Space Grotesk", Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  background:
    radial-gradient(1200px 600px at 8% 0%, #14325f 0%, #08111f 45%),
    linear-gradient(160deg, #0a1424 0%, #111f36 100%);
  color: #e8eef8;
}

main {
  max-width: 820px;
  margin: 1.25rem auto;
  padding: 0 1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  height: 49px;
  padding: 0 1.25rem;
  background: rgba(8, 17, 31, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(200, 220, 255, 0.16);
}

.page-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 49px);
}

.sidebar {
  position: sticky;
  top: 49px;
  height: calc(100vh - 49px);
  overflow-y: auto;
  background: rgba(8, 17, 31, 0.55);
  border-right: 1px solid rgba(200, 220, 255, 0.16);
  padding: 1.75rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-logo {
  font-size: 0.98rem;
  font-weight: 700;
  color: #e8eef8;
  margin-bottom: 0.9rem;
}

.nav-link {
  display: block;
  font-size: 0.83rem;
  color: #a8b4ca;
  padding: 0.28rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e8eef8;
}

@media (max-width: 760px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }
}

.home-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: #a8b4ca;
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(200, 220, 255, 0.16);
  background: rgba(14, 24, 42, 0.6);
}

.home-link:hover {
  color: #62c2ff;
}

html[lang="en"] .home-link-fr {
  display: none;
}

html[lang="fr"] .home-link-en {
  display: none;
}

.lang-switch {
  display: flex;
  gap: 0.35rem;
}

.lang-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
}

.lang-btn:hover {
  background: #d1d5db;
}

.lang-btn.active {
  background: #2563eb;
  color: white;
}

.mode-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.mode-tab {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
}

.mode-tab:hover {
  background: #d1d5db;
}

.mode-tab.active {
  background: #2563eb;
  color: white;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
}

.tagline {
  font-size: 0.9rem;
  color: #a8b4ca;
  margin: 0 0 0.85rem;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
}

.card {
  background: #ffffff;
  color: #1a1f2b;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  scroll-margin-top: 65px; /* clears the sticky 49px topbar when a sidebar anchor jumps here */
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.row button {
  justify-self: start;
}

.row label {
  font-weight: 600;
}

.row input {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid #d2d6db;
  border-radius: 12px;
  font-size: 0.98rem;
}

button {
  border: none;
  background: #2563eb;
  color: white;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.query-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.query-col label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.query-row {
  display: flex;
  gap: 0.5rem;
}

.query-row input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d2d6db;
  border-radius: 10px;
  font-size: 0.92rem;
}

.override-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.85rem;
  cursor: pointer;
}

.override-row input[type="checkbox"] {
  width: auto;
}

.param-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.85rem;
}

.param-col {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.param-col label {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.param-col input {
  width: 4.5rem;
  flex: none;
  padding: 0.4rem 0.5rem;
  border: 1px solid #d2d6db;
  border-radius: 10px;
  font-size: 0.9rem;
}

.param-col select {
  width: auto;
  flex: none;
  padding: 0.4rem 0.5rem;
  border: 1px solid #d2d6db;
  border-radius: 10px;
  font-size: 0.9rem;
  background: white;
}

.param-col input:disabled,
.param-col select:disabled {
  background: #f1f3f6;
  color: #6b7280;
}

.date-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.date-row label {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.date-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

.date-label {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 4.5rem;
  text-align: right;
}

.status {
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: #eef2ff;
  color: #1e3a8a;
}

.status.error {
  background: #fee2e2;
  color: #991b1b;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th,
.results-table td {
  text-align: left;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #e5e7eb;
}

.results-table th {
  background: #f8fafc;
  font-weight: 700;
}

.results-table tr.row-danger td {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
}

.hidden {
  display: none;
}

.info {
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
}

.airmass-warning {
  margin: -0.2rem 0 0.65rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #b91c1c;
}

.star-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem 1rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
  border-radius: 10px;
}

.star-panel:empty {
  display: none;
}

.stat-item {
  min-width: 0;
}

.stat-item .stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.stat-note-item {
  grid-column: 1 / -1;
}

.stat-note-item .stat-note {
  font-weight: 400;
  font-size: 0.82rem;
  color: #6b7280;
}

.stat-item .stat-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1f2b;
  overflow-wrap: break-word;
}

#airmassCard canvas {
  width: 100%;
  height: auto;
  display: block;
}

.airmass-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #52514e;
}

.airmass-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
}

.swatch-line {
  background: #2a78d6;
  height: 3px;
  width: 1rem;
  border-radius: 2px;
}

.swatch-twilight {
  background: #d8dbe2;
}

.swatch-night {
  background: #aeb3bd;
}

.swatch-now {
  background: #e34948;
  width: 2px;
  height: 0.9rem;
  border-radius: 1px;
}

.finder-chart-wrap {
  margin-top: 0.75rem;
}

.finder-chart-wrap .image-frame {
  max-width: 420px;
}

.finder-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #52514e;
}

.finder-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.swatch-finder-target {
  background: transparent;
  border: 2px solid #2a78d6;
  border-radius: 50%;
}

.swatch-finder-bright {
  background: transparent;
  border: 2px solid #e34948;
  border-radius: 50%;
}

.swatch-finder-field {
  background: transparent;
  border: 2px solid #fbbf24;
  border-radius: 50%;
}

.swatch-finder-fov {
  background: transparent;
  border: 2px solid #22c55e;
  border-radius: 2px;
}

.finder-credit {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: #9ca3af;
}

/* ── Images & lightbox (shared pattern across eartigau's tools) ─────────── */

.image-frame {
  border-radius: 12px;
  border: 1px solid rgba(200, 220, 255, 0.16);
  background: rgba(3, 8, 15, 0.8);
  overflow: hidden;
}

.image-frame img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.image-frame img:hover {
  opacity: 0.88;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  background: rgba(4, 8, 16, 0.92);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: default;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(143, 176, 220, 0.3);
  cursor: default;
}

.lightbox-figure figcaption {
  color: #d9e6fa;
  font-size: 0.9rem;
  text-align: center;
  max-width: 80ch;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(200, 220, 255, 0.16);
  background: rgba(14, 24, 42, 0.9);
  color: #e8eef8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(24, 38, 62, 0.95);
}
