/* Sky: the page (views/sky.js), the sky chart and its table, and the location control
   (location-control.js), which the Live map's panel also shows, compact. "Tonight" and "Saw a
   bright light?" on this page, the sighting cards and the night strip are styled in passes.css. */

/* ---- The location control: in full on the Sky page, compact in the Live map's panel -------- */
.loc { display: grid; gap: var(--space-2); }
.loc-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-5); }
.loc[aria-busy="true"] .loc-where strong::after { content: " …"; }
.loc-where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--space-2); margin: 0; max-width: none; }
.loc-pin { align-self: center; color: var(--ink-2); }
.loc-where strong { font-weight: 700; }
.loc-age { color: var(--ink-2); }
.loc-coords { color: var(--ink-2); font-size: var(--step--1); }
.loc-actions, .loc-device { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.loc-device:empty { display: none; }
.loc-msg { margin: 0; font-size: var(--step--1); color: var(--ink-2); }
.loc-msg:empty { display: none; }
.loc-hint { margin: 0; max-width: none; font-size: var(--step--1); color: var(--muted); }
.loc-error { margin: 0; padding: var(--space-2) var(--space-3); border-left: 4px solid var(--critical); border-radius: var(--radius-xs); background: var(--surface-2); font-size: var(--step--1); color: var(--ink); }
.loc-form, .loc-confirm { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--surface-2); }
.loc-form .form-actions, .loc-confirm .form-actions { margin-top: 0; }
.loc-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.loc-confirm-text { margin: 0; font-size: var(--step--1); }
.loc-change { display: none; }
.loc-change::after { content: ""; width: 6px; height: 6px; margin-left: 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--dur) var(--ease-out); }
.loc-change[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-1px); }
@media (max-width: 640px) {
  .loc:not(.compact) .loc-bar { flex-wrap: wrap; align-items: center; }
  .loc:not(.compact) .loc-where { flex: 1 1 12rem; }
  .loc:not(.compact) .loc-change { display: inline-flex; }
  .loc:not(.compact) .loc-actions:not(.open) { display: none; }
  .loc:not(.compact) .loc-actions { flex-basis: 100%; }
  .loc:not(.compact) .loc-hint { font-size: var(--step--2); }
}
.loc.compact .loc-bar { display: contents; }
.loc.compact .loc-where { font-size: var(--step--1); }
.loc.compact .loc-where > span { flex-basis: 100%; }
.loc.compact .loc-hint { font-size: var(--step--2); }
.loc.compact .loc-fields { grid-template-columns: 1fr; }
.loc.compact .loc-form, .loc.compact .loc-confirm { padding: var(--space-3); }

/* ---- The page: head, where from, the section bar, then the four sections -------------------- */
.sky-page > .page-head { margin-bottom: var(--space-5); }
/* A place from a link someone sent: said at the top, with the two ways on. */
.sky-visit { margin: 0 0 var(--space-4); }
.sky-visit-text { margin: 0 0 var(--space-1); max-width: 70ch; }
/* The link's name is someone else's words: quoted, and set apart from the sentence around it. */
.sky-visit-text .link-name { font-weight: 400; font-style: italic; }
.sky-visit-note { margin: 0; max-width: 70ch; font-size: var(--step--1); color: var(--ink-2); }
.sky-visit .form-actions { margin-top: var(--space-3); }
.sky-location { margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); }
.sky-page > .section-nav { margin-bottom: var(--space-6); }
.sky-section { margin-top: var(--space-16); }
.sky-section > .section-head { margin-bottom: var(--space-4); }
.sky-section > .section-head h2, .sky-saw > h2 { font-size: var(--step-3); }
.sky-saw { margin-top: var(--space-16); }

