/* ========================================
   SITE-SPECIFIC OVERRIDES
   Main CSS for b17s.net
   Uses CI design variables from theme files
   ======================================== */

html {
    scroll-padding-top: 150px;
}

/* CI design has fixed nav, so no need for top padding on body */
body {
    padding-top: 0;
}

/* Sticky footer without touching the document flow: `top: 100vh` parks the
   footer at the bottom of the viewport when the page is shorter than the
   screen, while leaving it in normal flow (scrolled to) on taller pages.
   Body/content layout is untouched, so there's no first-paint shift. */
footer {
    position: sticky;
    top: 100vh;
}

/* Hidden class utility */
.hidden {
    display: none !important;
}

/* ========================================
   LOGO STYLES
   Navigation and footer logo with image
   ======================================== */

/* Navigation logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo .logo-image {
    height: 32px;
    width: auto;
}

/* Inline SVG logo styling */
.logo svg.logo-image {
    color: var(--accent);
}

.logo .logo-text {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Footer logo */
.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    margin-bottom: 1rem;
}

.footer-logo .logo-image {
    height: 40px;
    width: auto;
}

/* Inline SVG footer logo styling */
.footer-logo svg.logo-image {
    color: var(--accent);
}

.footer-logo h3 {
    margin: 0;
}

@media (max-width: 768px) {
    .logo .logo-image {
        height: 28px;
    }

    .logo .logo-text {
        font-size: 1.5rem;
    }

    .footer-logo .logo-image {
        height: 32px;
    }
}

/* ========================================
   BLOG TIMELINE - Year-grouped list view
   ======================================== */

.blog-timeline {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 900px;
    margin: 0 auto;
}

/* Year Group */
.blog-year-group {
    position: relative;
}

.blog-year-header {
    position: sticky;
    top: 80px;
    z-index: 10;
    margin-bottom: 1.5rem;
}

.year-label {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 200;
    letter-spacing: -1px;
    color: var(--text);
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Posts List */
.blog-posts-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid var(--glass-border);
}

/* Individual Post Item */
.blog-list-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    margin-left: -1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.blog-list-item::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: var(--bg-dark);
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    transition: all 0.3s;
}

.blog-list-item:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    transform: translateX(8px);
}

.blog-list-item:hover::before {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-a40);
}

/* Date Badge */
.post-date-badge {
    flex-shrink: 0;
    width: 70px;
    padding: 0.5rem 0;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

/* Post Content */
.post-content {
    flex: 1;
    min-width: 0;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.blog-list-item .post-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.blog-list-item .post-category {
    padding: 0.2rem 0.6rem;
    background: var(--accent-a10);
    border: 1px solid var(--accent-a20);
    border-radius: 50px;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent);
    white-space: nowrap;
}

.blog-list-item .post-description {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Arrow Icon */
.post-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s;
}

.post-arrow svg {
    width: 20px;
    height: 20px;
}

.blog-list-item:hover .post-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .blog-timeline {
        gap: 2rem;
    }

    .blog-year-header {
        top: 70px;
    }

    .year-label {
        font-size: 2rem;
    }

    .blog-list-item {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }

    .post-date-badge {
        width: auto;
        padding: 0.35rem 0.75rem;
        font-size: 0.75rem;
    }

    .blog-list-item .post-title {
        font-size: 1rem;
    }

    .blog-list-item .post-description {
        display: none;
    }

    .post-arrow {
        display: none;
    }
}

/* ========================================
   BLOG HERO TITLE AUTO-RESIZE
   Scales down long titles to fit viewport
   ======================================== */

