:root {
    --docs-sidebar-width: 280px;
    --docs-content-width: 920px;
    --docs-surface: #ffffff;
    --docs-surface-alt: #f8fafc;
    --docs-border: #e5e7eb;
    --docs-text: #111827;
    --docs-text-muted: #6b7280;
    --docs-primary: #4a7bff;
    --docs-primary-soft: rgba(74, 123, 255, 0.1);
    --docs-shadow:
        0 1px 3px rgba(15, 23, 42, 0.08), 0 10px 24px rgba(15, 23, 42, 0.06);
    --docs-radius: 20px;
    --docs-radius-sm: 12px;
}

html {
    scroll-behavior: smooth;
}

body.docs-page {
    background: linear-gradient(
        180deg,
        #f8fbff 0%,
        #f8fafc 180px,
        #f8fafc 100%
    );
    color: var(--docs-text);
}

body.docs-page.doc-lightbox-open {
    overflow: hidden;
}

.docs-page main {
    min-height: calc(100vh - 80px);
}

.docs-hero {
    padding: 4.5rem 0 3rem;
    border-bottom: 1px solid var(--docs-border);
}

.docs-hero-inner {
    max-width: 860px;
}

.docs-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: var(--docs-primary-soft);
    color: var(--docs-primary);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 1rem;
}

.docs-hero h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1.05;
    margin-bottom: 1rem;
}

.docs-hero p {
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--docs-text-muted);
    max-width: 760px;
}

.docs-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem;
    margin-top: 1.75rem;
}

.docs-layout {
    display: grid;
    grid-template-columns: minmax(220px, var(--docs-sidebar-width)) minmax(
            0,
            1fr
        );
    gap: 2rem;
    padding: 2rem 0 4rem;
    align-items: start;
}

.docs-sidebar {
    position: sticky;
    top: 96px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    padding: 1.25rem;
    box-shadow: var(--docs-shadow);
}

.docs-sidebar-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--docs-text-muted);
    margin-bottom: 0.9rem;
}

.docs-sidebar nav,
.docs-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.docs-sidebar a,
.docs-nav a {
    display: block;
    padding: 0.72rem 0.85rem;
    border-radius: 10px;
    color: var(--docs-text);
    text-decoration: none;
    font-weight: 500;
    line-height: 1.35;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.docs-sidebar a:hover,
.docs-sidebar a:focus-visible,
.docs-nav a:hover,
.docs-nav a:focus-visible {
    background: var(--docs-primary-soft);
    color: var(--docs-primary);
    transform: translateX(2px);
}

.docs-sidebar a.active,
.docs-nav a.active {
    background: var(--docs-primary-soft);
    color: var(--docs-primary);
}

.docs-sidebar-note {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--docs-border);
    color: var(--docs-text-muted);
    font-size: 0.925rem;
    line-height: 1.65;
}

.docs-content {
    min-width: 0;
    max-width: var(--docs-content-width);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.doc-section {
    background: var(--docs-surface);
    border: 1px solid var(--docs-border);
    border-radius: var(--docs-radius);
    box-shadow: var(--docs-shadow);
    padding: 2rem;
    scroll-margin-top: 110px;
}

.doc-section + .doc-section {
    margin-top: 0;
}

.doc-section h2 {
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    line-height: 1.15;
    margin-bottom: 0.85rem;
}

.doc-section h3 {
    font-size: 1.15rem;
    line-height: 1.3;
    margin-bottom: 0.7rem;
}

.doc-section p {
    color: var(--docs-text-muted);
    line-height: 1.8;
}

.doc-section p + p {
    margin-top: 0.9rem;
}

.doc-section ul,
.doc-section ol {
    margin: 1rem 0 0 1.2rem;
    color: var(--docs-text-muted);
}

.doc-section li + li {
    margin-top: 0.55rem;
}

.doc-section strong {
    color: var(--docs-text);
}

.doc-section a {
    color: var(--docs-primary);
    text-decoration: underline;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.doc-grid.doc-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--docs-border);
    border-radius: 18px;
    padding: 1.25rem;
}

