/* ============================================================
 * sage.css — Heropedia theme, in Stripe's design language.
 *
 * White surfaces, navy headings, slate body text, a blurple accent,
 * pill buttons and soft layered shadows. Inter for text (nearest open
 * match to Söhne), JetBrains Mono for code.
 * ============================================================ */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* ---- Theme tokens ---- */
:root {
  color-scheme: light;
  --panel: #ffffff;
  --bg: #ffffff; --bg2: #f6f9fc; --bg3: #eef2f7;
  --bg-card: #ffffff; --bg-inset: #f6f9fc;
  --border: #e3e8ee; --border-hi: #c1c9d2;
  --text: #425466; --text-hi: #0a2540; --text-mid: #425466;
  /* blurple is only used as text on white (4.70:1); on #f6f9fc it is 4.45:1 */
  --text-dim: #425466; --text-faint: #697386; --text-ghost: #c1c9d2;
  --accent: #635bff; --accent-hi: #0a2540; --accent-lo: #c1c9d2;
  --accent-bg: #635bff14; --accent-on: #ffffff;
  --accent-text: #5249e6;  /* blurple text on tinted surfaces (>= 5.4:1) */
  --green: #15803d; --green-bg: #15803d12;
  --red: #df1b41; --red-bg: #df1b410d;
  --blue: #635bff; --blue-bg: #635bff0d;
  --shadow-lift: 0 13px 27px -5px rgba(50,50,93,.25), 0 8px 16px -8px rgba(0,0,0,.3);
}

/* ---- Base typography ---- */
html { background: var(--bg); }
body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.6;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
  font-variant-emoji: text;  /* symbols render as monochrome glyphs, not colour emoji */
}
h1, h2, h3 { letter-spacing: -0.02em; color: var(--text-hi); }
::selection { background: #635bff33; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
/* links inside running text stay recognisable without colour */
p a, li a, .def-box a {
  text-decoration: underline; text-decoration-color: var(--border-hi);
  text-underline-offset: 3px;
}
p a:hover, li a:hover, .def-box a:hover { text-decoration-color: currentColor; }
code, pre, .mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Page shell ---- */
.page-wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 40px; }
/* The page's first block is a full-bleed masthead that carries the nav. */
.page-wrap-masthead { padding-top: 0; max-width: 1180px; padding-inline: clamp(18px, 4vw, 40px); }

/* ---- Top nav ---- */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; margin-bottom: 8px; gap: 12px; flex-wrap: wrap;
}
.logo-area { display: flex; align-items: center; gap: 14px; }
.logo-mark { display: block; width: 30px; height: 30px; flex: none; }
.logo-title { font-size: 20px; font-weight: 650; color: var(--text-hi); letter-spacing: -0.02em; }
.logo-subtitle { font-size: 12px; color: var(--text-faint); }

.nav-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
}
.btn-accent {
  background: var(--accent); color: var(--accent-on);
  border: none; padding: 7px 16px 7px 18px; font-weight: 600;
  transition: background 0.2s;
}
.btn-accent:hover { background: var(--accent-hi); color: var(--accent-on); text-decoration: none; }
.btn-accent::after { content: "\203A"; display: inline-block; margin-left: 6px; transition: transform 0.15s; }
.btn-accent:hover::after { transform: translateX(2px); }
.btn-ghost {
  background: transparent; color: var(--text-hi);
  border: 0; padding: 7px 14px;
  transition: background 0.2s, color 0.2s;
}
.btn-ghost:hover { background: var(--bg2); color: var(--text-hi); text-decoration: none; }

/* ---- Source badge ---- */
.source-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-faint);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; margin-bottom: 14px;
}
.sync-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); display: inline-block;
}

/* ---- MCP promo strip (homepage) ---- */
.mcp-promo {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: var(--accent-bg); border: 1px solid var(--accent);
  border-radius: 6px; padding: 10px 14px; margin-bottom: 16px;
  font-size: 13px;
}
.mcp-promo-text { color: var(--text-hi); }
.mcp-promo-text strong { color: var(--accent); font-weight: 700; }
.mcp-promo-cta {
  font-size: 12px; font-weight: 600;
  color: var(--accent); text-decoration: none;
  white-space: nowrap;
}
.mcp-promo-cta:hover { text-decoration: underline; }

