/* --- References (the Loup books, agent skills) -----------------------
   Long-form reading on the Aurora Dark public site. Builds on
   aurora.css; listing colours come from references-highlight.css,
   which build_references.py generates. */

:root {
    --ref-text: #dbe3f0;
    --ref-muted: #9fb0ca;
    --ref-heading: #ffffff;
    --ref-link: #8cc4ff;
    --ref-rule: rgba(255, 255, 255, 0.10);
    --ref-surface: rgba(255, 255, 255, 0.04);
    --ref-code-bg: #0d1117;
    --ref-bad: #ff6b6b;
    --ref-bad-bg: rgba(255, 107, 107, 0.12);
    --ref-warn: #f0b429;
    --ref-warn-bg: rgba(240, 180, 41, 0.12);
    --ref-quiet: #8b98ad;
    --ref-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    --ref-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Layout --- */
.ref-layout {
    position: relative;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 48px;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 48px 72px 48px;
    box-sizing: border-box;
}

.ref-main {
    min-width: 0;
    max-width: 800px;
}

.ref-last-section {
    padding-bottom: 72px;
}

/* --- Sidebar --- */
.ref-sidebar {
    position: sticky;
    top: 16px;
    align-self: start;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.45;
    padding-right: 8px;
}

.ref-toc-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
}

.ref-toc-title a {
    color: var(--ref-heading);
}

.ref-toc-subtitle {
    color: var(--ref-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 18px 0 6px 0;
}

.ref-toc,
.ref-toc-books ul,
.ref-toc-headings {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ref-toc > li {
    margin: 0;
}

.ref-toc a,
.ref-toc-books a {
    display: block;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--ref-muted);
}

.ref-toc a:hover,
.ref-toc-books a:hover {
    color: #ffffff;
    background: var(--ref-surface);
}

.ref-toc li.is-current > a {
    color: #ffffff;
    background: rgba(46, 155, 255, 0.16);
}

.ref-toc-headings {
    margin: 2px 0 6px 12px;
    border-left: 1px solid var(--ref-rule);
}

.ref-toc-headings a {
    font-size: 13px;
    padding: 3px 10px;
}

.ref-toc--files a {
    font-family: var(--ref-mono);
    font-size: 13px;
}

.ref-mobile-toc {
    display: none;
}

/* --- Breadcrumbs, pager, tools --- */
.ref-breadcrumbs {
    color: var(--ref-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.ref-breadcrumbs a {
    color: var(--ref-muted);
}

.ref-pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--ref-rule);
}

.ref-pager-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 48%;
    padding: 12px 16px;
    border: 1px solid var(--ref-rule);
    border-radius: 10px;
}

.ref-pager-link--next {
    text-align: right;
    margin-left: auto;
}

.ref-pager-direction {
    color: var(--ref-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ref-pager-title {
    color: #ffffff;
    font-weight: 600;
}

.ref-page-tools {
    margin-top: 24px;
    font-size: 13px;
}

.ref-page-tools a {
    color: var(--ref-muted);
}

/* --- Cards --- */
.ref-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.ref-card-grid--inline {
    margin-top: 32px;
}

.ref-card {
    display: block;
    color: inherit;
    transition: border-color 0.15s ease;
}

.ref-card:hover {
    border-color: rgba(124, 196, 255, 0.5);
    color: inherit;
}

.ref-card-meta {
    color: var(--ref-muted);
    font-size: 12px;
    margin-top: 12px;
}

/* --- Article typography --- */
.ref-article {
    font-family: var(--ref-body);
    color: var(--ref-text);
    font-size: 16.5px;
    line-height: 1.72;
    overflow-wrap: break-word;
}

.ref-article h1,
.ref-article h2,
.ref-article h3,
.ref-article h4 {
    font-family: 'Sora', 'Helvetica Neue', Arial, sans-serif;
    color: var(--ref-heading);
    line-height: 1.25;
    scroll-margin-top: 16px;
}

.ref-article h1 {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 8px 0 20px 0;
}

.ref-article h2 {
    font-size: 25px;
    font-weight: 700;
    margin: 44px 0 14px 0;
    padding-top: 12px;
    border-top: 1px solid var(--ref-rule);
}

.ref-article h3 {
    font-size: 19px;
    font-weight: 700;
    margin: 30px 0 10px 0;
}

.ref-article h4 {
    font-size: 16px;
    margin: 24px 0 8px 0;
}

.ref-article p,
.ref-article ul,
.ref-article ol,
.ref-article blockquote,
.ref-article table {
    margin: 0 0 16px 0;
}

.ref-article a {
    color: var(--ref-link);
    text-decoration: underline;
    text-decoration-color: rgba(140, 196, 255, 0.35);
    text-underline-offset: 2px;
}

.ref-article a:hover {
    color: #ffffff;
}

.ref-article strong {
    color: #ffffff;
}

.ref-article :not(pre) > code {
    font-family: var(--ref-mono);
    font-size: 0.88em;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}

.ref-article blockquote {
    border-left: 3px solid rgba(124, 196, 255, 0.6);
    background: var(--ref-surface);
    padding: 10px 16px;
    border-radius: 0 8px 8px 0;
    color: var(--ref-text);
}

.ref-article blockquote p:last-child {
    margin-bottom: 0;
}

.ref-article hr {
    border: none;
    border-top: 1px solid var(--ref-rule);
    margin: 32px 0;
}

.ref-article table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 14.5px;
    line-height: 1.5;
}

.ref-article th,
.ref-article td {
    border: 1px solid var(--ref-rule);
    padding: 7px 10px;
    text-align: left;
    vertical-align: top;
}

.ref-article th {
    background: var(--ref-surface);
    color: #ffffff;
}

/* --- Code listings --- */
.listing {
    position: relative;
    margin: 18px 0;
    border-radius: 10px;
    border: 1px solid var(--ref-rule);
    background: var(--ref-code-bg);
    overflow: hidden;
}

.listing .highlight {
    background: transparent;
}

.listing pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: var(--ref-mono);
    font-size: 13.5px;
    line-height: 1.55;
    color: #e6edf3;
    tab-size: 4;
}

