/* ==========================================================================
   Docs Theme — Documentation section styles
   Built on top of the existing --htl-* design tokens (custom-properties.css)
   ========================================================================== */

/* ---------- Hero badge (used on the docs landing/front page) ---------- */
.hero-home__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-family: var(--htl-font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--htl-fg);
}

[data-theme="light"] .hero-home__badge {
    background: color-mix(in oklab, var(--htl-card) 90%, transparent);
    border: 1px solid var(--htl-border);
    color: var(--htl-heading-color);
}

.hero-home__badge-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: var(--htl-primary);
}

/* ---------- Layout shell: sidebar | content | table of contents ---------- */
.docs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
}

@media (min-width: 1100px) {
    .docs-layout {
        grid-template-columns: 260px minmax(0, 1fr) 240px;
    }
}

.docs-layout__sidebar {
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 0.5rem;
}

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

.docs-layout__toc {
    position: sticky;
    top: 96px;
    display: none;
}

@media (min-width: 1100px) {
    .docs-layout__toc {
        display: block;
    }
}

/* Mobile sidebar toggle button (hidden on desktop) */
.docs-mobile-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--htl-radius-md);
    border: 1px solid var(--htl-border);
    background: var(--htl-card);
    color: var(--htl-fg);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

@media (max-width: 899px) {
    .docs-mobile-toggle {
        display: flex;
    }

    .docs-layout__sidebar {
        position: fixed;
        inset: 0 25% 0 0;
        z-index: 60;
        max-height: none;
        padding: 1.5rem;
        background: var(--htl-bg);
        border-right: 1px solid var(--htl-border);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
    }

    .docs-layout__sidebar.is-open {
        transform: translateX(0);
    }
}

/* ---------- Sidebar tree ---------- */
.docs-sidebar-nav {
    font-size: 0.875rem;
}

.docs-tree,
.docs-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.docs-tree ul {
    padding-left: 1rem;
    display: none;
}

.docs-tree__item.is-open > ul {
    display: block;
}

.docs-tree__item {
    position: relative;
    margin-bottom: 0.125rem;
}

.docs-tree__link {
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: var(--htl-radius-sm);
    color: var(--htl-muted-fg);
    text-decoration: none;
    line-height: 1.4;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.docs-tree__link:hover {
    background: var(--htl-muted);
    color: var(--htl-fg);
}

.docs-tree__item.is-active > .docs-tree__link {
    background: color-mix(in oklab, var(--htl-primary) 15%, transparent);
    color: var(--htl-primary);
    font-weight: 600;
}

.docs-tree__toggle {
    position: absolute;
    right: 0.25rem;
    top: 0.4rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--htl-muted-fg);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.docs-tree__item.is-open > .docs-tree__toggle {
    transform: rotate(90deg);
}

/* ---------- Breadcrumbs ---------- */
.docs-breadcrumbs {
    margin-bottom: 1.5rem;
    font-size: 0.8125rem;
}

.docs-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.4rem;
    color: var(--htl-muted-fg);
}

.docs-breadcrumbs li:not(:last-child)::after {
    content: "/";
    margin-left: 0.4rem;
    opacity: 0.5;
}

.docs-breadcrumbs a {
    color: var(--htl-muted-fg);
    text-decoration: none;
}

.docs-breadcrumbs a:hover {
    color: var(--htl-primary);
}

.docs-breadcrumbs li[aria-current="page"] {
    color: var(--htl-fg);
    font-weight: 500;
}

/* ---------- Search box ---------- */
.docs-search {
    position: relative;
    margin-bottom: 1.5rem;
}

.docs-search__icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--htl-muted-fg);
    pointer-events: none;
}

.docs-search__input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.6rem;
    border-radius: var(--htl-radius-md);
    border: 1px solid var(--htl-border);
    background: var(--htl-card);
    color: var(--htl-fg);
    font-family: var(--htl-font-sans);
    font-size: 0.9375rem;
}

.docs-search__input:focus {
    outline: none;
    border-color: var(--htl-primary);
}

.docs-search__results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--htl-popover);
    border: 1px solid var(--htl-border);
    border-radius: var(--htl-radius-md);
    box-shadow: 0 12px 32px oklch(0 0 0 / 25%);
    max-height: 360px;
    overflow-y: auto;
}

.docs-search__result {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid var(--htl-border);
}

.docs-search__result:last-child {
    border-bottom: none;
}

.docs-search__result:hover {
    background: var(--htl-muted);
}

.docs-search__result-title {
    color: var(--htl-fg);
    font-weight: 600;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.2rem;
}

.docs-search__result-excerpt {
    color: var(--htl-muted-fg);
    font-size: 0.8125rem;
    display: block;
}

.docs-search__empty {
    padding: 1rem;
    color: var(--htl-muted-fg);
    font-size: 0.875rem;
    text-align: center;
}

