/* ═══════════════════════════════════════
   FLAREBUS — protocols.css
   Extends style.css (shared tokens, nav,
   footer, grain, animations already there)
═══════════════════════════════════════ */

/* ── Extra tokens for protocols page ── */
:root {
  --radius:     10px;
  --mono:       'DM Mono', monospace;

  /* Protocol accent dots */
  --dot-kinetic: #60a5fa;
  --dot-morpho:  #a78bfa;
  --dot-enosys:  #4ade80;
  --dot-spectra: #fb923c;
  --dot-dex:     #f472b6;

  /* APY tiers */
  --apy-hi:    #4ade80;   /* reuse --green */
  --apy-mid:   #facc15;
  --apy-lo:    #7a7570;   /* reuse --muted */
  --apy-total: #ffab00;   /* reuse --amber */
}

/* ── Body layout for this page ────────── */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden; /* belt-and-suspenders alongside style.css */
}

/* ── Nav overrides ────────────────────── */
/* style.css uses position:fixed + padding. Re-use as-is;
   just override active link colour */
.nav-links a.active { color: var(--amber); }

/* ── Page header ──────────────────────── */
.page-header {
  padding: 6rem 3rem 0;        /* compensate for fixed nav height */
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  /* prevent header from punching past viewport */
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.page-header::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 700px; height: 200px;
  background: radial-gradient(ellipse at center, rgba(255,96,0,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.sec-label {
  font-size: 0.72rem;
  font-family: var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fire);
  margin-bottom: 0.6rem;
}

.page-header h1 {
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.page-sub {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 1rem;
}

.header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* ── Last updated ─────────────────────── */
.last-updated {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Tab bar ──────────────────────────── */
.tab-bar-wrap {
  max-width: 1280px;
  margin: 1.75rem auto 0;
  width: 100%;
  padding: 0 3rem;
  border-bottom: 1px solid var(--border-s);
  box-sizing: border-box;
  overflow: hidden;
}

.tab-bar {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--fire); }
.tab-btn:focus-visible {
  outline: 2px solid var(--fire);
  outline-offset: -2px;
  border-radius: 4px 4px 0 0;
}

.tab-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-kinetic { background: var(--dot-kinetic); }
.dot-morpho  { background: var(--dot-morpho); }
.dot-enosys  { background: var(--dot-enosys); }
.dot-spectra { background: var(--dot-spectra); }
.dot-dex     { background: var(--dot-dex); }

/* ── Panels ───────────────────────────── */
.panels-wrap {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 2.5rem 3rem 5rem;
  box-sizing: border-box;
  min-width: 0;
}

.panel { display: none; }
.panel.active { display: block; }

/* ── Sub-section label ────────────────── */
.sub-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
  margin-top: 2rem;
}
.sub-label:first-child { margin-top: 0; }

/* ── Data table ───────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-s);
  /* Prevent table from blowing out its containing grid cell */
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.9rem;      /* bigger text */
}

thead tr { background: var(--surface); }

thead th {
  padding: 0.75rem 1.1rem;
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-s);
  /* sortable columns */
  cursor: pointer;
  user-select: none;
  position: relative;
}

thead th[aria-sort] { color: var(--text); }
thead th[aria-sort="ascending"]  { color: var(--amber); }
thead th[aria-sort="descending"] { color: var(--amber); }

/* sort indicator via ::after pseudo */
thead th.sortable::after {
  content: ' ⇅';
  font-size: 0.6rem;
  opacity: 0.4;
  margin-left: 0.3rem;
}
thead th[aria-sort="ascending"]::after  { content: ' ↑'; opacity: 1; color: var(--amber); }
thead th[aria-sort="descending"]::after { content: ' ↓'; opacity: 1; color: var(--amber); }

thead th:focus-visible {
  outline: 2px solid var(--fire);
  outline-offset: -2px;
}

tbody tr {
  border-bottom: 1px solid var(--border-s);
  transition: background 0.12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 0.8rem 1.1rem; white-space: nowrap; font-size: 0.9rem; }

/* ── Cell value classes ───────────────── */
.td-asset  { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.apy-hi    { color: var(--apy-hi);  font-weight: 500; }
.apy-mid   { color: var(--apy-mid); font-weight: 500; }
.apy-lo    { color: var(--apy-lo);  font-weight: 500; }   /* borrow APY — same weight */
.apy-total { color: var(--apy-total); font-weight: 500; } /* total APY — same weight, amber colour */
.td-addr   { color: var(--muted); font-size: 0.8rem; }
.null-val  { color: var(--muted); opacity: 0.3; }

.empty-row td {
  padding: 2.5rem 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

/* ── Loading / error states ───────────── */
.state-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 6rem 2rem;
  border: 1px solid var(--border-s);
  border-radius: var(--radius);
  background: var(--surface);
}

.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border-s);
  border-top-color: var(--fire);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.state-msg {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.state-err { color: var(--red); }

/* ── Footer ───────────────────────────── */
/* style.css has no footer styles for this layout,
   so define them here */
.protocols-footer {
  border-top: 1px solid var(--border-s);
  padding: 1.4rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
  flex-shrink: 0;
}
.protocols-footer a { color: var(--muted); text-decoration: none; }
.protocols-footer a:hover { color: var(--text); }
.protocols-footer a:focus-visible {
  outline: 2px solid var(--fire);
  border-radius: 2px;
}

/* ── Skip-to-content link (a11y) ──────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--fire);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 0 0 6px 6px;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ── Responsive ───────────────────────── */
@media (max-width: 900px) {
  .page-header,
  .tab-bar-wrap,
  .panels-wrap,
  .protocols-footer { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (max-width: 640px) {
  .page-header { padding-top: 5.5rem; }
  .page-header,
  .tab-bar-wrap,
  .panels-wrap,
  .protocols-footer { padding-left: 1rem; padding-right: 1rem; }
  .tab-btn { padding: 0.75rem 0.9rem; font-size: 0.82rem; }
  table { font-size: 0.82rem; }
  tbody td { font-size: 0.82rem; padding: 0.65rem 0.75rem; }
  thead th { padding: 0.6rem 0.75rem; }
}
/* ── DEX Pools + Vaults tab ─────────────────────────────────── */
.dex-dist-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  margin: -0.5rem 0 1rem;
}
.badge-stable,
.badge-type {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.08em 0.4em;
  font-size: 0.63rem;
  font-family: var(--mono);
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}
.badge-stable            { background: rgba(96,165,250,0.15);  color: #60a5fa; }
.badge-type.univ3        { background: rgba(251,146,60,0.15);  color: #fb923c; }
.badge-type.algebra      { background: rgba(244,114,182,0.15); color: #f472b6; }
.badge-type.vault-steer  { background: rgba(52,211,153,0.15);  color: #34d399; }
.badge-type.vault-ichi   { background: rgba(167,139,250,0.15); color: #a78bfa; }