/* ============================================================================
   Farder — website stylesheet
   ----------------------------------------------------------------------------
   THREE THEMES, one page. The palettes below are lifted from the client's own
   theme files (client/src/themes/<id>/theme.css), so the swatches on the page
   are not an impression of the client — they are the client's colours.

   No webfonts, no CDN, no analytics: every byte here is served from the same
   box as the rest of the site. A privacy project whose landing page phones a
   font service is telling on itself, and the visitor's IP is exactly what we
   claim to care about.
   ========================================================================= */

/* ── Theme: XP Luna Blue (default) ───────────────────────────────────────── */
:root,
[data-theme="xp"] {
  --accent:          #0058E6;
  --accent-light:    #3389FF;
  --accent-dark:     #003C74;
  --chrome:          #2E6FD0;
  --chrome-dark:     #1941A5;
  --bg:              #ECE9D8;
  --surface:         #F1EFE2;
  --surface-2:       #FFFFFF;
  --border:          #ACA899;
  --text:            #1A1A1A;
  --text-muted:      #6B6B63;
  --btn-face:        linear-gradient(#FDFDFD, #E3E0D2);
  --radius:          3px;
  --shadow:          2px 2px 8px rgba(0, 0, 0, 0.22);
  --shadow-lg:       4px 6px 22px rgba(0, 0, 0, 0.26);
  --font:            Tahoma, "MS Sans Serif", Verdana, system-ui, sans-serif;
  --font-mono:       "Lucida Console", Consolas, "Courier New", monospace;
}

/* ── Theme: Discord Dark ─────────────────────────────────────────────────── */
[data-theme="discord"] {
  --accent:          #5865F2;
  --accent-light:    #7983F5;
  --accent-dark:     #3C45A5;
  --chrome:          #2B2D31;
  --chrome-dark:     #1E1F22;
  --bg:              #313338;
  --surface:         #2B2D31;
  --surface-2:       #383A40;
  --border:          #1E1F22;
  --text:            #DBDEE1;
  --text-muted:      #949BA4;
  --btn-face:        linear-gradient(#4E5058, #3F4147);
  --radius:          6px;
  --shadow:          0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg:       0 8px 28px rgba(0, 0, 0, 0.55);
}

/* ── Theme: Hello Kitty ──────────────────────────────────────────────────── */
[data-theme="kitty"] {
  --accent:          #FF6FAB;
  --accent-light:    #FF9AC4;
  --accent-dark:     #D64A86;
  --chrome:          #FFB3CC;
  --chrome-dark:     #FF6FAB;
  --bg:              #FFF5F8;
  --surface:         #FFFFFF;
  --surface-2:       #FFE4ED;
  --border:          #FFB3CC;
  --text:            #4A2937;
  --text-muted:      #A87687;
  --btn-face:        linear-gradient(#FFFFFF, #FFE4ED);
  --radius:          12px;
  --shadow:          0 2px 10px rgba(255, 111, 171, 0.25);
  --shadow-lg:       0 10px 30px rgba(255, 111, 171, 0.3);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  /* The theme swap should feel like the client repainting, not a page reload. */
  transition: background-color .35s ease, color .35s ease;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img { max-width: 100%; display: block; }

/* Everything that carries a theme colour eases with it. */
.site-nav, .xp-panel, .feature-card, .btn, .download-item, .invite-window,
.honesty-item, .theme-swatch, .spec-row, .site-footer {
  transition: background-color .35s ease, border-color .35s ease,
              color .35s ease, box-shadow .35s ease;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.site-content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 72px 0; }

/* Alternating bands. Without them the page is one flat field and the eye has
   nothing to hold onto between headings. */
.section-alt {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 28px;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-lead {
  color: var(--text-muted);
  max-width: 62ch;
  margin-bottom: 36px;
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  background: linear-gradient(var(--chrome), var(--chrome-dark));
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: #fff;
}
.nav-logo:hover { color: #fff; text-decoration: none; }

.nav-logo-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  opacity: .92;
}
.nav-links a:hover {
  background: rgba(255, 255, 255, .16);
  text-decoration: none;
  opacity: 1;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: 96px 0 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* A soft wash of the accent, so each theme changes the mood of the page and
   not merely its buttons. */
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 50% auto;
  width: 900px;
  height: 900px;
  transform: translateX(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 62%);
  pointer-events: none;
}

.hero > * { position: relative; }

.hero-logo { display: inline-flex; align-items: center; gap: 14px; margin-bottom: 26px; }

.hero-logo-box {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  border-radius: var(--radius);
  background: linear-gradient(var(--accent-light), var(--accent));
  box-shadow: var(--shadow);
}

.hero-logo-text {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.hero-tagline {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 auto 10px;
}

.hero-points {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin: 22px 0 30px;
}

.hero-points li {
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--btn-face);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
}
.btn:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary,
.btn-blue {
  color: #fff;
  background: linear-gradient(var(--accent-light), var(--accent));
  border-color: var(--accent-dark);
}
.btn-primary:hover,
.btn-blue:hover { color: #fff; filter: brightness(1.06); }

.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.xp-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.xp-panel-title {
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(var(--chrome), var(--chrome-dark));
}

.xp-panel-body { padding: 22px; }

/* ── Feature grid ────────────────────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 18px;
}

.feature-card {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.feature-card-icon { font-size: 26px; line-height: 1; margin-bottom: 12px; }
.feature-card-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.feature-card-desc { font-size: 14px; color: var(--text-muted); }

/* ── "What the server can see" table ─────────────────────────────────────── */
.spec-table { border-top: 1px solid var(--border); }

.spec-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.spec-verdict {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.spec-no  { color: #1c7c3f; background: color-mix(in srgb, #1c7c3f 12%, transparent); }
.spec-yes { color: #a8452a; background: color-mix(in srgb, #a8452a 12%, transparent); }
[data-theme="discord"] .spec-no  { color: #5BC98A; }
[data-theme="discord"] .spec-yes { color: #F08A6C; }

/* ── Theme picker ────────────────────────────────────────────────────────── */
.theme-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}

.theme-swatch {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.theme-swatch:hover { transform: translateY(-2px); border-color: var(--accent); }
.theme-swatch[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow);
}

.theme-swatch-name { font-weight: 700; font-size: 14px; }
.theme-swatch-note { font-size: 13px; color: var(--text-muted); }

/* The preview is drawn from the theme's OWN colours, not the active page's,
   so a swatch shows what you are about to get. */
.theme-chips { display: flex; gap: 6px; }
.theme-chip {
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, .18);
}

/* ── Honesty section ─────────────────────────────────────────────────────── */
.honesty-list { display: grid; gap: 12px; }

.honesty-item {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 14px;
}
.honesty-item strong { display: block; margin-bottom: 3px; font-size: 15px; }
.honesty-item span { color: var(--text-muted); }

/* ── Download ────────────────────────────────────────────────────────────── */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.download-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.download-item.coming-soon { opacity: .72; }

.download-item-icon { font-size: 24px; }
.download-item-os { font-weight: 700; font-size: 15px; }
.download-item-meta { font-size: 13px; color: var(--text-muted); }

.download-note {
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-muted);
}

.info-box {
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 14px;
}

/* ── Invite steps (landing page explainer) ───────────────────────────────── */
.invite-steps { display: grid; gap: 14px; }

.invite-step { display: flex; gap: 14px; align-items: flex-start; }

.step-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  border-radius: 999px;
  background: var(--accent);
}

.step-text { font-size: 14px; }

.invite-code-display {
  margin-top: 18px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.invite-code-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.invite-code-value {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  color: var(--accent);
}

/* ── Invite page ─────────────────────────────────────────────────────────── */
.invite-page {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.invite-window {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.invite-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(var(--chrome), var(--chrome-dark));
}
.invite-titlebar-left { display: inline-flex; align-items: center; gap: 8px; }
.invite-titlebar-btn {
  display: grid;
  place-items: center;
  width: 20px;
  height: 18px;
  color: #fff;
  border-radius: 2px;
  background: rgba(255, 255, 255, .18);
}
.invite-titlebar-btn:hover { background: #c0392b; text-decoration: none; }

.invite-body { padding: 26px 22px; text-align: center; }

.invite-header { margin-bottom: 18px; }
.invite-server-icon { font-size: 34px; margin-bottom: 10px; }
.invite-heading { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.invite-subheading { font-size: 14px; color: var(--text-muted); }

.invite-separator {
  height: 1px;
  margin: 18px 0;
  background: var(--border);
}

.invite-actions { display: grid; gap: 10px; justify-items: center; }
.invite-status { margin-top: 12px; font-size: 13px; color: var(--text-muted); }

.invite-invalid { padding: 8px 0; }
.invite-invalid-icon { font-size: 34px; margin-bottom: 10px; }
.invite-invalid-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.invite-invalid-desc { font-size: 14px; color: var(--text-muted); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  padding: 30px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
  list-style: none;
}

/* ── Scroll reveal ───────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ── Motion, honestly ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .feature-card:hover, .theme-swatch:hover { transform: none; }
}

/* ── How it works page ───────────────────────────────────────────────────── */
.hero-compact { padding: 64px 0 40px; }

.sub-title {
  font-size: 19px;
  margin: 44px 0 14px;
}

.panel-gap { margin-top: 18px; }

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

/* The network diagrams are HTML boxes rather than an SVG so the labels stay
   readable on a phone: the row folds into a column instead of shrinking. */
.net-diagram {
  display: flex;
  align-items: center;
  gap: 10px;
}

.net-col { display: grid; gap: 10px; flex: 0 0 auto; }

.net-node {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 120px;
  padding: 12px 14px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.net-node small { font-size: 12px; color: var(--text-muted); }
.net-icon { font-size: 22px; line-height: 1.2; }
.net-node-relay { border: 2px solid var(--accent); }
.net-node-main { border-left: 3px solid var(--accent); }

.net-link {
  flex: 1 1 0;
  min-width: 70px;
  position: relative;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 12px;
}
/* The line, and an arrowhead pointing at whoever is being called. */
.net-link::before {
  content: "";
  position: absolute;
  left: 0;
  right: 8px;
  bottom: 4px;
  border-top: 2px dashed var(--accent);
}
.net-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  border: 5px solid transparent;
  border-left: 8px solid var(--accent);
}
.net-link-back::before { left: 8px; right: 0; }
.net-link-back::after { right: auto; left: 0; border-left: 5px solid transparent; border-right: 8px solid var(--accent); }

.diagram-caption {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

ol.flow-steps { list-style: none; }
.flow-steps .step-text strong { color: var(--text); }
.flow-steps .step-text { color: var(--text-muted); }

/* Envelopes inside envelopes: each layer is indented a little further. */
.layer-stack { display: grid; gap: 10px; }
.layer {
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 14px;
}
.layer p { color: var(--text-muted); margin-top: 4px; }
.layer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}
.layer-head strong { font-size: 15px; }
.layer:nth-child(2) { margin-left: 12px; }
.layer:nth-child(3) { margin-left: 24px; }
.layer:nth-child(n+4) { margin-left: 36px; }

.prose { font-size: 14px; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 12px; }
.prose ul { padding-left: 20px; display: grid; gap: 8px; }
.prose li { color: var(--text-muted); }
.prose li strong { color: var(--text); }

.faq { display: grid; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.faq-item summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 15px;
}
.faq-item summary:hover { color: var(--accent); }
.faq-item p { padding: 0 18px 16px; color: var(--text-muted); }

/* ── The "what happens if" chart ─────────────────────────────────────────── */
/* Without JavaScript the chart can't do anything, so it doesn't appear; the
   same story is told in words directly underneath it. */
.net-sim:not(.sim-ready) { display: none; }

.net-sim {
  --sim-bad:  #c0392b;
  --sim-warn: #c27c0e;
  margin-bottom: 8px;
}
[data-theme="discord"] .net-sim { --sim-bad: #F23F43; --sim-warn: #F0B232; }

.sim-controls { display: grid; gap: 10px; margin-bottom: 18px; }
.sim-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* The label sits on its own line, so when the buttons wrap they wrap under
   each other instead of under the label. */
.sim-group-label {
  width: 100%;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.sim-controls .btn[aria-pressed="true"] {
  background: linear-gradient(var(--accent-light), var(--accent));
  border-color: var(--accent-dark);
  color: #fff;
}

.sim-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.sim-svg { width: 100%; height: auto; display: block; overflow: visible; }

.sim-node rect {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1.5;
  transition: stroke .3s ease, opacity .3s ease;
}
.sim-node text { text-anchor: middle; fill: var(--text); font-family: var(--font); }
.sim-icon { font-size: 17px; }
.sim-label { font-size: 14px; font-weight: 700; }
.sim-node .sim-status { font-size: 12px; fill: var(--text-muted); }
.sim-node { transition: opacity .3s ease; }
.sim-node.sim-off { display: none; }
.sim-node.sim-ok rect { stroke: var(--accent); stroke-width: 2; }
.sim-node.sim-warn rect { stroke: var(--sim-warn); stroke-width: 2.5; }
.sim-node.sim-warn .sim-status { fill: var(--sim-warn); font-weight: 700; }
.sim-node.sim-down rect { stroke: var(--sim-bad); stroke-width: 2.5; stroke-dasharray: 6 4; }
.sim-node.sim-down { opacity: .7; }
.sim-node.sim-down .sim-status { fill: var(--sim-bad); font-weight: 700; }

.sim-link.sim-off { display: none; }
.sim-line {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke .3s ease;
}
/* Traffic moving along a live line: small bright dashes that travel. */
.sim-flow {
  stroke: var(--surface-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 2 12;
  animation: sim-flow 1.1s linear infinite;
}
@keyframes sim-flow { to { stroke-dashoffset: -28; } }
.sim-x { display: none; }
.sim-x circle { fill: var(--sim-bad); }
.sim-x path { stroke: #fff; stroke-width: 2; stroke-linecap: round; }

.sim-down .sim-line { stroke: var(--sim-bad); stroke-dasharray: 6 6; opacity: .75; }
.sim-down .sim-flow { display: none; }
.sim-down .sim-x { display: inline; }
.sim-blocked .sim-line { stroke: var(--sim-warn); stroke-dasharray: 3 6; }
.sim-blocked .sim-flow { display: none; }

.sim-explain {
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  min-height: 250px;
  display: flex;
  flex-direction: column;
}
.sim-counter { font-size: 12px; color: var(--text-muted); min-height: 18px; }
.sim-cause-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-top: 6px;
}
.sim-cause { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.sim-effect { font-size: 14px; flex: 1; }
.sim-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.sim-nav .btn[disabled] { opacity: .45; cursor: default; transform: none; }
.sim-nav .btn[hidden] { display: none; }
.sim-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.sim-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  cursor: pointer;
}
.sim-dot[aria-current="step"] { background: var(--accent); }

.sim-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.sim-legend li { display: inline-flex; align-items: center; gap: 8px; }
.sim-key { display: inline-block; width: 26px; border-top: 3px solid var(--accent); }
.sim-key-blocked { border-top: 3px dashed var(--sim-warn); }
.sim-key-down { border-top: 3px dashed var(--sim-bad); }

/* Three-column variant of the spec table, for side-by-side comparisons. */
.spec-table-3 .spec-row { grid-template-columns: 1.3fr 1fr 1fr; }
.spec-head { font-weight: 700; font-size: 13px; }
.spec-table-3 .spec-verdict { justify-self: start; }

@media (prefers-reduced-motion: reduce) {
  .sim-flow { animation: none; }
}

/* Side by side, the diagram gets too small to read below this width, so the
   explanation moves underneath it. */
@media (max-width: 980px) {
  .sim-stage { grid-template-columns: 1fr; }
  .sim-svg { max-width: 560px; margin: 0 auto; }
  .sim-explain { min-height: 0; }
}

/* ── Small screens ───────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  /* Six links wrapped onto three rows and ate a third of the screen, on a
     sticky bar, forever. One scrollable row keeps every link reachable and
     gives the page its height back. */
  .site-nav { gap: 10px; }
  .nav-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { white-space: nowrap; padding: 6px 9px; font-size: 13px; }
  .nav-logo { flex: 0 0 auto; }

  section { padding: 60px 0; }
  .hero { padding: 64px 0 48px; }
  .hero-logo-text { font-size: 32px; }
  .hero-tagline { font-size: 24px; }
  .site-nav { padding: 10px 16px; }
  .site-content { padding: 0 16px; }
  .nav-links a { padding: 6px 8px; }
  .spec-row { grid-template-columns: 1fr; gap: 6px; }
  .spec-verdict { justify-self: start; }

  /* Diagrams fold into a column; arrows turn to point down (or up, for the
     host calling the relay from below). */
  .net-diagram { flex-direction: column; align-items: stretch; }
  .net-col { grid-template-columns: 1fr 1fr; }
  .net-node { min-width: 0; }
  .net-link { min-height: 44px; padding: 0 0 0 18px; text-align: left; display: flex; align-items: center; }
  .net-link::before { left: 4px; right: auto; top: 0; bottom: 8px; border-top: 0; border-left: 2px dashed var(--accent); }
  .net-link::after { left: 0; right: auto; bottom: 0; border: 5px solid transparent; border-top: 8px solid var(--accent); border-bottom: 0; }
  .net-link-back::before { top: 8px; bottom: 0; }
  .net-link-back::after { top: 0; bottom: auto; border: 5px solid transparent; border-bottom: 8px solid var(--accent); border-top: 0; }
  .layer:nth-child(n) { margin-left: 0; }

  .sim-stage { grid-template-columns: 1fr; }
  /* The diagram scales down to fit a phone, so its text has to start bigger. */
  .sim-label { font-size: 17px; }
  .sim-node .sim-status { font-size: 15px; }
  .sim-icon { font-size: 20px; }
  .sim-explain { min-height: 0; }
  .spec-table-3 .spec-row { grid-template-columns: 1fr 1fr; }
  .spec-table-3 .spec-row > span:first-child { grid-column: 1 / -1; font-weight: 700; }
}