.blog-hero h1 {
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

@media (max-width: 768px) {
    .blog-hero h1 {
        font-size: clamp(1.25rem, 6vw, 2.5rem);
    }
}

@media (max-width: 480px) {
    .blog-hero h1 {
        font-size: clamp(1rem, 7vw, 2rem);
    }
}

/* Feature list styling (MarkDrown plugin compatibility) */
.feature-list h4 {
    background: none;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1em;
    color: var(--text);
}

.feature-list h4:after {
    max-height: 0;
    background: none;
}

/* Menu post item styling */
.menu-post-item h4 {
    background: none;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1em;
    color: var(--text);
}

.menu-post-item h4:after {
    max-height: 0;
    background: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    html {
        scroll-padding-top: 100px;
    }
}

/* ========================================
   BLOG MENU SYSTEM
   Slide-out menu for blog navigation
   ======================================== */

/* Fixed Menu Toggle Button.
   Hidden by default; only blog and docs pages expose the slide-out sidebar. */
.blog-menu-toggle {
    position: fixed;
    top: 1.25rem;
    right: 2rem;
    z-index: 1001;
    width: 48px;
    height: 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text);
}

body[data-page^="blog"] .blog-menu-toggle,
body[data-page^="docs"] .blog-menu-toggle {
    display: flex;
}

/* Keep the main nav links visible on narrow screens. ci-base.css hides them at
   <=768px, but the slide-out hamburger only exposes the blog/docs sidebar — not
   the site navigation — so hiding them would leave default pages with no menu at
   all. The three links are short and fit once the gap is tightened. */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem 1.25rem;
    }

    .nav-links {
        display: flex;
        gap: 1.25rem;
    }
}

/* On blog/docs pages the fixed slide-out toggle is pinned to the top-right
   corner and shown at every width, so it overlaps the nav links whenever the
   nav container fills the viewport. Reserve room for the toggle (plus a gap, so
   the links don't crowd against it) while the container is full width. */
@media (max-width: 1464px) {
    body[data-page^="blog"] .nav-container,
    body[data-page^="docs"] .nav-container {
        padding-right: 6.5rem;
    }
}

@media (max-width: 768px) {
    body[data-page^="blog"] .nav-container,
    body[data-page^="docs"] .nav-container {
        padding-right: 5rem;
    }
}

.blog-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    transform: scale(1.05);
}

.blog-menu-toggle.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.blog-menu-toggle .menu-icon {
    width: 22px;
    height: 22px;
}

/* Blog Menu Overlay */
.blog-menu-overlay {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--glass-border);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

.blog-menu-overlay.active,
.blog-menu-overlay.hover-active {
    right: 0;
}

/* Blog Menu Content */
.blog-menu-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Menu Header */
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}

.menu-header .brand-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.menu-close-btn {
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text);
}

.menu-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    color: var(--accent);
}

/* Menu Search */
.menu-search {
    margin-bottom: 1.5rem;
}

.search-input-wrapper {
    position: relative;
}

.menu-search input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 2.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.3s;
}

.menu-search input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.menu-search input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
}

.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background: var(--glass-bg);
    color: var(--accent);
}

