/* Shared styles for Bern library documentation pages (hub + per-library pages). */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #5b5f97;
    --primary-dark: #4a4d7a;
    --accent: #7b9fc4;
    --bg: #ffffff;
    --text: #333;
    --text-light: #666;
    --border: #ddd;
    --code-bg: #f8f8f8;
    --sidebar-bg: #f9fafb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
}

header {
    background: white;
    padding: 1rem 0;
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

nav {
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
    position: relative;
}

nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.2s ease;
}

nav a:hover {
    color: var(--primary);
}

nav a:hover::after {
    width: 100%;
}

.layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    width: 280px;
    padding: 2rem 1.5rem;
    position: sticky;
    top: 73px;
    height: calc(100vh - 73px);
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

.sidebar h3 {
    color: var(--primary-dark);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1.5rem 0 0.75rem;
}

.sidebar h3:first-child {
    margin-top: 0;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin: 0.4rem 0;
}

.sidebar a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    display: block;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar a:hover {
    color: var(--primary);
    background: rgba(91, 95, 151, 0.1);
}

.sidebar .back-link {
    color: var(--primary);
    font-weight: 600;
}

.container {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 1000px;
}

.page-title {
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
}

.breadcrumb {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.doc-section {
    margin: 3rem 0;
}

.doc-section h2 {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.doc-section h3 {
    color: var(--primary-dark);
    font-size: 1.3rem;
    margin: 2rem 0 1rem;
}

.doc-section h4 {
    color: var(--primary-dark);
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem;
}

.doc-section p {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.doc-section ul {
    margin: 1rem 0 1rem 2rem;
    color: var(--text-light);
}

.doc-section li {
    margin: 0.5rem 0;
}

.doc-section a {
    color: var(--primary);
    font-weight: 700;
}

.doc-section a:hover {
    text-decoration: underline;
}

code {
    background: var(--code-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-dark);
}

.simple-code {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre;
}

.note {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.note strong {
    color: #f57c00;
}

.example-box {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-box h4 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.function-sig {
    background: #f4f4f7;
    border-left: 3px solid var(--accent);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
}

.lib-table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
    font-size: 0.95rem;
}

.lib-table th,
.lib-table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.85rem;
    text-align: left;
}

.lib-table th {
    background: #f4f4f7;
    color: var(--primary);
}

.v2badge {
    display: inline-block; background: var(--primary); color: #fff;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em;
    text-transform: uppercase; padding: 0.22rem 0.65rem;
    border-radius: 0; vertical-align: middle; margin-left: 0.5rem;
}

.vendor-badge {
    display: inline-block; background: var(--accent); color: #fff;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em;
    text-transform: uppercase; padding: 0.22rem 0.65rem;
    vertical-align: middle; margin-left: 0.5rem;
}

/* Library hub grid */
.lib-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.lib-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.4rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    background: #fff;
}

.lib-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(91, 95, 151, 0.12);
    transform: translateY(-2px);
}

.lib-card h3 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
    font-family: 'Fira Code', monospace;
}

.lib-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin: 0;
}

.lib-card .import-line {
    display: inline-block;
    margin-top: 0.75rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--primary-dark);
    background: var(--code-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.hub-group-title {
    color: var(--primary-dark);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 2.5rem 0 0.5rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 0.85rem;
        padding: 0 1rem;
    }
    .logo img {
        width: 64px !important;
        margin-top: 0 !important;
    }
    nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1.1rem;
    }
    .container {
        padding: 2rem 1rem;
    }
    .page-title {
        font-size: 1.9rem;
    }
    .lib-grid {
        grid-template-columns: 1fr;
    }
    .lib-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
