/* FISCI - page styles
 *
 * One file, no build step. Colours are tokens on :root, redefined for dark
 * mode twice: under prefers-color-scheme (when the visitor has not chosen)
 * and under [data-theme="dark"] (when they have, via the header toggle).
 * Components use only the tokens.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;

  --bg: #f7f5f0;
  --bg-hero: #f2efe7;
  --surface: #ffffff;
  --surface-2: #f3f1eb;
  --surface-3: #ebe7de;
  --border: #e3ded3;
  --border-strong: #cfc8ba;

  --text: #1b1d21;
  --text-2: #4d5058;
  --muted: #72757d;

  --accent: #1d5f86;
  --accent-hover: #164c6c;
  --accent-contrast: #ffffff;
  --accent-soft: #e3eef5;
  --accent-2: #b0522a;

  --success: #2d7a53;
  --success-soft: #e4f2ea;
  --warn: #9a6512;
  --warn-soft: #fbf0dc;
  --danger: #b43c3c;
  --danger-soft: #fae6e4;

  --graph-edge: rgba(60, 64, 72, 0.18);
  --graph-edge-center: rgba(29, 95, 134, 0.55);
  --graph-label: #1b1d21;
  --graph-label-halo: rgba(247, 245, 240, 0.9);

  --shadow-sm: 0 1px 2px rgba(27, 29, 33, 0.06);
  --shadow: 0 1px 2px rgba(27, 29, 33, 0.05), 0 6px 20px -8px rgba(27, 29, 33, 0.12);
  --shadow-lg: 0 24px 60px -18px rgba(27, 29, 33, 0.35);
  --scrim: rgba(24, 26, 30, 0.55);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --gutter: 16px;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131519;
    --bg-hero: #171a1f;
    --surface: #1b1e24;
    --surface-2: #22262d;
    --surface-3: #2a2f37;
    --border: #2d323a;
    --border-strong: #3d434d;
    --text: #ecebe6;
    --text-2: #b9b8b2;
    --muted: #8d8f95;
    --accent: #72b4dc;
    --accent-hover: #93c6e6;
    --accent-contrast: #0e1a22;
    --accent-soft: rgba(114, 180, 220, 0.14);
    --accent-2: #e59a72;
    --success: #6cc496;
    --success-soft: rgba(108, 196, 150, 0.13);
    --warn: #e2b25c;
    --warn-soft: rgba(226, 178, 92, 0.13);
    --danger: #ef8a84;
    --danger-soft: rgba(239, 138, 132, 0.13);
    --graph-edge: rgba(210, 214, 222, 0.16);
    --graph-edge-center: rgba(114, 180, 220, 0.6);
    --graph-label: #ecebe6;
    --graph-label-halo: rgba(19, 21, 25, 0.9);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -10px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.8);
    --scrim: rgba(5, 6, 8, 0.7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131519;
  --bg-hero: #171a1f;
  --surface: #1b1e24;
  --surface-2: #22262d;
  --surface-3: #2a2f37;
  --border: #2d323a;
  --border-strong: #3d434d;
  --text: #ecebe6;
  --text-2: #b9b8b2;
  --muted: #8d8f95;
  --accent: #72b4dc;
  --accent-hover: #93c6e6;
  --accent-contrast: #0e1a22;
  --accent-soft: rgba(114, 180, 220, 0.14);
  --accent-2: #e59a72;
  --success: #6cc496;
  --success-soft: rgba(108, 196, 150, 0.13);
  --warn: #e2b25c;
  --warn-soft: rgba(226, 178, 92, 0.13);
  --danger: #ef8a84;
  --danger-soft: rgba(239, 138, 132, 0.13);
  --graph-edge: rgba(210, 214, 222, 0.16);
  --graph-edge-center: rgba(114, 180, 220, 0.6);
  --graph-label: #ecebe6;
  --graph-label-halo: rgba(19, 21, 25, 0.9);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, 0.8);
  --scrim: rgba(5, 6, 8, 0.7);
}

@media (min-width: 720px) {
  :root { --gutter: 24px; }
}

/* ------------------------------------------------------------------- base */

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

main { flex: 1 0 auto; outline: none; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; color: var(--text); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

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

::selection { background: var(--accent-soft); }

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted { color: var(--muted); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  transition: top .15s;
}
.skip-link:focus { top: 12px; color: var(--accent-contrast); }

/* ------------------------------------------------------------------ icons */

.icon {
  width: 20px; height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 13px; height: 13px; }

.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-contrast); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }

