/* BackyardDSN — mission-console dark theme.
   Legible first: high contrast, real focus rings, no gimmicks. */

:root {
  --bg: #0a0e14;
  --bg-elev: #121823;
  --bg-card: #151c28;
  --bg-card-hover: #1b2535;
  --border: #243044;
  --border-bright: #35496a;
  --text: #e6edf6;
  --text-dim: #a3b1c6;
  --muted: #6f7e95;
  --accent: #4fd1c5;        /* signal teal */
  --accent-2: #ffb347;      /* warm amber for warnings */
  --accent-glow: rgba(79, 209, 197, 0.18);
  --danger: #ff6b6b;
  --ok: #51cf66;
  --radius: 10px;
  --maxw: 1180px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(79,209,197,0.08), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(53,73,106,0.18), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; }

.sr-only, .skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px;
  width: auto; height: auto; clip: auto;
  background: var(--accent); color: #04211e;
  padding: 0.5rem 0.9rem; border-radius: 6px; z-index: 1000;
  font-weight: 600;
}

/* Focus visibility everywhere */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted { color: var(--muted); font-weight: 400; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18,24,35,0.95), rgba(10,14,20,0.85));
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-top: 0.85rem; padding-bottom: 0.85rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.85rem; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-family: var(--mono); font-size: 1.6rem; color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow); letter-spacing: -2px;
}
.brand h1 { font-size: 1.3rem; margin: 0; letter-spacing: 0.5px; }
.tagline { margin: 0; font-size: 0.82rem; color: var(--text-dim); }
.top-nav { display: flex; gap: 1.25rem; font-size: 0.9rem; flex-wrap: wrap; }
.top-nav a { color: var(--text-dim); padding: 0.15rem 0; border-bottom: 2px solid transparent; }
.top-nav a:hover { color: var(--accent); text-decoration: none; }
.top-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Section scaffolding ---------- */
section { padding: 2.5rem 0; }
section h2 { font-size: 1.5rem; }
.section-eyebrow { font-size: 1.05rem; letter-spacing: 0.5px; }
.section-lead { color: var(--text-dim); max-width: 70ch; margin-top: -0.2rem; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  display: inline-block; border-radius: 8px; font-weight: 600;
  padding: 0.6rem 1.1rem; font-size: 0.92rem; cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #04211e; }
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--border-bright); }
.btn-ghost:hover { background: var(--bg-card-hover); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { padding: 3rem 0 2.5rem; }
.hero-eyebrow {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.6rem;
}
.hero-title { font-size: clamp(1.6rem, 3.4vw, 2.4rem); max-width: 22ch; margin: 0 0 0.8rem; }
.hero-lead { color: var(--text-dim); max-width: 66ch; font-size: 1.02rem; margin: 0 0 1.5rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- Catalog intro ---------- */
.catalog-intro { margin: 0.5rem 0 0.5rem; }
.catalog-lead { color: var(--text-dim); max-width: 78ch; margin: 0 0 0.9rem; }
.catalog-lead strong { color: var(--text); font-weight: 600; }
.catalog-cats { margin: 1.5rem 0; }
.catalog-cats h3 { font-size: 1rem; color: var(--accent-2); }
.category-legend {
  list-style: none; margin: 0.5rem 0 0; padding: 0;
  display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.category-legend li {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 0.55rem 0.75rem; display: flex; justify-content: space-between;
  align-items: baseline; gap: 0.6rem;
}
.category-legend .cat-name { color: var(--text); font-size: 0.9rem; }
.category-legend .cat-count { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; white-space: nowrap; }
.chip-legend {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.4rem 1rem; margin: 1.25rem 0 0;
}
.chip-legend summary { cursor: pointer; color: var(--text-dim); font-size: 0.9rem; padding: 0.5rem 0; font-weight: 600; }
.chip-legend summary:hover { color: var(--text); }
.chip-legend ul { list-style: none; margin: 0.4rem 0 0.8rem; padding: 0; display: grid; gap: 0.55rem; }
.chip-legend li { color: var(--text-dim); font-size: 0.85rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }

/* ---------- Slim status banner (home) ---------- */
.status-banner {
  background: linear-gradient(180deg, rgba(255,179,71,0.08), transparent);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
}
.status-banner p { margin: 0; font-size: 0.9rem; color: var(--text-dim); }
.status-banner strong { color: var(--accent-2); font-weight: 600; }
.status-banner a { white-space: nowrap; }

/* ---------- Caveat strip ---------- */
/* On the dedicated Status page, give the strip normal section breathing room. */
.caveat-strip.caveat-page { border-top: none; padding-top: 2.5rem; }
.caveat-strip {
  background: linear-gradient(180deg, rgba(255,179,71,0.07), transparent);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 0;
}
.caveat-strip h2 { color: var(--accent-2); }
.caveat-list {
  list-style: none; margin: 0.75rem 0 0; padding: 0;
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.caveat-list li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem; color: var(--text-dim);
}

/* ---------- Framing cards ---------- */
.framing-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.framing-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
}
.framing-card h3 { color: var(--accent); font-size: 1.05rem; }
.framing-card p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
.framing-card.accent { border-color: var(--border-bright); background: linear-gradient(160deg, var(--bg-card), #101826); }
.framing-card.accent h3 { color: var(--accent-2); }

/* ---------- Controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 0.9rem 1rem; align-items: flex-end;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1.25rem 0;
}
.control { display: flex; flex-direction: column; gap: 0.3rem; }
.control label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.control.search { flex: 1 1 220px; }
input[type="search"], input[type="text"], select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-bright); border-radius: 7px;
  padding: 0.5rem 0.6rem; font-size: 0.9rem; font-family: inherit;
  min-width: 130px;
}
input[type="search"] { width: 100%; }
select { cursor: pointer; }
.toggles { display: flex; gap: 0.9rem 1rem; border: none; margin: 0; padding: 0; flex-wrap: wrap; align-items: center; }
.chk { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-dim); cursor: pointer; }
.chk input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.reset-btn, .link-btn {
  background: transparent; color: var(--accent);
  border: 1px solid var(--border-bright); border-radius: 7px;
  padding: 0.5rem 0.85rem; cursor: pointer; font-size: 0.85rem; font-family: inherit;
}
.reset-btn:hover { background: var(--bg-card-hover); }
.link-btn { border: none; text-decoration: underline; padding: 0; }
.result-count { color: var(--muted); font-size: 0.85rem; font-family: var(--mono); margin: 0 0 0.85rem; }

/* ---------- Cards ---------- */
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.15rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  cursor: pointer; transition: border-color 0.15s, transform 0.15s, background 0.15s;
  text-align: left; font: inherit; color: inherit; width: 100%;
}
.card:hover { border-color: var(--border-bright); background: var(--bg-card-hover); transform: translateY(-2px); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.card-name { font-size: 1.08rem; font-weight: 650; margin: 0; color: var(--text); }
.card-cat { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-family: var(--mono); }
.card-pitch { color: var(--text-dim); font-size: 0.9rem; margin: 0; }
.card-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: auto; }

.chip {
  font-size: 0.7rem; font-family: var(--mono);
  padding: 0.18rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--border-bright); color: var(--text-dim);
  white-space: nowrap;
}
.chip.cost-free { color: var(--ok); border-color: rgba(81,207,102,0.4); }
.chip.cost-paid { color: var(--accent-2); border-color: rgba(255,179,71,0.4); }
.chip.cost-mixed { color: var(--accent); border-color: rgba(79,209,197,0.4); }
.chip.rx { color: var(--accent); }
.chip.tx { color: var(--accent-2); }
.chip.license { color: var(--danger); border-color: rgba(255,107,107,0.4); }
.chip.api { color: var(--accent); }
.chip.level { color: var(--text-dim); }

.status-chip {
  font-size: 0.7rem; font-family: var(--mono); font-weight: 600;
  padding: 0.18rem 0.5rem; border-radius: 6px; white-space: nowrap;
}
.status-chip.caveat { background: rgba(255,179,71,0.15); color: var(--accent-2); border: 1px solid rgba(255,179,71,0.5); }
.status-chip.retired { background: rgba(255,107,107,0.15); color: var(--danger); border: 1px solid rgba(255,107,107,0.5); }
.status-chip.hibernating { background: rgba(111,126,149,0.18); color: var(--text-dim); border: 1px solid var(--border-bright); }
.status-chip.live { background: rgba(81,207,102,0.12); color: var(--ok); border: 1px solid rgba(81,207,102,0.35); }

.card-statusnote {
  font-size: 0.78rem; color: var(--accent-2);
  background: rgba(255,179,71,0.06); border-left: 2px solid var(--accent-2);
  padding: 0.4rem 0.55rem; border-radius: 4px; margin: 0;
}
.card.is-retired .card-statusnote, .card .card-statusnote.retired { color: var(--danger); border-color: var(--danger); }

.empty-state { color: var(--text-dim); padding: 2rem; text-align: center; }

/* ---------- Detail dialog ---------- */
.detail-dialog {
  border: 1px solid var(--border-bright); border-radius: 14px;
  background: var(--bg-elev); color: var(--text);
  max-width: 640px; width: calc(100% - 2rem); padding: 0;
}
.detail-dialog::backdrop { background: rgba(4,7,12,0.75); backdrop-filter: blur(3px); }
.detail-inner { padding: 1.6rem 1.7rem; position: relative; }
.dialog-close {
  position: absolute; top: 0.9rem; right: 0.9rem;
  background: var(--bg-card); border: 1px solid var(--border-bright);
  color: var(--text-dim); width: 2rem; height: 2rem; border-radius: 6px;
  cursor: pointer; font-size: 1rem;
}
.dialog-close:hover { color: var(--text); background: var(--bg-card-hover); }
#detail-body h3 { font-size: 1.3rem; margin-right: 2.5rem; }
#detail-body .detail-cat { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
#detail-body .detail-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0; }
#detail-body .detail-note { color: var(--text-dim); font-size: 0.92rem; }
#detail-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 0.9rem; margin: 1rem 0; font-size: 0.9rem; }
#detail-body dt { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; padding-top: 0.1rem; }
#detail-body dd { margin: 0; color: var(--text-dim); }
#detail-body .detail-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
#detail-body .detail-links a {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  padding: 0.4rem 0.7rem; border-radius: 7px; font-size: 0.85rem;
}
#detail-body .detail-links a:hover { background: var(--bg-card-hover); text-decoration: none; }
#detail-body .detail-statusnote {
  background: rgba(255,179,71,0.08); border-left: 3px solid var(--accent-2);
  padding: 0.6rem 0.8rem; border-radius: 6px; color: var(--accent-2);
  font-size: 0.88rem; margin: 0.5rem 0 0;
}

