/* =========================
   DOCS PAGES
   Shared styling for About, Citations, Documentation, Guides and FAQ
   ========================= */

.docs-page {
    max-width: 1200px;
    margin: 0 auto;
}

.docs-container {
    padding: 3rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 4%);
}

/* Header and introduction */
.docs-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.docs-header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.05;
}

.docs-lead {
    max-width: 75ch;
    margin: 0 0 2.5rem;
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1.8;
}

/* Content sections */
.docs-section {
    margin-bottom: 3rem;
}

.docs-section:last-child {
    margin-bottom: 0;
}

.docs-section h2 {
    margin: 0 0 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-gold);
    color: var(--brand-primary);
    font-size: 2rem;
    line-height: 1.25;
}

.docs-section h3 {
    margin: 2rem 0 1rem;
    color: var(--brand-brown);
    font-size: 1.35rem;
    line-height: 1.35;
}

.docs-section p {
    margin: 0 0 1.25rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.9;
}

.docs-section ul,
.docs-section ol {
    margin: 0 0 1.5rem;
    padding-left: 1.75rem;
}

.docs-section li {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Callouts */
.docs-note {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    background: color-mix(in srgb, var(--brand-gold) 10%, var(--background));
    border: 1px solid color-mix(in srgb, var(--brand-gold) 35%, var(--border));
    border-left: 5px solid var(--brand-gold);
    border-radius: 12px;
}

.docs-link-card p {
    margin: 0;
}

.docs-note p:last-child {
    margin-bottom: 0;
}

.docs-note-title {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--brand-primary);
    font-weight: 700;
}

/* Citation cards */
.citation-card {
    margin-bottom: 2rem;
    padding: 2rem;
    background: color-mix(in srgb, var(--brand-brown) 4%, var(--background));
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.citation-card h3 {
    margin: 0 0 1rem;
    color: var(--brand-primary);
}

.citation-reference {
    margin: 0 0 1.25rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.citation-reference strong {
    color: var(--text-primary);
}

.citation-doi {
    display: inline-block;
    margin-top: 0.5rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* Expandable details and BibTeX; scoped to docs pages */
.docs-page details {
    margin-top: 1.25rem;
}

.docs-page details summary {
    color: var(--brand-primary);
    cursor: pointer;
    font-weight: 600;
    user-select: none;
}

.docs-page a:focus-visible,
.docs-page summary:focus-visible {
    outline: 3px solid var(--brand-gold);
    outline-offset: 3px;
    border-radius: 3px;
}

.docs-page details[open] summary {
    margin-bottom: 1rem;
}

.docs-page details pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    background: color-mix(in srgb, var(--text-primary) 4%, var(--background));
    border: 1px solid var(--border);
    border-radius: 12px;
}

.docs-page details code {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Documentation link cards */
.docs-link-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.docs-link-card {
    display: block;
    padding: 1.25rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.docs-link-card h3 {
    margin: 0 0 0.5rem;
    color: var(--brand-primary);
}

/* Tables */
.table-responsive {
    max-width: 100%;
    margin: 1.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.docs-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    border: 1px solid var(--border);
}

.docs-table caption {
    padding: 0 0 0.75rem;
    color: var(--text-secondary);
    text-align: left;
}

.docs-table th {
    background: var(--brand-primary);
    color: var(--background);
}

.docs-table th,
.docs-table td {
    padding: 1rem;
    border: 1px solid var(--border);
    text-align: left;
}

.docs-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--text-primary) 4%, var(--background));
}

/* Optional table cell alignment for availability marks */
.docs-table td:not(:first-child) {
    text-align: center;
}

/* Optional table of contents */
.docs-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 2rem;
}

.docs-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
    padding: 1.5rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.docs-sidebar h3 {
    margin-top: 0;
}

.docs-sidebar ul {
    margin: 0;
    padding-left: 1rem;
}

.docs-sidebar li {
    margin-bottom: 0.5rem;
}

/* Visible keyboard focus */
@media (hover: hover) and (pointer: fine) {
    .citation-card:hover,
    .docs-link-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 30px rgb(0 0 0 / 8%);
    }
}

@media (width <= 992px) {
    .docs-layout {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        position: static;
    }
}

@media (width <= 768px) {
    .docs-container {
        padding: 2rem;
        border-radius: 18px;
    }

    .docs-header {
        margin-bottom: 2rem;
        padding-bottom: 1.5rem;
    }

    .docs-header h1 {
        font-size: 2.5rem;
    }

    .docs-lead {
        font-size: 1.1rem;
    }

    .docs-section h2 {
        font-size: 1.6rem;
    }

    .citation-card {
        padding: 1.5rem;
    }
}

@media (width <= 576px) {
    .docs-container {
        padding: 1.25rem;
        border-radius: 14px;
    }

    .docs-header h1 {
        font-size: 2rem;
    }

    .docs-table th,
    .docs-table td {
        padding: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .citation-card,
    .docs-link-card {
        scroll-behavior: auto;
        transition: none;
    }

    .citation-card:hover,
    .docs-link-card:hover {
        transform: none;
    }
}
