/* =========================================================================
   ExoEclipse — shared styles (/eclipse/)
   Dependency-free, dark/light aware. Pairs with /assets/css/style.css.
   ========================================================================= */

:root {
  --ecl-bg: #ffffff;
  --ecl-surface: #f8fafc;
  --ecl-border: #e2e8f0;
  --ecl-text: #0f172a;
  --ecl-muted: #475569;
  --ecl-accent: #e53935;     /* brand red (buttons + accents) */
  --ecl-accent-hover: #c62828;
  --ecl-accent2: #2563eb;    /* penumbra blue */
  --ecl-total: #e53935;
  --ecl-partial: #2563eb;
  --ecl-none: #64748b;
  --ecl-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ecl-bg: #0b1120;
    --ecl-surface: #111827;
    --ecl-border: #1f2937;
    --ecl-text: #e2e8f0;
    --ecl-muted: #94a3b8;
    --ecl-accent: #ef4444;
    --ecl-accent-hover: #f87171;
    --ecl-accent2: #60a5fa;
    --ecl-total: #ef4444;
    --ecl-partial: #60a5fa;
    --ecl-none: #94a3b8;
    --ecl-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

.eclipse-main { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* --- hero / answer-first ------------------------------------------------- */
.ecl-hero { margin: 0 0 1.25rem; }
.ecl-hero h1 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); line-height: 1.15; margin: 0 0 .5rem; }
.ecl-hero .ecl-lede { font-size: 1.05rem; color: var(--ecl-muted); }
.ecl-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin: .85rem 0; }
.ecl-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 600; padding: .3rem .65rem; border-radius: 999px;
  background: var(--ecl-surface); border: 1px solid var(--ecl-border); color: var(--ecl-text);
}
.ecl-badge.total { background: color-mix(in srgb, var(--ecl-total) 18%, transparent); border-color: var(--ecl-total); }
.ecl-badge.partial { background: color-mix(in srgb, var(--ecl-partial) 16%, transparent); border-color: var(--ecl-partial); }
.ecl-badge.none { background: color-mix(in srgb, var(--ecl-none) 16%, transparent); border-color: var(--ecl-none); }

/* --- map ----------------------------------------------------------------- */
.ecl-map-wrap {
  position: relative; border: 1px solid var(--ecl-border); border-radius: 12px;
  overflow: hidden; box-shadow: var(--ecl-shadow); background: var(--ecl-surface);
}
.ecl-map-canvas { display: block; width: 100%; height: clamp(360px, 56vh, 620px); touch-action: none; cursor: crosshair; }
.ecl-map-canvas:focus-visible { outline: 3px solid var(--ecl-accent2); outline-offset: -3px; }
.ecl-map-preview { display: block; width: 100%; height: auto; }

.ecl-map-legend {
  position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: .25rem;
  background: color-mix(in srgb, var(--ecl-bg) 85%, transparent); backdrop-filter: blur(4px);
  border: 1px solid var(--ecl-border); border-radius: 8px; padding: .5rem .6rem; font-size: .72rem;
}
.ecl-legend-row { display: flex; align-items: center; gap: .45rem; color: var(--ecl-muted); }
.ecl-legend-swatch { width: 16px; height: 4px; border-radius: 2px; }
.ecl-legend-title { font-weight: 600; color: var(--ecl-text); }
.ecl-legend-ramp { display: flex; align-items: center; gap: .3rem; color: var(--ecl-muted); margin-bottom: .15rem; }
.ecl-legend-ramp .ecl-ramp {
  display: inline-block; width: 92px; height: 9px; border-radius: 3px; border: 1px solid var(--ecl-border);
  background: linear-gradient(90deg,
    rgb(49,130,206), rgb(60,185,170), rgb(150,200,85),
    rgb(205,205,70), rgb(240,135,50), rgb(200,50,75), rgb(150,40,100));
}

/* --- Leaflet map --------------------------------------------------------- */
.ecl-map-canvas.ecl-leaflet { cursor: grab; touch-action: auto; background: var(--ecl-surface); }
.ecl-map-canvas.ecl-leaflet:active { cursor: grabbing; }
.ecl-map-wrap .leaflet-container { font: inherit; background: var(--ecl-surface); }
.ecl-map-wrap .ecl-map-legend { z-index: 1000; pointer-events: none; }
/* Dark mode tints the raster tiles to match the UI. Overlays (path, umbra,
   terminator, cities) live in Leaflet's SVG panes, so the filter hits tiles
   only, not the eclipse geometry. */
