/* ============================================================
   Finzo — Premium Documentation Theme
   Modular CSS architecture
   ============================================================ */

/* ---------- 1. Design Tokens / Variables ---------- */
:root {
    /* Brand */
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;

    /* Slate / Surface */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Semantic */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* Light theme surfaces */
    --bg: #ffffff;
    --bg-soft: #fafbfc;
    --bg-muted: #f5f7fa;
    --bg-elevated: #ffffff;
    --bg-code: #f8fafc;
    --border: #e6e9ef;
    --border-strong: #d4d8e1;
    --text: #1e293b;
    --text-soft: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --link: var(--brand-600);
    --link-hover: var(--brand-700);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-glow: 0 0 0 4px rgba(99, 102, 241, 0.12);

    /* Radius */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --r-2xl: 24px;
    --r-pill: 999px;

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* Typography */
    --font-sans: 'Inter', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Secondary Brand */
    --secondary: #B3ED97;
    --secondary-dark: #4aaa25;
    --secondary-muted: rgba(179, 237, 151, 0.18);

    /* Layout */
    --navbar-h: 64px;
    --sidebar-w: 280px;
    --toc-w: 240px;
    --container-max: none;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --t-fast: 120ms;
    --t-base: 200ms;
    --t-slow: 320ms;
}

/* ---------- 2. Dark Theme ---------- */
[data-theme="dark"] {
    --bg: #0b1020;
    --bg-soft: #0f152a;
    --bg-muted: #131a30;
    --bg-elevated: #161e36;
    --bg-code: #0d1326;
    --border: #1f2742;
    --border-strong: #2a3458;
    --text: #e6ebf5;
    --text-soft: #b8c1d9;
    --text-muted: #8b95b4;
    --text-faint: #6b7494;
    --link: var(--brand-400);
    --link-hover: var(--brand-300);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 0 4px rgba(129, 140, 248, 0.2);
}

/* ---------- 3. Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--navbar-h) + 24px);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    transition: background-color var(--t-base) var(--ease), color var(--t-base) var(--ease);
    overflow-x: hidden;
}

img,
svg {
    display: block;
    max-width: 100%;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: transparent;
    color: inherit;
}

input,
textarea,
select {
    font: inherit;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease);
}

a:hover {
    color: var(--link-hover);
}

::selection {
    background: var(--brand-200);
    color: var(--brand-900);
}

[data-theme="dark"] ::selection {
    background: var(--brand-700);
    color: var(--brand-50);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--r-pill);
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
}

/* ---------- 4. Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.25rem, 4vw, 3rem);
    margin-bottom: var(--space-4);
}

h2 {
    font-size: 2rem;
    margin-top: var(--space-12);
    margin-bottom: var(--space-4);
    padding-top: var(--space-2);
}

h3 {
    font-size: 1.5rem;
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
}

h4 {
    font-size: 1.25rem;
    margin-top: var(--space-6);
    margin-bottom: var(--space-2);
}

p {
    margin-bottom: var(--space-4);
    color: var(--text-soft);
}

.lead {
    font-size: 1.2rem;
    color: var(--text-muted);
    line-height: 1.75;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--bg-muted);
    color: var(--brand-700);
    padding: 0.15em 0.45em;
    border-radius: var(--r-xs);
    border: 1px solid var(--border);
}

[data-theme="dark"] code {
    color: var(--brand-300);
}

pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    font-size: 0.875rem;
}

/* ---------- 5. Top Navbar ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    transition: background-color var(--t-base) var(--ease);
}

[data-theme="dark"] .navbar {
    background: rgba(11, 16, 32, 0.82);
}

.navbar-inner {
    height: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr auto;
    align-items: center;
    gap: var(--space-6);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.0625rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.brand:hover {
    color: var(--text);
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-700) 100%);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-version {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--secondary-dark);
    background: var(--secondary-muted);
    padding: 2px 8px;
    border-radius: var(--r-pill);
    margin-left: var(--space-1);
    border: 1px solid rgba(179, 237, 151, 0.4);
}

[data-theme="dark"] .brand-version {
    background: rgba(179, 237, 151, 0.12);
    color: var(--secondary);
}

.navbar-search {
    max-width: 460px;
    width: 100%;
    justify-self: center;
}

.search-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 8px 12px 8px 14px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: all var(--t-fast) var(--ease);
}

.search-trigger:hover {
    background: var(--bg-elevated);
    border-color: var(--brand-300);
    box-shadow: var(--shadow-sm);
}

.search-trigger .search-text {
    flex: 1;
    text-align: left;
}

.search-trigger kbd {
    font-family: var(--font-sans);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 2px 6px;
    box-shadow: 0 1px 0 var(--border);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    border-radius: var(--r-md);
    transition: all var(--t-fast) var(--ease);
}

.icon-btn:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.version-switch {
    position: relative;
}

.version-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--r-md);
    background: var(--bg-muted);
    color: var(--text-soft);
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--border);
    transition: all var(--t-fast) var(--ease);
}

.version-btn:hover {
    border-color: var(--brand-300);
}

.version-btn svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.version-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: all var(--t-fast) var(--ease);
    z-index: 50;
}

.version-switch.open .version-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.version-menu a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    color: var(--text-soft);
}

.version-menu a:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.version-menu a.current {
    color: var(--brand-600);
    font-weight: 600;
}

.version-menu .badge-mini {
    font-size: 0.625rem;
    background: var(--color-success);
    color: white;
    padding: 1px 6px;
    border-radius: var(--r-pill);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--r-md);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    transition: all var(--t-fast) var(--ease);
    white-space: nowrap;
}

.btn-primary {
    background: #B3ED97;
    color: #142D25;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: #9de07d;
    color: #142D25;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-ghost {
    color: var(--text-soft);
    border: 1px solid var(--border);
    background: var(--bg);
}

.btn-ghost:hover {
    border-color: var(--border-strong);
    background: var(--bg-muted);
}

.mobile-toggle {
    display: none;
}

/* ---------- 6. Layout ---------- */
.docs-layout {
    max-width: var(--container-max);
    margin: 0 auto;
    padding-top: var(--navbar-h);
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
    gap: var(--space-10);
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

/* ---------- 7. Left Sidebar ---------- */
.sidebar {
    position: sticky;
    top: var(--navbar-h);
    align-self: start;
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    padding: var(--space-6) var(--space-2) var(--space-10) 0;
    scrollbar-width: thin;
}

.sidebar-search {
    margin-bottom: var(--space-5);
    position: relative;
}

.sidebar-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 0.8125rem;
    color: var(--text);
    outline: none;
    transition: all var(--t-fast) var(--ease);
}