/* ---------- Utilities ---------- */
.util-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.util-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.7rem;
}
.util-card h3 { color: var(--accent); font-size: 1.1rem; }
.util-card p { margin: 0; color: var(--text-dim); font-size: 0.9rem; }
.util-card code { font-family: var(--mono); background: var(--bg); padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.85em; color: var(--accent); }
.util-embed { position: relative; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--bg); }
.util-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.util-link {
  align-self: flex-start; color: var(--accent); background: transparent;
  border: 1px solid var(--border-bright); border-radius: 7px;
  padding: 0.4rem 0.75rem; cursor: pointer; font-size: 0.85rem; font-family: inherit;
}
.util-link:hover { background: var(--bg-card-hover); text-decoration: none; }
.util-form label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); display: block; margin-bottom: 0.3rem; }
.inline-fields { display: flex; gap: 0.5rem; }
.inline-fields input { flex: 1; }
.inline-fields button, .util-form button {
  background: var(--accent); color: #04211e; border: none; border-radius: 7px;
  padding: 0.5rem 0.9rem; cursor: pointer; font-weight: 600; font-family: inherit;
}
.inline-fields button:hover { filter: brightness(1.1); }
.apod-result img { width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 0.5rem; }
.apod-result .apod-title { font-weight: 600; color: var(--text); margin: 0.6rem 0 0.2rem; }
.apod-result .apod-expl { font-size: 0.85rem; color: var(--text-dim); max-height: 8rem; overflow-y: auto; }
.apod-result .err, .iss-result .err { color: var(--danger); font-size: 0.88rem; }
.iss-result { font-family: var(--mono); font-size: 0.9rem; color: var(--text-dim); }
.iss-result .coord { color: var(--accent); font-size: 1.05rem; }
.jump-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.jump-list a { display: block; background: var(--bg); border: 1px solid var(--border-bright); padding: 0.5rem 0.7rem; border-radius: 7px; font-size: 0.9rem; }
.jump-list a:hover { background: var(--bg-card-hover); text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; color: var(--text-dim); font-size: 0.88rem; }
.site-footer p { margin: 0 0 0.4rem; }

/* ---------- Motion / responsive ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
@media (max-width: 640px) {
  .site-header .wrap { flex-direction: column; align-items: flex-start; }
  section { padding: 2rem 0; }
}