/* Menu Categories */
.menu-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.category-filter {
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.category-filter:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.category-filter.active {
    background: var(--accent-a15);
    border-color: var(--accent);
    color: var(--accent);
}

/* Menu Posts */
.menu-posts {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.menu-post-item {
    padding: 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.menu-post-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-a30);
}

.menu-post-item .post-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.menu-post-item .post-date {
    opacity: 0.8;
}

.menu-post-item .post-category {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.menu-post-item .post-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.menu-post-item .post-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 0.75rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-post-item .post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.menu-post-item .tag {
    padding: 0.2rem 0.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Blog Menu Backdrop */
.blog-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.blog-menu-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* Docs-projects sidebar: stack the library cards in a single column inside the panel. */
.menu-docs-libraries {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.menu-docs-libraries .docs-libraries-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .blog-menu-toggle {
        top: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }

    .blog-menu-overlay {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }

    .blog-menu-content {
        padding: 1rem;
    }
}

/* ============================================================
   Dark-themed scrollbars for the scrollable sidebars.
   The slide-out blog/docs panel and the inline docs sidebar otherwise fall back
   to the browser's default (light) scrollbar, which clashes with the dark glass
   UI. Applies to Firefox (scrollbar-*) and WebKit/Blink (::-webkit-scrollbar).
   ============================================================ */
.blog-menu-overlay,
.menu-posts,
.menu-docs-libraries,
.docs-sidebar,
.markdrown-content .md-table-wrap,
.markdrown-content pre {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-a40) var(--bg-elevated);
}

.blog-menu-overlay::-webkit-scrollbar,
.menu-posts::-webkit-scrollbar,
.menu-docs-libraries::-webkit-scrollbar,
.docs-sidebar::-webkit-scrollbar,
.markdrown-content .md-table-wrap::-webkit-scrollbar,
.markdrown-content pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.blog-menu-overlay::-webkit-scrollbar-track,
.menu-posts::-webkit-scrollbar-track,
.menu-docs-libraries::-webkit-scrollbar-track,
.docs-sidebar::-webkit-scrollbar-track,
.markdrown-content .md-table-wrap::-webkit-scrollbar-track,
.markdrown-content pre::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    border-radius: 8px;
}

.blog-menu-overlay::-webkit-scrollbar-thumb,
.menu-posts::-webkit-scrollbar-thumb,
.menu-docs-libraries::-webkit-scrollbar-thumb,
.docs-sidebar::-webkit-scrollbar-thumb,
.markdrown-content .md-table-wrap::-webkit-scrollbar-thumb,
.markdrown-content pre::-webkit-scrollbar-thumb {
    background: var(--accent-a40);
    border-radius: 8px;
    border: 2px solid var(--bg-elevated);
}

.blog-menu-overlay::-webkit-scrollbar-thumb:hover,
.menu-posts::-webkit-scrollbar-thumb:hover,
.menu-docs-libraries::-webkit-scrollbar-thumb:hover,
.docs-sidebar::-webkit-scrollbar-thumb:hover,
.markdrown-content .md-table-wrap::-webkit-scrollbar-thumb:hover,
.markdrown-content pre::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ============================================================
   Docs layout (sidebar + main content)
   Used by docs.tpl.html for /docs/<library>/ pages.
   ============================================================ */

.docs-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 3rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
    position: relative;
    z-index: 1;
}

.docs-sidebar {
    position: sticky;
    top: 6rem;
    align-self: start;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    padding-right: 0.5rem;
}

.docs-nav {
    /* Override global `nav { position: fixed }` from ci-base.css */
    position: static;
    inset: auto;
    z-index: auto;
    border-bottom: none;

    background: rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    backdrop-filter: blur(12px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
}

.docs-nav-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-nav-title {
    display: block;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.docs-nav-title:hover {
    color: var(--halo-primary-text);
}

.docs-nav-description {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
}

.docs-version {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.docs-version-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
}

.docs-version-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(255, 255, 255, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.85rem;
    padding: 0.45rem 2rem 0.45rem 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.docs-version-select:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.08);
}

.docs-version-select:focus-visible {
    outline: none;
    border-color: var(--accent);
}

.docs-version-select option {
    background: #1a1a1a;
    color: #fff;
}

.docs-nav-section + .docs-nav-section {
    margin-top: 1.25rem;
}

.docs-nav-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
}

.docs-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-nav-item a {
    display: block;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.92rem;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
    border-left: 2px solid transparent;
}

.docs-nav-item a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.95);
}

.docs-nav-item.active a {
    background: color-mix(in oklch, var(--accent) 12%, transparent);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}

.docs-main {
    min-width: 0;
}

.docs-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.docs-eyebrow {
    display: inline-block;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--accent);
    background: color-mix(in oklch, var(--accent) 12%, transparent);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.docs-header h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.docs-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    line-height: 1.5;
}

.docs-article {
    max-width: 820px;
}

/* Docs-only heading scale. The shared .halo defaults size h2 (1.2em, thin)
   smaller than h3-h6 (1.3em, bold), which inverts the hierarchy in markdown
   docs where ## is a section and ### a subsection. Re-establish a clean
   descending scale, scoped to docs so blog/landing .halo content is untouched. */
.docs-article h1 {
    font-size: 2rem;
    font-weight: 700;
}

.docs-article h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--halo-text);
}

.docs-article h3 {
    font-size: 1.2rem;
}

.docs-article h4 {
    font-size: 1.05rem;
}

.docs-article h5 {
    font-size: 0.95rem;
}

.docs-article h6 {
    font-size: 0.85rem;
}

