@font-face {
    font-family: "Antropos";
    src: url("/sr/static/fonts/antropos.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #efe4d4;
    --surface: rgba(255, 247, 237, 0.88);
    --surface-strong: #fffaf3;
    --text: #38261d;
    --muted: #75584a;
    --line: rgba(92, 60, 43, 0.18);
    --accent: #a2472f;
    --accent-soft: rgba(162, 71, 47, 0.12);
    --etheric: #8a9a5b;
    --astral: #cc7435;
    --spirit: #93372f;
    --shadow: 0 20px 60px rgba(58, 31, 20, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(204, 116, 53, 0.2), transparent 30%),
        radial-gradient(circle at top right, rgba(147, 55, 47, 0.16), transparent 26%),
        radial-gradient(circle at bottom, rgba(138, 154, 91, 0.1), transparent 34%),
        linear-gradient(180deg, #f6e8d5 0%, var(--bg) 100%);
}

h1, h2, h3, h4, .eyebrow {
    font-family: "Antropos", Georgia, "Times New Roman", serif;
}

p, h1, h2, h3, h4, dl {
    margin-top: 0;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 26px 0 60px;
}

.top-strip,
.search-hero,
.media-card,
.catalog-tile,
.flash,
.empty-state {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.top-strip {
    display: grid;
    grid-template-columns: 1fr minmax(320px, 640px);
    gap: 20px;
    align-items: start;
    padding: 26px;
}

.top-strip h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 3.8vw, 3.2rem);
    line-height: 1.05;
}

.eyebrow {
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--muted);
}

.top-auth {
    margin-top: 2px;
    text-align: right;
    justify-self: end;
    width: min(360px, 100%);
}

.auth-panel form {
    margin: 0;
}

.auth-status {
    margin-bottom: 8px;
}

.auth-inline-actions {
    display: inline-flex;
    gap: 8px;
    justify-content: flex-end;
}

.auth-inline-actions button {
    padding: 10px 14px;
    min-width: 96px;
}

.search-hero {
    padding: 30px;
    text-align: center;
}

.catalog-experience {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 24px;
    margin-top: 22px;
    align-items: start;
}

.catalog-main {
    min-width: 0;
}

.catalog-experience.is-loading {
    opacity: 0.76;
    transition: opacity 0.2s ease;
}

.side-menu {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 16px;
}

.side-menu-card {
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.side-menu-card h2,
.side-menu-card h3 {
    margin-bottom: 10px;
}

.side-menu-copy {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 12px;
}

.side-menu-reset {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.side-menu-reset:hover {
    text-decoration: underline;
}

.side-menu-list {
    display: grid;
    gap: 8px;
}

.side-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(92, 60, 43, 0.14);
    background: rgba(255, 250, 243, 0.76);
    color: var(--text);
    text-decoration: none;
}

.side-link span,
.side-link small {
    pointer-events: none;
}

.side-link small {
    color: var(--muted);
}

.side-link:hover {
    border-color: rgba(162, 71, 47, 0.3);
    background: rgba(162, 71, 47, 0.08);
}

.side-link-active {
    border-color: var(--accent);
    background: rgba(162, 71, 47, 0.12);
}

.side-menu-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.education-section {
    margin-top: 24px;
    padding: 28px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.education-head {
    margin-bottom: 16px;
}

.education-head p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.education-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.education-grid article,
.education-references {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.education-grid h3,
.education-references h3 {
    margin-bottom: 10px;
}

.education-grid ul,
.education-references ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.65;
}

.education-grid li + li,
.education-references li + li {
    margin-top: 8px;
}

.education-references {
    margin-top: 18px;
}

.education-references a {
    color: var(--accent);
}

.education-references a:hover {
    text-decoration: underline;
}

.search-hero h2 {
    margin-bottom: 16px;
    font-size: clamp(1.6rem, 2.8vw, 2.4rem);
}

.search-form {
    width: min(840px, 100%);
    margin: 0 auto;
    text-align: left;
}

.search-form label {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--muted);
}

.search-row {
    display: flex;
    gap: 12px;
}

input,
textarea,
button {
    font: inherit;
}

input,
textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.86);
    color: var(--text);
    padding: 14px 16px;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
}

textarea {
    resize: vertical;
    min-height: 96px;
}

button {
    border: 0;
    border-radius: 14px;
    padding: 14px 18px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.checkbox {
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-dialog {
    width: min(460px, calc(100% - 24px));
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    padding: 0;
    color: var(--text);
}

.auth-dialog::backdrop {
    background: rgba(56, 38, 29, 0.36);
    backdrop-filter: blur(2px);
}

.auth-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 12px;
    border-bottom: 1px solid var(--line);
}

.auth-dialog-head h3 {
    margin: 0;
}

.auth-dialog-close {
    width: auto;
    padding: 8px 12px;
    background: var(--accent-soft);
    color: var(--text);
}

.auth-dialog-form {
    display: grid;
    gap: 10px;
    padding: 14px 18px 18px;
}

.auth-dialog-form label {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--muted);
    text-align: left;
}

.auth-dialog-form .checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
    text-align: left;
}

.legend div {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
}

.legend strong {
    display: inline-block;
    margin-bottom: 4px;
}

.legend p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.5;
}

.legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.legend-swatch.etheric {
    background: var(--etheric);
}

.legend-swatch.astral {
    background: var(--astral);
}

.legend-swatch.spirit {
    background: var(--spirit);
}

.flash-stack,
.section-head {
    margin-top: 24px;
}

.active-tag-panel {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
}

.clear-tag-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.clear-tag-link:hover {
    text-decoration: underline;
}

.flash {
    padding: 16px 18px;
}

.flash-success {
    border-left: 6px solid var(--etheric);
}

.flash-warning {
    border-left: 6px solid var(--astral);
}

