/* ==========================================================================
   Frax Finance knowledge base — single stylesheet
   Neutral, content-first, responsive, accessible. No framework, no JS.
   ========================================================================== */

:root {
  --navy: #0b1f3a;
  --navy-700: #12294a;
  --ink: #16202e;
  --body: #2b3646;
  --muted: #5a6678;
  --line: #e2e7ee;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --bg-softer: #eef2f7;
  --accent: #0e7c70;        /* readable teal for links/headings */
  --accent-bright: #39d3c3; /* logo accent */
  --warn-bg: #fff6ed;
  --warn-line: #f0c594;
  --warn-ink: #7a4a12;
  --tip-bg: #eef7f5;
  --tip-line: #aedbd4;
  --info-bg: #eef3fb;
  --info-line: #b9cdec;
  --maxw: 1120px;
  --readw: 720px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 8px 24px rgba(16, 32, 56, .06);
  --focus: #1b6fe0;
  font-size: 16px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

main.container { padding-top: 8px; padding-bottom: 56px; }

/* ---------- Links ---------- */
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

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

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand__mark { display: block; border-radius: 10px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; }
.brand__sub { font-size: .72rem; color: #9fb3cc; text-transform: uppercase; letter-spacing: 1.4px; }

.nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}
.nav__link {
  display: inline-block;
  color: #d7e1ee;
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: .94rem;
  font-weight: 500;
}
.nav__link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav__link.is-active { background: var(--accent-bright); color: var(--navy); font-weight: 600; }

/* ---------- Breadcrumbs ---------- */
.crumbs-wrap { padding-top: 16px; }
.crumbs__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  font-size: .86rem;
  color: var(--muted);
}
.crumbs__item + .crumbs__item::before { content: "›"; margin-right: 6px; color: var(--muted); }
.crumbs__item a { color: var(--muted); }
.crumbs__item[aria-current] { color: var(--ink); font-weight: 600; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.85rem, 1.3rem + 2.2vw, 2.6rem); margin: 18px 0 14px; letter-spacing: -.5px; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.8rem); margin: 2.2em 0 .6em; letter-spacing: -.3px; }
h3 { font-size: 1.22rem; margin: 1.8em 0 .5em; }
h4 { font-size: 1.04rem; margin: 1.5em 0 .4em; color: var(--navy-700); }

p { margin: 0 0 1.05em; }
.prose { max-width: var(--readw); }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose ul li::marker { color: var(--accent); }

