/* ============================================================
   Torii Membership System design system — Dense Pacific near-cousin
   Ported from webpowerandlight wpal.css, extended with
   palette × mode axes. Token-driven, no gradients.

   Axes on <html>:
     data-mode    = light | dark     (default: light)
     data-palette = vermillion | teal | indigo  (default: vermillion)

   Contrast floor: muted text clears WCAG AA on the field
   (light: #475569 / #5B6B82; WPAL's #64748B / #94A3B8 fail).
   ============================================================ */

/* ---------- Structural tokens (palette/mode independent) ---------- */
:root {
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: var(--font);
    --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-card: 16px;
    --radius-pill: 999px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    --space-9: 96px;
    --space-10: 128px;

    --wrap: 1280px;
    --wrap-doc: 860px;
    --gap: 12px;
    --header-h: 72px;
}

/* ---------- Mode: field, surfaces, text, hairlines ---------- */
[data-mode="light"] {
    color-scheme: light;

    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-tint: #F1F5F9;
    --text: #1E293B;
    --text-on-ink: #F8FAFC;
    --muted: #475569;        /* ~7.5:1 on field — AA fixed vs WPAL */
    --muted-soft: #5B6B82;   /* ~5.5:1 on field — AA fixed vs WPAL */
    --hairline: #E2E8F0;
    --hairline-strong: #CBD5E1;
    --sel: rgba(15, 23, 42, 0.04);

    /* Slate mono scale (WPAL) */
    --slate-1: #F1F5F9;
    --slate-15: #E2E8F0;
    --slate-2: #CBD5E1;
    --slate-25: #94A3B8;
    --slate-3: #64748B;
    --slate-4: #475569;
    --slate-5: #1E293B;

    /* Code stays dark in both modes (docs convention) */
    --code-bg: #0F172A;
    --code-text: #D6DEEA;
    --code-muted: #7E8EA3;

    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
    --shadow-lift: 0 2px 6px rgba(15, 23, 42, 0.10), 0 16px 36px -10px rgba(15, 23, 42, 0.18);
}

[data-mode="dark"] {
    color-scheme: dark;

    /* Soft-slate, hairline-driven — never navy glow / heavy shadows */
    --bg: #0F172A;
    --surface: #1E293B;
    --surface-tint: #243144;
    --text: #F1F5F9;
    --text-on-ink: #F8FAFC;
    --muted: #B6C2D4;        /* ~8:1 on field */
    --muted-soft: #93A1B7;   /* ~5.5:1 on field */
    --hairline: #2E3B52;
    --hairline-strong: #3D4D68;
    --sel: rgba(241, 245, 249, 0.06);

    --slate-1: #1E293B;
    --slate-15: #243144;
    --slate-2: #2E3B52;
    --slate-25: #64748B;
    --slate-3: #93A1B7;
    --slate-4: #B6C2D4;
    --slate-5: #F1F5F9;

    --code-bg: #0B1220;
    --code-text: #D6DEEA;
    --code-muted: #7E8EA3;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 4px 12px -4px rgba(0, 0, 0, 0.40);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 16px 36px -10px rgba(0, 0, 0, 0.50);
}

/* ---------- Palette: vermillion (default — torii gate) ---------- */
[data-palette="vermillion"] {
    --brand: #C2410C;
    --brand-hover: #9A3412;
    --brand-contrast: #FFFFFF;
    --brand-soft: #FDF0EA;
    --brand-line: #F3C9B5;
    --brand-text: #9A3412;
}

[data-mode="dark"][data-palette="vermillion"] {
    --brand: #FB923C;
    --brand-hover: #FDBA74;
    --brand-contrast: #3B1D0A;
    --brand-soft: rgba(251, 146, 60, 0.12);
    --brand-line: rgba(251, 146, 60, 0.35);
    --brand-text: #FDBA74;
}

/* ---------- Palette: teal (closest WPAL kin) ---------- */
[data-palette="teal"] {
    --brand: #0D9488;
    --brand-hover: #0F766E;
    --brand-contrast: #FFFFFF;
    --brand-soft: #E6F7F4;
    --brand-line: #B2E5DE;
    --brand-text: #0F766E;
}