/* Mobile: sidebar above content */
@media (max-width: 900px) {
    .docs-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding-top: 6rem;
    }

    .docs-sidebar {
        position: static;
        max-height: none;
    }
}

/* ============================================================
   Docs overview (/docs/) - library card grid
   ============================================================ */

.docs-overview-hero {
    padding-top: 8rem;
}

.docs-libraries-section {
    padding: 2rem 0 6rem;
}

.docs-libraries-grid {
    display: grid;
    /* auto-fit (not auto-fill) collapses unused tracks and the 420px cap
       stops cards from stretching, so justify-content can center the row
       when there are fewer cards than would fill it. */
    grid-template-columns: repeat(auto-fit, minmax(320px, 420px));
    gap: 1.5rem;
    justify-content: center;
}

.docs-library-card {
    display: block;
    background: rgba(255, 255, 255, 0.04);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    backdrop-filter: blur(12px) saturate(120%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.75rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s,
                background 0.3s,
                box-shadow 0.3s;
}

.docs-library-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-a30);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.docs-library-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.docs-library-name {
    margin: 0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: -0.01em;
}

.docs-library-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.docs-library-description {
    margin: 0 0 1.25rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
    font-size: 0.95rem;
}

.docs-library-link {
    display: inline-block;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.2s;
}

.docs-library-card:hover .docs-library-link {
    transform: translateX(4px);
}

/* Inside the slide-out sidebar, drop the hover-nudge/lift the cards use on the
   /docs/ overview grid — the motion is distracting and clips against the narrow
   panel. Keep the colour/border feedback only. */
.menu-docs-libraries .docs-library-card:hover,
.menu-docs-libraries .docs-library-card:hover .docs-library-link {
    transform: none;
}

.docs-libraries-empty {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 3rem 0;
}

/* ============================================================
   Landing: Library promo section
   Lives between Hero and Capabilities. Bold hero-style wordmark.
   ============================================================ */

.library-promo-section {
    padding: 5rem 0 3rem;
}

.library-promo-card {
    position: relative;
    max-width: 1080px;
    margin: 0 auto;
    padding: 4rem 3rem;
    overflow: hidden;
    border-radius: 28px;
    /* Fade in after the hero cascade (tag .2s -> buttons .5s) so the
       card doesn't sit fully visible before the title animates in. */
    animation: fadeInUp 1s ease-out 0.6s both;
    background:
        linear-gradient(135deg,
            color-mix(in oklch, var(--accent) 4%, transparent) 0%,
            transparent 50%,
            color-mix(in oklch, var(--primary) 5%, transparent) 100%),
        rgba(8, 10, 14, 0.55);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Ambient hover response (see :hover below): slow enough to read as
       lighting, not as a button-style affordance. */
    transition: border-color 0.7s ease, box-shadow 0.7s ease;
}

/* On hover the border picks up the card's theme accent and a soft halo
   bleeds outward. Deliberately NO transform/lift and NO cursor change —
   the card itself isn't clickable, only the buttons inside it are. */
.library-promo-card:hover {
    border-color: color-mix(in oklch, var(--accent) 35%, rgba(255, 255, 255, 0.08));
    box-shadow:
        0 0 24px var(--accent-a10),
        0 0 80px var(--accent-a10),
        inset 0 0 40px var(--accent-a05);
}

.library-promo-card::before {
    /* Top accent edge */
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--accent) 30%,
        var(--primary) 70%,
        transparent);
}

.library-promo-card::after {
    /* Large soft glow behind the wordmark */
    content: '';
    position: absolute;
    top: 20%;
    left: 10%;
    width: 70%;
    height: 70%;
    background: radial-gradient(ellipse at center,
        color-mix(in oklch, var(--accent) 25%, transparent) 0%,
        transparent 60%);
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
}

.library-promo-card > * {
    position: relative;
    z-index: 1;
}

