/* ============================================================================
   components.css — cards, hero, stat band, platform map, side-nav, tabs,
   code blocks, callouts, badges, tables, buttons, assistant, review banner
   ============================================================================ */

/* ---- buttons ---- */
.btn { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); padding: 11px 20px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: var(--fs-300); text-decoration: none;
  border: 1px solid transparent; cursor: pointer; line-height: 1.2;
  transition: transform .12s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--grad-brand); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--paddy) 35%, transparent); }
.btn--primary:hover { color: #fff; transform: translateY(-1px);
  box-shadow: 0 8px 20px -4px color-mix(in srgb, var(--paddy) 45%, transparent); }
.btn--ghost { background: var(--surface); color: var(--paddy); border-color: var(--border); box-shadow: var(--shadow-1); }
.btn--ghost:hover { background: var(--grain-soft); border-color: color-mix(in srgb, var(--grain) 45%, var(--border));
  color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-2); }

/* ---- badges (access status) ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: var(--fs-200); font-weight: 600; line-height: 1.7; white-space: nowrap; }
.badge--public { color: var(--ok-fg); background: var(--ok-bg); }
.badge--review { color: var(--warn-fg); background: var(--warn-bg); }
.badge--coming { color: var(--info-fg); background: var(--info-bg); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---- hero ---- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 420px at 92% -12%, color-mix(in srgb, var(--grain) 20%, transparent), transparent 60%),
    radial-gradient(700px 380px at 6% 18%, color-mix(in srgb, var(--terrace) 14%, transparent), transparent 60%),
    linear-gradient(168deg, color-mix(in srgb, var(--paddy) 15%, var(--paper)) 0%, var(--paper) 55%); }
.hero::after { content: ""; position: absolute; inset: auto 0 -1px 0; height: 3px; background: var(--grad-line); opacity: .55; }
/* Decorative paddy-terrace contours — kept faint and masked out of the text area
   so they never sit behind the headline. */
.hero__contours { position: absolute; inset: 0; pointer-events: none; color: var(--paddy);
  opacity: .18;
  -webkit-mask-image: linear-gradient(100deg, transparent 0 44%, #000 84%);
          mask-image: linear-gradient(100deg, transparent 0 44%, #000 84%); }
.hero__contours path { stroke-dasharray: 1; animation: contourDrift 24s linear infinite; }
.hero__contours path:nth-child(even) { animation-direction: reverse; animation-duration: 30s; }
@keyframes contourDrift { to { stroke-dashoffset: -40; } }
.hero .container { position: relative; padding-block: var(--sp-9); }
.hero .eyebrow { animation: heroRise .6s var(--ease-out) both; }
.hero h1 { max-width: 18ch; margin-bottom: var(--sp-4); animation: heroRise .6s .05s var(--ease-out) both; }
.hero__tag { font-family: var(--font-body); font-size: var(--fs-500); color: var(--body); max-width: 56ch;
  animation: heroRise .6s .12s var(--ease-out) both; }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-6);
  animation: heroRise .6s .2s var(--ease-out) both; }
.hero__stats { margin-top: var(--sp-8); animation: heroRise .6s .28s var(--ease-out) both; }
@keyframes heroRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) { .hero__contours { display: none; } .hero .container { padding-block: var(--sp-8); } }
@media (prefers-reduced-motion: reduce) {
  .hero__contours path { animation: none; }
  .hero .eyebrow, .hero h1, .hero__tag, .hero__cta, .hero__stats { animation: none; }
}

/* ---- stat band ---- */
.statband { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-3); }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--sp-5) var(--sp-4); box-shadow: var(--shadow-1);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease); }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-line);
  opacity: 0; transition: opacity .2s var(--ease); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-2);
  border-color: color-mix(in srgb, var(--paddy) 30%, var(--border)); }
.stat:hover::before { opacity: 1; }
.stat__num { font-family: var(--font-display); font-size: var(--fs-800); font-weight: 600; color: var(--paddy);
  font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.02em; }