[data-mode="dark"][data-palette="teal"] {
    --brand: #2DD4BF;
    --brand-hover: #5EEAD4;
    --brand-contrast: #042F2A;
    --brand-soft: rgba(45, 212, 191, 0.12);
    --brand-line: rgba(45, 212, 191, 0.35);
    --brand-text: #5EEAD4;
}

/* ---------- Palette: indigo ---------- */
[data-palette="indigo"] {
    --brand: #4F46E5;
    --brand-hover: #4338CA;
    --brand-contrast: #FFFFFF;
    --brand-soft: #EEF0FE;
    --brand-line: #C7CDF9;
    --brand-text: #4338CA;
}

[data-mode="dark"][data-palette="indigo"] {
    --brand: #818CF8;
    --brand-hover: #A5B4FC;
    --brand-contrast: #1E1B4B;
    --brand-soft: rgba(129, 140, 248, 0.14);
    --brand-line: rgba(129, 140, 248, 0.38);
    --brand-text: #A5B4FC;
}

/* ---------- Severity ramps (callouts; light mode) ---------- */
[data-mode="light"] {
    --sev-tip-a: var(--brand);
    --sev-tip-text: var(--brand-text);
    --sev-tip-soft: var(--brand-soft);
    --sev-tip-line: var(--brand-line);

    --sev-note-a: #0F766E;
    --sev-note-text: #115E59;
    --sev-note-soft: #EBF8F6;
    --sev-note-line: #B9E2DD;

    --sev-warning-a: #B45309;
    --sev-warning-text: #92400E;
    --sev-warning-soft: #FDF6E9;
    --sev-warning-line: #F1DCAE;

    --sev-danger-a: #B91C1C;
    --sev-danger-text: #991B1B;
    --sev-danger-soft: #FDECEC;
    --sev-danger-line: #F5C2C2;
}

/* ---------- Severity ramps (callouts; dark mode) ---------- */
[data-mode="dark"] {
    --sev-tip-a: var(--brand);
    --sev-tip-text: var(--brand-text);
    --sev-tip-soft: var(--brand-soft);
    --sev-tip-line: var(--brand-line);

    --sev-note-a: #2DD4BF;
    --sev-note-text: #5EEAD4;
    --sev-note-soft: rgba(45, 212, 191, 0.10);
    --sev-note-line: rgba(45, 212, 191, 0.35);

    --sev-warning-a: #FBBF24;
    --sev-warning-text: #FCD34D;
    --sev-warning-soft: rgba(251, 191, 36, 0.10);
    --sev-warning-line: rgba(251, 191, 36, 0.35);

    --sev-danger-a: #F87171;
    --sev-danger-text: #FCA5A5;
    --sev-danger-soft: rgba(248, 113, 113, 0.10);
    --sev-danger-line: rgba(248, 113, 113, 0.35);
}

/* ---------- Reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.25s ease, color 0.25s ease;
}

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

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

::selection { background: var(--sel); }

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

/* ============================================================
   Doc shell components
   ============================================================ */

/* ---------- Sticky header (lexicon 123: scroll-padding on html,
   driven from --header-h so they can't drift) ---------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--surface);
	border-bottom: 1px solid var(--hairline);
}

.site-header-inner {
	max-width: var(--wrap);
	margin: 0 auto;
	padding: 0 var(--space-5);
	height: var(--header-h);
	display: flex;
	align-items: center;
	gap: var(--space-5);
}

.brand {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-weight: 800;
	font-size: 16px;
	letter-spacing: -0.01em;
}

.brand-gate {
	width: 18px;
	height: 18px;
	border-radius: 4px;
	background: var(--brand);
}

.top-nav {
	display: flex;
	gap: var(--space-5);
	font-size: 14.5px;
	color: var(--muted);
}

.top-nav a[aria-current="page"] {
	color: var(--text);
	font-weight: 600;
	border-bottom: 2px solid var(--brand);
	padding-bottom: 2px;
}

.header-actions { display: flex; align-items: center; }

/* ---------- Theme switcher (lexicon 18) — sticky, floats over content ---------- */
.theme-switcher {
	position: fixed;
	right: var(--space-4);
	bottom: var(--space-4);
	z-index: 30;
	display: flex;
	gap: 4px;
	padding: 4px;
	background: var(--surface);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-pill);
	box-shadow: var(--shadow-lift);
}