/* Right now: what can be seen, then the chart beside its filters and what rises soon. */
.sky-summary .lede { margin-bottom: var(--space-2); }
.sky-summary-line { max-width: 70ch; }
.sky-light, .sky-filtered { margin-bottom: var(--space-1); }
.sky-summary-how { margin-top: var(--space-3); }
.sky-summary-how > summary, .sky-rising-how > summary { min-height: 32px; font-size: var(--step--1); color: var(--ink-2); }
.sky-summary-how .disclosure-body p, .sky-rising-how .disclosure-body p { margin: 0; font-size: var(--step--1); color: var(--ink-2); }
.sky-pause { display: flex; align-items: center; gap: var(--space-3); font-size: var(--step--1); }
.sky-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; margin-top: var(--space-5); }
.sky-side { display: grid; gap: var(--space-5); }
.sky-side > .card, .sky-layout > .card { margin: 0; }
.sky-layout h3 { margin-bottom: var(--space-3); font: 600 var(--step-1)/var(--leading-snug) var(--font-display); }
.sky-filters { display: grid; gap: var(--space-3); }
.sky-filters .check { align-self: start; }
.sky-rising-lead { font-size: var(--step--1); margin-bottom: var(--space-3); }
.sky-rising-how { margin-top: var(--space-3); }

/* The chart card is the night sky in either theme: views/sky.js gives it the class night-scope
   (app.css), so it takes the Night tokens, and these for the chart itself (sky-chart.js reads them
   through cssVar), all 3:1 or more against the dome, or 4.5:1 for text (test/theme-contrast.test.js). */
.sky-chart-card {
  background: var(--surface); border-color: var(--hairline);
  --sky-dome: #0e1830;
  --sky-ring: rgb(255 255 255 / 0.4);
  --sky-horizon: rgb(255 255 255 / 0.7);
  --sky-label: #b9bfd0;
  --sky-highlight: #eef0f6;
  --sky-sun: #fab219;
}
.sky-chart-card figure { margin: 0 0 var(--space-4); }
.sky-canvas { position: relative; width: 100%; max-width: 560px; aspect-ratio: 1; margin: 0 auto; }
.sky-canvas canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.sky-chart-card figcaption { max-width: 70ch; margin: var(--space-3) auto 0; font-size: var(--step--1); color: var(--ink-2); }
.sky-chart-card .group-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2); margin: var(--space-4) 0 var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--hairline); }
.sky-chart-card h4 { font-family: var(--font-text); font-size: var(--step--2); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); font-weight: 700; }
.sky-chart-card .hint { margin: var(--space-2) 0 0; font-size: var(--step--2); color: var(--muted); }
.sky-key { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; padding: 0; list-style: none; font-size: var(--step--1); color: var(--ink-2); }
.sky-key li { display: inline-flex; align-items: center; gap: 6px; }
.key-dot { display: inline-block; flex: none; width: 9px; height: 9px; border: 1.5px solid currentColor; border-radius: 50%; }
.key-dot.lit { background: currentColor; }
.key-sun { display: inline-block; flex: none; width: 11px; height: 11px; margin: 0 2px; border-radius: 50%; background: var(--sky-sun); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--sky-sun); }

/* The satellite picked on the chart or in the table. */
.sky-selection h3 { overflow-wrap: anywhere; }
.sky-selection .readout { margin-top: var(--space-1); }
.sky-selection .form-actions { margin-top: var(--space-4); }

/* Rising soon */
.rising-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.rising-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-3); align-items: center; padding: var(--space-2) 0; border-top: 1px solid var(--hairline); }
.rising-list li:first-child { border-top: 0; padding-top: 0; }
.rising-list li > a { font-weight: 650; overflow-wrap: anywhere; }
.rising-list .rising-detail { grid-column: 1; font-size: var(--step--1); color: var(--ink-2); }
.rising-list .rising-detail time { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); }
.rising-list li > button { grid-column: 2; grid-row: 1 / span 2; }
/* The link that leads each row: at least 24 by 24 px (WCAG 2.2, 2.5.8). */
:where(.rising-list li) > a:first-child { display: inline-block; min-height: 24px; max-width: 100%; }

