/* ============================================================
   CORAL TRIBE — DOCS
   Warm editorial knowledge base. Three-column GitBook shell.
   Brand tokens live in CSS variables; the accent is a single
   swappable value (--accent).
============================================================ */

/* Fonts — Coral Tribe public-site system: Playfair Display (serif titles,
   standing in for the Coral Tribe display face) + Helvetica Neue (body/UI). */
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&display=swap");

/* ---- Design tokens ---------------------------------------- */
:root {
  /* Colour — public-site palette: warm off-white ground, near-black ink.
     Monochrome by design (accent colours belong to the Members Club system). */
  --ink: #111111;          /* headlines / type */
  --ink-warm: #16120E;     /* footer band, dark surfaces, buttons */
  --paper: #F7F6F2;        /* warm off-white page ground */
  --offwhite: #EFEDE6;     /* cards / code / alt surfaces */
  --muted: #6f6a62;        /* labels, secondary text */
  --line: #E4E1D9;         /* hairline borders */

  /* Monochrome — the one dark ink carries CTAs and active states. */
  --accent: #16120E;
  --accent-tint: rgba(17, 17, 17, 0.05);   /* active nav background */

  /* Type — Playfair Display for titles, Helvetica Neue for body and UI. */
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-hand: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Layout */
  --header-h: 60px;
  --measure: 680px;        /* readable content width */
  --radius: 8px;
}

/* ---- Reset ------------------------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* Anchored headings clear the sticky header when jumped to. */
:target { scroll-margin-top: calc(var(--header-h) + 24px); }
[id] { scroll-margin-top: calc(var(--header-h) + 24px); }

/* ============================================================
   PERSISTENT HEADER  (logo · landing links · join CTA)
============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* logo stays centred */
  align-items: center;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header__left { display: flex; align-items: center; gap: 14px; justify-self: start; }
.site-header__right { justify-self: end; }

.site-header__logo { justify-self: center; display: flex; align-items: center; }
.site-header__logo img { height: 20px; width: auto; }

.site-header__navlink {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.site-header__navlink:hover { opacity: 0.55; }

/* Hamburger — only on mobile */
.site-header__burger {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 38px; height: 34px;
  cursor: pointer;
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
}

/* ============================================================
   THREE-COLUMN DOC SHELL
============================================================ */
.doc-shell {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 200px;
  gap: 44px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
  align-items: start;
}

/* ---- Left sidebar — collapsed to a NAVIGATION toggle; the menu
   reveals on hover, and clicking the toggle pins it open. -------- */
.sidebar {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  padding: 40px 0 48px;
  z-index: 40;
}
.sidebar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 2px;
  transition: color 0.15s ease;
}
.sidebar__toggle:hover { color: var(--ink); }
.sidebar__toggle .chev { font-size: 12px; transition: transform 0.2s ease; }
.sidebar.is-open .sidebar__toggle .chev { transform: rotate(90deg); }

/* The menu itself — an overlay panel so content never reflows. */
.sidebar__panel {
  position: absolute;
  top: 32px;
  left: -10px;
  width: 250px;
  max-height: calc(100vh - var(--header-h) - 56px);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 10px;
  box-shadow: 0 12px 36px rgba(17, 17, 17, 0.09);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
.sidebar:hover .sidebar__panel,
.sidebar.is-open .sidebar__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.sidebar__group { margin-bottom: 20px; }
.sidebar__group:last-child { margin-bottom: 0; }
.sidebar__group-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px;
  margin-bottom: 8px;
}
.sidebar__link {
  display: block;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.35;
  color: #5c554a;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--radius);
  transition: color 0.15s ease, background 0.15s ease;
}
.sidebar__link:hover { color: var(--ink); background: rgba(0,0,0,0.03); }
.sidebar__link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-tint);
  font-weight: 600;
}

/* ---- Centre content --------------------------------------- */
.doc-content {
  min-width: 0;
  padding: 44px 0 72px;
}
.doc-article { max-width: var(--measure); }