.sidebar-search input:focus {
    border-color: var(--brand-400);
    box-shadow: var(--shadow-glow);
    background: var(--bg);
}

.sidebar-search svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-faint);
}

.nav-section {
    margin-bottom: var(--space-5);
}

.nav-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 10px;
    font-size: 14px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: left;
}

.nav-section-title:hover {
    color: var(--text);
    background: var(--bg-muted);
}

.nav-title-left {
    display: flex;
    align-items: center;
    gap: 9px;
}

.nav-section-title .chev {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.45;
    transition: transform 0.25s ease;
}

.nav-section-title[aria-expanded="true"] .chev {
    transform: rotate(180deg);
    opacity: 0.7;
}

.nav-section-title.collapsed .chev {
    transform: rotate(0deg);
}

/* Bootstrap collapse integration */
.collapse:not(.show) {
    display: none;
}

.nav-list {
    margin-top: 2px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 0 8px 38px;
}

.nav-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.4;
    border-left: 2px solid transparent;
    margin-left: -2px;
}

.nav-list a:hover {
    color: var(--text);
    background: var(--bg-muted);
}

.nav-list a.active {
    color: var(--secondary-dark);
    background: var(--secondary-muted);
    font-weight: 600;
    border-left-color: var(--secondary-dark);
}

[data-theme="dark"] .nav-list a.active {
    color: var(--secondary);
    background: rgba(179, 237, 151, 0.1);
}

.nav-list .badge {
    margin-left: auto;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--r-pill);
    background: var(--bg-muted);
    color: var(--text-muted);
}

.nav-list .badge.new {
    background: var(--color-success);
    color: white;
}

.nav-list .badge.beta {
    background: var(--color-warning);
    color: white;
}

.nav-list .badge.pro {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: white;
}

/* Sub-nav */
.nav-list.sub {
    margin-left: 12px;
    border-left: 1px solid var(--border);
    padding-left: 6px;
}

.nav-list.sub a {
    font-size: 0.8125rem;
    padding: 5px 10px;
}

/* ---------- 8. Main Content ---------- */
.content {
    padding: var(--space-10) 0 var(--space-20);
    min-width: 0;
    /* fix grid overflow */
}

.content>* {
    animation: fadeUp 0.5s var(--ease) backwards;
}

.content>*:nth-child(2) {
    animation-delay: 60ms;
}

.content>*:nth-child(3) {
    animation-delay: 120ms;
}

.content>*:nth-child(4) {
    animation-delay: 180ms;
}

.content>*:nth-child(5) {
    animation-delay: 240ms;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-5);
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--brand-600);
}

.breadcrumb .sep {
    opacity: 0.5;
}

.page-header {
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-8);
}

.page-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.page-meta .dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-faint);
}

/* ---------- 9. Hero ---------- */
.hero {
    position: relative;
    padding: var(--space-12) var(--space-10);
    background:
        radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.12), transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(168, 85, 247, 0.10), transparent 50%),
        linear-gradient(180deg, var(--bg-soft), var(--bg));
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    margin-bottom: var(--space-10);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--secondary-dark);
    background: var(--secondary-muted);
    padding: 6px 12px;
    border-radius: var(--r-pill);
    border: 1px solid rgba(179, 237, 151, 0.45);
    margin-bottom: var(--space-4);
    position: relative;
}

[data-theme="dark"] .hero-eyebrow {
    background: rgba(179, 237, 151, 0.1);
    border-color: rgba(179, 237, 151, 0.2);
    color: var(--secondary);
}

