/* ============================================================
   .uk-docs-layout — proposed canonical docs layout chrome (loaded only on /docs/ui-kit)
   ============================================================
   Replaces the layout chrome from public/css/docs.css that the legacy
   layouts/docs.blade.php template uses today:
     .docs-layout              -> .uk-docs-layout
     .docs-sidebar             -> .uk-docs-sidebar
     .docs-sidebar::-webkit-scrollbar*  -> kept on canonical (thin slate scrollbar)
     .sidebar-header           -> .uk-docs-sidebar-header
     .sidebar-header h3        -> tag selector inside header
     .sidebar-close            -> .uk-docs-sidebar-close
     .sidebar-nav              -> .uk-docs-sidebar-nav
     .docs-content             -> .uk-docs-content
     .mobile-sidebar-toggle    -> .uk-docs-content-toggle

   Bakes in the polish layer directly — no separate modifier needed:
     - section h4 headers gain uppercase 0.08em letter-spacing
     - active link gets a 2px primary left-accent bar via ::before
     - hover leans translateX(2px) toward the content area
     - spring cubic-bezier(0.16, 1, 0.3, 1) easing on link transitions

   PRESERVES the legacy descendant class names inside the sidebar
   (.sidebar-section / -section h4 / -section ul / -section li /
   -section a / -section a.active) because docs.js targets them via
   `document.querySelectorAll('.sidebar-section a')`. Migration to
   canonical is pure rename of the LAYOUT classes; JS hook surfaces
   stay intact.

   PRESERVES JS-emitted state class .active on .uk-docs-sidebar for
   mobile drawer open/close (docs.js calls sidebar.classList.toggle).

   No radial-gradient. No JS.
   ============================================================ */

/* ============================================
   Root layout — flex with sidebar on left, content on right
   ============================================ */
.uk-docs-layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--layout-nav-height);
}

/* ============================================
   Sidebar — fixed, scrollable
   ============================================ */
.uk-docs-sidebar {
    position: fixed;
    top: var(--layout-nav-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--layout-nav-height));
    padding: var(--space-lg) 0;
    background: var(--color-bg-elevated);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    z-index: 100;
    scrollbar-color: var(--color-border) transparent;
    scrollbar-width: thin;
}

/* Webkit scrollbar — thin slate rail with hover lift */
.uk-docs-sidebar::-webkit-scrollbar {
    width: 8px;
}

.uk-docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.uk-docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-sm);
}

.uk-docs-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Header inside sidebar — title + (mobile) close button */
.uk-docs-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg) var(--space-lg);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.uk-docs-sidebar-header h3 {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--font-md);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Close button — hidden by default, surfaces on mobile */
.uk-docs-sidebar-close {
    display: none;
    padding: var(--space-xs);
    background: transparent;
    border: 0;
    color: var(--color-text-muted);
    cursor: pointer;
}

.uk-docs-sidebar-close svg {
    width: var(--icon-md);
    height: var(--icon-md);
}

/* Nav wrapper — content padding inside the sidebar */
.uk-docs-sidebar-nav {
    padding: 0 var(--space-md);
}

/* ============================================
   Sidebar sections — DESCENDANT classes preserved for docs.js
   .sidebar-section / -section h4 / ul / li / a / a.active
   ============================================
   Polish layer folded in: tracked uppercase h4, primary left-accent
   bar on active link via ::before, translateX hover lean.
   ============================================ */
.uk-docs-sidebar .sidebar-section {
    margin-bottom: var(--space-xl);
}

.uk-docs-sidebar .sidebar-section h4 {
    margin: 0 0 var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text-muted);
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.uk-docs-sidebar .sidebar-section ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.uk-docs-sidebar .sidebar-section li {
    margin-bottom: 2px;
}

.uk-docs-sidebar .sidebar-section a {
    position: relative;
    display: block;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-md);
    transition: color 0.15s ease,
                background-color 0.15s ease,
                transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Primary left-accent bar — animates height on .active */
.uk-docs-sidebar .sidebar-section a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 2px;
    height: 0;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transform: translateY(-50%);
    transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.uk-docs-sidebar .sidebar-section a:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

.uk-docs-sidebar .sidebar-section a.active {
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.1);
}

.uk-docs-sidebar .sidebar-section a.active::before {
    height: 60%;
}

/* ============================================
   Mobile drawer — sidebar slides off-screen below 1024px;
   .active class (JS-emitted) brings it back
   ============================================ */
@media (max-width: 1024px) {
    .uk-docs-sidebar {
        left: -100%;
        transition: left var(--transition-base);
        z-index: 1001;
    }

    .uk-docs-sidebar.active {
        left: 0;
    }

    .uk-docs-sidebar-close {
        display: inline-flex;
    }
}

/* ============================================
   Content — main area; offset for the sidebar on desktop
   ============================================ */
.uk-docs-content {
    width: 100%;
    max-width: 1400px;
    margin-left: 280px;
    padding: var(--space-2xl) var(--space-4xl);
    /* Flex-item min-width fix: long <pre> children would otherwise set
       intrinsic min-width to their content width and push the column
       horizontally. min-width: 0 lets the column shrink so child
       <pre> blocks scroll within their own box. */
    min-width: 0;
}

/* Cap content width on very wide screens for comfortable reading */
@media (min-width: 1800px) {
    .uk-docs-content {
        max-width: 1200px;
    }
}

/* Mobile: drop the sidebar margin; tighter horizontal padding */
@media (max-width: 1024px) {
    .uk-docs-content {
        margin-left: 0;
        padding: var(--space-xl);
    }
}

/* ============================================
   Mobile sidebar toggle — surfaces below 1024px
   ============================================ */
.uk-docs-content-toggle {
    display: none;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: inherit;
    font-size: var(--font-md);
    cursor: pointer;
}

.uk-docs-content-toggle svg {
    width: var(--icon-md);
    height: var(--icon-md);
}

@media (max-width: 1024px) {
    .uk-docs-content-toggle {
        display: inline-flex;
    }
}

/* ============================================
   Page header — title block at the top of a docs page
   ============================================
   Replaces .docs-header + .docs-intro from docs.css. Sits at the top
   of .uk-docs-content (above the first <section>). Big tracked H1,
   optional breadcrumb above (use .uk-breadcrumbs), generous bottom
   border + spacing as a visual divider before the first section. */
.uk-docs-header {
    margin-bottom: var(--space-3xl);
    padding-bottom: var(--space-2xl);
    border-bottom: 1px solid var(--color-border);
}

.uk-docs-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--space-md);
    margin-top: var(--space-lg);
    letter-spacing: -0.02em;
    line-height: var(--line-tight);
}

/* Crumb sits ABOVE the H1, slightly muted, no top margin so it hugs
   the top of .uk-docs-content padding. */
.uk-docs-header .uk-breadcrumbs {
    margin-bottom: var(--space-lg);
}

.uk-docs-intro {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    line-height: var(--line-relaxed);
    margin: 0;
}

@media (max-width: 768px) {
    .uk-docs-header h1 {
        font-size: 2rem;
    }
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .uk-docs-sidebar,
    .uk-docs-sidebar .sidebar-section a,
    .uk-docs-sidebar .sidebar-section a::before {
        transition: none;
    }
}