.doc-eyebrow {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.doc-article h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 4.6vw, 3.1rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin-bottom: 18px;
}

.doc-lead {
  font-size: 1.18rem;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 34px;
}

.doc-article h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
}
.doc-article h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 30px 0 10px;
}

.doc-article p { margin: 0 0 18px; }
.doc-article ul,
.doc-article ol { margin: 0 0 20px; padding-left: 1.3em; }
.doc-article li { margin-bottom: 10px; }
.doc-article li::marker { color: var(--muted); }
.doc-article strong { font-weight: 600; }

.doc-article a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(17, 17, 17, 0.32);
  transition: text-decoration-color 0.2s ease;
}
.doc-article a:hover { text-decoration-color: var(--accent); }
/* Solid buttons inside an article keep their own colours, not link colours. */
.doc-article a.btn-primary { color: var(--paper); text-decoration: none; }
.doc-article a.btn-primary:hover { color: var(--paper); text-decoration: none; }

/* Definition rows (glossary / FAQ) */
.def { margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.def:last-child { border-bottom: none; }
.def__term {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 4px;
}
.def__body { margin: 0; color: #423d34; }

/* ---- Right "on this page" rail ---------------------------- */
.on-this-page {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 52px 0 48px;
  font-family: var(--font-sans);
}
.on-this-page__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.on-this-page a {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 0 5px 12px;
  border-left: 2px solid var(--line);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.on-this-page a:hover { color: var(--ink); }
.on-this-page a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.on-this-page a[data-depth="3"] { padding-left: 24px; font-size: 12.5px; }

/* ============================================================
   STAT BAND  (pages that open with numbers)
============================================================ */
.stat-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
  margin: 0 0 36px;
  max-width: var(--measure);
}
.stat__num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.01em;
}
.stat__label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.3;
}

/* ============================================================
   TABLE  (staking points)
============================================================ */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 24px;
  font-size: 15.5px;
}
.doc-table th,
.doc-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.doc-table thead th {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.doc-table tbody td:last-child { font-family: var(--font-sans); font-weight: 600; }

/* ============================================================
   CALLOUTS
============================================================ */
.callout {
  background: var(--offwhite);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 8px 0 24px;
  font-size: 15.5px;
}

/* Calculator link-out button */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink) !important;
  text-decoration: none !important;
  background: var(--offwhite);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 18px;
  transition: border-color 0.2s ease;
}
.link-btn:hover { border-color: var(--accent); }
.link-btn__arrow { color: var(--accent); }