.hero h1 {
    background: linear-gradient(180deg, var(--text) 0%, var(--text-soft) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.hero p {
    font-size: 1.0625rem;
    max-width: 640px;
    position: relative;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-6);
    position: relative;
}

.hero-row {
    display: flex;
    align-items: center;
    position: relative;
}

.hero-col-text {
    flex: 0 0 66.6667%;
    max-width: 66.6667%;
    min-width: 0;
    padding-right: 30px;
}

.hero-col-img {
    flex: 0 0 33.3333%;
    max-width: 33.3333%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-col-img img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

/* ---------- 10. Cards ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    margin: var(--space-6) 0 var(--space-8);
}

.card-grid.col-2 {
    grid-template-columns: repeat(2, 1fr);
}

.card-grid.col-4 {
    grid-template-columns: repeat(4, 1fr);
}

.card {
    position: relative;
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: all var(--t-base) var(--ease);
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(99, 102, 241, 0.05) 100%);
    opacity: 0;
    transition: opacity var(--t-base) var(--ease);
    pointer-events: none;
}

.card:hover {
    border-color: var(--brand-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card:hover::before {
    opacity: 1;
}

.card-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--r-md);
    background: var(--brand-50);
    color: var(--brand-600);
    margin-bottom: var(--space-3);
}

[data-theme="dark"] .card-icon {
    background: rgba(99, 102, 241, 0.12);
    color: var(--brand-300);
}

.card-icon.green {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
}

.card-icon.amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-warning);
}

.card-icon.pink {
    background: rgba(236, 72, 153, 0.12);
    color: #ec4899;
}

.card-icon.cyan {
    background: rgba(6, 182, 212, 0.12);
    color: #06b6d4;
}

.card-icon.violet {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
}

.card-icon svg {
    width: 20px;
    height: 20px;
}

.card h3 {
    font-size: 1.1rem;
    margin: 0 0 8px;
}

.card p {
    font-size: 0.9375rem;
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.card img {
    width: 100%;
    height: auto;
    border-radius: var(--r-sm);
    display: block;
    margin-top: var(--space-3);
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: var(--space-3);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--brand-600);
}

.card-link svg {
    width: 12px;
    height: 12px;
    transition: transform var(--t-fast) var(--ease);
}

.card:hover .card-link svg {
    transform: translateX(3px);
}

/* ---------- 11. Code Blocks ---------- */
.code-block {
    position: relative;
    margin: var(--space-5) 0;
    background: #0f172a;
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid #1e293b;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px 8px 16px;
    background: #0a1020;
    border-bottom: 1px solid #1e293b;
}

.code-lang {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: lowercase;
    letter-spacing: 0.04em;
}

.code-dots {
    display: flex;
    gap: 6px;
}

.code-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.code-dots span:nth-child(1) {
    background: #ff5f57;
}

.code-dots span:nth-child(2) {
    background: #ffbd2e;
}

.code-dots span:nth-child(3) {
    background: #28c940;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: var(--r-xs);
    transition: all var(--t-fast) var(--ease);
}

.copy-btn:hover {
    color: white;
    background: rgba(148, 163, 184, 0.18);
}

.copy-btn.copied {
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.copy-btn svg {
    width: 12px;
    height: 12px;
}

.code-block pre {
    margin: 0;
    padding: 16px 18px;
    overflow-x: auto;
    background: transparent !important;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    color: #e2e8f0;
}

.code-block pre::-webkit-scrollbar {
    height: 6px;
}

.code-block pre::-webkit-scrollbar-thumb {
    background: #334155;
    border: none;
}

/* Override Prism theme */
code[class*="language-"],
pre[class*="language-"] {
    color: #e2e8f0;
    background: transparent;
    text-shadow: none;
    font-family: var(--font-mono);
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #64748b;
    font-style: italic;
}

.token.punctuation {
    color: #94a3b8;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
    color: #f472b6;
}

.token.boolean,
.token.number {
    color: #fbbf24;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #86efac;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #67e8f9;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #c084fc;
}

.token.function,
.token.class-name {
    color: #60a5fa;
}

.token.regex,
.token.important,
.token.variable {
    color: #fcd34d;
}

/* ---------- 12. Alerts / Callouts ---------- */
.callout {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    margin: var(--space-5) 0;
    border-radius: var(--r-md);
    border-left: 3px solid;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-left-width: 3px;
}

.callout-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    margin-top: 2px;
}

.callout-icon svg {
    width: 14px;
    height: 14px;
}

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

.callout-title {
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 2px;
    color: var(--text);
}

.callout-body p {
    font-size: 0.875rem;
    margin: 0;
    color: var(--text-soft);
}

.callout-body p+p {
    margin-top: 6px;
}

.callout.info {
    border-left-color: var(--color-info);
    background: rgba(59, 130, 246, 0.05);
}

.callout.info .callout-icon {
    background: var(--color-info);
    color: white;
}

.callout.success {
    border-left-color: var(--color-success);
    background: rgba(16, 185, 129, 0.05);
}

.callout.success .callout-icon {
    background: var(--color-success);
    color: white;
}

.callout.warning {
    border-left-color: var(--color-warning);
    background: rgba(245, 158, 11, 0.05);
}

.callout.warning .callout-icon {
    background: var(--color-warning);
    color: white;
}

.callout.danger {
    border-left-color: var(--color-danger);
    background: rgba(239, 68, 68, 0.05);
}

.callout.danger .callout-icon {
    background: var(--color-danger);
    color: white;
}

.callout.tip {
    border-left-color: var(--brand-500);
    background: rgba(99, 102, 241, 0.05);
}

.callout.tip .callout-icon {
    background: var(--brand-500);
    color: white;
}

/* ---------- 13. Tables ---------- */
.table-wrap {
    margin: var(--space-5) 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: var(--bg-muted);
}

th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text);
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 14px;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-soft);
}

td code {
    font-size: 0.8125rem;
}

/* ---------- 14. Tabs ---------- */
.tabs {
    margin: var(--space-5) 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--bg-elevated);
}

.tab-list {
    display: flex;
    gap: 2px;
    padding: 4px;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    padding: 8px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: var(--r-sm);
    transition: all var(--t-fast) var(--ease);
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--text);
    background: var(--bg);
    box-shadow: var(--shadow-xs);
}

.tab-panel {
    padding: var(--space-5);
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.2s var(--ease);
}

.tab-panel>*:first-child {
    margin-top: 0;
}

.tab-panel>*:last-child {
    margin-bottom: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---------- 15. Accordion ---------- */
.accordion {
    margin: var(--space-5) 0;
}

.accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    margin-bottom: var(--space-2);
    overflow: hidden;
    transition: border-color var(--t-fast) var(--ease);
}

.accordion-item.open {
    border-color: var(--brand-300);
}

.accordion-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
}

.accordion-trigger:hover {
    background: var(--bg-soft);
}

.accordion-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    border-radius: 50%;
    transition: all var(--t-base) var(--ease);
}

.accordion-icon svg {
    width: 14px;
    height: 14px;
    transition: transform var(--t-base) var(--ease);
}

