:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #666666;
  --faint: #999999;
  --line: #e8e8e8;
  --hover: #f5f5f5;
  --radius: 0px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: "Helvetica Neue", Arial, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.devanagari { font-weight: 500; color: var(--muted); font-size: 0.85em; }
.thin { font-weight: 300; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-gate-card {
  width: 100%;
  max-width: 320px;
  padding: 2rem 1.75rem;
  border: 1px solid var(--fg);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  text-align: center;
}

.auth-gate-card h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.auth-gate-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.auth-gate-card input[type="password"] {
  width: 100%;
  text-align: center;
  padding: 0.55rem 0.6rem;
}

.auth-gate-card button {
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
}

.auth-gate-card button:hover { background: var(--bg); color: var(--fg); }

.auth-gate-error {
  margin: 0;
  color: #b00020;
  font-size: 0.78rem;
}

.site-header {
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.site-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: auto;
}

.site-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--fg);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.nav-item {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.2rem 0;
}

.nav-item.active {
  color: var(--fg);
  border-bottom: 2px solid var(--fg);
}

.nav-item.soon {
  cursor: default;
  color: var(--faint);
}

.nav-item.soon:hover { color: var(--muted); }

.nav-item.soon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 6px);
  background: var(--fg);
  color: var(--bg);
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.25rem 0.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.nav-item.soon:hover::after,
.nav-item.soon:focus-visible::after {
  opacity: 1;
}

.layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  align-items: start;
  min-height: calc(100vh - 52px);
}

.steps-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg);
}

.steps-panel-inner {
  padding: 1.25rem 1.75rem 4rem;
}

.steps-panel h2 {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
}

.steps-placeholder {
  color: var(--faint);
  font-size: 1.05rem;
  line-height: 1.6;
}

.steps-header {
  margin-bottom: 1.4rem;
}

.steps-kind {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.6rem;
}

.steps-date {
  font-size: 1rem;
  color: var(--muted);
}

.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.step { }

.step-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