/* ---------- Main doc content typography ---------- */
.docs-content h2 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    scroll-margin-top: 100px;
}

.docs-content h3 {
    font-size: 1.15rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    scroll-margin-top: 100px;
}

.docs-content p {
    color: var(--htl-muted-fg);
    line-height: 1.75;
    margin-bottom: 1.1rem;
}

.docs-content ul,
.docs-content ol {
    color: var(--htl-muted-fg);
    line-height: 1.75;
    margin-bottom: 1.1rem;
    padding-left: 1.5rem;
}

.docs-content code {
    font-family: var(--htl-font-mono);
    background: var(--htl-muted);
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
    font-size: 0.875em;
}

.docs-content pre {
    position: relative;
    background: var(--htl-card);
    border: 1px solid var(--htl-border);
    border-radius: var(--htl-radius-md);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.docs-content pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
}

.docs-copy-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-family: var(--htl-font-sans);
    font-weight: 500;
    color: var(--htl-muted-fg);
    background: var(--htl-muted);
    border: 1px solid var(--htl-border);
    border-radius: var(--htl-radius-sm);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.docs-copy-btn:hover {
    color: var(--htl-fg);
}

.docs-copy-btn.is-copied {
    color: var(--htl-primary);
}

/* ---------- Callout boxes ---------- */
.docs-callout {
    border-radius: var(--htl-radius-md);
    border: 1px solid var(--htl-border);
    border-left-width: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: var(--htl-card);
}

.docs-callout p:last-child {
    margin-bottom: 0;
}

.docs-callout--info { border-left-color: var(--htl-primary); }
.docs-callout--warning { border-left-color: var(--htl-gold); }
.docs-callout--danger { border-left-color: var(--htl-destructive); }
.docs-callout--success { border-left-color: oklch(0.6 0.15 150); }

/* ---------- Table of contents (right rail) ---------- */
.docs-toc {
    font-size: 0.8125rem;
    border-left: 1px solid var(--htl-border);
    padding-left: 1rem;
}

.docs-toc__title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.6875rem;
    color: var(--htl-muted-fg);
    margin-bottom: 0.75rem;
}

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

.docs-toc__item {
    margin-bottom: 0.5rem;
}

.docs-toc__item--h3 {
    padding-left: 0.85rem;
}

.docs-toc__item a {
    color: var(--htl-muted-fg);
    text-decoration: none;
    line-height: 1.4;
    display: inline-block;
}

.docs-toc__item a:hover,
.docs-toc__item a.is-active {
    color: var(--htl-primary);
}

/* ---------- Meta bar (last updated / needs update flag) ---------- */
.docs-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--htl-muted-fg);
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--htl-border);
}

.docs-meta-bar__flag {
    color: var(--htl-gold);
    font-weight: 600;
}

/* ---------- Prev / next navigation ---------- */
.docs-prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
}