.accordion-item.open .accordion-icon {
    background: var(--brand-50);
    color: var(--brand-600);
}

.accordion-item.open .accordion-icon svg {
    transform: rotate(45deg);
}

[data-theme="dark"] .accordion-item.open .accordion-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--brand-300);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--t-slow) var(--ease);
}

.accordion-item.open .accordion-content {
    max-height: 800px;
}

.accordion-body {
    padding: 0 var(--space-5) var(--space-5);
    color: var(--text-soft);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.accordion-body>*:first-child {
    margin-top: 0;
}

/* ---------- 16. API Endpoint Block ---------- */
.endpoint {
    margin: var(--space-6) 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}

.endpoint-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border);
}

.method {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--r-xs);
    color: white;
    letter-spacing: 0.04em;
}

.method.get {
    background: #10b981;
}

.method.post {
    background: #3b82f6;
}

.method.put {
    background: #f59e0b;
}

.method.patch {
    background: #8b5cf6;
}

.method.delete {
    background: #ef4444;
}

.endpoint-path {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.endpoint-auth {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 3px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
}

.endpoint-body {
    padding: var(--space-5);
    background: var(--bg-elevated);
}

.endpoint-body p {
    font-size: 0.875rem;
}

.endpoint-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: var(--space-4) 0 var(--space-2);
}

.endpoint-body .table-wrap {
    margin-top: 0;
}

/* ---------- 17. Right TOC Sidebar ---------- */
.toc {
    position: sticky;
    top: var(--navbar-h);
    align-self: start;
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    padding: var(--space-10) 0;
}

.toc-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    padding-left: 12px;
}

.toc-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-left: 1px solid var(--border);
}

.toc-list a {
    display: block;
    padding: 5px 12px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    margin-left: -1px;
    line-height: 1.5;
    transition: all var(--t-fast) var(--ease);
}

.toc-list a:hover {
    color: var(--text);
}

.toc-list a.active {
    color: var(--secondary-dark);
    border-left-color: var(--secondary-dark);
    font-weight: 600;
}

[data-theme="dark"] .toc-list a.active {
    color: var(--secondary);
}

.toc-list a.h3 {
    padding-left: 24px;
    font-size: 0.75rem;
}

.toc-extras {
    margin-top: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-muted);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
}

.toc-extras h5 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 var(--space-2);
    font-weight: 700;
}

.toc-extras a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 0.8125rem;
    color: var(--text-soft);
}

.toc-extras a:hover {
    color: var(--brand-600);
}

.toc-extras svg {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

/* ---------- 18. Pagination / Prev-Next ---------- */
.page-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
}

.page-nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    transition: all var(--t-base) var(--ease);
    color: var(--text);
}

.page-nav-link:hover {
    border-color: var(--brand-400);
    background: var(--bg-soft);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.page-nav-link .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.page-nav-link .title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
}

.page-nav-link.next {
    text-align: right;
    align-items: flex-end;
}

.page-nav-link svg {
    width: 14px;
    height: 14px;
}

/* ---------- 19. Pricing / Feature Grid ---------- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
    margin: var(--space-6) 0;
}

.pricing-card {
    padding: var(--space-6);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: all var(--t-base) var(--ease);
    position: relative;
}

.pricing-card.featured {
    border-color: var(--brand-400);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--brand-400);
    background: linear-gradient(180deg, var(--brand-50), var(--bg-elevated) 60%);
}

[data-theme="dark"] .pricing-card.featured {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), var(--bg-elevated) 60%);
}

.pricing-card .badge-top {
    position: absolute;
    top: -10px;
    right: 16px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: var(--r-pill);
}

.pricing-name {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-600);
    margin-bottom: var(--space-2);
}

.pricing-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: var(--space-3);
}

.pricing-price small {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pricing-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: var(--space-4) 0;
    font-size: 0.875rem;
}

.pricing-features li {
    display: flex;
    gap: 8px;
    color: var(--text-soft);
}

.pricing-features li::before {
    content: '✓';
    color: var(--color-success);
    font-weight: 700;
}

/* ---------- 20. Timeline (Setup Steps) ---------- */
.timeline {
    position: relative;
    margin: var(--space-6) 0;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--secondary-dark), var(--border) 80%);
    border-radius: 1px;
}

.timeline-step {
    position: relative;
    padding-bottom: var(--space-8);
}

.timeline-step:last-child {
    padding-bottom: 0;
}

.timeline-step::before {
    content: counter(step);
    counter-increment: step;
    position: absolute;
    left: calc(var(--space-8) * -1 + 4px);
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--secondary-dark);
    color: var(--secondary-dark);
    font-size: 0.75rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 4px var(--bg);
}

.timeline {
    counter-reset: step;
}

.timeline-step h4 {
    margin: 0 0 var(--space-2);
    font-size: 1.0625rem;
}

.timeline-step p {
    font-size: 0.9375rem;
    margin-bottom: var(--space-3);
}

/* ---------- 21. Screenshots / Slider ---------- */
.screenshot {
    position: relative;
    margin: var(--space-5) 0;
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-muted);
    box-shadow: var(--shadow-md);
}

.screenshot img {
    width: 100%;
    height: auto;
    display: block;
}

/* Image grid for 2-3 column screenshot layouts */
.img-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin: var(--space-5) 0;
}

.img-grid.col-2 {
    grid-template-columns: repeat(2, 1fr);
}

.img-grid img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* Full-width doc images */
.doc-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    margin: var(--space-4) 0;
}

.timeline-step img,
.timeline-step .screenshot {
    width: 100%;
}

.screenshot-frame {
    aspect-ratio: 16 / 9;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.05));
    display: grid;
    place-items: center;
    color: var(--text-muted);
    position: relative;
}

