/* GALFA-HI DR2 portal.
   Dark, sky-first, restrained. Three type sizes, one accent hue, system
   font stack so there is nothing to download and nothing to build. */

:root {
  --bg:        #0d1117;
  --panel:     #151b24;
  --panel-2:   #1b2230;
  --line:      #263040;
  --ink:       #e4e8ef;
  --ink-dim:   #9aa6b8;
  --ink-faint: #68748a;
  --accent:    #7eb3ff;
  --accent-soft: rgba(126, 179, 255, 0.28);
  --seam:      #ff8f6b;
  --ok:        #7ddba0;
  --warn:      #ffcf70;
  --radius: 7px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ── masthead ────────────────────────────────────────────────────── */
.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #121922 0%, var(--bg) 100%);
  padding: 26px 0 0;
}
.masthead h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.masthead h1 .rel { color: var(--ink-faint); font-weight: 400; }
.sc { font-variant: small-caps; text-transform: lowercase; }
.tagline {
  margin: 6px 0 18px;
  color: var(--ink-dim);
  max-width: 62ch;
  font-size: 0.9rem;
}

.tabs { display: flex; gap: 2px; }
.tab {
  appearance: none;
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.88rem;
  padding: 9px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
}
.tab:hover { color: var(--ink); background: var(--panel); }
.tab.is-active {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
  position: relative; top: 1px;
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── views ───────────────────────────────────────────────────────── */
.view { display: none; padding: 26px 0 50px; }
.view.is-active { display: block; }

h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 0.9rem; font-weight: 600; margin: 18px 0 6px; color: var(--ink-dim); }
.hint, .note { color: var(--ink-dim); font-size: 0.84rem; }
.note { margin-top: 14px; }
.muted { color: var(--ink-faint); }

/* ── sky map ─────────────────────────────────────────────────────── */
.map-layout { display: grid; grid-template-columns: 1fr 310px; gap: 18px; }
.aladin {
  width: 100%; height: 620px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #05070b;
}
.side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  align-self: start;
}
.selection { margin-top: 14px; font-size: 0.85rem; }
.selection dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 12px; }
.selection dt { color: var(--ink-faint); }
.selection dd { margin: 0; font-family: var(--mono); font-size: 0.8rem; }
.legend { margin-top: 16px; display: flex; flex-direction: column; gap: 5px;
          font-size: 0.78rem; color: var(--ink-dim); }
.legend .sw { display: inline-block; width: 11px; height: 11px; margin-right: 7px;
              vertical-align: -1px; border-radius: 2px; }
.sw-normal { background: rgba(126,179,255,.3); border: 1px solid var(--accent); }
.sw-seam   { background: rgba(255,143,107,.3); border: 1px solid var(--seam); }
kbd {
  font-family: var(--mono); font-size: 0.75rem;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 3px; padding: 1px 5px;
}

/* ── forms ───────────────────────────────────────────────────────── */
.field { margin-bottom: 12px; }
label {
  display: block; font-size: 0.76rem; letter-spacing: 0.02em;
  color: var(--ink-dim); margin-bottom: 4px;
}
input, select {
  width: 100%; padding: 7px 9px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 5px;
  font: inherit; font-size: 0.86rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

button.primary {
  width: 100%; padding: 10px;
  background: var(--accent); color: #0b1017;
  border: none; border-radius: 5px;
  font: inherit; font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }
button.primary:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── toolbar + table ─────────────────────────────────────────────── */
.toolbar {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.toolbar .field { margin: 0; min-width: 150px; }
.count { margin: 0 0 0 auto; color: var(--ink-dim); font-size: 0.82rem; }

.table-scroll {
  max-height: 620px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-2); color: var(--ink-dim);
  text-align: left; font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th[data-sort] { cursor: pointer; user-select: none; }
thead th[data-sort]:hover { color: var(--ink); }
thead th .arrow { color: var(--accent); margin-left: 4px; }
tbody td { padding: 7px 12px; border-bottom: 1px solid #1c232e; white-space: nowrap; }
tbody tr:hover { background: var(--panel); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: var(--mono); font-size: 0.78rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.seam-flag {
  color: var(--seam); font-size: 0.7rem; margin-left: 6px;
  border: 1px solid var(--seam); border-radius: 3px; padding: 0 4px;
}

/* ── cutout ──────────────────────────────────────────────────────── */
.cutout-layout { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.estimate {
  margin: 4px 0 12px; padding: 9px 11px;
  background: var(--panel-2); border-left: 2px solid var(--accent);
  border-radius: 3px; font-size: 0.82rem; color: var(--ink-dim);
}
.estimate.over { border-left-color: var(--warn); color: var(--warn); }
.estimate b { color: var(--ink); font-variant-numeric: tabular-nums; }
.status { min-height: 1.2em; margin: 10px 0 0; font-size: 0.82rem; }
.status.err { color: var(--seam); }
.status.ok { color: var(--ok); }
.turnstile { margin: 10px 0; min-height: 0; }
pre {
  background: #090d13; border: 1px solid var(--line); border-radius: 5px;
  padding: 11px 13px; overflow-x: auto; margin: 0;
}
code { font-family: var(--mono); font-size: 0.78rem; color: #cbd5e6; }

/* ── prose ───────────────────────────────────────────────────────── */
.prose { max-width: 70ch; }
.prose dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.prose dt { color: var(--accent); font-weight: 600; font-size: 0.86rem; }
.prose dd { margin: 0; color: var(--ink-dim); font-size: 0.86rem; }
blockquote {
  margin: 10px 0; padding: 10px 14px;
  border-left: 2px solid var(--line); color: var(--ink-dim); font-size: 0.88rem;
}
.dois { padding-left: 18px; font-size: 0.86rem; color: var(--ink-dim); }
.dois li { margin: 3px 0; }

/* ── footer ──────────────────────────────────────────────────────── */
.foot {
  border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 28px;
  display: flex; justify-content: space-between; flex-wrap: wrap;
  color: var(--ink-faint); font-size: 0.78rem;
}
.foot p { margin: 0; }

/* ── responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .map-layout, .cutout-layout { grid-template-columns: 1fr; }
  .aladin { height: 420px; }
  .grid2 { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; }
}