/* ---- MCP guide page ---- */
.mcp-hero {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 20px 24px; margin-bottom: 24px;
  background: var(--panel);
}
.mcp-hero h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.05; letter-spacing: -0.02em; margin-bottom: 10px; color: var(--text-hi); }
.mcp-hero .lede { color: var(--text-mid); margin-bottom: 12px; font-size: 15px; }
.mcp-hero code.endpoint {
  display: inline-block;
  background: var(--bg3); color: var(--text-hi);
  padding: 6px 10px; border-radius: 4px;
  font-family: "JetBrains Mono", monospace; font-size: 13px;
  border: 1px solid var(--border);
}
.mcp-section { margin-bottom: 28px; }
.mcp-section h2 {
  font-size: 22px; letter-spacing: -0.01em; color: var(--text-hi); margin-bottom: 10px;
  border-bottom: 1px solid var(--border); padding-bottom: 6px;
}
.mcp-section h3 { font-size: 14px; color: var(--text-hi); margin: 14px 0 6px; }
.mcp-section p { color: var(--text); margin-bottom: 10px; }
.mcp-section ul, .mcp-section ol { margin-left: 22px; margin-bottom: 10px; color: var(--text); }
.mcp-section li { margin-bottom: 4px; }
.mcp-section pre {
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 14px; margin-bottom: 12px;
  overflow-x: auto;
  font-family: "JetBrains Mono", monospace; font-size: 12px;
  color: var(--text-hi); line-height: 1.5;
}
.mcp-section pre code { background: none; padding: 0; font-size: inherit; }
.mcp-section code {
  background: var(--bg3); padding: 1px 5px; border-radius: 3px;
  font-family: "JetBrains Mono", monospace; font-size: 12px;
  color: var(--text-hi);
}
.mcp-example {
  border-left: 3px solid var(--accent);
  padding: 8px 14px; margin-bottom: 12px;
  background: var(--bg2);
}
.mcp-example .prompt { color: var(--text-hi); font-style: italic; margin-bottom: 6px; }
.mcp-example .arrow { color: var(--text-faint); font-family: "JetBrains Mono", monospace; }
.mcp-example .result { color: var(--text-mid); font-size: 13px; }
.mcp-downloads {
  display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px;
}
.mcp-download {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border-hi);
  border-radius: 6px; background: var(--bg2);
  color: var(--text-hi); font-size: 13px; font-weight: 600;
  text-decoration: none;
}
.mcp-download:hover { border-color: var(--accent); text-decoration: none; }
.mcp-download .icon { color: var(--accent); }

/* ---- Page title (profession, role, rank, submit, edit) ---- */
.page-title {
  font-size: clamp(26px, 3.4vw, 34px); line-height: 1.15; letter-spacing: -0.025em;
  font-weight: 650; color: var(--text-hi); margin: 0;
}
.page-icon { width: 32px; height: 32px; color: var(--text-hi); }

/* ---- Profession line icons (components/ProfIcon.astro) ---- */
.prof-icon { display: inline-block; flex: none; }
.inline-icon { width: 1.15em; height: 1.15em; vertical-align: -0.22em; margin-right: 1px; }

/* ---- 404 ---- */
.not-found { max-width: 560px; margin: 72px 0 40px; }
.not-found-lede { margin-top: 12px; font-size: 17px; color: var(--text-mid); }
.not-found-acts { display: flex; gap: 10px; margin-top: 26px; }
.not-found-acts .btn { padding: 9px 16px; font-size: 14px; }

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: 13px; margin-bottom: 18px; }
.breadcrumb a { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; color: var(--text-ghost); }
.breadcrumb .cur { color: var(--text-dim); }

/* ---- Section label ---- */
.sec-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: var(--accent); letter-spacing: 0.06em;
  margin-bottom: 14px;
}