.stat__num .accent { color: var(--grain); }
.stat__label { display: block; margin-top: 8px; font-size: var(--fs-200); color: var(--muted); }
@media (max-width: 900px) { .statband { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .statband { grid-template-columns: repeat(2, 1fr); } }

/* ---- cards & router ---- */
.cardgrid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--sp-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-1); text-decoration: none; color: var(--body);
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), border-color .18s var(--ease-out); }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-line);
  transform: scaleX(0); transform-origin: left; transition: transform .28s var(--ease-out); }
a.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-3);
  border-color: color-mix(in srgb, var(--paddy) 38%, var(--border)); }
a.card:hover::before { transform: scaleX(1); }
.card__title { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: var(--fs-500);
  letter-spacing: -.01em; transition: color .18s var(--ease); }
.card p { color: var(--muted); font-size: var(--fs-300); margin-bottom: var(--sp-3); transition: color .18s var(--ease); }
a.card:hover .card__title { color: var(--paddy); }
a.card:hover p { color: var(--body); }
.card__to { margin-top: auto; color: var(--paddy); font-weight: 600; font-size: var(--fs-300);
  display: inline-flex; align-items: center; gap: 4px; transform-origin: left center;
  transition: gap .2s var(--ease), transform .2s var(--ease-out); }
a.card:hover .card__to { gap: 9px; transform: scale(1.08); }

/* ---- router cards (Choose your path) ---- */
.cardgrid--router { grid-template-columns: repeat(3, 1fr); }
.cardgrid--router .card { padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.card__head { display: flex; align-items: center; gap: var(--sp-3); }
.card__head .card__title { margin: 0; }
.card__icon { flex: none; display: inline-grid; place-items: center; width: 48px; height: 48px;
  border-radius: 13px; color: var(--paddy);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--paddy) 16%, var(--surface)), color-mix(in srgb, var(--grain) 16%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--paddy) 20%, var(--border));
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), color .25s var(--ease); }
.card__icon svg { width: 24px; height: 24px; }
a.card:hover .card__icon { transform: translateY(-2px) rotate(-4deg) scale(1.06);
  box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--paddy) 40%, transparent); }
.card__to .card__arrow { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px;
  background: color-mix(in srgb, var(--paddy) 12%, transparent); font-size: 13px; line-height: 1;
  transition: background .2s var(--ease), transform .2s var(--ease-out), color .2s var(--ease); }
a.card:hover .card__arrow { background: var(--paddy); color: #fff; transform: translateX(2px); }
@media (max-width: 920px) { .cardgrid--router { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cardgrid--router { grid-template-columns: 1fr; } }

/* ---- platform map ---- */
.platmap { background:
    radial-gradient(600px 200px at 50% -10%, color-mix(in srgb, var(--paddy) 7%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-6); box-shadow: var(--shadow-1); }
.platmap svg { width: 100%; height: auto; color: var(--border); }
.platmap .node { fill: var(--surface-2); stroke: color-mix(in srgb, var(--paddy) 55%, var(--border)); stroke-width: 1.4; }
.platmap .node:first-of-type { fill: color-mix(in srgb, var(--paddy) 10%, var(--surface)); stroke: var(--paddy); }
.platmap .node-label { fill: var(--ink); font-family: var(--font-body); font-weight: 600; font-size: 13px; }
.platmap .edge { stroke: color-mix(in srgb, var(--terrace) 65%, transparent); fill: none; stroke-width: 1.4; }
.platmap .cap { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }

/* ============================================================================
   Platform-page layout: side-nav | content | TOC
   ============================================================================ */
.platform-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px;
  gap: var(--sp-7); align-items: start; padding-block: var(--sp-6); }
.side-nav { position: sticky; top: calc(var(--header-h) + var(--sp-4)); align-self: start; }
.side-nav__title { font-family: var(--font-display); font-weight: 600; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-3); }
.side-nav nav { display: flex; flex-direction: column; gap: 2px; border-left: 2px solid var(--border); }
.side-nav a { padding: 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted);
  text-decoration: none; font-size: var(--fs-300); }
.side-nav a:hover { color: var(--ink); }
.side-nav a.is-active, .side-nav a[aria-current="true"] { color: var(--paddy); font-weight: 600;
  border-left-color: var(--paddy); }