.ts-btn {
	border: none;
	background: transparent;
	color: var(--muted);
	font-size: 12.5px;
	font-weight: 600;
	padding: 4px 12px;
	border-radius: var(--radius-pill);
	line-height: 1.4;
}

.ts-btn[aria-pressed="true"] {
	background: var(--surface);
	color: var(--text);
	box-shadow: var(--shadow-card);
}

.ts-btn.ts-palette { padding: 4px 10px; }

/* ---------- Doc layout: sidebar + main (lexicon 121) ---------- */
.doc-layout {
	max-width: var(--wrap);
	margin: 0 auto;
	padding: var(--space-6) var(--space-5) var(--space-9);
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: var(--space-5);
}

/* Full-bleed pages (404): no sidebar, content centered on the viewport */
.doc-layout.full-bleed {
	grid-template-columns: minmax(0, 1fr);
	max-width: var(--wrap-doc);
}

.doc-side {
	font-size: 14px;
	position: sticky;
	top: calc(var(--header-h) + var(--space-5));
	align-self: start;	max-height: calc(100vh - var(--header-h) - var(--space-6));
	overflow-y: auto;
}

.side-group + .side-group { margin-top: var(--space-5); }

/* ---------- Header search (Fuse.js) ---------- */
.header-search { position: relative; margin-left: auto; }
.doc-search { position: relative; width: 260px; }
.doc-search__icon {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 15px;
	height: 15px;
	color: var(--muted-soft);
	pointer-events: none;
}
.doc-search input[type="search"] {
	width: 100%;
	padding: 7px 10px 7px 32px;
	font: inherit;
	font-size: 13.5px;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--hairline-strong);
	border-radius: var(--radius-sm);
	transition: border-color 0.15s, box-shadow 0.15s, width 0.2s;
	-webkit-appearance: none;
	appearance: none;
}
.doc-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.doc-search input[type="search"]::placeholder { color: var(--muted-soft); }
.doc-search input[type="search"]:focus {
	outline: none;
	border-color: var(--brand);
	box-shadow: 0 0 0 3px var(--brand-soft);
	width: 320px;
}

