/* Barnard Atlas: design tokens (handoff "Design tokens"), page shell, shared components. */
:root {
  --bg: #0b100e; --surface: #0f1512; --surface-2: #131a17; --plate-black: #070a09;
  --line: #24302b; --line-strong: #33423b; --row-line: #1a231f; --hover: #17201c;
  --text: #e6e2d8; --text-2: #c9c4b8; --text-long: #d8d3c7; --muted: #969d93; --faint: #6c756d;
  --accent: #d9a55b; --accent-hi: #f0c07a; --accent-line: #5a4a30; --accent-bg: #1d1a14; --accent-bg-2: #2a2418;
  --on-accent: #14110b; --night-on: #3a1410; --warn: #e07a5f;
  --serif: 'Newsreader', 'Noto Serif', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --gutter: 28px;
  --page-max: 1440px;
  /* Side padding that centres content in a --page-max column on wide screens. */
  --pad-x: max(var(--gutter), calc((100% - var(--page-max)) / 2));
  --photo-filter: none;
  color-scheme: dark;
}

/* Night vision: the design prototype's look — one red filter over the whole page
   (handoff "Night vision"), so every colour, photo and chart dims the same way. */
html[data-theme="night"] { background: #20090c; }
[data-theme="night"] body { filter: grayscale(1) sepia(1) saturate(9) hue-rotate(-42deg) brightness(.72); }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; text-wrap: pretty; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline; }
img { max-width: 100%; filter: var(--photo-filter); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: 8px; top: -40px; padding: 8px 12px; background: var(--accent); color: var(--on-accent); border-radius: 4px; z-index: 10; }
.skip-link:focus { top: 8px; }

/* Header */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 28px;
  padding: 14px var(--pad-x); border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-name { font: 400 22px/1.1 var(--serif); }
.brand-sub { font: 11px/1.4 var(--mono); color: var(--muted); }
.site-nav { display: flex; gap: 4px; }
.site-nav a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.header-tools { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 6px 10px; font: 12px var(--mono); color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--line); color: var(--text); }
.btn-outline { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; color: var(--text-2); }
#night-toggle[aria-pressed="true"] { background: var(--night-on); color: var(--text); }

/* Search band */
.search-band { padding: 20px var(--pad-x) 16px; border-bottom: 1px solid var(--line); }
.search input {
  width: 100%; max-width: 880px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 14px 16px; font-size: 17px;
}
.search input::placeholder { color: var(--muted); }
.q-note { min-height: 1.5em; margin-top: 8px; font: 12px var(--mono); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px;
  font: 11px var(--mono); color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 4px;
}
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--accent-line); }
button.chip[aria-pressed="true"] { background: var(--accent-bg-2); border-color: var(--accent); color: var(--text); }

/* Main + footer */
main { display: block; padding: 28px var(--pad-x) 40px; }
main:focus { outline: none; }
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding: 18px var(--pad-x); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted);
}

/* Shared components */
.eyebrow { font: 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); }
.caption { font-size: 12px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 6px; font-weight: 600;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
}
.btn:hover { background: var(--accent-hi); color: var(--on-accent); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--accent-line); font-weight: 500; }
.btn-small { padding: 6px 10px; border-radius: 4px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.btn-small:hover { border-color: var(--accent-line); color: var(--text); text-decoration: none; }
.btn-plate { padding: 4px 10px; border-radius: 4px; font: 12px var(--mono); background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-line); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; color: var(--text); display: block; }
a.card:hover { border-color: var(--accent-line); text-decoration: none; color: var(--text); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-family: var(--mono); color: var(--text); width: 100%; }
.notice { padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: 8px; background: var(--accent-bg); color: var(--text-2); }
.loading { color: var(--muted); }
.notfound { max-width: 640px; display: grid; gap: 14px; }
.notfound h1 { font-size: 34px; }

@media (max-width: 600px) {
  :root { --gutter: 16px; }
  .site-header { gap: 12px; }
  .header-tools { margin-left: 0; }
  .site-nav a, .seg button, .btn-outline, .chip, .btn-small, .btn-plate, .btn { min-height: 44px; display: inline-flex; align-items: center; }
  .field { min-height: 44px; }
  .results-table th button { min-height: 44px; }
  .results-table .bno a, .near li a, .plate-objects a, .downloads a, .plate-top a, .plate-pn a, .about-nav a { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
  .detail-links { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; }
  .detail-links a { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
  .zoom-btns .zoom-btn { width: 44px; height: 44px; }
}

/* "Opens in a new window" icon (PDF links). */
.nw {
  display: inline-block; width: .8em; height: .8em; margin-left: .3em; vertical-align: -.05em;
  background: currentColor;
  -webkit-mask: url(../img/new-window.svg) center / contain no-repeat;
          mask: url(../img/new-window.svg) center / contain no-repeat;
}
.export-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.export-row .caption { margin-right: 4px; }
