/**
 * Light / dark theme tokens for Satellite Hunter tool pages.
 * Toggle sets html[data-theme="light"|"dark"]. Default is light (localStorage 'sh-theme').
 */

:root,
html[data-theme="light"] {
  --sh-card-bg: #ffffff;
  --sh-card-fg: #18181b;
  --sh-muted: #52525b;
  --sh-muted-2: #71717a;
  --sh-muted-3: #a1a1aa;
  --sh-border: #f4f4f5;
  --sh-border-strong: #e4e4e7;
  --sh-panel-bg: #fafafa;
  --sh-panel-hover: #f0f9ff;
  --sh-panel-selected: #e0f2fe;
  --sh-link: #0369a1;
  --sh-heading: #18181b;
  --sh-info-bg: #fafafa;
  --sh-info-title: #18181b;
  --sh-chevron-bg: #f4f4f5;
  --sh-chevron-fg: #52525b;
  --sh-chevron-open-bg: #e0f2fe;
  --sh-chevron-open-fg: #0369a1;
  --sh-card-shadow: 0 25px 50px -12px rgb(14 165 233 / 0.25);
  --sh-content-body: #3f3f46;
  --sh-content-h3: #0369a1;
  --sh-code-bg: #f4f4f5;
}

html[data-theme="dark"] {
  --sh-card-bg: #0f172a;
  --sh-card-fg: #e2e8f0;
  --sh-muted: #94a3b8;
  --sh-muted-2: #94a3b8;
  --sh-muted-3: #64748b;
  --sh-border: #1e293b;
  --sh-border-strong: #334155;
  --sh-panel-bg: #1e293b;
  --sh-panel-hover: rgba(14, 165, 233, 0.12);
  --sh-panel-selected: rgba(14, 165, 233, 0.22);
  --sh-link: #38bdf8;
  --sh-heading: #f1f5f9;
  --sh-info-bg: #1e293b;
  --sh-info-title: #f1f5f9;
  --sh-chevron-bg: #1e293b;
  --sh-chevron-fg: #94a3b8;
  --sh-chevron-open-bg: rgba(14, 165, 233, 0.2);
  --sh-chevron-open-fg: #7dd3fc;
  --sh-card-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.55);
  --sh-content-body: #cbd5e1;
  --sh-content-h3: #7dd3fc;
  --sh-code-bg: #1e293b;
}

/* Apply tokens to themed surfaces */
.form-card {
  background-color: var(--sh-card-bg) !important;
  color: var(--sh-card-fg) !important;
  box-shadow: var(--sh-card-shadow);
}

.form-card .text-zinc-900,
.form-card .font-semibold.text-zinc-900,
.intro-card summary .text-zinc-900 {
  color: var(--sh-heading) !important;
}

.form-card .text-zinc-700 {
  color: var(--sh-muted) !important;
}

.form-card .text-zinc-600,
.form-card .text-sm.text-zinc-600 {
  color: var(--sh-muted) !important;
}

.form-card .text-zinc-500,
.form-card .text-sm.text-zinc-500 {
  color: var(--sh-muted-2) !important;
}

.form-card .text-zinc-400,
.form-card .text-xs.text-zinc-400 {
  color: var(--sh-muted-3) !important;
}

.form-card a.text-sky-700,
.form-card .text-sky-700 {
  color: var(--sh-link) !important;
}

.line-section {
  background: var(--sh-panel-bg) !important;
  border-color: var(--sh-border) !important;
}

.line-header {
  color: var(--sh-heading) !important;
  border-bottom-color: var(--sh-border-strong) !important;
}

.data-row {
  border-bottom-color: var(--sh-border) !important;
}

.data-row:hover {
  background: var(--sh-panel-hover) !important;
}

.data-row.is-selected {
  background: var(--sh-panel-selected) !important;
}

.data-row .label {
  color: var(--sh-muted) !important;
}

.data-row .value {
  color: var(--sh-link) !important;
}

#info-panel {
  background: var(--sh-info-bg) !important;
  border-color: var(--sh-border) !important;
}

#info-title {
  color: var(--sh-info-title) !important;
}