/* Floating dropdown panel under the header input */
.search-results {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	width: 480px;
	max-width: calc(100vw - 32px);
	background: var(--surface);
	border: 1px solid var(--hairline-strong);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-lift);
	padding: var(--space-2);
	z-index: 60;
}
.search-results[hidden] { display: none; }
.search-loading, .search-empty {
	padding: var(--space-4);
	color: var(--muted-soft);
	font-size: 13px;
	text-align: center;
}
.search-results__inner { max-height: 65vh; overflow-y: auto; }
.search-results__group + .search-results__group { margin-top: var(--space-3); }
.search-results__group h4 {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted-soft);
	margin: 0 0 var(--space-1) var(--space-2);
}
.search-result {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 7px var(--space-2);
	border-radius: var(--radius-sm);
	margin-bottom: 2px;
	text-decoration: none;
	border: 1px solid transparent;
}
.search-result:hover, .search-result--active {
	background: var(--sel);
	border-color: var(--hairline);
}
.search-result--active { border-color: var(--brand-line); }
.search-result__row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pill {
	flex-shrink: 0;
	font-size: 9.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 1.5px 6px;
	border-radius: 99px;
	background: var(--brand-soft);
	border: 1px solid var(--brand-line);
	color: var(--brand-text);
}
.search-result__title {
	color: var(--text);
	font-weight: 600;
	font-size: 13px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.search-result__excerpt {
	color: var(--muted-soft);
	font-size: 11.5px;
	line-height: 1.45;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.search-result mark {
	background: var(--brand-soft);
	color: var(--brand-text);
	padding: 0 2px;
	border-radius: 3px;
	font-weight: 700;
}

.side-heading {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted-soft);
	padding: 0 var(--space-2);
	margin-bottom: var(--space-1);
}

.doc-side a {
	display: block;
	padding: 5px var(--space-2);
	border-radius: 6px;
	color: var(--muted);
}

.doc-side a:hover {
	background: var(--sel);
	color: var(--text);
}

.doc-side a[aria-current="page"] {
	background: var(--brand-soft);
	color: var(--brand-text);
	font-weight: 600;
}

/* ---------- Breadcrumbs (lexicon 117: ol, CSS separators, last not linked) ---------- */
.breadcrumbs {
	font-size: 12.5px;
	color: var(--muted-soft);
	margin-bottom: var(--space-3);
}

.breadcrumbs ol {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.breadcrumbs li + li::before {
	content: '/';
	margin-right: var(--space-2);
	color: var(--hairline-strong);
}

.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs [aria-current="page"] { color: var(--muted); font-weight: 600; }

/* ---------- Doc main ---------- */
.doc-main { min-width: 0; max-width: var(--wrap-doc); }

.doc-title {
	font-size: 32px;
	line-height: 1.2;
	letter-spacing: -0.02em;
	margin: 0 0 var(--space-2);
}

.doc-lede {
	color: var(--muted);
	font-size: 17px;
	margin: 0 0 var(--space-5);
	max-width: 62ch;
}

/* ---------- Footer (lexicon 68, lean variant) ---------- */
.site-footer {
	border-top: 1px solid var(--hairline);
	background: var(--surface);
}

.site-footer-inner {
	max-width: var(--wrap);
	margin: 0 auto;
	padding: var(--space-5);
	display: flex;
	align-items: center;
	gap: var(--space-5);
	font-size: 13.5px;
	color: var(--muted);
}

.foot-brand { font-weight: 700; color: var(--text); }

.site-footer nav { display: flex; gap: var(--space-4); }
.site-footer a:hover { color: var(--text); }

.foot-legal { margin-left: auto; color: var(--muted-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
	.doc-layout {
		grid-template-columns: 1fr;
		padding-top: var(--space-5);
	}
	.doc-side {
		position: static;
		max-height: none;
		overflow: visible;
		border: 1px solid var(--hairline);
		border-radius: var(--radius);
		padding: var(--space-3);
		background: var(--surface);
	}
	.top-nav { display: none; }
	.header-search { margin-left: auto; }
	.doc-search { width: 200px; }
	.doc-search input[type="search"]:focus { width: 200px; }
	.search-results { left: 0; right: auto; width: min(480px, calc(100vw - 32px)); }
}

/* ---------- Callout (decided anatomy; severity = tint+icon+label) ---------- */
.callout {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	border-radius: var(--radius);
	padding: 14px 16px;
	margin: var(--space-4) 0;
}

.callout-body { min-width: 0; }

.callout-chip {
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: var(--radius-sm);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 15px;
	margin-top: 1px;
}

.callout-eyebrow {
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	margin-bottom: 2px;
}

.callout p { margin: 0; font-size: 14px; }

.callout-tip {
	background: var(--sev-tip-soft);
	border: 1px solid var(--sev-tip-line);
}
.callout-tip .callout-chip { background: var(--sev-tip-a); }
.callout-tip .callout-eyebrow { color: var(--sev-tip-text); }

.callout-note {
	background: var(--sev-note-soft);
	border: 1px solid var(--sev-note-line);
}
.callout-note .callout-chip { background: var(--sev-note-a); }
.callout-note .callout-eyebrow { color: var(--sev-note-text); }

.callout-warning {
	background: var(--sev-warning-soft);
	border: 1px solid var(--sev-warning-line);
}
.callout-warning .callout-chip { background: var(--sev-warning-a); }
.callout-warning .callout-eyebrow { color: var(--sev-warning-text); }

.callout-danger {
	background: var(--sev-danger-soft);
	border: 1px solid var(--sev-danger-line);
}
.callout-danger .callout-chip { background: var(--sev-danger-a); }
.callout-danger .callout-eyebrow { color: var(--sev-danger-text); }

/* dark mode chips need dark ink for contrast on bright severity fills */
[data-mode="dark"] .callout-warning .callout-chip,
[data-mode="dark"] .callout-danger .callout-chip { color: #1E293B; }

/* ---------- Icon system (Lucide sprite, currentColor strokes) ---------- */
.icon {
	width: 1em;
	height: 1em;
	display: inline-block;
	vertical-align: -0.125em;
	flex: none;
}

.callout-chip .icon { width: 16px; height: 16px; }

/* ============================================================
   Content patterns (markdown-rendered docs)
   ============================================================ */

.doc-article > * + * { margin-top: var(--space-4); }

.doc-article h2 { font-size: 24px; letter-spacing: -0.01em; margin-top: var(--space-8); }
.doc-article h3 { font-size: 19px; margin-top: var(--space-5); }
.doc-article p, .doc-article li { color: var(--muted); max-width: 72ch; }
/* No-TOC pages (reference hubs): prose fills the column, matching the cards */
.doc-columns:not(.has-toc) .doc-article p,
.doc-columns:not(.has-toc) .doc-article li { max-width: none; }
.doc-article p a, .doc-article li a, .doc-article td a { color: var(--brand-text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--brand-line); text-underline-offset: 3px; }
.doc-article ul, .doc-article ol { padding-left: var(--space-5); }
.doc-article li + li { margin-top: var(--space-2); }
.doc-article code { font-family: var(--font-mono); font-size: 0.875em; background: var(--surface-tint); border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 5px; }
.doc-article pre { background: var(--code-bg); color: var(--code-text); padding: var(--space-4); border-radius: var(--radius); overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; }
.doc-article pre code { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-article pre code { background: none; border: none; padding: 0 0 0 2ch; font-size: inherit; text-indent: -2ch; }

/* ---------- Split hero ---------- */
.split-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	gap: var(--space-7);
	align-items: center;
	padding: var(--space-7) 0 var(--space-6);
}
.split-hero-eyebrow { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: var(--brand-text); margin-bottom: var(--space-2); }
.split-hero-title { font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 var(--space-3); }
.split-hero-lede { color: var(--muted); font-size: 17px; margin: 0 0 var(--space-4); max-width: 56ch; }
.split-hero-aside { min-width: 0; }

.btn-primary {
	display: inline-block;
	background: var(--brand);
	color: var(--brand-contrast);
	font-weight: 600;
	font-size: 14.5px;
	padding: 10px 20px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
}
.btn-primary:hover { background: var(--brand-hover); color: var(--brand-contrast); }

/* ---------- Status pills ----------
   Support level: alpha pairs with warning (amber, earliest), beta with
   note (teal, nearly there). Mode-aware for free.
   Tool tiers: read = note (teal, open), pii = warning (amber, member
   data), write = danger (red, changes data). */
.status-pill {
    display: inline-flex;
    align-items: center;
    flex: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.5;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--sev-note-line);
    background: var(--sev-note-soft);
    color: var(--sev-note-text);
    vertical-align: middle;
}
.status-pill.status-beta {
    border-color: var(--sev-note-line);
    background: var(--sev-note-soft);
    color: var(--sev-note-text);
}
.status-pill.status-alpha {
    border-color: var(--sev-warning-line);
    background: var(--sev-warning-soft);
    color: var(--sev-warning-text);
}
.status-pill.status-read {
    border-color: var(--sev-note-line);
    background: var(--sev-note-soft);
    color: var(--sev-note-text);
}
.status-pill.status-pii {
    border-color: var(--sev-warning-line);
    background: var(--sev-warning-soft);
    color: var(--sev-warning-text);
}
.status-pill.status-write {
    border-color: var(--sev-danger-line);
    background: var(--sev-danger-soft);
    color: var(--sev-danger-text);
}
/* H1 row: smaller pill next to a 32px title */
.doc-title .status-pill { font-size: 11px; margin-left: 10px; }
/* Card titles: pill follows the CRM name */
.card-title .status-pill { margin-left: 8px; }

/* ---------- Cards ---------- */
.cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--space-4);
}
.card {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	background: var(--surface);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	padding: var(--space-5);
	box-shadow: var(--shadow-card);
}
.card:hover { border-color: var(--hairline-strong); box-shadow: var(--shadow-lift); }
.card-title { font-weight: 700; font-size: 15.5px; color: var(--text); }
.card-body { font-size: 14px; color: var(--muted); }
.card-body p { margin: 0; max-width: none; }

/* ---------- Steps ---------- */
.steps ol { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
	counter-increment: step;
	position: relative;
	padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-7) + var(--space-3));
	background: var(--surface);
	border: 1px solid var(--hairline);
	border-radius: var(--radius);
}
.steps li + li { margin-top: calc(var(--space-2) * -1); border-top-left-radius: 0; }
.steps li::before {
	content: counter(step);
	position: absolute;
	left: var(--space-4);
	top: var(--space-3);
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--brand-soft);
	border: 1px solid var(--brand-line);
	color: var(--brand-text);
	font-size: 12.5px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ---------- Video embed ---------- */