.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost.muted { color: var(--muted); font-weight: 500; }

.btn-google {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn-google:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { min-height: 34px; padding: 6px 14px; font-size: 14px; }
.btn-lg { min-height: 50px; padding: 12px 24px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--topbar-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand img { display: block; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.brand-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mainnav { display: flex; align-items: center; gap: 4px; }
.mainnav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s, background-color .15s;
}
.mainnav a:hover { color: var(--text); background: var(--surface-2); }
.mainnav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.nav-toggle { display: none; }

/* Account menu */
.account { position: relative; }
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
}
.account-btn:hover { border-color: var(--border-strong); }
.account-initial {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 14px;
  font-weight: 600;
}
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop-in .14s ease-out;
}
.account-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.account-label { font-size: 12px; color: var(--muted); }
.account-email {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-plan:empty { display: none; }
.account-plan {
  align-self: flex-start;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
}
.account-plan.is-none { background: var(--surface-2); color: var(--muted); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 859px) {
  .nav-toggle { display: inline-grid; }
  .brand-tag { display: none; }
  .mainnav {
    position: absolute;
    left: 0; right: 0;
    top: var(--topbar-h);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px var(--gutter) 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
  }
  .mainnav.is-open { display: flex; }
  .mainnav a { padding: 12px 14px; border-radius: var(--radius-sm); }
}

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

.hero {
  position: relative;
  overflow: hidden;
  background: var(--bg-hero);
  border-bottom: 1px solid var(--border);
}

.hero-graph {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, var(--border-strong) 1.2px, transparent 0);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 85% 20%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 80% at 85% 20%, #000 10%, transparent 70%);
  opacity: .8;
}

.hero-inner {
  position: relative;
  padding-block: clamp(48px, 9vw, 104px) clamp(40px, 6vw, 72px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.display {
  max-width: 17em;
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 5.2vw, 3.7rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.display em { font-style: italic; color: var(--accent); font-weight: 500; }

.lede {
  max-width: 38em;
  margin: 20px 0 32px;
  color: var(--text-2);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
}

.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 720px;
  padding: 6px 6px 6px 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.searchbar:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft);
}
.searchbar-icon { color: var(--muted); }
.searchbar input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 17px;
  outline: none;
}
.searchbar input::placeholder { color: var(--muted); }
.searchbar input::-webkit-search-cancel-button { cursor: pointer; }
.searchbar .btn { min-height: 46px; padding-inline: 22px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.chips-label { margin-right: 4px; color: var(--muted); font-size: 14px; }
.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text-2);
  font-size: 14px;
  transition: border-color .15s, color .15s, background-color .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin: 44px 0 0;
}
.hero-stats div { display: flex; flex-direction: column-reverse; }
.hero-stats dt { color: var(--muted); font-size: 13px; }
.hero-stats dd {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .searchbar { padding-left: 14px; }
  .searchbar .btn span { display: none; }
  .searchbar .btn { padding-inline: 14px; }
  .hero-stats { gap: 12px 28px; }
  .hero-stats dd { font-size: 1.3rem; }
}

/* --------------------------------------------------------------- results */

.results-wrap { padding-block: 40px 16px; }

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.results-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
}
.results-sub { margin-top: 4px; font-size: 15px; }

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.segmented button {
  min-width: 38px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.segmented button:hover:not(:disabled) { color: var(--text); }
.segmented button[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.segmented button:disabled { opacity: .45; cursor: not-allowed; }

.results {
  display: grid;
  gap: 12px;
  padding: 0;
  list-style: none;
}
.results[aria-busy="true"] { opacity: .55; transition: opacity .2s; }

.result {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px 18px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
  animation: rise .25s ease-out both;
}
.result:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.avatar {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
}
.avatar { position: relative; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }

.result-main { min-width: 0; }
.result-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}
.result-name h3 { font-size: 1.1rem; font-weight: 650; }
.result-handle { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.result-bio {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 15px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.result-bio.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bio-toggle {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}
.metric strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: start;
}

@media (max-width: 720px) {
  .result { grid-template-columns: auto 1fr; padding: 16px; }
  .result-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    margin-top: 8px;
  }
  .result-actions .btn { flex: 1; }
  .avatar { width: 44px; height: 44px; font-size: 15px; }
}

.result-locked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 70%),
    var(--surface);
}
.result-locked .locked-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
}
.result-locked div { flex: 1 1 260px; }
.result-locked h3 { font-size: 1.05rem; margin-bottom: 4px; }
.result-locked p { color: var(--text-2); font-size: 15px; }