.screenshot-frame::before {
    content: '';
    position: absolute;
    inset: 12px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--r-md);
    pointer-events: none;
}

.screenshot-frame .ph-text {
    text-align: center;
    font-size: 0.875rem;
    z-index: 1;
}

.screenshot-frame .ph-text strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 4px;
}

.slider {
    position: relative;
    margin: var(--space-6) 0;
}

.slider-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: var(--space-4);
    padding-bottom: var(--space-3);
    scrollbar-width: thin;
}

.slider-slide {
    flex: 0 0 calc(60% - 8px);
    min-width: 280px;
    scroll-snap-align: start;
}

.slider-slide .screenshot {
    margin: 0;
}

.slider-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-3);
}

.slider-dots {
    display: flex;
    gap: 6px;
}

.slider-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: all var(--t-fast) var(--ease);
}

.slider-dot.active {
    background: var(--brand-500);
    width: 18px;
    border-radius: var(--r-pill);
}

.slider-arrows {
    display: flex;
    gap: 6px;
}

.slider-arrow {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-soft);
    transition: all var(--t-fast) var(--ease);
}

.slider-arrow:hover {
    border-color: var(--brand-400);
    color: var(--brand-600);
}

.slider-arrow svg {
    width: 14px;
    height: 14px;
}

/* ---------- 22. Changelog ---------- */
.changelog {
    margin: var(--space-6) 0;
}

.changelog-entry {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--space-6);
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--border);
}

.changelog-entry:last-child {
    border-bottom: none;
}

.changelog-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.changelog-version {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--brand-600);
    margin-bottom: 4px;
}

.changelog-version::before {
    content: '●';
    color: var(--color-success);
    font-size: 0.75rem;
}

.changelog-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.changelog-list {
    font-size: 0.875rem;
    color: var(--text-soft);
}

.changelog-list li {
    padding: 3px 0 3px 18px;
    position: relative;
}

.changelog-list li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 11px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand-400);
}

.tag {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: var(--r-xs);
    margin-right: 6px;
}

.tag.new {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
}

.tag.fix {
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-info);
}

.tag.improved {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
}

.tag.breaking {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

/* ---------- 23. Feature Badge ---------- */
.feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--r-pill);
    background: var(--bg-muted);
    color: var(--text-soft);
}

.feature-badge.new {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
}

.feature-badge.beta {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-warning);
}

.feature-badge.pro {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: white;
}

/* ---------- 24. Footer ---------- */
.footer {
    margin-top: var(--space-20);
    padding: var(--space-12) 0 var(--space-8);
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
}

.footer-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--space-8);
}

.footer-brand .brand {
    margin-bottom: var(--space-3);
}

.footer-brand p {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 320px;
}

.footer-social {
    display: flex;
    gap: 8px;
    margin-top: var(--space-4);
}

.footer-social a {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-muted);
    transition: all var(--t-fast) var(--ease);
}

.footer-social a:hover {
    color: var(--brand-600);
    border-color: var(--brand-300);
    transform: translateY(-2px);
}

.footer-social svg {
    width: 16px;
    height: 16px;
}

.footer-col h5 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text);
    margin-bottom: var(--space-3);
    font-weight: 700;
}

.footer-col ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col a {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer-col a:hover {
    color: var(--brand-600);
}

.footer-bottom {
    max-width: var(--container-max);
    margin: var(--space-8) auto 0;
    padding: var(--space-5) var(--space-6) 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.footer-bottom a {
    color: var(--text-muted);
}

/* ---------- 25. Command Palette (Search Modal) ---------- */
.cmdk-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base) var(--ease);
}

.cmdk-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.cmdk {
    position: fixed;
    top: 12vh;
    left: 50%;
    transform: translateX(-50%) scale(0.96);
    width: min(92vw, 600px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    z-index: 201;
    opacity: 0;
    pointer-events: none;
    transition: all var(--t-base) var(--ease);
    overflow: hidden;
}

.cmdk-backdrop.open+.cmdk,
.cmdk.open {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

.cmdk-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.cmdk-input-wrap svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.cmdk-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.9375rem;
    color: var(--text);
}

.cmdk-input::placeholder {
    color: var(--text-faint);
}

.cmdk-close {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-muted);
    padding: 4px 8px;
    border-radius: var(--r-xs);
    border: 1px solid var(--border);
}

.cmdk-results {
    max-height: 50vh;
    overflow-y: auto;
    padding: 6px;
}

.cmdk-group-title {
    padding: 8px 10px 4px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.cmdk-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    color: var(--text-soft);
    font-size: 0.875rem;
    cursor: pointer;
}

.cmdk-result:hover,
.cmdk-result.active {
    background: var(--bg-muted);
    color: var(--text);
}

.cmdk-result-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: var(--bg-muted);
    border-radius: var(--r-sm);
    color: var(--text-muted);
}

.cmdk-result.active .cmdk-result-icon,
.cmdk-result:hover .cmdk-result-icon {
    background: var(--brand-50);
    color: var(--brand-600);
}

[data-theme="dark"] .cmdk-result.active .cmdk-result-icon,
[data-theme="dark"] .cmdk-result:hover .cmdk-result-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--brand-300);
}

.cmdk-result-icon svg {
    width: 14px;
    height: 14px;
}

.cmdk-result-meta {
    flex: 1;
}

.cmdk-result-meta strong {
    display: block;
    color: var(--text);
    font-weight: 600;
    font-size: 0.875rem;
}

.cmdk-result-meta span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cmdk-empty {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.cmdk-foot {
    display: flex;
    gap: var(--space-4);
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-soft);
}

.cmdk-foot kbd {
    font-family: var(--font-sans);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 2px 5px;
    margin-right: 4px;
}

/* ---------- 26. Theme Toggle Switch ---------- */
.theme-toggle .moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon {
    display: block;
}