.video-embed { margin: 0; }
.video-frame { position: relative; }
.video-embed video {
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: var(--radius);
	border: 1px solid var(--hairline);
	background: #000;
}
.video-embed .video-play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
}
.video-embed .video-play svg {
	width: 72px;
	height: 72px;
	filter: drop-shadow(0 2px 10px rgb(15 23 42 / 0.45));
	transition: transform 150ms ease;
}
.video-embed .video-play:hover svg { transform: scale(1.08); }
.video-embed .video-play:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius); }
.video-embed .video-play.hidden { display: none; }
.video-embed figcaption { font-size: 13px; color: var(--muted-soft); margin-top: var(--space-2); }
@media (prefers-reduced-motion: reduce) {
	.video-embed .video-play svg { transition: none; }
	.video-embed .video-play:hover svg { transform: none; }
}

/* ---------- Attribute table ---------- */
.table-wrap { overflow-x: auto; }
.attr-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.attr-table th, .attr-table td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--hairline); vertical-align: top; }
.attr-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-soft); background: var(--surface-tint); }
.attr-table tr:last-child td { border-bottom: none; }
.attr-table td:first-child { font-family: var(--font-mono); font-size: 13px; color: var(--brand-text); white-space: nowrap; }

/* ---------- Bare markdown tables in doc content ---------- */
.doc-main table:not(.attr-table) { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.doc-main table:not(.attr-table) th, .doc-main table:not(.attr-table) td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--hairline); vertical-align: top; }
.doc-main table:not(.attr-table) th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-soft); background: var(--surface-tint); }
.doc-main table:not(.attr-table) tr:last-child td { border-bottom: none; }