.result-skeleton {
  height: 128px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  border: 1px solid var(--border);
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.results-empty {
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.results-empty h3 { font-family: var(--font-serif); font-size: 1.3rem; margin-bottom: 6px; }

.results-more { display: flex; justify-content: center; margin-top: 20px; }

/* --------------------------------------------------------------- features */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-block: 56px 72px;
}
.feature {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.feature h3 { font-family: var(--font-serif); font-size: 1.2rem; margin-bottom: 8px; }
.feature p { color: var(--text-2); font-size: 15px; }

@media (max-width: 860px) {
  .features { grid-template-columns: 1fr; gap: 12px; padding-block: 40px 56px; }
}

/* ------------------------------------------------------------------ pages */

.page { padding-block: clamp(40px, 6vw, 72px) 80px; }
.page-narrow { max-width: 800px; }

.page-head { margin-bottom: 36px; }
.page-head.centered { text-align: center; max-width: 680px; margin-inline: auto; margin-bottom: 44px; }
.page-head-tight { margin-bottom: 24px; }
.page-title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.page-sub { margin-top: 12px; font-size: 1.08rem; }

.prose { color: var(--text-2); font-size: 16.5px; }
.prose h2 {
  margin: 36px 0 12px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
}
.prose h2:first-child { margin-top: 0; }
.prose p { margin-bottom: 1em; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 1em; }
.prose li { margin-bottom: .35em; }
.prose strong { color: var(--text); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.callout {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 15px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 40px;
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat dt { color: var(--muted); font-size: 13px; }
.stat dd {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) { .stat-grid { grid-template-columns: 1fr 1fr; } }

.creator { padding: 22px; margin: 4px 0 8px; }
.creator-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.creator-name { margin: 0; font-weight: 650; font-size: 1.1rem; }
.link-list { display: grid; gap: 6px; padding: 0; list-style: none; }
.link-list a { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.link-list a:hover { text-decoration: underline; }

/* FAQ */
.faq { display: grid; gap: 10px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  font-weight: 600;
  font-size: 16.5px;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq-body { padding: 0 20px 20px; color: var(--text-2); }
.faq-body p { margin-bottom: .8em; }
.faq-body ul, .faq-body ol { padding-left: 1.3em; margin-bottom: .8em; }
.faq-body li { margin-bottom: .35em; }
.faq-body strong { color: var(--text); }

/* Pricing */
.plans {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: stretch;
}
.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.plan-featured {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}
.plan-trial { background: var(--surface-2); }
.plan-badge {
  position: absolute;
  top: -12px; left: 24px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.plan-name { font-size: 1.05rem; font-weight: 650; }
.plan-price { display: flex; align-items: baseline; gap: 6px; margin: 14px 0 2px; }
.plan-price .amount {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
}
.plan-price .per { color: var(--muted); font-size: 15px; }
.plan-who { color: var(--text-2); font-size: 14px; }
.plan-features {
  display: grid;
  gap: 10px;
  flex: 1;
  margin: 20px 0 24px;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
  font-size: 14.5px;
  color: var(--text-2);
}
.plan-features li {
  position: relative;
  padding-left: 24px;
}
.plan-features li::before {
  content: "";
  position: absolute;
  left: 2px; top: 5px;
  width: 11px; height: 6px;
  border-left: 2px solid var(--success);
  border-bottom: 2px solid var(--success);
  transform: rotate(-45deg);
}
.plan-features strong { color: var(--text); }

@media (max-width: 1020px) { .plans { grid-template-columns: repeat(2, 1fr); gap: 24px 16px; } }
@media (max-width: 600px) { .plans { grid-template-columns: 1fr; } }

.assurances {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.assurance { display: flex; gap: 14px; }
.assurance > .icon { color: var(--accent); margin-top: 2px; }
.assurance h3 { font-size: 1rem; margin-bottom: 4px; }
.assurance p { font-size: 14.5px; }
@media (max-width: 860px) { .assurances { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- notices */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  text-align: left;
}
.notice > .icon { margin-top: 1px; }
.notice h3 { font-size: 1rem; margin-bottom: 4px; }
.notice p { color: var(--text-2); }
.notice-info { background: var(--accent-soft); }
.notice-info > .icon { color: var(--accent); }
.notice-warn { background: var(--warn-soft); }
.notice-warn > .icon { color: var(--warn); }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-success { background: var(--success-soft); }
.notice-success > .icon { color: var(--success); }
.notice-success .btn { margin-top: 10px; }

.notice-preview {
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.notice-preview > .icon { color: var(--accent); margin: 0; }
.notice-preview p { flex: 1 1 280px; color: var(--text); }

/* ---------------------------------------------------------------- network */

.network-page { padding-block: 36px 56px; }

.network-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 20px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-grow { flex: 1 1 280px; min-width: 0; }
.field-range { flex: 0 1 240px; }
.label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
.label output {
  margin-left: auto;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.lock-hint { display: none; color: var(--muted); }
.is-preview .lock-hint { display: inline; }

.combobox { position: relative; }
.combobox-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.combobox input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 38px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.combobox input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.listbox {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.listbox li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.listbox li[aria-selected="true"], .listbox li:hover { background: var(--surface-2); }
.listbox .opt-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.listbox .opt-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listbox .opt-handle { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listbox .opt-empty { color: var(--muted); cursor: default; font-size: 14px; }
.listbox .opt-empty:hover { background: none; }

input[type="range"] {
  width: 100%;
  height: 42px;
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
}
input[type="range"]:disabled { opacity: .45; }

.network-stage {
  position: relative;
  height: clamp(440px, 70vh, 780px);
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--border-strong) 60%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    var(--surface);
}
.network-canvas { position: absolute; inset: 0; }
.network-canvas .vis-network:focus { outline: none; }

/* vis-network's hover tooltip */
div.vis-tooltip {
  max-width: 280px;
  padding: 8px 12px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  white-space: normal !important;
}

.network-empty, .network-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}
.network-empty h2 { font-family: var(--font-serif); font-size: 1.4rem; }
.network-loading {
  flex-direction: row;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text-2);
  font-weight: 500;
  backdrop-filter: blur(2px);
}

.empty-graph { width: 220px; height: 140px; margin-bottom: 8px; }
.empty-graph .edges path { stroke: var(--border-strong); stroke-width: 1.5; fill: none; }
.empty-graph .nodes circle { fill: var(--surface-3); stroke: var(--border-strong); stroke-width: 1.5; }
.empty-graph .nodes .center { fill: var(--accent); stroke: var(--accent-soft); stroke-width: 6; }
.empty-graph .nodes circle { animation: float 4s ease-in-out infinite; }
.empty-graph .nodes circle:nth-child(2n) { animation-delay: -2s; }
@keyframes float { 50% { transform: translateY(-3px); } }

.network-tools {
  position: absolute;
  top: 14px; left: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.network-legend {
  position: absolute;
  left: 14px; bottom: 14px;
  max-width: min(300px, calc(100% - 28px));
  max-height: 45%;
  overflow-y: auto;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
}
.legend-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.network-legend ul { display: grid; gap: 5px; padding: 0; list-style: none; }
.network-legend li { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.network-legend .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.network-legend .count { margin-left: auto; padding-left: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.node-panel {
  position: absolute;
  top: 14px; right: 14px; bottom: 14px;
  width: min(340px, calc(100% - 28px));
  overflow-y: auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.node-panel-close { position: absolute; top: 10px; right: 10px; }
.node-panel .avatar { margin-bottom: 12px; }
.node-panel h2 { font-size: 1.2rem; padding-right: 30px; }
.node-panel .result-handle { display: block; margin-top: 2px; }
.node-panel .result-bio { font-size: 14.5px; }
.node-panel .result-meta { margin-top: 14px; }
.node-panel-actions { display: grid; gap: 8px; margin-top: 18px; }
.node-panel .center-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .network-controls { padding: 16px; }
  .network-controls .btn { width: 100%; }
  .field-range { flex: 1 1 100%; }
  .network-stage { height: 68vh; min-height: 420px; }
  .node-panel {
    top: auto; left: 8px; right: 8px; bottom: 8px;
    width: auto;
    max-height: 62%;
    animation-name: slide-up;
  }
  .network-legend { display: none; }
}
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.network-foot { margin-top: 12px; font-size: 14px; }

/* ------------------------------------------------------------------ modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh var(--gutter);
  overflow-y: auto;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  animation: fade-in .15s ease-out;
}
.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 900px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  outline: none;
  animation: pop-in .18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
}
.modal-title .icon { color: var(--accent); }
.modal-body { display: grid; gap: 20px; padding: 24px; }
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.signin-prompt { display: grid; justify-items: center; gap: 10px; text-align: center; }
.signin-prompt .notice-error { width: 100%; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.modal-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mini-plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.mini-plan-featured { border: 2px solid var(--accent); }
.mini-plan .plan-badge { left: 18px; }
.mini-plan h3 { font-size: 1rem; }
.mini-price { margin: 8px 0 12px; font-family: var(--font-serif); font-size: 1.9rem; font-weight: 600; line-height: 1; }
.mini-price span { font-family: var(--font-sans); font-size: 14px; font-weight: 400; color: var(--muted); }
.mini-plan ul {
  display: grid;
  gap: 6px;
  flex: 1;
  margin-bottom: 16px;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 14px;
}
.mini-plan li::before { content: "\2713"; margin-right: 8px; color: var(--success); font-weight: 700; }
.mini-plan strong { color: var(--text); }

.modal-assurances { display: grid; gap: 6px; color: var(--text-2); font-size: 14px; }
.modal-assurances p { display: flex; align-items: flex-start; gap: 10px; margin: 0; }
.modal-assurances .icon { margin-top: 2px; color: var(--accent); }

.modal-status { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--text-2); }
.modal-status p { margin: 0; }

@media (max-width: 760px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal-dialog { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-plans { grid-template-columns: 1fr; }
  .modal-footer { border-radius: 0; justify-content: stretch; }
  .modal-footer > * { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- paywall */

.paywall {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8vh var(--gutter) 24px;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  animation: fade-in .2s ease-out;
}
.paywall-card {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 36px 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: pop-in .2s ease-out;
}
.paywall-mark {
  display: inline-grid;
  place-items: center;
  width: 56px; height: 56px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}
.paywall-mark .icon { width: 26px; height: 26px; }
.paywall-title {
  margin-bottom: 10px;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
}
.paywall-lede { color: var(--text); font-size: 1.08rem; }
.paywall-card p { color: var(--text-2); }
.paywall-card .notice-error { margin-top: 16px; }
.paywall-actions { display: grid; gap: 8px; margin-top: 24px; }

@media (max-width: 480px) {
  .paywall-card { padding: 28px 20px 16px; }
}

/* ------------------------------------------------------------------ Shiny */

/* Notifications: showNotification() is still the server's toast channel. */
#shiny-notification-panel {
  width: min(380px, calc(100vw - 32px));
  right: 16px; bottom: 16px;
  padding: 0;
  z-index: 80;
}
.shiny-notification {
  position: relative;
  margin-top: 10px;
  padding: 14px 40px 14px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 1;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.45;
}
.shiny-notification-message { border-left-color: var(--success); }
.shiny-notification-warning { border-left-color: var(--warn); background: var(--surface); color: var(--text); }
.shiny-notification-error { border-left-color: var(--danger); background: var(--surface); color: var(--text); }
.shiny-notification-close {
  position: absolute;
  top: 8px; right: 12px;
  color: var(--muted);
  font-size: 20px;
  font-weight: 400;
}
.shiny-notification-close:hover { color: var(--text); }

/* The disconnect overlay: the R session has ended (see CLAUDE.md, "Page
   greys out after a while"). Say so, rather than only greying the page. */
#shiny-disconnected-overlay {
  background: var(--scrim);
  opacity: 1;
  z-index: 90;
}
#shiny-disconnected-overlay::after {
  content: "Connection lost \2014 reload the page to continue.";
  position: fixed;
  left: 50%; top: 40%;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 20px 24px;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

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

.footer {
  margin-top: auto;
  padding-block: 32px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
}
.footer-brand { display: flex; flex-direction: column; gap: 2px; }
.footer-brand .brand-name { font-size: 18px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { color: var(--text-2); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-copy { width: 100%; margin: 0; font-size: 13px; }

/* ----------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .spin, .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}