.doc-card p:last-child,
.doc-card ul:last-child,
.doc-card ol:last-child {
    margin-bottom: 0;
}

.doc-callout {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px solid rgba(74, 123, 255, 0.18);
    background: rgba(74, 123, 255, 0.08);
    color: var(--docs-text-muted);
}

.doc-callout strong {
    color: var(--docs-text);
}

.doc-callout-warning {
    border-color: rgba(245, 158, 11, 0.22);
    background: rgba(245, 158, 11, 0.1);
}

.doc-callout-success {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.1);
}

.doc-callout-danger {
    border-color: rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.1);
}

.doc-meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1rem;
}

.doc-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    background: var(--docs-surface-alt);
    border: 1px solid var(--docs-border);
    color: var(--docs-text);
    font-size: 0.9rem;
    font-weight: 600;
}

.doc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    vertical-align: middle;
    margin-left: 0.4rem;
}

.doc-badge-pro {
    color: #4338ca;
    background: rgba(99, 102, 241, 0.12);
}

.doc-badge-free {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
}

.doc-steps {
    list-style: none;
    margin: 1.4rem 0 0;
    padding: 0;
    counter-reset: docs-steps;
    display: grid;
    gap: 1rem;
}

.doc-steps li {
    position: relative;
    padding-left: 3.25rem;
    min-height: 2.4rem;
    color: var(--docs-text-muted);
    line-height: 1.7;
}

.doc-steps li::before {
    counter-increment: docs-steps;
    content: counter(docs-steps);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    background: var(--docs-primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    font-weight: 800;
}

.doc-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.doc-shortcut {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px solid var(--docs-border);
    background: var(--docs-surface-alt);
}

.doc-shortcut h3 {
    margin-bottom: 0.4rem;
}

.doc-shortcut p {
    margin: 0;
}

.doc-image-block {
    margin-top: 1.25rem;
    border: 1px solid var(--docs-border);
    border-radius: 18px;
    overflow: hidden;
    background: var(--docs-surface);
}

.doc-gallery {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    background:
        radial-gradient(
            circle at top left,
            rgba(74, 123, 255, 0.08),
            transparent 28%
        ),
        radial-gradient(
            circle at bottom right,
            rgba(99, 102, 241, 0.08),
            transparent 24%
        ),
        linear-gradient(180deg, #f8fbff 0%, #f8fafc 100%);
}

.doc-gallery-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.doc-gallery-item {
    position: relative;
    display: block;
    width: 100%;
    height: 340px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    cursor: zoom-in;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.doc-gallery-item:hover,
.doc-gallery-item:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(74, 123, 255, 0.45);
    box-shadow:
        0 14px 30px rgba(15, 23, 42, 0.12),
        0 0 0 4px rgba(74, 123, 255, 0.12);
}

.doc-gallery-item:focus-visible {
    outline: none;
}

.doc-gallery-item::after {
    content: "Click to enlarge";
    position: absolute;
    right: 0.8rem;
    bottom: 0.8rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.74);
    color: white;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    pointer-events: none;
}

.doc-gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.doc-image-placeholder {
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background:
        radial-gradient(
            circle at top left,
            rgba(74, 123, 255, 0.16),
            transparent 28%
        ),
        radial-gradient(
            circle at bottom right,
            rgba(99, 102, 241, 0.14),
            transparent 24%
        ),
        linear-gradient(135deg, #111827 0%, #0f172a 100%);
    text-align: center;
}

.doc-image-placeholder span {
    display: inline-block;
    max-width: 720px;
    color: #f9fafb;
    font-size: clamp(1.1rem, 2.4vw, 1.8rem);
    line-height: 1.5;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.doc-image-caption {
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--docs-border);
    background: white;
    color: var(--docs-text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

.doc-lightbox[hidden] {
    display: none;
}

.doc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.doc-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
}

.doc-lightbox-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 1.5rem 5rem;
}

.doc-lightbox-figure {
    width: min(1200px, 100%);
    margin: 0;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #0f172a;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.doc-lightbox-image {
    display: block;
    width: 100%;
    max-height: calc(100vh - 10rem);
    object-fit: contain;
    background: #0f172a;
}

.doc-lightbox-caption {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: rgba(15, 23, 42, 0.96);
    color: #e5e7eb;
    font-size: 0.95rem;
    line-height: 1.6;
}

.doc-lightbox-counter {
    color: #93c5fd;
    font-weight: 700;
    white-space: nowrap;
}

.doc-lightbox-caption-text {
    flex: 1;
}

.doc-lightbox-close,
.doc-lightbox-nav {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        opacity 0.2s ease;
}

.doc-lightbox-close:hover,
.doc-lightbox-close:focus-visible {
    transform: scale(1.04);
    background: rgba(30, 41, 59, 0.96);
}

.doc-lightbox-nav:hover,
.doc-lightbox-nav:focus-visible {
    transform: translateY(-50%) scale(1.04);
    background: rgba(30, 41, 59, 0.96);
}

.doc-lightbox-close:focus-visible,
.doc-lightbox-nav:focus-visible {
    outline: none;
}

.doc-lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.8rem;
    line-height: 1;
}

.doc-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    line-height: 1;
}