.step-detail {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.step-formula {
  display: block;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.88rem;
  color: var(--muted);
  background: var(--hover);
  padding: 0.5rem 0.65rem;
  white-space: pre-wrap;
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.step-work {
  display: block;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.step-result {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: pre-wrap;
  line-height: 1.5;
}

.main { min-width: 0; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  padding: 0 0 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.control-group.custom-coords {
  flex-direction: row;
  align-items: end;
  gap: 0.75rem;
}

label { font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.68rem; }

select, input {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 0.35rem 0.45rem;
  font-size: 0.85rem;
  font-family: inherit;
}

select:focus, input:focus, button:focus {
  outline: 1px solid var(--fg);
  outline-offset: 1px;
}

input[type="number"] { width: 4.5rem; }

button#calculate-btn {
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  padding: 0.45rem 1.1rem;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

button#calculate-btn:hover { background: var(--bg); color: var(--fg); }
button#calculate-btn:disabled { opacity: 0.4; cursor: default; }

.status {
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0 0 1.2rem;
}

.eclipse-section {
  padding: 0 1.25rem;
  margin-top: 1.6rem;
}

.back-btn {
  margin: 1.6rem 1.25rem 0;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.back-btn:hover { background: var(--hover); }

.detail-heading {
  padding: 0 1.25rem;
  margin: 0.9rem 0 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.eclipse-section h2,
.eclipse-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.section-note {
  color: var(--faint);
  font-size: 0.75rem;
  margin: 0.2rem 0 0.6rem;
}

.map-status {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0 0 0.6rem;
}

.sim-city-group {
  max-width: 240px;
  margin-top: 0.6rem;
}

.sim-city-group select { width: 100%; }

.sim-wrap {
  border: 1px solid var(--line);
  background: #0a0a10;
  margin-top: 0.6rem;
  line-height: 0;
}

#sim-canvas {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
}

.sim-controls {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.6rem;
  max-width: 640px;
}

.sim-play-btn {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  width: 2rem;
  height: 2rem;
  flex: none;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.sim-play-btn:hover { background: var(--hover); }

.sim-controls input[type="range"] {
  flex: 1;
  padding: 0;
  accent-color: var(--fg);
}

.sim-status {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0.5rem 0 0;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
}

.sim-unavailable {
  margin-top: 0.6rem;
}

.eclipse-map {
  height: 560px;
  border: 1px solid var(--line);
  margin-top: 0.6rem;
}

/* Black & white basemap: grayscale the OSM tiles only — contour lines,
   graticule and markers live in other Leaflet panes and stay pure black. */
.eclipse-map .leaflet-tile-pane {
  filter: grayscale(1) contrast(1.05);
}

.eclipse-map .leaflet-tooltip.magnitude-tooltip {
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: 0;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem;
}

.eclipse-map .leaflet-tooltip.magnitude-tooltip::before {
  display: none;
}

.eclipse-map .graticule-label {
  color: #c0392b;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  box-shadow: none;
  padding: 0 2px;
}

.eclipse-map .pct-label {
  color: var(--fg);
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--fg);
  box-shadow: none;
  padding: 0 2px;
}

.eclipse-map .city-label {
  color: var(--fg);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--bg);
  border: none;
  box-shadow: none;
  padding: 0 3px;
}

.eclipse-map .scroll-zoom-control {
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
}

.eclipse-map .scroll-zoom-control label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.eclipse-map .graticule-density-control {
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  margin-top: 0.4rem;
}

.eclipse-map .graticule-auto-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  white-space: nowrap;
}

.eclipse-map .graticule-density-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.eclipse-map .graticule-density-row input[type="range"] {
  width: 110px;
  accent-color: var(--fg);
}

.eclipse-map .graticule-density-row span {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  min-width: 2.6em;
  text-align: right;
}

.table-heading,
.chips-heading {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 1.6rem 0 0.2rem;
}

.table-note {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0 0 0.6rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.chip {
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-family: inherit;
}

.chip:hover {
  background: var(--hover);
}

.chip.selected {
  background: var(--fg);
  color: var(--bg);
}

.table-wrap {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}

.coord-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.78rem;
}

.coord-table th {
  position: sticky;
  top: 0;
  background: var(--bg);
  text-align: left;
  font-family: "Helvetica Neue", Arial, "Segoe UI", system-ui, sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--fg);
}

.coord-table td {
  padding: 0.35rem 0.7rem;
  border-bottom: 1px solid var(--line);
}

.coord-table tbody tr:hover {
  background: var(--hover);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.card {
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  background: var(--hover);
  text-align: left;
  font: inherit;
  color: inherit;
  border: none;
}

.card:hover { background: var(--line); }

.card.selected {
  background: var(--fg);
  color: var(--bg);
}

.card.selected .time-tag,
.card.selected .peak-time,
.card.selected .obscuration,
.card.selected .visibility-badge {
  color: var(--bg);
  opacity: 0.75;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kind-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.time-tag {
  font-size: 0.65rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card.future .time-tag { color: var(--fg); font-weight: 700; }
.card.selected.future .time-tag { color: var(--bg); }

.card .peak-date {
  font-size: 0.95rem;
  font-weight: 700;
}

.card .peak-time {
  color: var(--muted);
  font-size: 0.75rem;
}

.phase-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.card.selected .phase-list { color: var(--bg); opacity: 0.85; }

.visibility-badge {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.visible-yes::before { content: "● "; }
.visible-no { color: var(--faint); }
.visible-no::before { content: "○ "; }

.obscuration {
  font-size: 0.72rem;
  color: var(--muted);
}

.empty-msg {
  color: var(--faint);
  font-style: italic;
  padding: 0.6rem 0;
}

.site-footer {
  text-align: left;
  color: var(--faint);
  font-size: 0.72rem;
  padding: 1.5rem 1.25rem 3rem;
  margin-top: 1.5rem;
}

.site-footer a { color: var(--fg); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .steps-panel {
    position: static;
    height: auto;
    max-height: 45vh;
  }
}

@media (max-width: 700px) {
  .site-header { flex-direction: column; align-items: stretch; }
  .site-header-bar { width: 100%; }

  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    margin-top: 0.75rem;
  }

  .site-nav.open { display: flex; }

  .nav-item {
    width: 100%;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-item.active { border-bottom: 1px solid var(--line); }

  .nav-item.soon::after {
    left: 0;
    transform: translate(0, 0);
    position: static;
    display: inline-block;
    margin-left: 0.5rem;
    opacity: 1;
    padding: 0.1rem 0.4rem;
  }
}