.catalog-grid {
    display: grid;
    gap: 22px;
}

.media-card {
    padding: 28px;
}

.media-card-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.media-card-main {
    min-width: 0;
}

.media-thumb-placeholder {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    gap: 6px;
    width: 100%;
    min-height: 180px;
    margin-bottom: 18px;
    border-radius: 18px;
    border: 1px dashed rgba(92, 60, 43, 0.28);
    background:
        linear-gradient(135deg, rgba(204, 116, 53, 0.16), rgba(147, 55, 47, 0.14)),
        repeating-linear-gradient(45deg, rgba(255, 248, 238, 0.44) 0 10px, rgba(255, 248, 238, 0.14) 10px 20px);
    color: var(--muted);
    text-align: center;
}

.media-thumb-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 18px;
}

.media-thumb-placeholder-sm .media-thumb-image {
    border-radius: 16px;
}

.media-thumb-placeholder.has-thumbnail {
    border-style: solid;
    border-color: rgba(92, 60, 43, 0.12);
    background: rgba(255, 248, 238, 0.35);
}

.media-thumb-placeholder:not(.has-thumbnail) .media-thumb-image {
    opacity: 0;
    pointer-events: none;
}

.media-thumb-placeholder span {
    display: inline-grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid rgba(92, 60, 43, 0.16);
    background: rgba(255, 247, 237, 0.72);
    color: #5c3c2b;
    font-size: 1.45rem;
    font-weight: 700;
}

.media-thumb-placeholder small {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.media-thumb-placeholder-sm {
    min-height: 140px;
    margin-bottom: 14px;
}

.media-thumb-portrait {
    width: 180px;
    min-height: 250px;
    margin-bottom: 0;
    justify-self: start;
    background:
        linear-gradient(180deg, rgba(255, 250, 243, 0.95), rgba(239, 228, 212, 0.92));
}

.media-thumb-placeholder-sm span {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}

.card-head,
.recent-top,
.recent-stats,
.facts,
.engagement-grid {
    display: flex;
    gap: 16px;
}

.card-head,
.recent-top {
    justify-content: space-between;
    align-items: start;
}

.meta-line,
.byline,
.summary,
.recent-summary,
dt,
.discussion-list p {
    color: var(--muted);
}

.media-card h3,
.catalog-tile h3,
.section-head h2 {
    margin-bottom: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}

.badge small {
    opacity: 0.72;
}

.badge-etheric {
    background: rgba(138, 154, 91, 0.16);
    color: #5b6638;
}

.badge-astral {
    background: rgba(204, 116, 53, 0.16);
    color: #8d4f25;
}

.badge-spirit {
    background: rgba(147, 55, 47, 0.15);
    color: #6f2e28;
}

.approved-pill {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #4f3f13;
    background: rgba(239, 208, 115, 0.35);
    border: 1px solid rgba(157, 123, 34, 0.35);
}

.facts {
    flex-wrap: wrap;
    margin: 22px 0;
    padding: 0;
}

.facts div {
    min-width: 120px;
    padding: 12px 14px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.tag-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0 0;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--accent);
    border: 1px solid rgba(162, 71, 47, 0.28);
    background: rgba(162, 71, 47, 0.1);
    font-size: 0.86rem;
    font-weight: 600;
}

.tag-pill:hover {
    background: rgba(162, 71, 47, 0.16);
}

.tag-pill-active {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent);
}

.tag-pill-static {
    cursor: default;
}

.recommend-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.recommend-actions form {
    margin: 0;
}

.recommend-actions button {
    padding: 10px 14px;
}

.btn-active {
    background: #7f3223;
}

dt {
    font-size: 0.82rem;
    margin-bottom: 4px;
}

dd {
    margin: 0;
    font-weight: 600;
}

.theme-grid,
.engagement-grid,
.tile-grid {
    display: grid;
    gap: 18px;
}

.theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 20px;
}

.theme-grid section,
.engagement-panel,
.recommendation,
.rationale {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
}

.theme-grid p,
.recommendation p,
.rationale p,
.engagement-panel p,
.discussion-list p {
    margin-bottom: 0;
    line-height: 1.6;
}

.child-list {
    display: grid;
    gap: 10px;
}

.child-link {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    color: var(--text);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.55);
}

.child-link small {
    color: var(--muted);
}

.engagement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px;
}

.engagement-panel form {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.discussion-list {
    display: grid;
    gap: 12px;
}

.discussion-list article {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.empty-state {
    margin-top: 8px;
    padding: 28px;
}

.tile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 14px;
}

.catalog-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 22px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.catalog-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(58, 31, 20, 0.16);
}

.recent-summary {
    line-height: 1.65;
    min-height: 5rem;
}

.recent-stats {
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.92rem;
}

@media (max-width: 1060px) {
    .catalog-experience,
    .top-strip,
    .legend,
    .education-grid,
    .engagement-grid,
    .tile-grid,
    .theme-grid {
        grid-template-columns: 1fr;
    }

    .media-card-layout {
        grid-template-columns: 1fr;
    }

    .side-menu {
        position: static;
    }

    .media-thumb-portrait {
        width: min(220px, 100%);
        justify-self: center;
        margin-bottom: 18px;
    }

    .top-auth {
        margin-top: 10px;
        width: 100%;
        text-align: left;
        justify-self: stretch;
    }

    .auth-inline-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 16px;
    }

    .top-strip,
    .search-hero,
    .education-section,
    .media-card,
    .catalog-tile,
    .empty-state {
        padding: 20px;
    }

    .search-row,
    .card-head,
    .recommend-actions,
    .recent-stats {
        flex-direction: column;
        align-items: stretch;
    }

    .facts div {
        min-width: 100%;
    }

    button {
        width: 100%;
    }
}