/* ---- Stats strip ---- */
.stats {
  display: flex;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.stat-cell {
  flex: 1; padding: 12px 0; text-align: center;
  font-size: 11px; color: var(--text-dim);
  border-right: 1px solid var(--border);
}
.stat-cell:last-child { border-right: none; }
.stat-num {
  color: var(--text-hi); font-weight: 700; font-size: 16px;
  display: block; margin-bottom: 2px;
  font-family: "JetBrains Mono", monospace;
}

/* ---- Search input ---- */
.search { position: relative; margin-bottom: 6px; }
.search input {
  width: 100%; box-sizing: border-box;
  padding: 13px 40px; background: var(--bg-inset);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; outline: none;
  font-family: inherit;
}
.search input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px #635bff29;
}
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 17px; color: var(--text-faint); pointer-events: none;
}
.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; max-height: 360px; overflow-y: auto;
  z-index: 20; padding: 4px 0;
  box-shadow: var(--shadow-lift);
}
.search-dd-section {
  font-size: 10px; font-weight: 700; color: var(--text-faint);
  letter-spacing: 2px; padding: 8px 16px 4px;
}
.search-dd-item {
  display: block; padding: 8px 16px; color: var(--text);
}
.search-dd-item:hover { background: var(--bg3); text-decoration: none; }
.search-dd-title { display: block; color: var(--accent-text); font-size: 13px; }
.search-dd-meta { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ---- Profession grid ---- */
.prof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 10px; margin-bottom: 24px;
}
.prof-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px; cursor: pointer;
  transition: border-color 0.2s;
  color: var(--text);
}
.prof-card:hover, .role-row:hover, .hero-card:hover { border-color: var(--border-hi); box-shadow: var(--shadow-lift); transform: translateY(-1px); text-decoration: none; }
.prof-card, .role-row, .hero-card { border-radius: 8px; transition: border-color 0.2s, box-shadow 0.25s, transform 0.25s; }
.pc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pc-icon { width: 22px; height: 22px; color: var(--accent); }
.pc-count { font-size: 11px; color: var(--text-dim); font-family: "JetBrains Mono", monospace; }
.pc-name { font-size: 15px; font-weight: 600; color: var(--text-hi); margin-bottom: 4px; }
.pc-top-hero { font-size: 11px; color: var(--text-dim); line-height: 1.3; }

/* ---- Role cards (profession page) ---- */
.role-list { display: flex; flex-direction: column; gap: 8px; }
.role-row {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  color: var(--text); cursor: pointer;
  transition: border-color 0.2s;
}
.role-row-main { flex: 1; min-width: 0; }
.role-row-name { font-size: 15px; font-weight: 700; color: var(--text-hi); }
.role-row-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.role-row-meta {
  font-size: 11px; color: var(--text-faint);
  font-family: "JetBrains Mono", monospace;
  text-align: right;
}

/* ---- Hero cards ---- */
.hero-list { display: flex; flex-direction: column; gap: 8px; }
.hero-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 15px 17px;
  display: block; color: var(--text);
  transition: border-color 0.2s;
}
.hero-card:hover { text-decoration: none; }
.hero-card-top { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.avatar {
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: 0.5px;
  font-family: "JetBrains Mono", monospace;
  border: 1px solid;
  flex-shrink: 0;
}
.hero-name { font-size: 15px; font-weight: 700; color: var(--text-hi); line-height: 1.2; }
.hero-role { font-size: 13px; color: var(--text-mid); }
.hero-prof { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.hero-excerpt { font-size: 13px; line-height: 1.6; color: var(--text-mid); margin: 0 0 9px; }
.hero-meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-faint);
}
.hero-path { font-family: "JetBrains Mono", monospace; font-size: 10px; }

/* ---- Star button ---- */
.star-btn {
  background: none; border: 1px solid var(--border);
  color: var(--accent-text); padding: 5px 11px; border-radius: 5px;
  font-size: 12px; font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer; flex-shrink: 0;
}
.star-btn.starred {
  background: var(--accent-bg); border-color: var(--accent);
}
.star-btn.lg {
  font-size: 15px; padding: 9px 16px;
  border-radius: 7px;
}

/* ---- Metric group (star + views + downloads) ---- */
.metric-group {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.metric-chip svg { width: 15px; height: 15px; flex: none; }
.metric-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 9px 12px; border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px; font-weight: 600;
  user-select: none;
}