/* ---------- 27. Reveal On Scroll ---------- */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 28. Responsive ---------- */
@media (max-width: 1400px) {
    .docs-layout {
        grid-template-columns: var(--sidebar-w) 1fr;
    }

    .toc {
        display: none;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1100px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card-grid.col-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .img-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-w: 260px;
    }

    .navbar-inner {
        grid-template-columns: auto 1fr auto;
        padding: 0 var(--space-4);
        gap: var(--space-3);
    }

    .navbar-search {
        max-width: none;
    }

    .mobile-toggle {
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        margin-right: 4px;
        border-radius: var(--r-md);
        color: var(--text-soft);
    }

    .mobile-toggle:hover {
        background: var(--bg-muted);
    }

    .brand {
        display: none;
    }

    .docs-layout {
        display: block;
        padding: 0 var(--space-4);
    }

    .sidebar {
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        bottom: 0;
        width: 86vw;
        max-width: 320px;
        background: var(--bg);
        border-right: 1px solid var(--border);
        padding: var(--space-5);
        z-index: 90;
        transform: translateX(-100%);
        transition: transform var(--t-base) var(--ease);
        height: auto;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: var(--navbar-h) 0 0 0;
        background: rgba(15, 23, 42, 0.4);
        z-index: 80;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--t-base) var(--ease);
    }

    .sidebar-backdrop.open {
        opacity: 1;
        pointer-events: auto;
    }

    .content {
        padding: var(--space-6) 0 var(--space-12);
    }

    .hero {
        padding: var(--space-8) var(--space-5);
    }

    .hero-row {
        flex-direction: column;
    }

    .hero-col-text,
    .hero-col-img {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .hero-col-img {
        display: none;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }

    .changelog-entry {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card-grid.col-2 {
        grid-template-columns: 1fr;
    }

    .img-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {

    .version-switch,
    .footer-inner {
        display: none;
    }

    .footer-inner {
        display: grid;
        grid-template-columns: 1fr;
    }

    .navbar-search .search-trigger .search-text {
        display: none;
    }

    .navbar-search .search-trigger kbd {
        display: none;
    }

    .page-nav {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    .hero-eyebrow {
        font-size: 0.625rem;
    }

    .timeline {
        padding-left: var(--space-6);
    }

    .timeline-step::before {
        left: -22px;
    }

    .endpoint-head {
        flex-wrap: wrap;
    }
}

/* Print */
@media print {

    .navbar,
    .sidebar,
    .toc,
    .footer,
    .page-nav {
        display: none;
    }

    .docs-layout {
        display: block;
        padding: 0;
    }

    .content {
        padding: 0;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}


/* ============================================================
   COMPONENT LIBRARY ADDITIONS
   ============================================================ */

/* ---------- 29. Buttons (variants & sizes) ---------- */
.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 0.75rem;
    border-radius: var(--r-sm);
}

.btn-lg {
    height: 46px;
    padding: 0 22px;
    font-size: 0.9375rem;
    border-radius: var(--r-lg);
}

.btn-success {
    background: linear-gradient(180deg, #10b981, #059669);
    color: white;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success:hover {
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(180deg, #ef4444, #dc2626);
    color: white;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-danger:hover {
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-soft {
    background: var(--brand-50);
    color: var(--brand-700);
    border: 1px solid var(--brand-100);
}

.btn-soft:hover {
    background: var(--brand-100);
    color: var(--brand-700);
}

[data-theme="dark"] .btn-soft {
    background: rgba(99, 102, 241, 0.12);
    color: var(--brand-300);
    border-color: rgba(99, 102, 241, 0.25);
}

[data-theme="dark"] .btn-soft:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--brand-200);
}

.btn[disabled],
.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Button group */
.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-soft);
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--r-md);
    border-bottom-left-radius: var(--r-md);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--r-md);
    border-bottom-right-radius: var(--r-md);
}

.btn-group .btn+.btn {
    border-left: none;
}

.btn-group .btn:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.btn-group .btn.active {
    background: var(--bg-muted);
    color: var(--brand-600);
    font-weight: 600;
}

/* ---------- 30. Form Controls ---------- */
.form-row {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-help {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-error {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--color-danger);
    display: flex;
    align-items: center;
    gap: 4px;
}

.input,
.textarea,
.select {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 0.875rem;
    color: var(--text);
    outline: none;
    transition: all var(--t-fast) var(--ease);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-faint);
}

.input:hover,
.textarea:hover,
.select:hover {
    border-color: var(--border-strong);
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: var(--brand-400);
    box-shadow: var(--shadow-glow);
}

.input.is-invalid,
.textarea.is-invalid,
.select.is-invalid {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.textarea {
    height: auto;
    min-height: 96px;
    padding: 10px 14px;
    resize: vertical;
    line-height: 1.55;
    font-family: var(--font-sans);
}

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group .input {
    padding-left: 38px;
}

.input-group-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-faint);
    pointer-events: none;
}

/* Checkbox & Radio */
.check,
.radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-soft);
    user-select: none;
}

.check input,
.radio input {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    background: var(--bg);
    cursor: pointer;
    transition: all var(--t-fast) var(--ease);
    flex-shrink: 0;
    position: relative;
    margin: 0;
}

.check input {
    border-radius: 5px;
}

.radio input {
    border-radius: 50%;
}

.check input:hover,
.radio input:hover {
    border-color: var(--brand-400);
}

.check input:checked,
.radio input:checked {
    background: var(--brand-600);
    border-color: var(--brand-600);
}

.check input:checked::after {
    content: '';
    position: absolute;
    inset: 2px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 12px;
    background-repeat: no-repeat;
    background-position: center;
}

.radio input:checked::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: white;
    border-radius: 50%;
}