.listing--output {
    background: rgba(255, 255, 255, 0.03);
}

.listing--output pre {
    color: #c9d4e3;
}

.listing-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-family: 'Sora', 'Helvetica Neue', Arial, sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.listing-label::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.listing--does-not-compile {
    border-color: rgba(255, 107, 107, 0.55);
}

.listing--does-not-compile .listing-label {
    color: var(--ref-bad);
    background: var(--ref-bad-bg);
}

.listing--throws,
.listing--panics,
.listing--not-desired-behavior {
    border-color: rgba(240, 180, 41, 0.55);
}

.listing--throws .listing-label,
.listing--panics .listing-label,
.listing--not-desired-behavior .listing-label {
    color: var(--ref-warn);
    background: var(--ref-warn-bg);
}

.listing--ignore .listing-label {
    color: var(--ref-quiet);
    background: rgba(255, 255, 255, 0.04);
}

.ref-article p.listing-caption {
    margin-top: -8px;
    color: var(--ref-muted);
    font-size: 14px;
    text-align: center;
}

/* --- Book chapter list --- */
.ref-chapter-list {
    margin-top: 40px;
    font-family: var(--ref-body);
}

.ref-chapter-list h2 {
    font-size: 22px;
    color: #ffffff;
}

.ref-chapter-list ol {
    padding-left: 22px;
}

.ref-chapter-list li {
    margin-bottom: 14px;
}

.ref-chapter-list li a {
    font-weight: 600;
    color: var(--ref-link);
}

.ref-chapter-list li p {
    margin: 4px 0 0 0;
    color: var(--ref-muted);
    font-size: 14.5px;
    line-height: 1.55;
}

/* --- Skill install box --- */
.ref-install {
    margin: 8px 0 32px 0;
    padding: 18px 20px;
    border: 1px solid rgba(124, 196, 255, 0.35);
    border-radius: 12px;
    background: rgba(46, 155, 255, 0.07);
    font-family: var(--ref-body);
    color: var(--ref-text);
    line-height: 1.6;
}

.ref-install-title {
    font-family: 'Sora', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #ffffff;
    margin-bottom: 6px;
}

.ref-install code {
    font-family: var(--ref-mono);
    font-size: 0.9em;
}

.ref-install-actions {
    margin: 16px 0 0 0;
}

/* --- Phones --- */
@media (max-width: 900px) {
    .ref-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 16px 16px 56px 16px;
    }

    .ref-sidebar {
        display: none;
    }

    .ref-mobile-toc {
        display: block;
        border: 1px solid var(--ref-rule);
        border-radius: 10px;
        padding: 10px 12px;
        font-size: 14px;
    }

    .ref-mobile-toc summary {
        cursor: pointer;
        font-weight: 600;
        color: #ffffff;
    }

    .ref-mobile-toc .ref-toc-title {
        margin-top: 12px;
    }

    .ref-card-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .ref-article {
        font-size: 16px;
    }

    .ref-article h1 {
        font-size: 28px;
    }

    .ref-article h2 {
        font-size: 22px;
    }

    .ref-pager {
        flex-direction: column;
    }

    .ref-pager-link {
        max-width: 100%;
    }
}