.lead { font-size: 1.18rem; color: var(--ink); line-height: 1.6; margin-bottom: 1.4em; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

strong { color: var(--ink); }
abbr { text-decoration: underline dotted; cursor: help; }

code, kbd {
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  font-size: .9em;
  background: var(--bg-softer);
  padding: .12em .4em;
  border-radius: 5px;
}

/* page meta line under h1 */
.page-meta { font-size: .85rem; color: var(--muted); margin: -6px 0 22px; }
.page-meta time { font-weight: 600; color: var(--body); }

/* ---------- Callouts ---------- */
.callout {
  border: 1px solid var(--info-line);
  background: var(--info-bg);
  border-left-width: 5px;
  border-radius: 10px;
  padding: 14px 18px;
  margin: 1.5em 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout__title { font-weight: 700; color: var(--ink); margin: 0 0 .3em; display: flex; align-items: center; gap: 8px; }
.callout.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.callout.warn .callout__title { color: var(--warn-ink); }
.callout.tip { background: var(--tip-bg); border-color: var(--tip-line); }

/* "Live figure" inline marker */
.live {
  display: inline;
  background: #fff8e6;
  border-bottom: 1px dashed #d9b25a;
  padding: 0 2px;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.4em 0; border: 1px solid var(--line); border-radius: 10px; }
table.table { width: 100%; border-collapse: collapse; font-size: .96rem; min-width: 520px; }
table.table caption { text-align: left; color: var(--muted); font-size: .85rem; padding: 10px 14px; }
table.table th, table.table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.table thead th { background: var(--bg-soft); color: var(--ink); font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:nth-child(even) { background: #fafbfd; }

/* ---------- Hero (home) ---------- */
.hero {
  background: linear-gradient(160deg, #0b1f3a 0%, #123a63 70%, #0e5d57 100%);
  color: #eaf1f9;
  border-radius: 18px;
  padding: clamp(28px, 4vw, 52px);
  margin: 22px 0 8px;
  position: relative;
  overflow: hidden;
}
.hero h1 { color: #fff; max-width: 16ch; }
.hero p { color: #cfdcec; max-width: 56ch; font-size: 1.12rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero__art { position: absolute; right: -10px; bottom: -10px; opacity: .85; pointer-events: none; }
@media (max-width: 720px) { .hero__art { display: none; } }

.btn {
  display: inline-block;
  background: var(--accent-bright);
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 10px;
}
.btn:hover { background: #5fe0d2; }
.btn.ghost { background: transparent; color: #eaf1f9; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
.btn.ghost:hover { background: rgba(255, 255, 255, .1); }

/* ---------- Card grid (hub spokes) ---------- */
.card-grid {
  list-style: none;
  margin: 1.4em 0;
  padding: 0;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(16, 32, 56, .12); }
.card a { text-decoration: none; }
.card h3 { margin: 4px 0 6px; font-size: 1.1rem; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--muted); font-size: .95rem; margin: 0; }
.card__kicker { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); font-weight: 700; }

/* ---------- Figures / diagrams ---------- */
figure.figure { margin: 1.8em 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--bg-soft); }
figure.figure svg { display: block; width: 100%; height: auto; }
figure.figure figcaption { margin-top: 12px; font-size: .88rem; color: var(--muted); text-align: center; }

/* ---------- Steps ---------- */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; margin: 1.4em 0; }
ol.steps > li {
  position: relative;
  padding: 0 0 0 52px;
  margin: 0 0 18px;
  min-height: 36px;
}
ol.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 34px; height: 34px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
ol.steps > li h4 { margin: 4px 0 4px; }

/* ---------- Definition list (glossary) ---------- */
.glossary { margin: 1.4em 0; }
.glossary dt { font-weight: 700; color: var(--ink); font-size: 1.06rem; margin-top: 1.1em; scroll-margin-top: 80px; }
.glossary dd { margin: .25em 0 0; color: var(--body); }
.glossary dd a { font-weight: 500; }

/* glossary jump index */
.alpha-index { display: flex; flex-wrap: wrap; gap: 6px; margin: 1em 0 1.6em; padding: 0; list-style: none; }
.alpha-index a { display: inline-block; padding: 4px 9px; border: 1px solid var(--line); border-radius: 7px; text-decoration: none; font-size: .9rem; }

/* ---------- FAQ ---------- */
.faq { margin: 1.4em 0; }
.faq details {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
  background: var(--bg);
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  position: relative;
  padding-right: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--accent);
  line-height: 1;
}
.faq details[open] summary::after { content: "\2013"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .faq__a { padding: 14px 18px 4px; }
.faq .faq__a > :last-child { margin-bottom: 14px; }

/* ---------- Related pages ---------- */
.related { margin: 48px 0 0; padding-top: 28px; border-top: 1px solid var(--line); }
.related__heading { font-size: 1.15rem; margin: 0 0 14px; }
.related__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.related__link { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; text-decoration: none; background: var(--bg); height: 100%; }
.related__link:hover { border-color: var(--accent-bright); background: var(--bg-soft); }
.related__title { display: block; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.related__desc { display: block; font-size: .86rem; color: var(--muted); }

/* ---------- TOC ---------- */
.toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin: 1.6em 0; }
.toc h2 { margin: 0 0 .4em; font-size: 1rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.toc ul { margin: 0; padding-left: 1.1em; }
.toc li { margin: .25em 0; }

/* ---------- Pills / tags ---------- */
.pill { display: inline-block; font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg-softer); color: var(--navy-700); letter-spacing: .3px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 40px 0 20px; }
.notfound .code { font-size: clamp(4rem, 12vw, 8rem); font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -2px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #c7d4e4; margin-top: 56px; padding: 44px 0 28px; }
.footer__top { display: grid; gap: 28px; grid-template-columns: 1.4fr repeat(4, 1fr); }
.footer__brand { max-width: 32ch; }
.footer__logo { font-size: 2rem; color: var(--accent-bright); }
.footer__about { font-size: .9rem; color: #9fb3cc; margin: 8px 0 0; }
.footer__heading { font-size: .82rem; text-transform: uppercase; letter-spacing: 1px; color: #fff; margin: 0 0 12px; }
.footer__list { list-style: none; margin: 0; padding: 0; }
.footer__list li { margin: 7px 0; }
.footer__list a { color: #c7d4e4; text-decoration: none; font-size: .92rem; }
.footer__list a:hover { color: #fff; text-decoration: underline; }
.footer__bottom { border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 32px; padding-top: 20px; }
.footer__note { font-size: .82rem; color: #8ea4be; margin: 0 0 8px; }
.footer__safety { font-size: .82rem; color: #b6e3dc; margin: 0; }

@media (max-width: 900px) {
  .footer__top { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .footer__top { grid-template-columns: 1fr; }
}

/* ---------- Dark mode (respect user preference) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1722;
    --bg-soft: #16202e;
    --bg-softer: #1d2937;
    --ink: #f1f5f9;
    --body: #cbd5e1;
    --muted: #93a4b8;
    --line: #273345;
    --accent: #57c7ba;
    --info-bg: #15212f;
    --info-line: #2c4a6b;
    --tip-bg: #11211f;
    --tip-line: #1f4640;
    --warn-bg: #241a10;
    --warn-line: #5e431f;
    --warn-ink: #e7b675;
  }
  .card, .related__link, .faq details { background: var(--bg-soft); }
  table.table tbody tr:nth-child(even) { background: #131c28; }
  .live { background: #2a2410; border-bottom-color: #6b5a2a; color: #f1e6c4; }
  .notfound .code { color: #cfe0f5; }
}