/* TODO flag — reconciliation notes for Monkey */
.callout--todo {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: #55504a;
}
.callout--todo strong {
  font-family: var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

/* ============================================================
   PREV / NEXT FOOTER
============================================================ */
.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: var(--measure);
  margin-top: 24px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.prev-next__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.prev-next__link:hover { border-color: var(--accent); background: #fff; }
.prev-next__link--next { text-align: right; grid-column: 2; }
.prev-next__dir {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.prev-next__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.2;
}

/* ============================================================
   FOOTER
============================================================ */
/* Black footer — matches the main site (white Georgia links, logo right).
   Sizing mirrors the main .site-footer: links 1.5vw, logo 5.5vw, 8vh 6vw
   padding, clamped so it stays sensible on small screens. */
.doc-footer {
  background: var(--ink-warm);
  margin-top: 72px;
  padding: clamp(48px, 8vh, 88px) clamp(20px, 6vw, 88px);
}
.doc-footer__inner {
  max-width: 1260px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.doc-footer__links {
  display: flex;
  flex-direction: column;
}
.doc-footer__links a {
  font-family: Georgia, "Times New Roman", serif;
  color: #ece9e2;
  text-decoration: none;
  font-size: clamp(15px, 1.5vw, 21px);
  line-height: 1.5;
  letter-spacing: 0.01em;
  transition: opacity 0.3s ease;
}
.doc-footer__links a:hover { opacity: 0.55; }
.doc-footer__logo { width: clamp(52px, 5.5vw, 76px); height: auto; opacity: 0.85; }

/* ============================================================
   HOME HERO  (docs landing — no sidebar)
============================================================ */
.home-main { max-width: 1000px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 40px); }

.hero {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(48px, 10vh, 96px) 0 clamp(32px, 6vh, 56px);
}
.hero__eyebrow {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 34px;
}
.hero__headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.9rem, 8vw, 6rem);
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 0 0 52px;
}
.hero__ctas {
  display: flex;
  align-items: center;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-primary {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink-warm);
  border: 1px solid var(--ink-warm);
  padding: 14px 30px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.btn-primary:hover { opacity: 0.88; }
/* Quiet arrow link that sits beside the primary button */
.hero__link {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.hero__link .arrow { transition: transform 0.18s ease; }
.hero__link:hover .arrow { transform: translateX(4px); }

/* Statement, just above the metrics */
.hero-statement {
  text-align: center;
  padding: clamp(24px, 5vh, 48px) 0 clamp(32px, 6vh, 56px);
}
.hero-statement p {
  font-family: var(--font-sans);
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.4;
  font-weight: 400;
  max-width: 38rem;
  margin: 0 auto;
}

/* Home stat row — three metrics */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.hero-stats .stat { text-align: center; }
.hero-stats .stat__num { font-size: clamp(1.9rem, 5vw, 3rem); }
.hero-stats .stat__label { text-align: center; }

/* What's inside — its own generous section (a screenful of its own) */
.whats-inside {
  padding: clamp(72px, 14vh, 160px) 0 0;
}
.whats-inside__label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-bottom: 44px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 28px 26px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  min-height: 150px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.card__arrow { font-family: var(--font-sans); font-weight: 600; font-size: 14px; color: var(--accent); }

/* Start here button — solid CTA, centred in the space between the cards
   and the footer, with room above it. */
.start-here {
  text-align: center;
  margin-top: clamp(88px, 20vh, 220px);
  margin-bottom: clamp(88px, 20vh, 220px);
}
.start-here__btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink-warm);
  border: 1px solid var(--ink-warm);
  padding: 16px 32px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.start-here__btn:hover { opacity: 0.88; }
.start-here__btn .arrow { transition: transform 0.18s ease; }
.start-here__btn:hover .arrow { transform: translateX(4px); }

/* ============================================================
   RESPONSIVE
============================================================ */

/* Tablet — drop the right rail */
@media (max-width: 1080px) {
  .doc-shell { grid-template-columns: 140px minmax(0, 1fr); gap: 36px; }
  .on-this-page { display: none; }
}

/* Mobile — single column; NAVIGATION toggle opens an inline menu */
@media (max-width: 760px) {
  .doc-shell { display: block; padding-top: 8px; }
  .doc-content { padding-top: 8px; }

  .sidebar {
    position: static;
    padding: 16px 0 0;
    z-index: auto;
  }
  .sidebar__toggle {
    width: 100%;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
  }
  /* Inline accordion on mobile — no hover reveal, tap the toggle. */
  .sidebar__panel {
    position: static;
    width: auto;
    left: auto;
    top: auto;
    margin-top: 8px;
    box-shadow: none;
    transform: none;
    display: none;
  }
  .sidebar:hover .sidebar__panel { display: none; opacity: 0; visibility: hidden; }
  .sidebar.is-open .sidebar__panel {
    display: block;
    opacity: 1;
    visibility: visible;
  }

  .cards { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .prev-next { grid-template-columns: 1fr; }
  .prev-next__link--next { grid-column: 1; text-align: left; }
}

/* ============================================================
   INLINE CODE  (on-chain addresses)
============================================================ */
.doc-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, "Roboto Mono", monospace;
  font-size: 0.85em;
  background: var(--offwhite);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  word-break: break-all;
}

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