/* Shortcode index: one fixed name column so summaries line up down the page */
.page-shortcodes .doc-main table:not(.attr-table) { table-layout: fixed; }
.page-shortcodes .doc-main table:not(.attr-table) th:first-child,
.page-shortcodes .doc-main table:not(.attr-table) td:first-child { width: 284px; font-family: var(--font-mono); font-size: 13px; color: var(--brand-text); }
@media (max-width: 760px) {
	.page-shortcodes .doc-main table:not(.attr-table) { table-layout: auto; }
	.page-shortcodes .doc-main table:not(.attr-table) th:first-child,
	.page-shortcodes .doc-main table:not(.attr-table) td:first-child { width: auto; }
}

/* MCP tools reference: the stacked per-group tables share one column grid */
.pg-modules-mcp-tools .doc-main table:not(.attr-table) { table-layout: fixed; }
.pg-modules-mcp-tools .doc-main table:not(.attr-table) th:first-child,
.pg-modules-mcp-tools .doc-main table:not(.attr-table) td:first-child { width: 224px; font-family: var(--font-mono); font-size: 13px; color: var(--brand-text); }
.pg-modules-mcp-tools .doc-main table:not(.attr-table) th:nth-child(2),
.pg-modules-mcp-tools .doc-main table:not(.attr-table) td:nth-child(2) { width: 76px; }
/* First column already reads as code; drop the inline-code chip there */
.pg-modules-mcp-tools .doc-main table:not(.attr-table) td:first-child code { background: none; border: none; padding: 0; font-size: inherit; }
@media (max-width: 760px) {
	.pg-modules-mcp-tools .doc-main table:not(.attr-table) { table-layout: auto; }
	.pg-modules-mcp-tools .doc-main table:not(.attr-table) th:first-child,
	.pg-modules-mcp-tools .doc-main table:not(.attr-table) td:first-child,
	.pg-modules-mcp-tools .doc-main table:not(.attr-table) th:nth-child(2),
	.pg-modules-mcp-tools .doc-main table:not(.attr-table) td:nth-child(2) { width: auto; white-space: normal; }
}