.ecl-leaflet-dark .leaflet-tile { filter: brightness(0.65) invert(1) contrast(0.92) hue-rotate(180deg) saturate(0.7); }
/* Click marker — a small target/crosshair pin. */
.ecl-clickpin-wrap { background: none; border: 0; }
.ecl-clickpin { display: block; width: 22px; height: 22px; position: relative; }
.ecl-clickpin::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  transform: translate(-50%, -50%); border: 2px solid var(--ecl-accent2); border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}
.ecl-clickpin::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(var(--ecl-accent2), var(--ecl-accent2)) center / 2px 22px no-repeat,
    linear-gradient(var(--ecl-accent2), var(--ecl-accent2)) center / 22px 2px no-repeat;
}

/* --- controls ------------------------------------------------------------ */
.ecl-controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .85rem 0; }
.ecl-scrubber { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: .6rem; }
.ecl-scrubber input[type="range"] { flex: 1; min-width: 0; accent-color: var(--ecl-accent); }
.ecl-scrub-time { font-variant-numeric: tabular-nums; font-size: .85rem; min-width: 11ch; color: var(--ecl-text); }
.ecl-btn {
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  background: var(--ecl-surface); color: var(--ecl-text);
  border: 1px solid var(--ecl-border); border-radius: 8px; padding: .5rem .8rem;
}
.ecl-btn:hover { border-color: var(--ecl-accent); }
.ecl-btn.primary { background: var(--ecl-accent); color: #fff; border-color: var(--ecl-accent); }
.ecl-btn.primary:hover { background: var(--ecl-accent-hover); border-color: var(--ecl-accent-hover); }

.ecl-latlon { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.ecl-latlon label { font-size: .8rem; color: var(--ecl-muted); }
.ecl-latlon input {
  width: 8ch; font: inherit; font-size: .85rem; padding: .4rem .5rem;
  border: 1px solid var(--ecl-border); border-radius: 6px; background: var(--ecl-bg); color: var(--ecl-text);
}

/* --- readout panel ------------------------------------------------------- */
.ecl-readout {
  margin: 1rem 0; border: 1px solid var(--ecl-border); border-radius: 12px;
  background: var(--ecl-surface); padding: 1rem 1.1rem; box-shadow: var(--ecl-shadow);
}
.ecl-readout h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.ecl-readout .ecl-type {
  display: inline-block; font-weight: 700; padding: .15rem .55rem; border-radius: 6px; font-size: .9rem;
}
.ecl-readout .ecl-type.total { color: var(--ecl-total); }
.ecl-readout .ecl-type.partial { color: var(--ecl-partial); }
.ecl-readout .ecl-type.none { color: var(--ecl-none); }
.ecl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: .65rem .9rem; margin: .6rem 0; }
.ecl-stat { display: flex; flex-direction: column; min-width: 0; }
.ecl-stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ecl-muted); overflow-wrap: anywhere; }
.ecl-stat .v { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ecl-contacts { width: 100%; border-collapse: collapse; margin: .5rem 0; font-size: .85rem; }
.ecl-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .5rem 0; }
.ecl-tablewrap .ecl-contacts { margin: 0; }
.ecl-contacts th, .ecl-contacts td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid var(--ecl-border); }
.ecl-contacts td.t { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ecl-notes { margin: .5rem 0 0; padding-left: 1.1rem; color: var(--ecl-muted); font-size: .85rem; }
.ecl-notes li { margin: .15rem 0; }

.ecl-safety-banner {
  display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0;
  background: color-mix(in srgb, #dc2626 12%, transparent); border: 1px solid #dc2626;
  border-radius: 10px; padding: .7rem .9rem; font-size: .88rem; color: var(--ecl-text);
}
.ecl-safety-banner i { color: #dc2626; margin-top: .15rem; }
.ecl-disclaimer {
  margin: 2rem 0 0; padding: .75rem 1rem; border-radius: 8px;
  background: var(--ecl-surface); border: 1px solid var(--ecl-border);
  font-size: .78rem; color: var(--ecl-muted); line-height: 1.55;
}
.ecl-disclaimer strong { color: var(--ecl-text); }

/* --- content sections ---------------------------------------------------- */
.ecl-section { margin: 1.75rem 0; }
.ecl-section h2 { font-size: 1.25rem; margin: 0 0 .6rem; }
.ecl-section p { color: var(--ecl-text); }
.ecl-faq dt { font-weight: 600; margin: .8rem 0 .2rem; }
.ecl-faq dd { margin: 0 0 .4rem; color: var(--ecl-muted); }

.ecl-citylist { list-style: none; text-align: center; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: .5rem; }
.ecl-citylist a { display: flex; flex-direction: column; gap: .25rem; padding: .55rem .7rem; border: 1px solid var(--ecl-border); border-radius: 8px; text-decoration: none; color: var(--ecl-text); background: var(--ecl-surface); min-width: 0; height: 100%; box-sizing: border-box; }
.ecl-citylist a:hover { border-color: var(--ecl-accent); }
.ecl-citylist .nm { display: block; overflow-wrap: anywhere; line-height: 1.25; }
.ecl-citylist .pct { display: block; margin-top: auto; color: var(--ecl-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.ecl-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.ecl-hub-card { border: 1px solid var(--ecl-border); border-radius: 12px; padding: 1.1rem; background: var(--ecl-surface); box-shadow: var(--ecl-shadow); min-width: 0; }
.ecl-hub-card h2 { margin: 0 0 .4rem; font-size: 1.1rem; }
.ecl-hub-card p { color: var(--ecl-muted); font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  .ecl-scrubber input[type="range"] { scroll-behavior: auto; }
}

/* --- breadcrumbs --------------------------------------------------------- */
.ecl-crumbs a { color: var(--ecl-accent2); text-decoration: none; }
.ecl-crumbs a:hover { text-decoration: underline; }
.ecl-crumbs span { color: var(--ecl-muted); }

/* --- exposure calculator ------------------------------------------------- */
.ecl-exp-controls { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0 0 .6rem; }
.ecl-exp-field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--ecl-muted); }
.ecl-exp-field select {
  font: inherit; padding: .45rem .6rem; border: 1px solid var(--ecl-border); border-radius: 8px;
  background: var(--ecl-surface); color: var(--ecl-text); min-width: 9rem;
}
.ecl-exp-hint { font-size: .85rem; color: var(--ecl-muted); margin: 0 0 .8rem; }
.ecl-exp-tablewrap { overflow-x: auto; }
.ecl-exp-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ecl-exp-table th, .ecl-exp-table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--ecl-border); vertical-align: top; }
.ecl-exp-table thead th { color: var(--ecl-muted); font-weight: 600; white-space: nowrap; }
.ecl-exp-table tbody th { font-weight: 600; white-space: nowrap; }
.ecl-exp-speed { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ecl-exp-filter { font-size: .78rem; padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }
.ecl-exp-filter.on { background: color-mix(in srgb, #dc2626 14%, transparent); color: #dc2626; border: 1px solid #dc2626; }
.ecl-exp-filter.off { background: color-mix(in srgb, var(--ecl-accent) 16%, transparent); color: var(--ecl-accent); border: 1px solid var(--ecl-accent); }

/* --- countdown ----------------------------------------------------------- */
.ecl-countdown { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0 .8rem; }
.ecl-cd-cell {
  flex: 1 1 5.5rem; min-width: 5rem; text-align: center; padding: 1rem .5rem;
  border: 1px solid var(--ecl-border); border-radius: 12px; background: var(--ecl-surface); box-shadow: var(--ecl-shadow);
}
.ecl-cd-num { display: block; font-size: clamp(1.8rem, 6vw, 3rem); font-weight: 700; line-height: 1; color: var(--ecl-accent); font-variant-numeric: tabular-nums; }
.ecl-cd-lbl { display: block; margin-top: .35rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ecl-muted); }
.ecl-cd-target { font-size: .95rem; color: var(--ecl-text); margin: 0; }
.ecl-countdown.is-now .ecl-cd-num { color: var(--ecl-accent2); }
