/*
 * Shared design system for all sections.
 * Pages render inside <article class="page"> and only use the components below,
 * so every section shares the same compact, parallel layout.
 */

:root {
    --accent: #3a6ea5;
    --accent-strong: #2b5788;
    --accent-tint: rgba(58, 110, 165, 0.09);
    --ink: #1f2933;
    --text: #3d4852;
    --muted: #6b7785;
    --line: #e4e8ee;
    --bg: #f6f8fa;
    --surface: #ffffff;
    --gold: #d4900f;
    --gold-tint: rgba(243, 156, 18, 0.12);
    --radius: 10px;
    --sidebar: #22313f;
    --sidebar-hover: #2d3f50;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
}

/* ---------- Page shell ---------- */

.page {
    max-width: 980px;
    margin: 0 auto;
    padding: 40px 40px 64px;
    color: var(--text);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.55;
    text-align: left;
}

.page h1, .page h2, .page h3, .page h4 {
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.01em;
}

.page p, .page ul, .page ol {
    margin: 0;
}

.page ul {
    list-style: none;
    padding: 0;
}

.page ul li {
    padding-left: 0;
}

.page a {
    color: var(--accent);
    text-decoration: none;
}

.page a:hover {
    color: var(--accent-strong) !important;
    text-decoration: underline;
}

.page strong {
    font-weight: 600;
    color: var(--ink);
}

.page i.fa-solid, .page i.fa-brands, .page i.fas, .page i.fab, .page i.far {
    font-style: normal;
}

.page-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.page-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--accent-tint);
    color: var(--accent);
    font-size: 18px;
}

.page-head-text {
    flex: 1;
    min-width: 0;
}

.page-head h2 {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.page-lead {
    color: var(--muted);
    font-size: 14px;
    margin-top: 2px !important;
}

.page-head-actions {
    flex: 0 0 auto;
}

/* ---------- Section labels ---------- */

.page .section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 28px 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.page .section-label:first-child {
    margin-top: 0;
}

.section-label i {
    color: var(--accent);
}

.section-label .count {
    font-weight: 600;
    letter-spacing: 0;
    color: #9aa5b1;
}

.section-label .more {
    margin-left: auto;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 600;
}

/* ---------- Cards & rows ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.card + .card {
    margin-top: 12px;
}

.row-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    color: inherit;
}

.row-item:first-child {
    border-top: none;
}

a.row-item {
    text-decoration: none !important;
    transition: background 0.15s ease;
}

a.row-item:hover {
    background: #f8fafc;
}

a.row-item:hover .row-title {
    color: var(--accent);
}

.row-media {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--accent-tint);
    color: var(--accent);
    font-size: 16px;
    overflow: hidden;
}

.row-media.logo {
    background: #fff;
    border: 1px solid var(--line);
    padding: 4px;
}

.row-media.logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.row-media.gold {
    background: var(--gold-tint);
    color: var(--gold);
}

.row-body {
    flex: 1;
    min-width: 0;
}

.row-title {
    font-weight: 600;
    color: var(--ink);
    line-height: 1.4;
    transition: color 0.15s ease;
}

.row-meta {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.45;
    margin-top: 2px !important;
}

.row-meta + .row-meta {
    margin-top: 4px !important;
}

.row-aside {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 1px;
}

.row-link-icon {
    color: #b0bac5;
    font-size: 12px;
}

a.row-item:hover .row-link-icon {
    color: var(--accent);
}

/* ---------- Badges & chips ---------- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    background: #eef2f6;
    color: #52606d;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

.badge.accent {
    background: var(--accent-tint);
    color: var(--accent);
}

.badge.success {
    background: rgba(39, 174, 96, 0.12);
    color: #1e8a4c;
}

.badge.code {
    min-width: 46px;
    text-align: center;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.5;
    white-space: nowrap;
}

.chip i {
    font-size: 11px;
}

.chip.small {
    padding: 0 7px;
    font-size: 11.5px;
    color: var(--muted);
    background: #f8fafc;
}

/* ---------- Grids & tiles ---------- */

.grid {
    display: grid;
    gap: 12px;
}

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

.tile {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.tile {
    text-decoration: none !important;
}

a.tile:hover {
    border-color: rgba(58, 110, 165, 0.45);
    box-shadow: 0 4px 14px rgba(31, 41, 51, 0.06);
    transform: translateY(-1px);
}

a.tile:hover .row-title {
    color: var(--accent);
}

.stat {
    align-items: center;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

/* ---------- Icon links ---------- */

.icon-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text) !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.icon-link:hover {
    border-color: var(--accent);
    color: var(--accent) !important;
}

.icon-link i {
    font-size: 14px;
    color: var(--accent);
}

.icon-link img {
    width: 14px;
    height: 14px;
}

/* ---------- Collapsible groups ---------- */

.group {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
}

.group > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s ease;
}

.group > summary::-webkit-details-marker {
    display: none;
}

.group > summary:hover {
    background: #f8fafc;
}

.group > summary .row-media {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 14px;
}

.group-title {
    flex: 1;
    font-weight: 600;
    color: var(--ink);
}

.group-chevron {
    color: #9aa5b1;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.group[open] .group-chevron {
    transform: rotate(180deg);
}

.group[open] > summary {
    border-bottom: 1px solid var(--line);
}

.group-list li {
    padding: 9px 16px 9px 62px !important;
    border-top: 1px solid #f0f2f5;
    font-size: 14px;
    line-height: 1.5;
}

.group-list li:first-child {
    border-top: none;
}

/* ---------- Buttons & inputs ---------- */

/* Neutralise the template's skeuomorphic button styles */
.page button,
.mobile-header button {
    background-image: none;
    text-shadow: none;
    box-shadow: none;
    width: auto;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    overflow: visible;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--line) !important;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text) !important;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-ghost:hover {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

.filter-pill:hover {
    border-color: var(--accent) !important;
}

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search {
    position: relative;
    flex: 1 1 220px;
}

.search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa5b1;
    font-size: 13px;
}

.search input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 12px 7px 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
}

.search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-tint);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border: 1px solid var(--line) !important;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text) !important;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-pill .n {
    color: var(--muted);
    font-weight: 600;
}

.filter-pill.off {
    opacity: 0.45;
    filter: grayscale(1);
}

.filter-pill:hover {
    border-color: var(--accent);
}

/* ---------- Notes ---------- */

.note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    background: var(--accent-tint);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.note > i {
    color: var(--accent);
    margin-top: 3px;
}

.empty {
    padding: 24px 16px;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.muted { color: var(--muted); }

/* ---------- Responsive ---------- */

@media screen and (max-width: 900px) {
    .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 768px) {
    .page {
        padding: 20px 16px 48px;
        font-size: 14.5px;
    }

    .page-head h2 {
        font-size: 22px;
    }

    .page-icon {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
        font-size: 15px;
    }

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

    .row-item {
        gap: 12px;
        padding: 12px;
    }

    .row-media {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        font-size: 14px;
    }

    .group-list li {
        padding-left: 16px !important;
    }
}
