/* Self-hosted DM Sans, mirroring bendentremont.com (see that repo's styles.css
   for the source of this block) — weights 400/500 only, latin + latin-ext. */
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/dmsans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/dmsans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/dmsans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/dmsans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #000000;
  --panel-bg: #000000;
  --card-bg: #141414;
  --border: #2c3038;
  --text: #eceef1;
  --text-dim: #9aa1ad;
  --accent: #ffcc66;
  --topbar-h: 44px;
  --controlbar-h: 64px;
  --footer-h: 32px;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

body {
  display: flex;
  flex-direction: column;
}

/* ===== Top bar ===== */

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: #000000;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
}

/* ===== Control bar ===== */

.controlbar {
  flex: 0 0 auto;
  min-height: var(--controlbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: #000000;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.controlbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controlbar-search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}

#location-search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.search-results li {
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.search-results li:hover,
.search-results li.is-active {
  background: var(--border);
}

.controlbar-numeric label {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.controlbar-numeric input {
  width: 72px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 8px;
  font-size: 14px;
}

.controlbar-numeric .unit {
  font-size: 12px;
  color: var(--text-dim);
}

.unit-toggle {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  min-width: 32px;
}

.unit-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.controlbar-time {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.time-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

/* ===== Custom date picker ===== */

.date-picker {
  position: relative;
}

.date-picker-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  width: 240px;
  padding: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.date-nav {
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.date-nav:hover {
  color: var(--accent);
  background: var(--border);
}

.date-picker-label {
  font-size: 13px;
  font-weight: 600;
}

.date-picker-weekdays,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.date-picker-weekdays span {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0;
}

.date-picker-day {
  background: none;
  border: 0;
  color: var(--text);
  font-size: 12px;
  padding: 6px 0;
  border-radius: 4px;
  cursor: pointer;
}

.date-picker-day:hover {
  background: var(--border);
}

.date-picker-day--muted {
  color: var(--text-dim);
  opacity: 0.5;
}

.date-picker-day--today {
  outline: 1px solid var(--text-dim);
}

.date-picker-day--selected {
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

/* ===== Layout ===== */

.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.sidebar-pane {
  /* Placeholder for future tools — half the width of the right panel. */
  flex: 0.5 1 0;
  min-width: 140px;
  max-width: 210px;
  background: #000000;
  border-right: 1px solid var(--border);
}

.map-pane {
  flex: 2 1 0;
  min-width: 0;
}

.panel-pane {
  flex: 1 1 0;
  min-width: 280px;
  max-width: 420px;
  padding: 20px;
  overflow-y: auto;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
}

/* ===== Moon panel ===== */

.panel-title {
  font-size: 18px;
  margin: 0 0 16px;
}

.panel-row--phase {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.panel-phase-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.panel-phase-pct {
  font-size: 13px;
  color: var(--text-dim);
}

.panel-facts {
  margin: 0;
}

.panel-fact {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.panel-fact dt { color: var(--text-dim); }
.panel-fact dd { margin: 0; }

.panel-facts--secondary .panel-fact { font-size: 12px; }

.panel-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ===== Path window (start/end override) ===== */

.path-bounds {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.path-bounds-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.path-bounds-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.path-bounds-row label {
  font-size: 13px;
  color: var(--text-dim);
}

.path-bounds-row input[type="time"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 13px;
  color-scheme: dark;
}

.panel-path-status {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ===== Map hover tooltip =====
   A plain DOM element that follows the raw cursor position over the path
   (rather than Mapbox's Popup, which anchors to a lngLat and re-projects on
   every frame) — simpler and gives snappier direct cursor-following. */

.path-hover-tooltip {
  position: absolute;
  display: none;
  pointer-events: none;
  transform: translate(14px, 14px);
  z-index: 40;
  background: var(--card-bg);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ===== Footer ===== */

.site-footer {
  flex: 0 0 auto;
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Same inset formula as bendentremont.com's footer: scales with viewport
     width so the version/copyright text sits well clear of the screen edges. */
  padding: 0
           max(clamp(18px, 5vw, 64px), env(safe-area-inset-right))
           0
           max(clamp(18px, 5vw, 64px), env(safe-area-inset-left));
  background: #000000;
  border-top: 1px solid var(--border);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-family: var(--font-sans);
  letter-spacing: 0.06em;
}

.footer-version {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* ===== Responsive ===== */

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }
  .sidebar-pane {
    /* Placeholder-only for now — not worth the space on narrow screens. */
    display: none;
  }
  .map-pane {
    height: 60vh;
  }
  .panel-pane {
    max-width: none;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .controlbar {
    min-height: auto;
    padding: 12px;
  }
  .controlbar-time {
    margin-left: 0;
  }
  .topbar {
    padding: 0 16px;
  }
}