.toc { position: sticky; top: calc(var(--header-h) + var(--sp-4)); align-self: start; font-size: var(--fs-200); }
.toc h4 { font-family: var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  font-size: var(--fs-200); margin: 0 0 var(--sp-2); }
.toc a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0; }
.toc a:hover, .toc a.is-active { color: var(--paddy); }
.platform-content section { scroll-margin-top: calc(var(--header-h) + 16px); padding-bottom: var(--sp-6); }
.platform-content section + section { border-top: 1px solid var(--border); padding-top: var(--sp-6); }

.breadcrumb { font-size: var(--fs-200); color: var(--muted); padding: var(--sp-3) 0; }
.breadcrumb a { color: var(--muted); }

@media (max-width: 1080px) { .platform-layout { grid-template-columns: 220px minmax(0,1fr); } .toc { display: none; } }
@media (max-width: 760px) {
  .platform-layout { grid-template-columns: 1fr; gap: var(--sp-4); }
  .side-nav { position: static; }
  .side-nav nav { border-left: 0; }
  .side-nav__details summary { cursor: pointer; padding: 10px 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; }
}

/* ---- tabs (curl / Python / R) ---- */
.tabs { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface);
  margin: var(--sp-4) 0; box-shadow: var(--shadow-1); }
.tablist { display: flex; gap: 2px; background: var(--code-bg); border-bottom: 1px solid var(--border); padding: 5px 5px 0; overflow-x: auto; }
.tab { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-300);
  font-weight: 600; padding: 9px 16px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; cursor: pointer; white-space: nowrap;
  transition: color .15s var(--ease), background .15s var(--ease); }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--paddy); box-shadow: inset 0 -2px 0 var(--grain); }
.tabpanel[hidden] { display: none; }

/* ---- code blocks + copy ---- */
.codeblock { position: relative; }
.codeblock pre { margin: 0; padding: var(--sp-5); padding-right: calc(var(--sp-5) + 58px); background: var(--code-bg);
  font-family: var(--font-mono); font-size: var(--fs-300); line-height: 1.6; color: var(--ink);
  tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.codeblock code { font-family: var(--font-mono); }
.copy-btn { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; font-size: var(--fs-200); font-weight: 600; color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; opacity: .85;
  box-shadow: var(--shadow-1); transition: color .15s var(--ease), opacity .15s var(--ease), border-color .15s var(--ease); }
.copy-btn:hover { color: var(--paddy); opacity: 1; border-color: color-mix(in srgb, var(--paddy) 40%, var(--border)); }
:not(.tabs) > .codeblock { margin: var(--sp-4) 0; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-1); }
p code, li code, td code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: .88em; }

/* ---- callouts ---- */
.callout { display: flex; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-radius: var(--radius);
  border: 1px solid var(--border); border-left-width: 4px; background: var(--surface); margin: var(--sp-4) 0;
  box-shadow: var(--shadow-1); }
.callout__body { margin: 0; }
.callout__body :last-child { margin-bottom: 0; }
.callout--note { border-left-color: var(--terrace); background: var(--info-bg); }
.callout--tip  { border-left-color: var(--ok-fg);  background: var(--ok-bg); }
.callout--warn { border-left-color: var(--warn-fg); background: var(--warn-bg); }
.callout__icon { flex: none; width: 20px; height: 20px; margin-top: 2px; }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; margin: var(--sp-4) 0; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-1); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-300); }
table.data th, table.data td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data thead th { position: sticky; top: 0; background: var(--code-bg); color: var(--ink); font-weight: 600; }
table.data tbody tr { transition: background .12s var(--ease); }
table.data tbody tr:nth-child(even) { background: color-mix(in srgb, var(--code-bg) 45%, transparent); }
table.data tbody tr:hover { background: color-mix(in srgb, var(--paddy) 7%, transparent); }

/* ---- review banner ---- */
.review-banner { background: var(--warn-bg); color: var(--warn-fg); border-bottom: 1px solid color-mix(in srgb, var(--warn-fg) 30%, transparent);
  font-size: var(--fs-300); }