/* ---------- 31. Toggle Switch ---------- */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-soft);
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-track {
    width: 38px;
    height: 22px;
    background: var(--border-strong);
    border-radius: var(--r-pill);
    position: relative;
    transition: background-color var(--t-base) var(--ease);
    flex-shrink: 0;
}

.switch-track::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-base) var(--ease);
}

.switch input:checked+.switch-track {
    background: var(--brand-600);
}

.switch input:checked+.switch-track::before {
    transform: translateX(16px);
}

.switch input:focus-visible+.switch-track {
    box-shadow: var(--shadow-glow);
}

/* ---------- 32. Avatars ---------- */
.avatar {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
    color: white;
    font-weight: 700;
    font-size: 0.8125rem;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 2px var(--bg);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: 0.625rem;
}

.avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 0.6875rem;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.avatar-xl {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
}

.avatar.bg-amber {
    background: linear-gradient(135deg, #fbbf24, #d97706);
}

.avatar.bg-emerald {
    background: linear-gradient(135deg, #34d399, #059669);
}

.avatar.bg-pink {
    background: linear-gradient(135deg, #f472b6, #be185d);
}

.avatar.bg-cyan {
    background: linear-gradient(135deg, #22d3ee, #0e7490);
}

.avatar.bg-violet {
    background: linear-gradient(135deg, #a78bfa, #6d28d9);
}

.avatar-status {
    position: relative;
}

.avatar-status::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: var(--color-success);
    border: 2px solid var(--bg);
}

.avatar-status.away::after {
    background: var(--color-warning);
}

.avatar-status.busy::after {
    background: var(--color-danger);
}

.avatar-status.offline::after {
    background: var(--text-faint);
}

.avatar-group {
    display: inline-flex;
}

.avatar-group .avatar {
    box-shadow: 0 0 0 2px var(--bg);
}

.avatar-group .avatar+.avatar {
    margin-left: -10px;
}

.avatar-group .avatar.more {
    background: var(--bg-muted);
    color: var(--text-soft);
    border: 1px dashed var(--border-strong);
    box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- 33. Progress ---------- */
.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-muted);
    border-radius: var(--r-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
    border-radius: inherit;
    transition: width var(--t-slow) var(--ease);
}

.progress.success .progress-bar {
    background: linear-gradient(90deg, #34d399, #059669);
}

.progress.warning .progress-bar {
    background: linear-gradient(90deg, #fbbf24, #d97706);
}

.progress.danger .progress-bar {
    background: linear-gradient(90deg, #f87171, #dc2626);
}

.progress.striped .progress-bar {
    background-image: linear-gradient(45deg,
            rgba(255, 255, 255, 0.18) 25%, transparent 25%,
            transparent 50%, rgba(255, 255, 255, 0.18) 50%,
            rgba(255, 255, 255, 0.18) 75%, transparent 75%);
    background-size: 16px 16px;
    animation: progress-stripe 1.2s linear infinite;
}

@keyframes progress-stripe {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 16px 0;
    }
}

.progress-ring {
    width: 64px;
    height: 64px;
    transform: rotate(-90deg);
}

.progress-ring circle {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
}

.progress-ring .ring-track {
    stroke: var(--bg-muted);
}

.progress-ring .ring-fill {
    stroke: var(--brand-500);
    transition: stroke-dashoffset var(--t-slow) var(--ease);
}

.progress-ring-wrap {
    position: relative;
    display: inline-grid;
    place-items: center;
}

.progress-ring-label {
    position: absolute;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
}

/* ---------- 34. Stat / KPI Cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin: var(--space-5) 0;
}

.stat-card {
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    transition: all var(--t-base) var(--ease);
}

.stat-card:hover {
    border-color: var(--brand-300);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.stat-label svg {
    width: 14px;
    height: 14px;
}

.stat-value {
    margin: 8px 0 4px;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-pill);
}

.stat-delta.up {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.10);
}

.stat-delta.down {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.10);
}

.stat-delta svg {
    width: 11px;
    height: 11px;
}

.stat-trend {
    margin-top: var(--space-3);
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 32px;
}

.stat-trend span {
    flex: 1;
    background: var(--brand-200);
    border-radius: 2px;
    transition: background-color var(--t-fast) var(--ease);
}

[data-theme="dark"] .stat-trend span {
    background: rgba(99, 102, 241, 0.4);
}

.stat-card:hover .stat-trend span {
    background: var(--brand-500);
}

/* ---------- 35. Empty State ---------- */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    border: 2px dashed var(--border);
    border-radius: var(--r-lg);
    background: var(--bg-soft);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin: 0 auto var(--space-4);
    border-radius: var(--r-lg);
    background: var(--bg-elevated);
    color: var(--brand-500);
    box-shadow: var(--shadow-sm);
}

.empty-state-icon svg {
    width: 28px;
    height: 28px;
}

.empty-state h4 {
    margin: 0 0 var(--space-2);
}

.empty-state p {
    margin: 0 auto var(--space-4);
    max-width: 420px;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ---------- 36. Skeleton Loader ---------- */
.skeleton {
    display: block;
    background: linear-gradient(90deg,
            var(--bg-muted) 0%,
            var(--border) 50%,
            var(--bg-muted) 100%);
    background-size: 200% 100%;
    border-radius: var(--r-sm);
    animation: skeleton-shimmer 1.6s linear infinite;
    height: 14px;
    width: 100%;
}

.skeleton.text {
    height: 12px;
    margin-bottom: 8px;
}

.skeleton.title {
    height: 18px;
    width: 50%;
    margin-bottom: 12px;
}

.skeleton.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton.thumb {
    width: 100%;
    height: 140px;
    border-radius: var(--r-md);
}

.skeleton.btn {
    height: 36px;
    width: 120px;
    border-radius: var(--r-md);
}

@keyframes skeleton-shimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

/* ---------- 37. Tooltip (CSS only) ---------- */
.has-tip {
    position: relative;
}

.has-tip::before,
.has-tip::after {
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    z-index: 30;
}

.has-tip::before {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--slate-900);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: var(--r-sm);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

.has-tip::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--slate-900);
}

.has-tip:hover::before,
.has-tip:focus-visible::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.has-tip:hover::after,
.has-tip:focus-visible::after {
    opacity: 1;
}

[data-theme="dark"] .has-tip::before {
    background: #2a3458;
}

[data-theme="dark"] .has-tip::after {
    border-top-color: #2a3458;
}

/* ---------- 38. Modal / Dialog ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base) var(--ease);
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -48%) scale(0.96);
    width: min(92vw, 480px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    z-index: 201;
    opacity: 0;
    pointer-events: none;
    transition: all var(--t-base) var(--ease);
    overflow: hidden;
}

.modal.open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5) var(--space-3);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.modal-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.modal-close {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    border-radius: var(--r-sm);
    transition: all var(--t-fast) var(--ease);
}

.modal-close:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.modal-close svg {
    width: 16px;
    height: 16px;
}

.modal-body {
    padding: 0 var(--space-5) var(--space-5);
    color: var(--text-soft);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
}

/* ---------- 39. Toast Notifications ---------- */
.toast-region {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 250;
    max-width: calc(100vw - 32px);
    width: 360px;
}

.toast {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.3s var(--ease);
    border-left: 3px solid var(--brand-500);
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.warning {
    border-left-color: var(--color-warning);
}

.toast.danger {
    border-left-color: var(--color-danger);
}

.toast.info {
    border-left-color: var(--color-info);
}

.toast.leaving {
    animation: toast-out 0.25s var(--ease) forwards;
}

.toast-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
    margin-top: 2px;
    background: var(--brand-500);
}

.toast.success .toast-icon {
    background: var(--color-success);
}

.toast.warning .toast-icon {
    background: var(--color-warning);
}

.toast.danger .toast-icon {
    background: var(--color-danger);
}

.toast.info .toast-icon {
    background: var(--color-info);
}

.toast-icon svg {
    width: 13px;
    height: 13px;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text);
}

.toast-msg {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.toast-close {
    color: var(--text-faint);
    padding: 2px;
    align-self: flex-start;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ---------- 40. Chips / Tag Pills ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-muted);
    color: var(--text-soft);
    border: 1px solid var(--border);
}

.chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-500);
}

.chip.success {
    background: rgba(16, 185, 129, 0.10);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.25);
}