.docs-prev-next__link {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 1.25rem;
    border-radius: var(--htl-radius-md);
    border: 1px solid var(--htl-border);
    background: var(--htl-card);
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.docs-prev-next__link:hover {
    border-color: var(--htl-primary);
}

.docs-prev-next__link--next {
    text-align: right;
    align-items: flex-end;
}

.docs-prev-next__label {
    font-size: 0.75rem;
    color: var(--htl-muted-fg);
}

.docs-prev-next__title {
    font-weight: 600;
    color: var(--htl-fg);
    font-size: 0.9375rem;
}

@media (max-width: 640px) {
    .docs-prev-next {
        grid-template-columns: 1fr;
    }
}

/* ---------- Related docs ---------- */
.docs-related {
    margin-top: 2.5rem;
    padding: 1.5rem;
    border-radius: var(--htl-radius-md);
    background: var(--htl-muted);
}

.docs-related__title {
    font-weight: 700;
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

.docs-related__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.docs-related__list a {
    color: var(--htl-primary);
    text-decoration: none;
    font-size: 0.875rem;
}

.docs-related__list a:hover {
    text-decoration: underline;
}

/* ---------- Feedback widget ---------- */
.docs-feedback {
    margin-top: 2.5rem;
    padding: 1.5rem;
    text-align: center;
    border-radius: var(--htl-radius-md);
    border: 1px solid var(--htl-border);
    background: var(--htl-card);
}

.docs-feedback__question {
    font-weight: 600;
    margin-bottom: 1rem;
}

.docs-feedback__buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.docs-feedback__btn {
    padding: 0.5rem 1.25rem;
    border-radius: var(--htl-radius-sm);
    border: 1px solid var(--htl-border);
    background: var(--htl-muted);
    color: var(--htl-fg);
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.docs-feedback__btn:hover {
    border-color: var(--htl-primary);
}

.docs-feedback__btn.is-selected {
    border-color: var(--htl-primary);
    color: var(--htl-primary);
}

.docs-feedback__thanks {
    margin-top: 0.75rem;
    color: var(--htl-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

/* ---------- Docs archive / landing page ---------- */
.docs-hero {
    position: relative;
    padding: 5rem 0 3rem;
    overflow: visible;
}

.docs-category-card {
    display: block;
    padding: 1.75rem;
    text-decoration: none;
    height: 100%;
}

.docs-category-card__icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--htl-radius-md);
    background: linear-gradient(135deg, color-mix(in oklab, var(--htl-primary) 30%, transparent), color-mix(in oklab, var(--htl-gold) 20%, transparent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
}

.docs-category-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--htl-fg);
    margin-bottom: 0.4rem;
}

.docs-category-card__count {
    font-size: 0.8125rem;
    color: var(--htl-muted-fg);
}

/* ---------- Mobile sidebar overlay ---------- */
.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: oklch(0 0 0 / 50%);
    z-index: 55;
}

.docs-sidebar-overlay.is-visible {
    display: block;
}

.docs-single .docs-layout,
.docs-taxonomy .docs-layout {
    grid-template-columns: 260px minmax(0, 1fr) !important;
}

/* ---------- Doc Sidebar Badges & CTAs ---------- */
.doc-sidebar__plugin-card {
    padding: 1rem;
    border-radius: var(--htl-radius);
    background: var(--htl-card);
    border: 1px solid var(--htl-border);
    margin-bottom: 1.5rem;
}

.doc-sidebar__plugin-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.doc-sidebar__plugin-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--htl-muted);
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.doc-sidebar__plugin-icon img {
    max-width: 100%;
    height: auto;
}

.doc-sidebar__plugin-name {
    font-weight: 700;
    color: var(--htl-fg);
    font-size: 0.9375rem;
}

.plugin-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.plugin-badge--free {
    background: color-mix(in oklab, var(--htl-gold) 15%, transparent);
    color: var(--htl-gold);
    border: 1px solid color-mix(in oklab, var(--htl-gold) 30%, transparent);
}

.plugin-badge--pro,
.plugin-badge--premium {
    background: color-mix(in oklab, var(--htl-primary) 15%, transparent);
    color: var(--htl-primary);
    border: 1px solid color-mix(in oklab, var(--htl-primary) 30%, transparent);
}

.plugin-badge--addon {
    background: color-mix(in oklab, #5b7bff 15%, transparent);
    color: #5b7bff;
    border: 1px solid color-mix(in oklab, #5b7bff 30%, transparent);
}

.plugin-badge--theme {
    background: color-mix(in oklab, oklch(0.65 0.2 300) 15%, transparent);
    color: oklch(0.65 0.2 300);
    border: 1px solid color-mix(in oklab, oklch(0.65 0.2 300) 30%, transparent);
}

.doc-sidebar__cta {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--htl-card);
    border-radius: var(--htl-radius);
    border: 1px solid var(--htl-border);
}

.doc-sidebar__cta-title {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--htl-muted-fg);
    margin-bottom: 0.75rem;
    margin-top: 0;
}

.doc-sidebar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    border-radius: var(--htl-radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
}

.doc-sidebar__btn--free {
    background: var(--htl-muted);
    color: var(--htl-fg);
    border: 1px solid var(--htl-border);
}

.doc-sidebar__btn--free:hover {
    background: color-mix(in oklab, var(--htl-muted) 80%, var(--htl-fg));
}

.doc-sidebar__btn--pro {
    background: linear-gradient(135deg, var(--htl-primary), #5b7bff);
    color: var(--htl-primary-fg);
    border: none;
}

.doc-sidebar__btn--pro:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ---------- Doc Upsell Banner ---------- */
.doc-upsell {
    margin: 3rem 0;
    padding: 2rem;
    border-radius: var(--htl-radius);
    background: linear-gradient(135deg, color-mix(in oklab, var(--htl-primary) 10%, transparent), color-mix(in oklab, var(--htl-gold) 8%, transparent));
    border: 1px solid var(--htl-border);
    position: relative;
    overflow: hidden;
}

.doc-upsell::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, color-mix(in oklab, var(--htl-primary) 40%, transparent), color-mix(in oklab, var(--htl-gold) 30%, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.doc-upsell__content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.doc-upsell__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--htl-fg);
    margin-bottom: 0.5rem;
    margin-top: 0;
}

.doc-upsell__desc {
    font-size: 0.9375rem;
    color: var(--htl-muted-fg);
    margin: 0;
}

.doc-upsell__btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--htl-radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--htl-primary-fg);
    background: linear-gradient(90deg, var(--htl-primary), oklch(0.65 0.2 300));
    transition: all 0.2s ease;
    text-decoration: none;
}

.doc-upsell__btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}


