/* Reading room — public site */

:root,
[data-theme="light"] {
    --paper: #F3F5F9;
    --card: #FFFFFF;
    --ink: #12263F;
    --slate: #5A6B80;
    --line: #D5DCE7;
    --cobalt: #2350E8;
    --amber: #F4A62A;
    --mint: #14A37F;
    --night: #0F2038;
    --on-cb: #ffffff;
    --fail: #9f2d2d;
    --bg: var(--paper);
    --s1: var(--card);
    --s2: #E7EDF6;
    --tx: var(--ink);
    --mu: var(--slate);
    --cb: var(--cobalt);
}

[data-theme="dark"] {
    --paper: #0A1424;
    --card: #101F35;
    --ink: #EAF0F8;
    --slate: #93A6BF;
    --line: #233A5A;
    --cobalt: #5B86FF;
    --amber: #F4A62A;
    --mint: #14A37F;
    --night: #EAF0F8;
    --on-cb: #ffffff;
    --fail: #f0b4b4;
    --bg: #0A1424;
    --s1: #101F35;
    --s2: #162B47;
    --tx: #EAF0F8;
    --mu: #93A6BF;
    --cb: #5B86FF;
}

body.theme-reading {
    background: var(--bg);
    color: var(--tx);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

body.theme-reading button {
    width: auto;
    font-family: inherit;
}

body.theme-reading h1,
body.theme-reading h2,
body.theme-reading h3 {
    font-family: "Bricolage Grotesque", Georgia, sans-serif;
    color: var(--tx);
    letter-spacing: -0.03em;
}

body.theme-reading a:focus-visible,
body.theme-reading button:focus-visible,
body.theme-reading input:focus-visible,
body.theme-reading textarea:focus-visible,
body.theme-reading select:focus-visible {
    outline: 2px solid var(--cb);
    outline-offset: 2px;
}

.rr-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.rr-nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.rr-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--tx);
    text-decoration: none;
    font-weight: 600;
    margin-right: auto;
}

.rr-mark {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--cb);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.rr-links {
    display: none;
    gap: 4px;
}

.rr-links a {
    color: var(--mu);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 10px;
}

.rr-links a:hover,
.rr-links a.is-active {
    color: var(--tx);
    background: var(--s2);
}

.rr-search,
.rr-theme,
.site-nav-toggle {
    border: 1px solid var(--line);
    background: var(--s1);
    color: var(--mu);
    border-radius: 10px;
    min-height: 40px;
}

.rr-search {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    cursor: pointer;
}

.rr-search kbd {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 6px;
}

.rr-theme {
    width: 40px;
    padding: 0;
    cursor: pointer;
}

.rr-theme-icon {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: inset -5px -2px 0 0 var(--night);
}

[data-theme="dark"] .rr-theme-icon {
    background: transparent;
    box-shadow: inset -6px -4px 0 0 var(--tx);
}

.rr {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 16px 48px;
}

.rr-hero {
    display: grid;
    gap: 24px;
    margin-bottom: 48px;
}

.rr-hero h1 {
    font-size: clamp(32px, 8vw, 56px);
    line-height: 1.05;
    margin: 0 0 12px;
}

.rr-hero-copy > p,
.rr-section-head p,
.rr-panel p,
.rr-empty {
    color: var(--mu);
    margin: 0 0 16px;
    max-width: 42rem;
}

.rr-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

body.theme-reading .res-btn {
    border-radius: 10px;
    min-height: 42px;
    padding: 10px 16px;
    font-size: 15px;
}

body.theme-reading .res-btn-primary {
    background: var(--cb);
    color: #fff;
}

body.theme-reading .res-btn-primary:hover {
    filter: brightness(1.08);
}

body.theme-reading .res-btn-outline {
    background: transparent;
    color: var(--tx);
    border: 1px solid var(--line);
}

.rr-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.rr-stats div {
    padding: 12px;
    border-radius: 14px;
    background: var(--s1);
    border: 1px solid var(--line);
}

.rr-stats dt {
    font-size: 12px;
    color: var(--mu);
}

.rr-stats dd {
    margin: 4px 0 0;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 18px;
    color: var(--tx);
}

