/* ============================================================
   ISS Lunar Transit Finder (transits.html)
   Builds on style.css: same tokens, hairlines and square corners.
   ============================================================ */

.transit-tool {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--pad-x) 3rem;
}

/* Form ------------------------------------------------------- */
.transit-form {
  border: 1px solid var(--line);
  padding: 1.75rem;
}
.transit-form fieldset { border: 0; margin-bottom: 1.75rem; min-width: 0; }
.transit-form legend {
  margin-bottom: 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1rem;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.field-wide { grid-column: span 2; }
.field > span {
  color: var(--dim);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input,
.field select,
.tle-manual textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  color-scheme: dark;
}
/* One height for text boxes, selects, the date picker and the button beside them */
.field input,
.field select,
.field-row > .button { height: 2.9rem; }
.field input::placeholder { color: #555; }
.field input:user-invalid { border-style: dashed; }

/* Feedback for the place search and the location button sits right under them */
.locate-status { min-height: 1.4rem; margin: 0.8rem 0 0.2rem; color: var(--muted); }
.locate-status.is-error { color: var(--text); border-left: 2px solid var(--line); padding-left: 0.75rem; }
.place-results {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.2rem 0 0.4rem;
  font-size: 0.85rem;
}
.place-results[hidden] { display: none; }
.place-results .link-btn { color: var(--muted); text-align: left; }
.place-results .link-btn:hover { color: var(--text); }
.locate-status + .place-results + .field-row,
.locate-status + .field-row { margin-top: 0.8rem; }
.field-credit { margin-top: 0.8rem; font-size: 0.78rem; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}
.button[disabled] { opacity: 0.5; cursor: progress; }

.transit-note { color: var(--dim); font-size: 0.85rem; }
.transit-note a,
.transit-status a,
.transit-card a { color: var(--text); }

.tle-manual { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.tle-manual summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.tle-manual p { margin: 0.75rem 0; }
.tle-manual textarea {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre;
  overflow-x: auto;
  resize: vertical;
}

.transit-status {
  min-height: 1.6rem;
  margin: 2rem 0 1.25rem;
  font-size: 1.05rem;
}
.transit-status.is-error { border-left: 2px solid var(--line); padding-left: 0.9rem; }
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Results + map ---------------------------------------------- */
.transit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.transit-layout[hidden] { display: none; }
.transit-results { list-style: none; display: grid; gap: 1.25rem; }

.transit-card { border: 1px solid var(--rule); transition: border-color 0.3s ease; }
.transit-card.is-selected { border-color: var(--line); }
.transit-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 1.1rem 1.25rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.transit-when { display: flex; flex-direction: column; }
.transit-date { color: var(--muted); font-size: 0.85rem; }
.transit-time {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.transit-time small { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.transit-utc { color: var(--dim); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* The kind of shot. Filled = sunlit station on a dark sky, the one worth driving for. */
.transit-badge {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.transit-badge.is-prime { background: #fff; color: #000; }
.transit-badge.is-weak { border-color: var(--dim); color: var(--muted); }

.transit-facts { padding: 0 1.25rem; }
.transit-facts div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.transit-facts dt {
  color: var(--dim);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 0.15rem;
}
.transit-facts dd { font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.transit-facts dd small { display: block; color: var(--dim); font-size: 0.8rem; }

.transit-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.25rem 1.1rem;
  font-size: 0.85rem;
}
.transit-card-foot .button { padding: 0.5rem 1rem; font-size: 0.85rem; }

.transit-map-wrap { position: sticky; top: 5rem; }
.transit-map {
  position: relative;
  z-index: 0;          /* keep Leaflet's panes under the sticky header */
  isolation: isolate;
  height: min(70vh, 620px);
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  background: var(--surface);
}
/* Monochrome dark map to match the site */
.transit-map .leaflet-tile-pane { filter: grayscale(1) invert(1) contrast(0.85) brightness(0.9); }
.transit-map.leaflet-container { background: var(--surface); font: inherit; }
.transit-map .leaflet-control-attribution { background: rgba(0, 0, 0, 0.7); color: var(--dim); font-size: 0.7rem; }
.transit-map .leaflet-control-attribution a { color: var(--muted); }
.transit-map .leaflet-bar a {
  border-radius: 0;
  background: #000;
  color: #fff;
  border-bottom-color: var(--rule);
}
.transit-map .leaflet-bar { border: 1px solid var(--line); border-radius: 0; }
.transit-map .leaflet-tooltip {
  border: 1px solid var(--line);
  border-radius: 0;
  background: #000;
  color: #fff;
  box-shadow: none;
}
.transit-map .leaflet-tooltip::before { display: none; }

@media (max-width: 900px) {
  .transit-layout { grid-template-columns: 1fr; }
  .transit-map-wrap { position: static; order: -1; }
  .transit-map { height: 340px; }
}
@media (max-width: 600px) {
  .transit-form { padding: 1.25rem; }
  .field-wide { grid-column: auto; }
  .place-field { grid-column: 1 / -1; }            /* search box on its own row, both buttons under it */
  .field-row > .button { padding-inline: 0.5rem; }
  .form-actions .button { width: 100%; }
  .transit-facts div { grid-template-columns: 1fr; gap: 0.15rem; }
}