.doc-lightbox-prev {
    left: 1.5rem;
}

.doc-lightbox-next {
    right: 1.5rem;
}

.doc-lightbox-nav[disabled] {
    opacity: 0.35;
    cursor: default;
}

.doc-lightbox-nav[disabled]:hover,
.doc-lightbox-nav[disabled]:focus-visible {
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.78);
}

.docs-footer-note {
    padding: 2rem 0 3rem;
    text-align: center;
    color: var(--docs-text-muted);
    font-size: 0.95rem;
}

.docs-footer-note a {
    color: var(--docs-primary);
}

.docs-page kbd {
    display: inline-block;
    padding: 0.14rem 0.45rem;
    border-radius: 8px;
    border: 1px solid var(--docs-border);
    border-bottom-width: 2px;
    background: white;
    color: var(--docs-text);
    font-size: 0.86rem;
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    line-height: 1.2;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

@media (max-width: 1024px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
    }

    .docs-content {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .docs-hero {
        padding: 3.2rem 0 2.4rem;
    }

    .doc-section {
        padding: 1.35rem;
        border-radius: 18px;
    }

    .doc-grid,
    .doc-grid.doc-grid-3,
    .mini-grid,
    .doc-shortcuts {
        grid-template-columns: 1fr;
    }

    .doc-gallery-grid-2 {
        grid-template-columns: 1fr;
    }

    .doc-gallery-item {
        height: 240px;
    }

    .doc-image-placeholder {
        min-height: 240px;
        padding: 1.5rem;
    }

    .doc-gallery-item img {
        height: 100%;
    }

    .doc-gallery-item::after {
        right: 0.65rem;
        bottom: 0.65rem;
    }

    .doc-lightbox-dialog {
        padding: 1rem 1.25rem 1.25rem;
    }

    .doc-lightbox-image {
        max-height: calc(100vh - 8.5rem);
    }

    .doc-lightbox-close,
    .doc-lightbox-nav {
        width: 2.75rem;
        height: 2.75rem;
    }

    .doc-lightbox-close {
        top: 0.85rem;
        right: 0.85rem;
    }

    .doc-lightbox-prev {
        left: 0.85rem;
    }

    .doc-lightbox-next {
        right: 0.85rem;
    }

    .docs-sidebar {
        padding: 1rem;
    }

    .nav-links.active {
        display: flex;
        position: absolute;
        top: calc(100% + 0.75rem);
        right: 1rem;
        left: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
        background: white;
        border: 1px solid var(--docs-border);
        border-radius: 16px;
        box-shadow: var(--docs-shadow);
    }

    .nav {
        position: relative;
    }
}

@media (max-width: 480px) {
    .docs-hero p,
    .doc-section p,
    .doc-section li {
        font-size: 0.98rem;
    }

    .doc-image-caption,
    .docs-sidebar-note,
    .docs-footer-note,
    .doc-lightbox-caption {
        font-size: 0.9rem;
    }

    .doc-lightbox-caption {
        flex-direction: column;
    }
}