#info-text {
  color: var(--sh-muted) !important;
}

.deep-dive-btn {
  color: var(--sh-link) !important;
  border-color: #0ea5e9 !important;
}

html[data-theme="dark"] .deep-dive-btn:hover {
  background: #0ea5e9 !important;
  color: #fff !important;
}

.intro-card .intro-body {
  border-top-color: var(--sh-border) !important;
}

.intro-card summary .chevron {
  background: var(--sh-chevron-bg) !important;
  color: var(--sh-chevron-fg) !important;
}

.intro-card[open] summary .chevron {
  background: var(--sh-chevron-open-bg) !important;
  color: var(--sh-chevron-open-fg) !important;
}

/* Deep dive article */
.content-body {
  color: var(--sh-content-body) !important;
}

.content-body h3 {
  color: var(--sh-content-h3) !important;
}

.content-body code {
  background: var(--sh-code-bg) !important;
  color: var(--sh-card-fg) !important;
}

.form-card h1,
#detail-title {
  color: var(--sh-heading) !important;
  border-bottom-color: var(--sh-border) !important;
}

.form-card > a {
  color: var(--sh-link) !important;
}

/* Theme toggle control (in site chrome) */
.chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #e0f2fe;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon { display: inline; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }

/* Viewport-fixed hero in dark mode (matches light-mode standard) */
html[data-theme="dark"] .hero-bg {
  background: linear-gradient(135deg, #020617 0%, #0c4a6e 55%, #1e3a8a 100%);
  background-attachment: fixed;
}

html[data-theme="dark"] .hero-bg::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 30% 70%, rgba(56, 189, 248, 0.18) 0%, transparent 50%);
}

/* Footer social icons (keep compact; clarity comes from glyph design) */
.footer-socials {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: rgba(224, 242, 254, 0.65);
  transition: color 0.15s ease, background 0.15s ease;
}

.footer-socials a:hover {
  color: #7dd3fc;
  background: rgba(255, 255, 255, 0.08);
}

.footer-socials svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

/* Speech-bubble glyph has more padding in the viewBox; scale up to match visual weight */
.footer-socials a[aria-label="Community list"] svg {
  width: 1.28rem;
  height: 1.28rem;
}



/* ── Catalog Readiness: tables, samples, status key panels ── */

.form-card h2 {
  color: var(--sh-heading) !important;
}

.form-card h3 {
  color: var(--sh-heading) !important;
}

table.status-table th {
  color: var(--sh-muted-2) !important;
  border-bottom-color: var(--sh-border) !important;
}

table.status-table tbody {
  border-color: var(--sh-border) !important;
}

table.status-table td {
  color: var(--sh-card-fg);
}

/* Soft inset panels (samples, sources, notes) */
.form-card .bg-zinc-50 {
  background-color: var(--sh-panel-bg) !important;
  border-color: var(--sh-border) !important;
}

/* Status key color chips — keep semantic colors; dark mode only softens surfaces */
html[data-theme="dark"] .form-card .bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.28) !important;
}

html[data-theme="dark"] .form-card .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.28) !important;
}

html[data-theme="dark"] .form-card .bg-rose-50 {
  background-color: rgba(244, 63, 94, 0.12) !important;
  border-color: rgba(244, 63, 94, 0.28) !important;
}

html[data-theme="dark"] .form-card .bg-sky-50 {
  background-color: rgba(14, 165, 233, 0.12) !important;
  border-color: rgba(14, 165, 233, 0.28) !important;
}

/* Status tags stay readable on dark cards */
html[data-theme="dark"] .status-tag.bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.22) !important;
  color: #6ee7b7 !important;
}

html[data-theme="dark"] .status-tag.bg-amber-100 {
  background-color: rgba(245, 158, 11, 0.22) !important;
  color: #fcd34d !important;
}

html[data-theme="dark"] .status-tag.bg-rose-100 {
  background-color: rgba(244, 63, 94, 0.22) !important;
  color: #fda4af !important;
}

html[data-theme="dark"] .status-tag.bg-sky-100 {
  background-color: rgba(14, 165, 233, 0.22) !important;
  color: #7dd3fc !important;
}

