/* appfl-bio-suite project site.
   Both palettes are the federation viewer's own, so the landing page and the embedded
   map read as the same piece of software in either theme.

   Dark is the default and light is an explicit [data-theme="light"], rather than a
   prefers-color-scheme media block: an inline script in each page's <head> resolves the
   stored choice or the OS preference into that attribute before first paint, which is
   what keeps the tokens in one copy and the page from flashing the wrong theme. */

:root {
  color-scheme: dark;
  --bg: #081219;
  --surface: #101d26;
  --surface-2: #16242e;
  --border: #25343e;
  --border-soft: #1b2932;
  --text: #e1edf0;
  --muted: #93a8b3;
  --accent: #50d9c7;
  --accent-dim: #2f8f85;
  --amber: #f5bd66;
  --blue: #669fe0;
  --measure: 1120px;
  --radius: 14px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --code-text: #cfe3e6;
  --on-accent: #05171b;
  --accent-hover: #6ce6d5;
  --header-bg: rgba(8, 18, 25, .88);
  --teaser-bg: linear-gradient(140deg, #0e1f28, #0a1620 62%);
  --tag-alt-border: #7a6034;
  --tag-alt2-border: #3b587d;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf3f3;
  --surface: #ffffff;
  --surface-2: #f3f8f8;
  --border: #d6e3e3;
  --border-soft: #e3eceb;
  --text: #143038;
  --muted: #536c75;
  --accent: #087f75;
  --accent-dim: #58a9a1;
  --amber: #9a6a14;
  --blue: #2e5f9e;

  --code-text: #24454e;
  --on-accent: #ffffff;
  --accent-hover: #0a9d90;
  --header-bg: rgba(237, 243, 243, .9);
  --teaser-bg: linear-gradient(140deg, #ffffff, #e6f1ef 62%);
  --tag-alt-border: #d8b877;
  --tag-alt2-border: #9dbbdf;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 5px;
}

pre {
  margin: 0;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--code-text);
  -webkit-overflow-scrolling: touch;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
pre .c { color: var(--muted); }
pre .k { color: var(--accent); }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- header ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 22px;
  min-height: 66px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 34px; height: 34px; object-fit: contain; }
.brand b { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.brand b span { font-weight: 400; color: var(--muted); }

.site-nav { display: flex; align-items: center; gap: 8px 18px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { color: var(--muted); font-size: 13.5px; font-weight: 500; position: relative; padding: 4px 0; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
/* "page" is the cross-page current item; "location" is the section being read, set by
   the scroll spy in site.js. Both are marked, so the underline is never the only cue. */
.site-nav a[aria-current] { color: var(--accent); font-weight: 600; }
.site-nav a[aria-current]::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.site-nav .nav-repo[aria-current]::after { display: none; }
.site-nav .nav-repo {
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  background: var(--surface);
}
.site-nav .nav-repo:hover { border-color: var(--accent-dim); color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  line-height: 1;
  font-size: 15px;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-dim); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
/* One button, two glyphs: each theme shows the one you would switch TO. */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* --- sections ----------------------------------------------------------- */

section { padding: 58px 0; border-top: 1px solid var(--border-soft); }
section:first-of-type { border-top: 0; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}
.section-title { font-size: clamp(24px, 3.4vw, 31px); margin-bottom: 14px; }
.section-lead { color: var(--muted); font-size: 17px; max-width: 68ch; margin-bottom: 34px; }

/* --- hero --------------------------------------------------------------- */

.hero { padding: 76px 0 62px; }
.hero h1 { font-size: clamp(36px, 6.4vw, 60px); letter-spacing: -.035em; margin-bottom: 20px; }
.hero h1 span { color: var(--muted); font-weight: 400; }
.hero .lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); max-width: 62ch; }

.byline { margin-top: 22px; color: var(--muted); font-size: 15px; }
.byline a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.byline a:hover { color: var(--accent); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 10px;
  padding: 11px 19px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.btn:hover { text-decoration: none; border-color: var(--accent-dim); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* --- diagram ------------------------------------------------------------ */

.figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 20px;
}
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

/* --- cards -------------------------------------------------------------- */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
}
.card h3 { font-size: 18px; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 14.5px; }
.card .tag {
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 14px;
}
.card .tag.alt { color: var(--amber); border-color: var(--tag-alt-border); }
.card .tag.alt2 { color: var(--blue); border-color: var(--tag-alt2-border); }
.card dl {
  margin: 16px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
}
.card dt { color: var(--muted); letter-spacing: .4px; }
.card dd { margin: 0; color: var(--text); }
.card .card-link { margin-top: auto; padding-top: 18px; font-size: 13.5px; font-weight: 600; }

/* --- prose list of design points ---------------------------------------- */

.points { display: grid; gap: 2px; margin: 0; padding: 0; }
.points > div {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 22px 24px;
}
.points > div:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.points > div:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.points h3 { font-size: 16px; margin-bottom: 7px; }
.points p { color: var(--muted); font-size: 14.5px; max-width: 78ch; }

/* --- table -------------------------------------------------------------- */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  background: var(--surface);
}
table { border-collapse: collapse; width: 100%; font-size: 14.5px; min-width: 520px; }
th, td { text-align: left; padding: 15px 20px; border-bottom: 1px solid var(--border-soft); }
tbody tr:last-child td { border-bottom: 0; }
th {
  font-size: 11px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
td:first-child { font-weight: 600; white-space: nowrap; }
td.q { color: var(--muted); }

/* --- callout ------------------------------------------------------------ */

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  padding: 22px 24px;
  color: var(--muted);
  font-size: 15px;
}
.callout strong { color: var(--text); }

/* --- the network-map teaser --------------------------------------------- */

.teaser {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 34px;
  align-items: center;
  background: var(--teaser-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 38px 36px;
}
.teaser h2 { font-size: clamp(23px, 3vw, 29px); margin-bottom: 14px; }
.teaser p { color: var(--muted); font-size: 15.5px; }
.teaser .teaser-art { display: flex; justify-content: center; }
.teaser .teaser-art svg { width: 100%; max-width: 280px; height: auto; }

/* --- the embedded viewer ------------------------------------------------ */

.embed {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.embed-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--muted);
}
.embed-bar .dots { display: flex; gap: 6px; }
.embed-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.embed-bar .spacer { margin-left: auto; }
.embed-bar a { font-weight: 600; font-size: 12.5px; }
.embed iframe {
  display: block;
  width: 100%;
  height: min(78vh, 760px);
  min-height: 460px;
  border: 0;
  background: var(--bg);
}
.embed-note { margin-top: 14px; color: var(--muted); font-size: 13.5px; }

/* --- footer ------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 44px 0 56px;
  color: var(--muted);
  font-size: 13.5px;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 26px 44px; }
.site-footer .foot-col { flex: 1 1 200px; }
.site-footer h4 {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 600;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .colophon { flex: 1 1 100%; padding-top: 22px; border-top: 1px solid var(--border-soft); }

/* --- responsive --------------------------------------------------------- */

@media (max-width: 1000px) {
  .site-nav { gap: 8px 14px; font-size: 13px; }
}
@media (max-width: 860px) {
  .teaser { grid-template-columns: 1fr; padding: 30px 26px; }
  .teaser .teaser-art { order: -1; }
  .teaser .teaser-art svg { max-width: 190px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  section { padding: 46px 0; }
  .hero { padding: 54px 0 46px; }
  .site-header .wrap { gap: 10px 14px; min-height: 60px; }
  .site-nav { gap: 8px 14px; width: 100%; margin-left: 0; }
  .site-nav a { font-size: 13px; }
  .card, .points > div, .callout { padding: 20px 18px; }
  pre { padding: 16px; font-size: 12px; }
  .embed iframe { height: 72vh; min-height: 420px; }
}