/* Wider lean: content column breathes a little more */
:root { --wrap: 1440px; --wrap-doc: 920px; }

@media (max-width: 760px) {
	.split-hero { grid-template-columns: 1fr; padding-top: var(--space-4); }
	.split-hero-title { font-size: 30px; }
}

/* ---------- Doc columns with TOC rail (shortcode pages) ---------- */
.doc-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-7); }
.doc-columns.has-toc { grid-template-columns: minmax(0, 1fr) 220px; align-items: start; gap: var(--space-4); }

.doc-toc {
	position: sticky;
	top: calc(var(--header-h) + var(--space-5));
	max-height: calc(100vh - var(--header-h) - var(--space-6));
	overflow-y: auto;
	font-size: 13px;
	background: var(--surface);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	padding: var(--space-5);
	box-shadow: var(--shadow-card);
}

.toc-title {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted-soft);
	margin-bottom: var(--space-2);
}

.doc-toc ol { list-style: none; margin: 0; padding: 0; }
.doc-toc li { margin: 0; }
.doc-toc a {
	display: block;
	padding: 3px 0;
	color: var(--muted);
	line-height: 1.45;
}
.doc-toc a:hover { color: var(--text); }
.doc-toc li.toc-l3 a { padding-left: var(--space-3); font-size: 12.5px; }
.doc-toc a.toc-active { color: var(--brand-text); font-weight: 600; }

@media (max-width: 1100px) {
	.doc-columns.has-toc { grid-template-columns: 1fr; }
	.doc-toc { display: none; }
}

/* ---------- 404 ---------- */
.err-404 { text-align: center; padding: var(--space-4) var(--space-4) var(--space-8); }
.err-404 .code { font-size: 64px; font-weight: 800; letter-spacing: -0.03em; color: var(--hairline-strong); line-height: 1; }
.err-404 h1 { font-size: 24px; margin: var(--space-3) 0 var(--space-2); }
.err-404 p { color: var(--muted); margin: 0 auto var(--space-4); max-width: 46ch; }

/* ---------- 404 word cloud (painted globe) ---------- */
.wc-cloud {
	position: relative;
	width: min(960px, 100%);
	height: 600px;
	margin: 0 auto;
	perspective: 900px;
}
.wc-sphere {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
}
.wc-word {
	position: absolute;
	top: 50%;
	left: 50%;
	transform-style: flat;
	white-space: nowrap;
	text-decoration: none;
	color: var(--muted);
	font-weight: 600;
	will-change: opacity;
	transition: color 0.15s ease;
}
.wc-word:hover { color: var(--brand); }
.wc-hot { color: var(--brand-text); }
.wc-hint { display: none; }

/* ---------- Code block copy button ---------- */
.doc-article pre { position: relative; }
.copy-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #2E3B52;
	border-radius: 6px;
	background: transparent;
	color: #64748B;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:hover { color: #F1F5F9; border-color: #5B6B82; background: #1E293B; }
.copy-btn.copied { color: #4ADE80; border-color: #4ADE80; }
.copy-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-copy-label {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Section panels (settings-box cousin, lighter touch) ---------- */
.doc-panel {
	background: var(--surface);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	padding: var(--space-6) var(--space-7) var(--space-7);
	box-shadow: var(--shadow-card);
}
.doc-panel + .doc-panel { margin-top: var(--space-3); }
.doc-panel > * + * { margin-top: var(--space-4); }
.doc-panel h2 { margin-top: 0; }
.doc-panel h3 { margin-top: var(--space-5); }
.doc-panel pre { margin-left: 0; margin-right: 0; }
.doc-panel table, .doc-panel .table-wrap { margin-left: 0; margin-right: 0; }