/* Inline code chips */
.form-card code.bg-zinc-100,
.form-card code.bg-white {
  background-color: var(--sh-code-bg) !important;
  color: var(--sh-card-fg) !important;
}

pre.sample {
  color: var(--sh-content-body) !important;
}

/* Table row dividers under Tailwind divide utilities */
html[data-theme="dark"] table.status-table tbody tr {
  border-color: var(--sh-border) !important;
}

html[data-theme="dark"] table.status-table thead tr {
  border-color: var(--sh-border) !important;
}

/* Collapsible section cards */
.section-card summary .section-title {
  color: var(--sh-heading) !important;
}

.section-card summary .chevron {
  background: var(--sh-chevron-bg) !important;
  color: var(--sh-chevron-fg) !important;
}

.section-card[open] summary .chevron {
  background: var(--sh-chevron-open-bg) !important;
  color: var(--sh-chevron-open-fg) !important;
}

.section-card .section-body {
  border-top-color: var(--sh-border) !important;
}

/* ── Site menu (tool-v1) — refined panel ── */
.site-menu {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  width: min(22rem, calc(100vw - 2rem));
  margin-top: 0.5rem;
  z-index: 40;
  transform-origin: top right;
}

.site-menu[hidden] {
  display: none !important;
}

.site-menu-panel {
  border-radius: 1rem;
  border: 1px solid rgba(125, 211, 252, 0.28);
  background:
    linear-gradient(165deg, rgba(30, 58, 138, 0.55) 0%, rgba(15, 23, 42, 0.97) 42%, rgba(15, 23, 42, 0.99) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 48px -12px rgba(0, 0, 0, 0.55),
    0 8px 20px -8px rgba(14, 165, 233, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

.site-menu-panel::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #38bdf8 20%, #7dd3fc 50%, #38bdf8 80%, transparent 100%);
  opacity: 0.9;
}

.site-menu-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.site-menu-kicker {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.site-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem;
}

.site-menu-nav a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.7rem;
  text-decoration: none;
  color: #e0f2fe;
  border: 1px solid transparent;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.site-menu-nav a:hover {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(125, 211, 252, 0.18);
  transform: translateX(2px);
}

.site-menu-nav a:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.7);
  outline-offset: 2px;
}

.site-menu-nav a.is-current {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(56, 189, 248, 0.28);
  box-shadow: inset 3px 0 0 0 #38bdf8;
}

.site-menu-nav a.is-current .menu-arrow {
  opacity: 1;
  color: #7dd3fc;
}

.menu-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.menu-label {
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: #f8fafc;
}

.menu-desc {
  font-size: 0.72rem;
  line-height: 1.35;
  color: #94a3b8;
  font-weight: 400;
}

.menu-arrow {
  font-size: 0.85rem;
  color: #64748b;
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.site-menu-nav a:hover .menu-arrow {
  opacity: 1;
  color: #7dd3fc;
  transform: translateX(2px);
}

/* Menu toggle — refined control + open state as × */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #e0f2fe;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(125, 211, 252, 0.35);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.menu-toggle[aria-expanded="true"] {
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(125, 211, 252, 0.4);
}

.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
  display: block;
  width: 1.05rem;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.menu-toggle-bars::before,
.menu-toggle-bars::after {
  content: '';
  position: absolute;
  left: 0;
}

.menu-toggle-bars::before { top: -5.5px; }
.menu-toggle-bars::after { top: 5.5px; }

.menu-toggle[aria-expanded="true"] .menu-toggle-bars {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bars::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Fixed back-to-top — body overlay only; never inside page flow */
#back-to-menu {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  box-sizing: border-box;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border-radius: 9999px;
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: rgba(15, 23, 42, 0.92);
  color: #7dd3fc;
  line-height: 0;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease, background 0.15s ease, color 0.15s ease;
}

#back-to-menu .back-to-menu-icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

#back-to-menu.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#back-to-menu:hover {
  background: rgba(14, 165, 233, 0.35);
  color: #e0f2fe;
}