/* ---- Everything above the horizon: the chart's accessible equivalent ----------------------- */
.sky-table-lead { max-width: 70ch; margin-bottom: var(--space-4); }
.sky-table-card { padding: var(--space-3); container: skytable / inline-size; }
.sky-table-card .table-wrap { border: 0; border-radius: var(--radius-sm); }
.sky-table th[scope="row"] { min-width: 9rem; font-size: inherit; font-weight: 500; color: var(--ink); white-space: normal; }
.sky-table th[scope="row"] a { font-weight: 650; }
.sky-table th .sub { display: flex; align-items: center; gap: 5px; margin-top: 1px; font-size: var(--step--2); font-weight: 400; color: var(--muted); }
.sky-table td .key-dot { margin-right: 6px; vertical-align: -1px; color: var(--ink-2); }
.sky-table th.pick, .sky-table td.pick { width: 1%; padding-right: 0; }
.sky-table thead th { position: relative; }
.sky-table thead th button { color: var(--ink-2); font-weight: 700; }
.sky-table thead th[aria-sort] button { color: var(--ink); }
/* Every column can be sorted: a faint mark on each, the current one's direction in ink. */
.sky-table .sort-mark:empty::after { content: " ↕"; color: var(--muted); font-weight: 400; }
.sky-pick { all: unset; box-sizing: border-box; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.sky-pick span { width: 14px; height: 14px; border: 2px solid var(--ink-2); border-radius: 50%; }
.sky-pick:hover { background: var(--surface-2); }
.sky-pick:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.sky-pick[aria-pressed="true"] span { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 3px, transparent 3.5px); }
.sky-table tbody tr { cursor: default; }
.sky-table tbody tr:hover { background: var(--surface-2); }
.sky-table tbody tr.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.sky-table tbody tr.gone { color: var(--muted); }
.sky-table-card .empty { margin: 0; padding: var(--space-6) var(--space-3); text-align: left; }
.sky-count { font-variant-numeric: tabular-nums; }
.sky-table-card .pager { padding: 0 var(--space-2) var(--space-1); }
.sky-table-card .scroll-hint { display: none; }
.sky-table th .stale-note .stale-mark { margin-top: 0; }

/* A narrow box (a phone): each row a small block, the figures in two columns with their names, and
   the column heads a row of sort buttons. The table stays a table to screen readers (views/sky.js
   keepTableSemantics). */
@container skytable (max-width: 640px) {
  .sky-table, .sky-table > thead, .sky-table > tbody, .sky-table tr { display: block; }
  .sky-table > thead tr { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: var(--space-2); border-bottom: 1px solid var(--border); background: var(--surface-2); }
  .sky-table > thead th { display: block; padding: 0; border: 0; background: none; }
  .sky-table > thead th.pick { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sky-table > thead th button { min-height: 32px; padding: 0 var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); font-size: var(--step--2); }
  .sky-table > thead th[aria-sort] button { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
  .sky-table tbody tr { display: grid; grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr); gap: 2px var(--space-3); padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--hairline); }
  .sky-table tbody tr:last-child { border-bottom: 0; }
  .sky-table tbody :is(td, th) { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; text-align: left; }
  .sky-table td.pick { grid-column: 1; grid-row: 1 / span 4; width: auto; }
  .sky-table th[scope="row"] { grid-column: 2 / -1; min-width: 0; margin-bottom: var(--space-1); }
  .sky-table td.c-dir, .sky-table td.c-range { grid-column: 2; }
  .sky-table td.c-el, .sky-table td.c-height { grid-column: 3; }
  .sky-table td.c-light { grid-column: 2 / -1; }
  .sky-table td[data-label]::before { content: attr(data-label) " "; content: attr(data-label) " " / ""; display: block; font-size: var(--step--2); font-weight: 600; color: var(--muted); }
  .sky-table-card .table-wrap { overflow: visible; background: none; }
}

@media (max-width: 900px) {
  .sky-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .sky-section, .sky-saw { margin-top: var(--space-12); }
  .sky-location { padding: var(--space-3); }
  .sky-section > .section-head h2, .sky-saw > h2 { font-size: var(--step-2); }
}
@media (max-width: 480px) {
  /* The buttons wrap too: "Show all 1,245" beside "Show 25 more" is wider than a 280 px screen. */
  .sky-page .pager, .sky-page .pager .btns { flex-wrap: wrap; }
}
.sky-rising-more { margin-top: var(--space-2); }
