/*
 * C26-A — Standalone Reference page owner.
 *
 * This stylesheet intentionally contains every visual rule required by
 * /reference after legacy /static/style.css is disabled for that page.
 */

:where(body[data-ui-page="/reference"]) {
    --bg: #0b1119;
    --panel: #101925;
    --panel-2: #152131;
    --ink: #f4eee5;
    --muted: #aeb8c7;
    --line: #3a332c;
    --accent: #c88748;
    --accent-2: #e2b06f;
    --gold: #e2a04d;
    --gold-soft: #f0b766;
    --cream: #f1e8dc;
    --reference-system-accent: #e2a04d;

    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:where(body[data-ui-page="/reference"]),
:where(body[data-ui-page="/reference"]) * {
    box-sizing: border-box;
}

:where(body[data-ui-page="/reference"]) a {
    color: var(--accent-2);
    text-decoration: none;
}

:where(body[data-ui-page="/reference"]) a:hover {
    text-decoration: underline;
}

:where(body[data-ui-page="/reference"]) h1,
:where(body[data-ui-page="/reference"]) h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
}

:where(body[data-ui-page="/reference"]) input {
    width: 100%;
    border: 1px solid var(--line);
    background: #0d1621;
    color: var(--ink);
    border-radius: 8px;
    padding: .95rem 1rem;
    font: inherit;
    outline: none;
}

:where(body[data-ui-page="/reference"]) input:focus {
    border-color: var(--reference-system-accent);
    box-shadow: 0 0 0 3px rgba(200,135,72,.10);
}

:where(body[data-ui-page="/reference"]) button {
    border-radius: 8px;
    border: 0;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.reference-root {
    min-height: 100vh;
}

.reference-root .eyebrow {
    letter-spacing: .18em;
    font-size: .72rem;
    font-weight: 800;
    color: var(--accent-2);
}

.reference-topbar {
    min-height: 74px;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 82px 0 22px;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(11,17,25,.96);
    backdrop-filter: blur(12px);
}

.reference-topbar-left {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.reference-topbar .back-button {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: transparent;
    color: var(--gold-soft);
    text-decoration: none;
    line-height: 0;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.reference-topbar .back-button:hover {
    text-decoration: none;
    border-color: var(--accent);
    background: rgba(200,135,72,.08);
    transform: translateX(-1px);
}

.reference-topbar .back-arrow {
    position: relative;
    display: block;
    width: 25px;
    height: 2px;
    background: var(--gold-soft);
    border-radius: 999px;
}

.reference-topbar .back-arrow::before,
.reference-topbar .back-arrow::after {
    content: "";
    position: absolute;
    left: 0;
    width: 11px;
    height: 2px;
    background: var(--gold-soft);
    border-radius: 999px;
    transform-origin: left center;
}

.reference-topbar .back-arrow::before {
    top: 0;
    transform: rotate(42deg);
}

.reference-topbar .back-arrow::after {
    bottom: 0;
    transform: rotate(-42deg);
}

.reference-site-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--cream);
    text-decoration: none;
    white-space: nowrap;
}

.reference-site-brand:hover {
    text-decoration: none;
}

.reference-site-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    min-width: 30px;
    height: 30px;
    color: var(--reference-system-accent);
    font-size: .82rem;
    font-weight: 950;
    line-height: 1;
    letter-spacing: .04em;
}

.reference-site-brand-name {
    display: inline-block;
    color: var(--cream);
    font-size: .9rem;
    font-weight: 800;
    line-height: 1.2;
}

.reference-site-brand::before,
.reference-site-brand::after,
.reference-site-brand-mark::before,
.reference-site-brand-mark::after {
    content: none;
    display: none;
}

.reference-topbar-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

.reference-dashboard-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0;
    padding: 0 15px;
    border: 1px solid color-mix(in srgb, var(--reference-system-accent) 48%, transparent);
    border-radius: 9px;
    background: color-mix(in srgb, var(--reference-system-accent) 4.5%, transparent);
    color: var(--accent-2);
    text-decoration: none;
    white-space: nowrap;
    font-size: .76rem;
    font-weight: 850;
    line-height: 1;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.reference-dashboard-link:hover {
    border-color: color-mix(in srgb, var(--reference-system-accent) 78%, transparent);
    background: color-mix(in srgb, var(--reference-system-accent) 9%, transparent);
    text-decoration: none;
    transform: translateY(-1px);
}