.chip.warning {
    background: rgba(245, 158, 11, 0.10);
    color: var(--color-warning);
    border-color: rgba(245, 158, 11, 0.25);
}

.chip.danger {
    background: rgba(239, 68, 68, 0.10);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.25);
}

.chip.brand {
    background: rgba(99, 102, 241, 0.10);
    color: var(--brand-600);
    border-color: rgba(99, 102, 241, 0.25);
}

.chip-x {
    margin-left: 2px;
    width: 14px;
    height: 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.6;
}

.chip-x:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
}

.chip-x svg {
    width: 9px;
    height: 9px;
}

/* ---------- 41. Number Pagination ---------- */
.pager {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: var(--space-5) 0;
}

.pager .pager-item {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-soft);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: all var(--t-fast) var(--ease);
}

.pager .pager-item:hover {
    border-color: var(--border-strong);
    background: var(--bg-muted);
    color: var(--text);
}

.pager .pager-item.active {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: white;
}

.pager .pager-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pager .pager-ellipsis {
    color: var(--text-faint);
    padding: 0 4px;
}

/* ---------- 42. Component Showcase Layout ---------- */
.kit-section {
    margin: var(--space-10) 0;
    padding-top: var(--space-2);
    scroll-margin-top: calc(var(--navbar-h) + 24px);
}

.kit-section:first-of-type {
    margin-top: var(--space-6);
}

.kit-preview {
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background:
        linear-gradient(45deg, var(--bg-soft) 25%, transparent 25%) -10px 0,
        linear-gradient(-45deg, var(--bg-soft) 25%, transparent 25%) -10px 0,
        linear-gradient(45deg, transparent 75%, var(--bg-soft) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bg-soft) 75%);
    background-size: 20px 20px;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    align-items: flex-start;
}

.kit-preview.center {
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.kit-preview.row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
}

.kit-preview>.full-width {
    width: 100%;
}

.kit-preview+.code-block {
    margin-top: 0;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    border-top: none;
}

.kit-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kit-toolbar+.kit-preview {
    border-radius: 0;
    border-top: none;
}

.kit-grid-quicknav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin: var(--space-5) 0 var(--space-8);
}

.kit-grid-quicknav a {
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-soft);
    transition: all var(--t-fast) var(--ease);
    text-align: center;
}

.kit-grid-quicknav a:hover {
    color: var(--brand-600);
    border-color: var(--brand-300);
    background: var(--brand-50);
    transform: translateY(-1px);
}

[data-theme="dark"] .kit-grid-quicknav a:hover {
    background: rgba(99, 102, 241, 0.12);
}

/* swatch grid for color tokens */
.swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin: var(--space-4) 0;
}

.swatch {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--bg-elevated);
}

.swatch-color {
    height: 56px;
}

.swatch-meta {
    padding: 8px 10px;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
}

.swatch-meta strong {
    display: block;
    color: var(--text);
    font-weight: 700;
    font-size: 0.75rem;
    font-family: var(--font-sans);
    margin-bottom: 2px;
}

.swatch-meta span {
    color: var(--text-muted);
}

/* type sample */
.type-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

.type-row:last-child {
    border-bottom: none;
}

.type-row .type-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}