/* The SDN-AP site, on the Space Data Network style guide (sdn
   docs/STYLE-GUIDE.md): dark first, one amber accent, system fonts. The top
   bar, stack section and footer come from assets/sdn-chrome/. */

:root {
  --bg: #000000;
  --surface: #0b0b0c;
  --panel: rgba(28, 28, 30, 0.72);
  --panel-solid: #161617;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f5f5f7;
  --text-2: rgba(245, 245, 247, 0.78);
  --muted: #8e8e93;
  --accent: #f5a524;
  --accent-soft: rgba(245, 165, 36, 0.14);
  --cyan: #59d9ff;
  --red: #ff3b30;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  --text: #1d1d1f;
  --text-2: rgba(29, 29, 31, 0.8);
  --muted: #6e6e73;
  --accent: #c77d00;
  --accent-soft: rgba(199, 125, 0, 0.12);
  --cyan: #0a84b8;
  --red: #d70015;
  color-scheme: light;
}

html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sdn-c-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
code { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; }

/* Layout */
.wrap { box-sizing: border-box; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 860px; }
.section { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--border); }
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section h2 {
  margin-bottom: 14px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.lede { max-width: 760px; margin: 0 0 32px; color: var(--text-2); font-size: clamp(17px, 2vw, 21px); }
.section p:not([class]) { color: var(--text-2); }
.center { text-align: center; }
.center .lede { margin-left: auto; margin-right: auto; }

/* Hero */
.hero {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 120px 20px 64px;
  text-align: center;
}
.hero h1 {
  margin-bottom: 20px;
  font-size: clamp(40px, 7vw, 76px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.04;
}
.hero .lede { margin: 0 auto 28px; }
.hero-reel { width: min(100%, 960px); margin: 0 auto 28px; }
.page-head { padding: 120px 0 0; }
.page-head .lede { margin-bottom: 0; }
.page-head + .section { padding-top: 48px; }
.page-head h1 {
  margin-bottom: 14px;
  font-size: clamp(36px, 5.5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.06;
}

/* Buttons: pills; the hovered one turns white with black text */
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.6);
  color: var(--text);
  font: 600 15px/1 var(--sdn-c-sans);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn.primary { background: #fff; border-color: #fff; color: #000; }
.actions:hover .btn.primary:not(:hover) { background: rgba(28, 28, 30, 0.6); border-color: var(--border-strong); color: var(--text); }
.btn:hover { background: #fff; border-color: #fff; color: #000; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:root[data-theme="light"] .btn { background: rgba(255, 255, 255, 0.7); }
:root[data-theme="light"] .btn.primary { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }
:root[data-theme="light"] .actions:hover .btn.primary:not(:hover) { background: rgba(255, 255, 255, 0.7); border-color: var(--border-strong); color: var(--text); }
:root[data-theme="light"] .btn:hover { background: #1d1d1f; border-color: #1d1d1f; color: #fff; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 16px; }
.card {
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.card h3 { margin-bottom: 8px; font-size: 19px; font-weight: 600; }
.card p { margin: 0; font-size: 15px; }
a.card { display: block; color: inherit; transition: border-color 0.2s, background 0.2s; }
a.card:hover { border-color: var(--border-strong); text-decoration: none; }
a.card .more { display: block; margin-top: 14px; color: var(--accent); font-size: 14px; font-weight: 600; }
.card svg { width: 24px; height: 24px; margin-bottom: 12px; color: var(--accent); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; counter-reset: step; list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding: 24px 24px 24px 72px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 24px;
  top: 22px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text);
  font-weight: 700;
}
.steps h3 { margin-bottom: 6px; font-size: 19px; font-weight: 600; }
.steps p { margin: 0; font-size: 15px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td { color: var(--text-2); }
td:first-child { color: var(--text); }
table.ref td:nth-child(2), table.ref td:nth-child(3) { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
code.hash { font-size: 12px; word-break: break-all; }

/* Reference pages */
.toc { columns: 3 220px; margin: 0 0 32px; padding-left: 20px; font-size: 15px; }
.ref-block { padding-top: 24px; scroll-margin-top: 72px; }
.ref-block h3 { margin-bottom: 8px; font-size: 19px; font-weight: 600; }
.ref-kind { color: var(--muted); font-size: 13px; font-weight: 400; }
.note { color: var(--muted); font-size: 14px; }
pre {
  overflow-x: auto;
  margin: 0 0 24px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
}
.refs { padding-left: 20px; font-size: 15px; color: var(--text-2); }
.refs li { margin-bottom: 6px; }

/* Demo */
.demo { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.demo-controls { display: grid; gap: 16px; padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); }
.demo-controls label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; }
.demo-controls select, .demo-controls input {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--panel-solid);
  color: var(--text);
  font: 400 15px/1.2 var(--sdn-c-sans);
}
.demo-view { display: grid; gap: 16px; }
.demo-canvas-frame { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: #0b0b0c; aspect-ratio: 1 / 1; }
.demo-canvas-frame canvas { display: block; width: 100%; height: 100%; }
.demo-time { position: absolute; left: 14px; top: 12px; color: rgba(245, 245, 247, 0.8); font: 500 12px/1.4 var(--mono); }
.demo-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.demo-stats div { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.demo-stats dt { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.demo-stats dd { margin: 4px 0 0; color: var(--text); font: 600 18px/1.3 var(--sdn-c-sans); font-variant-numeric: tabular-nums; }
.demo-status { min-height: 1.6em; margin: 0; color: var(--muted); font-size: 14px; }
.demo-status.is-error { color: var(--red); }
.demo-module { margin: 0; color: var(--muted); font-size: 13px; }

@media (max-width: 860px) {
  .demo { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .section { padding: 56px 0; }
  .hero { padding-top: 104px; }
  .page-head { padding-top: 100px; }
  th, td { padding: 8px 10px; }
}
.section h3.sub { margin: 32px 0 12px; font-size: 19px; font-weight: 600; }
.actions.start { justify-content: flex-start; }
#demo-table caption { caption-side: bottom; padding: 10px 14px; text-align: left; }

/* Whitepaper reader */
.paper-head .paper-meta, .paper-head .paper-legal { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.paper-head .lede { margin-bottom: 18px; }
.paper-section { padding-top: 40px; }
.paper-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start; }
.paper-toc { position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow: auto; font-size: 14px; }
.paper-toc ol { list-style: none; margin: 0; padding: 0; }
.paper-toc ol ol { padding-left: 12px; font-size: 13px; }
.paper-toc a { display: block; padding: 3px 0; color: var(--text-2); }
.paper-toc a:hover { color: var(--accent); text-decoration: none; }
.paper { min-width: 0; max-width: 820px; }
.paper h2 { margin: 48px 0 14px; font-size: clamp(24px, 3vw, 30px); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; scroll-margin-top: 72px; }
.paper h2:first-child { margin-top: 0; }
.paper h3 { margin: 32px 0 10px; font-size: 19px; font-weight: 600; scroll-margin-top: 72px; }
.paper p, .paper li { color: var(--text-2); }
.paper .math-display { overflow-x: auto; overflow-y: hidden; margin: 18px 0; padding: 4px 0; }
.paper .katex { font-size: 1.06em; }
.paper sup a { text-decoration: none; }
.paper td, .paper th { font-size: 14px; }
@media (max-width: 960px) {
  .paper-layout { grid-template-columns: minmax(0, 1fr); }
  .paper-toc { position: static; max-height: none; padding: 16px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
}