body[data-ui-page="/reference"] > .account-menu {
    z-index: 50;
}

.reference-page-shell {
    width: min(1420px, calc(100% - 48px));
    margin: 0 auto;
    padding: 62px 0 76px;
}

.reference-page-hero {
    max-width: 850px;
    margin-bottom: 24px;
}

.reference-page-hero h1 {
    margin: 6px 0 12px;
    font-size: clamp(3rem, 5vw, 5.2rem);
    line-height: .95;
}

.reference-page-hero > p:last-of-type {
    max-width: 760px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.reference-system-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.reference-system-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid rgba(205,151,72,.28);
    border-radius: 9px;
    background: rgba(9,20,31,.72);
    color: #9fb0bd;
    text-decoration: none;
    font-weight: 700;
}

.reference-system-tabs a:hover {
    text-decoration: none;
}

.reference-system-tabs a span {
    color: var(--reference-system-accent);
}

.reference-system-tabs a.is-active {
    border-color: color-mix(in srgb, var(--reference-system-accent) 72%, transparent);
    background: color-mix(in srgb, var(--reference-system-accent) 10%, transparent);
    color: #f0d4a1;
}

.reference-page-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        linear-gradient(145deg, rgba(200,135,72,.045), transparent 36%),
        var(--panel);
    box-shadow: 0 24px 60px rgba(0,0,0,.23);
}

.reference-page-toolbar {
    padding: 18px;
    border-bottom: 1px solid rgba(255,255,255,.065);
}

.reference-page-search {
    display: block;
    max-width: 760px;
}

.reference-page-search > span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.reference-page-search input {
    min-height: 48px;
}

.reference-page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.reference-page-tabs button {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255,255,255,.018);
    color: var(--muted);
}

.reference-page-tabs button small {
    margin-left: 5px;
    color: #81786f;
}

.reference-page-tabs button.is-active {
    border-color: color-mix(in srgb, var(--reference-system-accent) 60%, transparent);
    background: color-mix(in srgb, var(--reference-system-accent) 9%, transparent);
    color: var(--accent-2);
}

.reference-page-tabs button.is-active small {
    color: #d9ac70;
}

.reference-page-content {
    min-height: 620px;
}

.reference-page-content-modal-list {
    display: block;
}

.reference-page-list {
    min-width: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.reference-page-content-modal-list .reference-page-list {
    width: 100%;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
    padding: 14px;
}

.reference-page-card {
    width: 100%;
    display: block;
    margin: 0;
    padding: 12px 13px;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 10px;
    background: rgba(255,255,255,.015);
    color: var(--ink);
    text-align: left;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.reference-page-content-modal-list .reference-page-card {
    min-height: 126px;
}

.reference-page-card:hover {
    border-color: color-mix(in srgb, var(--reference-system-accent) 38%, transparent);
    background: color-mix(in srgb, var(--reference-system-accent) 3.5%, transparent);
    transform: translateX(2px);
}

.reference-page-card.is-selected {
    border-color: color-mix(in srgb, var(--reference-system-accent) 66%, transparent);
    background: linear-gradient(90deg, rgba(226,160,77,.09), rgba(226,160,77,.025));
    box-shadow: inset 3px 0 0 var(--reference-system-accent);
}

.reference-page-card-kind {
    display: block;
    margin-bottom: 3px;
    color: var(--accent-2);
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.reference-page-card strong {
    display: block;
    font-size: .95rem;
}

.reference-page-card p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    margin: 7px 0 0;
    overflow: hidden;
    color: #b9afa6;
    font-size: .73rem;
    line-height: 1.4;
}

.reference-page-card em {
    display: block;
    margin-top: 8px;
    color: var(--accent-2);
    font-size: .68rem;
    font-style: normal;
    font-weight: 900;
}

.reference-page-empty {
    padding: 18px;
    border: 1px dashed rgba(255,255,255,.1);
    border-radius: 10px;
    color: var(--muted);
    line-height: 1.5;
}

.reference-page-empty strong,
.reference-page-empty span {
    display: block;
}

.reference-article-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 22px;
}

.reference-article-modal[hidden] {
    display: none;
}

.reference-article-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2,9,14,.78);
    backdrop-filter: blur(4px);
}