.rr-preview,
.res-cover {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    min-height: 180px;
    padding: 16px;
    border-radius: 16px;
    color: #fff;
    text-decoration: none;
}

.rr-preview {
    background: var(--s1);
    border: 1px solid var(--line);
    padding: 12px;
    color: var(--tx);
}

.rr-preview-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--mu);
}

.rr-preview-bar i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--line);
}

.rr-preview .res-cover {
    min-height: 210px;
}

.rr-preview-meta {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    color: var(--mu);
}

.tone-mint { background: linear-gradient(160deg, #0f766e, #14A37F); }
.tone-amber { background: linear-gradient(160deg, #b45309, #F4A62A); color: #1c1408; }
.tone-cobalt { background: linear-gradient(160deg, #1e3a8a, #2350E8); }

.res-cover span,
.res-cover strong {
    display: block;
}

.res-cover strong {
    font-family: "Bricolage Grotesque", Georgia, sans-serif;
    font-size: 22px;
    line-height: 1.2;
}

.rr-section {
    margin-bottom: 48px;
}

.rr-section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
}

.rr-section-head h2 {
    margin: 0;
    font-size: clamp(26px, 4vw, 36px);
}

.rr-section-head a {
    color: var(--cb);
    text-decoration: none;
    font-weight: 600;
}

.rr-paths,
.rr-grid,
.rr-tools,
.rr-split {
    display: grid;
    gap: 14px;
}

.rr-path,
.rr-panel,
.rr-tool,
body.theme-reading .res-card,
body.theme-reading .legal-page,
body.theme-reading .about-page,
body.theme-reading .error-page-card,
body.theme-reading .resources-toolbar,
body.theme-reading .view-page .resource-card {
    background: var(--s1);
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--tx);
    box-shadow: none;
}

.rr-path,
.rr-panel,
.rr-tool {
    padding: 16px;
}

.rr-path header,
.rr-tool {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.rr-path h3,
.rr-tool strong {
    margin: 0;
    font-size: 18px;
}

.rr-path header span,
.rr-tool span,
.rr-path li a {
    color: var(--mu);
}

.rr-path ol {
    margin: 12px 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.rr-path li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.rr-path li > span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--s2);
    color: var(--tx);
    font-size: 12px;
    flex-shrink: 0;
}

.rr-path li.is-read > span {
    background: var(--mint);
    color: #fff;
}

.rr-path li a {
    text-decoration: none;
    font-size: 15px;
}

.rr-path-foot {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rr-path-bar {
    flex: 1;
    height: 6px;
    border-radius: 99px;
    background: var(--s2);
    overflow: hidden;
}

.rr-path-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--mint);
}

.rr-filters {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.rr-chips,
.rr-sort {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rr-chips button,
.rr-sort button {
    border: 1px solid var(--line);
    background: var(--s1);
    color: var(--mu);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.rr-chips button.is-active,
.rr-sort button.is-active {
    background: var(--cb);
    border-color: var(--cb);
    color: #fff;
}

body.theme-reading .res-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

body.theme-reading .res-card[hidden] {
    display: none;
}

body.theme-reading .res-card .res-cover {
    min-height: 140px;
    border-radius: 12px;
}

body.theme-reading .res-title {
    font-size: 18px;
    margin: 0;
}

body.theme-reading .res-title a,
body.theme-reading .res-excerpt,
body.theme-reading .res-category,
body.theme-reading .res-meta {
    color: var(--tx);
}

body.theme-reading .res-excerpt,
body.theme-reading .res-category,
body.theme-reading .res-meta {
    color: var(--mu);
}

body.theme-reading .res-excerpt {
    font-size: 16px;
}

body.theme-reading .res-meta {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
}

body.theme-reading .res-type {
    background: var(--s2);
    color: var(--tx);
}

body.theme-reading .res-actions .res-btn {
    flex: 1;
}

.rr-tools {
    grid-template-columns: 1fr;
}

.rr-tool {
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    color: var(--tx);
}

.rr-tool-ask {
    background: var(--cb);
    color: #fff;
    border-color: transparent;
}

.rr-tool-ask span,
.rr-tool-ask strong {
    color: #fff;
}

.rr-tool-ask .res-btn {
    background: #fff;
    color: var(--night);
    margin-top: 8px;
}

.rr-split {
    margin-bottom: 28px;
}

body.theme-reading .contact-form input,
body.theme-reading .contact-form textarea,
body.theme-reading .resources-search input,
body.theme-reading .resources-filters select {
    width: 100%;
    background: var(--bg);
    color: var(--tx);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
}

body.theme-reading .contact-form button {
    width: 100%;
    background: var(--cb);
}

.hp-field {
    position: absolute;
    left: -9999px;
}

body.theme-reading .site-footer {
    margin-top: 12px;
    padding: 20px 0 0;
    background: transparent;
    border: none;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    color: var(--mu);
}

body.theme-reading .site-footer-brand,
body.theme-reading .site-footer a,
body.theme-reading .site-footer-copy,
body.theme-reading .site-footer-copy strong {
    color: var(--tx);
}

body.theme-reading .site-footer a {
    text-decoration: none;
}

body.theme-reading .site-footer-col-title {
    color: var(--mu);
}

body.theme-reading .page-content,
body.theme-reading .resources-page,
body.theme-reading .view-page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 16px 48px;
}

body.theme-reading .legal-lead,
body.theme-reading .legal-page p,
body.theme-reading .legal-page li,
body.theme-reading .about-page-body p,
body.theme-reading .about-page-body li,
body.theme-reading .resources-hero-lead,
body.theme-reading .view-page .description,
body.theme-reading .resources-result-count {
    color: var(--mu);
}

body.theme-reading .legal-page a,
body.theme-reading .about-page-body a {
    color: var(--cb);
}

body.theme-reading .view-page .stats strong,
body.theme-reading .view-page .stats small,
body.theme-reading .badge-free {
    color: var(--tx);
}

body.theme-reading .page-btn {
    background: var(--s1);
    color: var(--tx);
    border: 1px solid var(--line);
}

body.theme-reading .page-btn.is-active,
body.theme-reading .page-btn:hover {
    background: var(--cb);
    color: #fff;
    border-color: var(--cb);
}

.rr-palette {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(15, 32, 56, 0.45);
    display: grid;
    align-items: start;
    justify-content: center;
    padding: 12vh 16px 16px;
}

.rr-palette[hidden] {
    display: none;
}

.rr-palette-panel {
    width: min(560px, 100%);
    background: var(--s1);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

.rr-palette-panel input {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--tx);
    font-size: 16px;
    padding: 16px;
    margin: 0;
}

.rr-palette-panel ul {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 320px;
    overflow: auto;
}

.rr-palette-panel li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.rr-palette-panel li.is-active,
.rr-palette-panel li:hover {
    background: var(--s2);
}

.rr-palette-panel small,
.rr-palette-hint,
.rr-palette-empty {
    color: var(--mu);
    font-size: 13px;
}

.rr-palette-hint {
    margin: 0;
    padding: 8px 16px 12px;
}

.rr-alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fee2e2;
    color: #991b1b;
}

body.rr-palette-open {
    overflow: hidden;
}

@media (min-width: 768px) {
    .rr-nav-inner {
        padding: 14px 24px;
    }

    .rr-links {
        display: flex;
    }

    .rr-search {
        display: inline-flex;
    }

    .site-nav-toggle {
        display: none;
    }

    .rr {
        padding: 40px 24px 64px;
    }

    .rr-hero,
    .rr-split {
        grid-template-columns: 1.2fr 0.8fr;
        align-items: center;
    }

    .rr-paths,
    .rr-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rr-grid,
    body.theme-reading .resources-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .rr-paths,
    .rr-grid,
    .rr-tools,
    body.theme-reading .resources-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    body.theme-reading .site-nav.is-open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--s1);
        border-bottom: 1px solid var(--line);
        padding: 8px;
    }

    body.theme-reading .site-nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        background: var(--s1);
    }

    body.theme-reading .site-nav-toggle span {
        display: block;
        width: 16px;
        height: 2px;
        background: var(--tx);
        margin: 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body.theme-reading .res-card,
    body.theme-reading .res-btn {
        transition: none;
    }
}