/* ---- Detail page ---- */
.detail-hero {
  display: flex; align-items: flex-start; gap: 14px;
  margin-bottom: 18px; border-left: 2px solid var(--accent);
  padding-left: 18px; flex-wrap: wrap;
}
.detail-avatar {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
  font-family: "JetBrains Mono", monospace;
  border: 1px solid; flex-shrink: 0;
}
.detail-name { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.1; letter-spacing: -0.015em; font-weight: 700; color: var(--text-hi); margin: 0; }
.detail-role { font-size: 14px; color: var(--text-mid); margin-top: 2px; }
.detail-chips { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chip {
  font-size: 11px; color: var(--text-dim);
  background: var(--bg3); padding: 3px 9px;
  border-radius: 4px; border: 1px solid var(--border);
}

.gh-link-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 14px;
  margin-bottom: 20px; font-size: 12px;
}
.gh-link {
  color: var(--text-hi); font-family: "JetBrains Mono", monospace; font-size: 12px;
}
.gh-link-hint { margin-left: auto; color: var(--text-faint); }

.def-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px;
  margin-bottom: 18px;
}
.def-box p { font-size: 15px; line-height: 1.85; margin-bottom: 12px; }
.def-box p:last-child { margin-bottom: 0; }

.acts { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.btn-primary { background: var(--accent); color: var(--accent-on); border: none; padding: 10px 20px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-secondary { background: #ffffff; color: var(--text-hi); border: 1px solid var(--border); padding: 10px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }

.md-pre {
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px; line-height: 1.7; color: var(--text-dim);
  overflow: auto; white-space: pre-wrap; margin: 0;
}

/* ---- Submit form ---- */
.form-wrap {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 22px;
}
.form-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.form-col { flex: 1; min-width: 180px; }
.form-label {
  display: block; font-size: 10px; font-weight: 700;
  color: var(--text-dim); margin-bottom: 5px;
  letter-spacing: 1px; text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px;
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  font-size: 14px; outline: none; font-family: inherit;
}
.form-textarea { line-height: 1.75; resize: vertical; }
.form-label-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 5px;
}
.form-label-row .form-label { margin-bottom: 0; }
.char-counter {
  font-size: 11px; color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.5px;
}
.char-counter.char-counter-over { color: var(--red); font-weight: 700; }
.author-lock {
  padding: 10px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--green); font-size: 14px;
  font-family: "JetBrains Mono", monospace;
}
.file-preview {
  font-size: 11px; color: var(--text-dim);
  padding: 6px 0 14px;
  margin-bottom: 6px;
  font-family: "JetBrains Mono", monospace;
  border: none; background: none;
  display: flex; align-items: center; gap: 6px;
}
.file-preview::before {
  content: "→";
  color: var(--text-faint);
  font-family: inherit;
}

.err-box {
  color: var(--red); font-size: 13px;
  margin-bottom: 16px; padding: 10px 13px;
  background: var(--red-bg); border-radius: 6px;
  border: 1px solid var(--red);
}
.ok-box {
  color: var(--green); font-size: 13px; font-weight: 600;
  margin-bottom: 16px; padding: 10px 13px;
  background: var(--green-bg); border-radius: 6px;
  border: 1px solid var(--green);
}

/* ---- Footer ---- */
.site-footer {
  text-align: center; padding: 36px 0 10px;
  font-size: 12px; color: var(--text-faint);
  letter-spacing: 0.6px;
}

/* ---- Empty state ---- */
.empty {
  text-align: center; padding: 44px 18px;
  color: var(--text-faint); font-size: 14px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .page-wrap { padding: 18px 12px 32px; }
  .page-wrap-masthead { padding-top: 0; padding-inline: 18px; }
  .stats { flex-wrap: wrap; }
  .stat-cell { flex: 1 1 50%; }
  .nav-right { width: 100%; justify-content: flex-end; }
}

/* ---- Form hint (under role input) ---- */
.form-hint {
  font-size: 11px;
  margin-top: 4px;
  font-family: "JetBrains Mono", monospace;
  min-height: 14px;
}
.form-hint.hint-ok { color: var(--green); }
.form-hint.hint-new { color: var(--accent); }

/* ---- Login page ---- */
.login-wrap {
  max-width: 380px;
  margin: 40px auto;
}
.login-title {
  font-size: 22px; font-weight: 700;
  color: var(--text-hi);
  margin-bottom: 20px;
  text-align: center;
}
.login-providers {
  display: flex; flex-direction: column; gap: 10px;
}
.btn-provider {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text-hi);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-provider:hover { border-color: var(--accent); }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--text-faint);
  font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.login-hint {
  font-size: 13px; color: var(--text-mid); margin-bottom: 12px;
}
.code-inputs {
  display: flex; gap: 8px; justify-content: center;
}
.code-digit {
  width: 44px; height: 52px;
  text-align: center;
  font-size: 22px; font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-hi);
  outline: none;
}
.code-digit:focus { border-color: var(--accent); }
.code-actions {
  display: flex; justify-content: space-between;
  margin-top: 12px;
  font-size: 13px;
}