.library-promo-header {
    /* Floated out of flow into the top-right corner so the badges take up
       no vertical space and don't push the wordmark down. */
    position: absolute;
    top: 2.5rem;
    right: 3rem;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

/* Badge paragraph carries default <p> margins — kill them so the row
   stays tight in the corner. */
.library-promo-header p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.library-promo-tag {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.library-promo-badge {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #0a0a0f;
    text-transform: uppercase;
    box-shadow: 0 4px 16px color-mix(in oklch, var(--accent) 30%, transparent);
}

/* Wordmark row. */
.library-promo-brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Oversized logo bleeding off the right edge as a background watermark.
   Masked so it fades out before reaching the text, and kept behind
   content (z-index 0) so it never interferes with readability. */
.library-promo-watermark {
    /* Out of flow + geometry anchored to the card's own box (top/bottom/right),
       so the watermark can never affect the card's size or content layout.
       The logo is painted as the card's --accent (set by the theme scope) and
       cut to shape by the logo SVG used as a mask, so it follows the theme
       instead of the color baked into the SVG file. A second mask layer fades
       it out toward the left; the two are intersected. Point --watermark-src at
       the logo per card. mask-size: contain keeps the logo's aspect ratio. */
    position: absolute;
    top: 2rem;
    bottom: 0;
    right: -3rem;
    width: clamp(240px, 42%, 520px);
    z-index: 0;
    opacity: 0.25;
    background-color: var(--accent);
    -webkit-mask-image: var(--watermark-src), linear-gradient(to left, #000 25%, transparent 85%);
    mask-image: var(--watermark-src), linear-gradient(to left, #000 25%, transparent 85%);
    -webkit-mask-repeat: no-repeat, no-repeat;
    mask-repeat: no-repeat, no-repeat;
    -webkit-mask-position: center right, center right;
    mask-position: center right, center right;
    -webkit-mask-size: contain, cover;
    mask-size: contain, cover;
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
    pointer-events: none;
    user-select: none;
}

/* The wordmark itself: big, mono, gradient. */
.library-promo-wordmark {
    margin: 0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 700;
    font-size: clamp(3rem, 9vw, 6rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
    color: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

.library-promo-wordmark .wordmark-part {
    background: linear-gradient(180deg, #fff 30%, rgba(255, 255, 255, 0.55) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.library-promo-wordmark .wordmark-dot {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
    margin: 0 -0.05em;
}

.library-promo-wordmark .wordmark-accent {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.library-promo-description {
    margin: 0 0 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.78);
    max-width: 640px;
}

/* Install block: terminal-style with copy button on the right. */
.library-promo-install {
    display: flex;
    align-items: stretch;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
}

.library-promo-install code {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
    background: none;
    border: none;
    overflow-x: auto;
    white-space: nowrap;
}

.library-promo-install code::before {
    content: '$ ';
    color: var(--accent);
    user-select: none;
    font-weight: 600;
}

/* ============================================================
   Copy-to-clipboard button (reusable)
   ============================================================ */

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 1.1rem;
    /* Muted (darkened) accent fill at rest, full bright accent on hover.
       Mixed with the bg instead of alpha so the fill stays a solid tone. */
    background: color-mix(in oklch, var(--accent) 35%, var(--bg-dark));
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.copy-btn:hover {
    background: var(--accent);
    /* Dark text for contrast on the bright accent fill, like .btn-primary. */
    color: var(--bg-dark);
}

.copy-btn:active {
    background: oklch(from var(--accent) calc(l + 0.06) c h);
}

.copy-btn-icon-copy,
.copy-btn-icon-done {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Copied feedback: the check icon replaces the copy icon. It inherits the
   button's text color — an accent-colored icon would disappear against the
   accent-filled background on hover. */
.copy-btn .copy-btn-icon-done {
    display: none;
}

.copy-btn.is-copied .copy-btn-icon-copy {
    display: none;
}

.copy-btn.is-copied .copy-btn-icon-done {
    display: inline-block;
}

.library-promo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 720px) {
    .library-promo-card {
        padding: 2.5rem 1.75rem;
        border-radius: 20px;
    }
    .library-promo-install code {
        font-size: 0.8rem;
        padding: 0.85rem 1rem;
    }
    .copy-btn .copy-btn-label {
        display: none;
    }
    .library-promo-watermark {
        width: 280px;
        right: -4rem;
        opacity: 0.05;
    }
    .library-promo-header {
        top: 1rem;
        right: 1.75rem;
    }
}