.reference-article-modal-card {
    position: relative;
    width: min(760px,calc(100vw - 28px));
    max-height: min(86vh,820px);
    overflow: auto;
    border: 1px solid rgba(209,147,48,.48);
    border-radius: 14px;
    background: #0b1822;
    box-shadow: 0 24px 70px rgba(0,0,0,.55);
    padding: 24px;
}

.reference-article-modal-close {
    position: absolute;
    right: 14px;
    top: 12px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #91a5b2;
    font-size: 26px;
}

.reference-article-modal-close:hover {
    color: #efd092;
}

.reference-article {
    max-width: 900px;
}

.reference-article h2 {
    margin: 5px 0 0;
    font-size: clamp(2rem, 3.5vw, 3.4rem);
    line-height: 1;
}

.reference-article-en {
    margin-top: 6px;
    color: var(--muted);
    font-size: .9rem;
}

.reference-article-summary {
    margin: 12px 0;
    padding: 11px 13px;
    border: 1px solid rgba(213,151,52,.24);
    border-radius: 8px;
    background: rgba(213,151,52,.06);
    color: #d9c9ac;
    line-height: 1.5;
    font-weight: 650;
}

.reference-article-facts {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 8px;
    margin: 20px 0;
}

.reference-article-facts > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid rgba(255,255,255,.045);
    border-radius: 9px;
    background: rgba(255,255,255,.02);
}

.reference-article-facts dt {
    color: var(--muted);
    font-size: .6rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.reference-article-facts dd {
    margin: 4px 0 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.reference-article-description {
    white-space: pre-wrap;
    color: #d0c6bc;
    font-size: .92rem;
    line-height: 1.7;
}

.reference-article-placeholder {
    padding: 18px;
    border: 1px dashed rgba(255,255,255,.1);
    border-radius: 10px;
    color: var(--muted);
    line-height: 1.5;
}

.reference-article footer {
    margin-top: 22px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
    color: var(--muted);
    font-size: .66rem;
}

body.reference-modal-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .reference-page-shell {
        width: min(calc(100% - 24px), 760px);
        padding-top: 34px;
    }

    .reference-article-facts {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

@media (max-width: 760px) {
    .reference-page-content-modal-list .reference-page-list {
        grid-template-columns: 1fr;
        padding: 8px;
    }

    .reference-article-modal {
        padding: 10px;
    }

    .reference-article-modal-card {
        padding: 20px 16px;
    }
}

@media (max-width: 620px) {
    .reference-topbar {
        min-height: 66px;
        height: 66px;
        padding: 0 64px 0 10px;
        gap: 8px;
    }

    .reference-site-brand {
        gap: 5px;
    }

    .reference-site-brand-mark {
        width: 24px;
        min-width: 24px;
        height: 24px;
        font-size: .72rem;
    }

    .reference-site-brand-name {
        max-width: 145px;
        white-space: normal;
        font-size: .72rem;
    }

    .reference-dashboard-link {
        min-height: 36px;
        max-width: 132px;
        overflow: hidden;
        padding: 0 10px;
        text-overflow: ellipsis;
        font-size: .68rem;
    }

    .reference-topbar .back-button {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }

    .reference-topbar .back-arrow {
        width: 22px;
    }

    .reference-topbar .back-arrow::before,
    .reference-topbar .back-arrow::after {
        width: 10px;
    }
}

@media (max-width: 520px) {
    .reference-page-hero h1 {
        font-size: 3rem;
    }

    .reference-page-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .reference-page-tabs button {
        flex: 0 0 auto;
    }

    .reference-article-facts {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reference-page-card,
    .reference-dashboard-link {
        transition: none;
    }
}