/* ---------- Rank rows & leaderboards ---------- */
.rank-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  grid-template-rows: auto auto;
  grid-template-areas:
    "num title  metric"
    "num meta   sub";
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease;
}
.rank-row:hover { border-color: var(--border-hi); box-shadow: var(--shadow-lift); text-decoration: none; }
.rank-row .rank-num    { grid-area: num;    font-family: "JetBrains Mono", monospace; color: var(--text-mid); align-self: center; }
.rank-row .rank-title  { grid-area: title;  font-weight: 600; }
.rank-row .rank-meta   { grid-area: meta;   font-size: 12px; color: var(--text-mid); }
.rank-row .rank-metric { grid-area: metric; font-weight: 600; white-space: nowrap; }
.rank-row .rank-metric-sub { grid-area: sub; font-size: 12px; color: var(--text-mid); text-align: right; white-space: nowrap; }

.rank-board { display: flex; flex-direction: column; gap: 6px; margin-bottom: 28px; }
.rank-empty { padding: 24px; text-align: center; color: var(--text-mid); border: 1px dashed var(--border); border-radius: 6px; }

.rank-header-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 32px; margin-bottom: 10px; }
.rank-header-row .sec-label { margin: 0; }
.rank-header-row a { font-size: 12px; color: var(--text-mid); }
.rank-header-row a:hover { color: var(--accent); }

/* ---------- Rank tabs (primary + sub-sort) ---------- */
.rank-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0 8px;
  border-bottom: 1px solid var(--border);
}
.rank-tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 80ms, border-color 80ms;
}
.rank-tab:hover { color: var(--text-hi); text-decoration: none; }
.rank-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.rank-subtoggle { display: flex; gap: 4px; }
.rank-subtab {
  font-size: 12px;
  color: var(--text-mid);
  padding: 2px 8px;
  border-radius: 999px;
}
.rank-subtab:hover { color: var(--text-hi); text-decoration: none; }
.rank-subtab.is-active {
  color: var(--accent-text);
  background: var(--accent-bg);
}

/* Panels with [hidden] collapse cleanly; no transition to avoid jitter. */
.rank-panel[hidden], .rank-sub[hidden] { display: none; }

/* ---------- Danger button modifier ---------- */
.btn-secondary.btn-danger {
  border-color: var(--red, #c97070);
  color: var(--red, #c97070);
}
.btn-secondary.btn-danger:hover {
  background: var(--red, #c97070);
  color: #fff;
}

/* ---------- Author page (/u/[login]) ---------- */
.author-hero-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  grid-template-areas:
    "title role"
    "meta  meta";
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease;
  margin-bottom: 8px;
}
.author-hero-row:hover { border-color: var(--border-hi); box-shadow: var(--shadow-lift); text-decoration: none; }
.author-hero-row .ah-title { grid-area: title; font-weight: 600; }
.author-hero-row .ah-role  { grid-area: role;  color: var(--text-mid); font-style: italic; }
.author-hero-row .ah-meta  { grid-area: meta;  font-size: 12px; color: var(--text-mid); }

/* Author chip becomes a link to /u/[login]; preserve chip look,
 * add hover affordance so users learn it's interactive. */
a.chip:hover { border-color: var(--accent); color: var(--accent-text); }