.review-banner .container { display: flex; align-items: center; gap: var(--sp-3); padding-block: 8px; }
.review-banner button { margin-left: auto; background: transparent; border: 0; color: inherit; cursor: pointer; font-weight: 700; }

/* ---- assistant launcher + panel ---- */
.assistant-launcher { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: inline-flex;
  align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--grad-brand); color: #fff; font-weight: 600;
  box-shadow: 0 8px 22px -6px color-mix(in srgb, var(--paddy) 55%, transparent); cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.assistant-launcher:hover { transform: translateY(-2px);
  box-shadow: 0 12px 28px -6px color-mix(in srgb, var(--paddy) 65%, transparent); }
.assistant-launcher svg { color: #fff; }
.assistant-panel { position: fixed; right: 20px; bottom: 76px; z-index: 121; width: min(420px, calc(100vw - 40px));
  max-height: min(560px, calc(100vh - 120px)); display: none; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); overflow: hidden; }
.assistant-panel.is-open { display: flex; }
.assistant-panel.is-expanded { width: min(720px, calc(100vw - 32px)); max-height: min(80vh, calc(100vh - 96px)); }
.assistant-panel.is-expanded .assistant-panel__msgs { padding: var(--sp-5); gap: var(--sp-4); }
.assistant-panel.is-expanded .amsg { font-size: var(--fs-400); max-width: 86%; }
.assistant-panel.is-expanded .achip { font-size: var(--fs-300); padding: 7px 13px; }
.assistant-panel .icon-collapse { display: none; }
.assistant-panel.is-expanded .icon-expand { display: none; }
.assistant-panel.is-expanded .icon-collapse { display: inline-block; }
.assistant-panel__head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border); }
.assistant-panel__head .title { font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.assistant-panel__msgs { padding: var(--sp-4); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3); }
.amsg { padding: 10px 12px; border-radius: var(--radius); font-size: var(--fs-300); max-width: 92%;
  line-height: 1.5; overflow-wrap: anywhere; word-break: break-word; }
.amsg--bot { background: var(--code-bg); align-self: flex-start; }
.amsg--user { background: var(--ok-bg); align-self: flex-end; }
.amsg p { margin: 0 0 6px; }
.amsg p:last-child { margin-bottom: 0; }
.amsg code { background: color-mix(in srgb, var(--ink) 9%, transparent); padding: 1px 5px; border-radius: 4px;
  font-family: var(--font-mono); font-size: .85em; overflow-wrap: anywhere; word-break: break-word; }
.amsg pre, .amsg-pre { margin: 8px 0 2px; padding: 9px 11px; background: var(--paper); border: 1px solid var(--border);
  border-radius: 8px; overflow-x: auto; max-width: 100%; }
.amsg pre code, .amsg-pre code { display: block; background: none; padding: 0; white-space: pre;
  font-family: var(--font-mono); font-size: .82em; line-height: 1.5; color: var(--ink); overflow-wrap: normal; word-break: normal; }
.achips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--sp-4) var(--sp-3); }
.achip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 11px;
  font-size: var(--fs-200); color: var(--paddy); cursor: pointer; }
.achip:hover { background: var(--grain-soft); }
.assistant-panel__input { display: flex; gap: 8px; padding: var(--sp-3); border-top: 1px solid var(--border); }
.assistant-panel[data-mode="off"] .assistant-panel__input { display: none; }
.amsg-links { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.amsg .achip { text-decoration: none; }
.amsg--typing { display: inline-flex; gap: 5px; align-items: center; }
.adot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .5; animation: ablink 1s infinite; }
.adot:nth-child(2) { animation-delay: .15s; }
.adot:nth-child(3) { animation-delay: .3s; }
@keyframes ablink { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .adot { animation: none; } }
.assistant-panel__input input { flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; background: var(--paper); color: var(--body); }
.assistant-foot { padding: 8px var(--sp-4); font-size: var(--fs-200); color: var(--muted); border-top: 1px solid var(--border); }
@media (max-width: 760px) { .assistant-launcher { bottom: 14px; right: 14px; } .assistant-panel { bottom: 66px; } }
