/*
=========================================================
THE CRIMSON COURT — SHARED CHROME
=========================================================

The gothic-encyclopedia shell every Crimson Court page wears: the masthead,
the heraldic banner, the midnight reading surface and the royal footer.

Load order on a court page is always:

    normalize.css → styles.css → crimson-court.css → <page>.css
        → court-chrome.css → court-page.css | court-encyclopedia.css

This file comes after the page stylesheets on purpose. It undoes the legacy
entrance animation (the portal fade, the banner drop-in, the preloader) and
the main site's bare-element chrome, both of which are written earlier in the
cascade — see the "Cascade traps" table in BRANDING.md.

Colours come from the :root block in crimson-court.css. Nothing here invents
one; gold is structure, crimson is voice, parchment is speech.
*/

html { scroll-behavior: smooth; }

body.crimson-court-page {
    background: var(--royal-black) !important;
    color: var(--ink);
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 20px;
    line-height: 1.65;
    overflow: auto !important;
    scrollbar-color: var(--royal-gold) var(--royal-black);
}

/* The legacy entrance furniture. Court pages now open on the content. */
body::before,
body::after,
.court-portal::before,
.court-portal::after,
.preloader,
.fade-overlay,
.transition-overlay,
.burn-effect,
.decorative-elements,
.royal-seal {
    display: none !important;
}

/* .court-portal is a fixed, faded-in overlay in crimson-court.css. Here it is
   just a wrapper, so every property that made it an overlay comes back off. */
.court-portal {
    display: block !important;
    position: relative !important;
    height: auto !important;
    min-height: 0 !important;
    z-index: auto !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    background: none !important;
    padding: 0 !important;
    overflow: visible !important;
    animation: none !important;
}

.container {
    max-width: 1160px;
    padding: 0 44px;
    width: 100%;
    margin: auto;
}

a { color: var(--oxblood); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--gold) !important;
    outline-offset: 4px;
}

h1, h2, h3, h4 {
    font-family: 'Cinzel', Georgia, serif !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
    color: var(--royal-gold-light) !important;
    line-height: 1.3;
}

/*
=========================================================
MASTHEAD
=========================================================
styles.css styles bare `header` (light slab, sticky, blur, shadow) — all of
it has to be put back off here, not just the background.
*/
header.encyclopedia-header {
    position: relative;
    top: 0;
    z-index: 50;
    background: var(--royal-black) !important;
    border: 0;
    border-bottom: 1px solid var(--court-border) !important;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0;
}

.masthead {
    max-width: 1440px;
    margin: auto;
    min-height: 96px;
    padding: 18px 32px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.encyclopedia-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    color: var(--royal-gold-light);
    font-family: 'Cinzel', Georgia, serif;
    font-size: 18px;
    line-height: 1.1;
    text-decoration: none;
}

.encyclopedia-brand img {
    width: 40px;
    height: 48px;
    object-fit: contain;
}

.encyclopedia-brand small {
    display: block;
    font: 10px 'Cinzel', Georgia, serif;
    letter-spacing: .16em;
    color: var(--court-secondary);
    margin-top: 9px;
}

.masthead nav {
    display: flex;
    gap: 16px;
    margin-left: auto;
}

.masthead nav a,
.main-site {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 12px;
    line-height: normal;
    letter-spacing: .12em;
    color: var(--parchment);
    text-decoration: none;
    padding: 12px 0;
}

.masthead nav a { text-transform: uppercase; }

.masthead nav a:hover {
    color: var(--parchment);
    border-bottom: 2px solid var(--royal-gold);
}

/* Crimson is "the current thing", so the page you are on is crimson. */
.masthead nav a[aria-current] {
    color: var(--crimson-light);
    border-bottom: 2px solid var(--crimson-blood);
}

.main-site {
    font-size: 10px;
    letter-spacing: .1em;
    white-space: nowrap;
}

/* Court-wide search, fed by js/court-search.js. */
.court-search {
    width: 185px;
    flex: 0 0 185px;
    margin: 0;
    position: relative;
}

.court-search-icon { display: none; }

.court-search input {
    width: 100%;
    height: 40px;
    padding: 10px 12px !important;
    border: 1px solid var(--court-border) !important;
    border-radius: 2px;
    background: var(--court-raised) !important;
    color: var(--parchment) !important;
    font: 17px 'EB Garamond', Georgia, serif !important;
}

.court-search input::placeholder { color: var(--court-secondary); }

.court-search-results {
    background: var(--court-raised) !important;
    border: 1px solid var(--line) !important;
    box-shadow: 0 8px 30px #0003;
}

.court-search-results * {
    font-family: 'EB Garamond', Georgia, serif !important;
    color: var(--parchment) !important;
    text-shadow: none !important;
}

.court-search-results [aria-selected="true"] {
    background: var(--court-hover) !important;
    border-left: 2px solid var(--crimson-blood);
}

/*
=========================================================
HERALDIC BANNER
=========================================================
The page's title block. It sits on the reading surface rather than above it:
banner and surface are one panel, split by nothing but the crest's arch.
*/
.heraldic-banner {
    position: relative;
    max-width: 1160px;
    margin: 32px auto 0;
    padding: 38px 150px 34px 44px !important;
    background: var(--court-surface) !important;
    border: 1px solid var(--court-border) !important;
    border-bottom: 0 !important;
    border-top: 3px double var(--court-border) !important;
    box-shadow: none !important;
    text-align: left;
    min-height: 0;
    height: auto;
}

/* Gold corner rules, the one bit of ornament the panel gets. */
.heraldic-banner::before,
.heraldic-banner::after {
    content: '';
    display: block !important;
    position: absolute;
    top: 11px;
    width: 28px;
    height: 28px;
    z-index: 1;
    background: none;
    opacity: 1;
    transform: none;
    pointer-events: none;
}

.heraldic-banner::before {
    left: 11px;
    border-top: 1px solid var(--royal-gold);
    border-left: 1px solid var(--royal-gold);
}

.heraldic-banner::after {
    right: 11px;
    border-top: 1px solid var(--royal-gold);
    border-right: 1px solid var(--royal-gold);
}

/* The crest, in its arched niche at the banner's shoulder. */
.heraldic-banner .banner-emblem {
    display: block;
    position: absolute;
    right: 42px;
    top: 22px;
    width: 82px;
    height: 108px;
    margin: 0;
    padding: 13px 12px 8px;
    opacity: 1;
    transform: none;
    transition: none;
    border: 1px solid var(--court-border);
    border-radius: 50% 50% 0 0 / 36% 36% 0 0;
    background: var(--royal-black);
    box-shadow: 0 0 0 5px var(--court-surface), 0 0 0 6px var(--court-line);
}

.heraldic-banner .royal-crest {
    width: 100%;
    height: 100%;
    opacity: 1;
    transform: none;
    animation: none;
    filter: drop-shadow(0 3px 9px rgba(195, 10, 61, .24));
}

.royal-title,
.royal-subtitle,
.royal-footer {
    opacity: 1 !important;
    transform: none !important;
}

.royal-title {
    width: auto;
    font-size: 40px !important;
    line-height: 1.12 !important;
    margin: 0 0 10px !important;
    background: none !important;
    color: var(--royal-gold-light) !important;
    -webkit-text-fill-color: var(--royal-gold-light) !important;
}

.royal-title::before,
.royal-title::after { display: none !important; }

.royal-subtitle {
    width: auto;
    margin: 0 !important;
    padding-left: 16px;
    border-left: 2px solid var(--crimson-dark);
    font-family: 'EB Garamond', Georgia, serif !important;
    font-size: 19px !important;
    line-height: normal;
    font-style: italic !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    color: var(--court-secondary) !important;
}

/*
=========================================================
READING SURFACE
=========================================================
The panel the page's content sits on, continuing the banner downward.
*/
.court-surface {
    max-width: 1160px;
    margin: 0 auto;
    background: var(--court-surface);
    border: 1px solid var(--court-border);
    border-top: 0;
}

/* A breadcrumb line, where a page opens with one. */
.article-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font: 12px 'Cinzel', Georgia, serif;
    color: var(--muted);
    margin-bottom: 34px;
}

.article-breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}

/*
=========================================================
ROYAL FOOTER
=========================================================
*/
.royal-footer {
    background: var(--charcoal) !important;
    border: 0;
    padding: 30px 0;
    box-shadow: none !important;
    animation: none !important;
}

.royal-decree {
    max-width: 800px;
    margin: auto;
    padding-top: 22px;
    text-align: center;
}

.royal-decree::before {
    content: '';
    display: block;
    position: static;
    width: 6px;
    height: 6px;
    margin: 0 auto 14px;
    background: var(--royal-gold);
    transform: rotate(45deg);
    opacity: .7;
}

.royal-decree::after { display: none; }

.royal-decree p {
    font: italic 18px 'EB Garamond', Georgia, serif;
    color: var(--court-secondary);
}

/*
=========================================================
RESPONSIVE
=========================================================
*/
@media (max-width: 1240px) {
    .masthead {
        flex-wrap: wrap;
        gap: 12px 24px;
    }

    .masthead nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .court-search { margin-left: auto; }
}

@media (max-width: 1200px) {
    .heraldic-banner,
    .court-surface { width: calc(100% - 48px); }
}

@media (max-width: 700px) {
    .masthead {
        padding: 16px 20px;
        gap: 16px;
    }

    .encyclopedia-brand { font-size: 16px; }

    .main-site { margin-left: auto; }

    .court-search {
        order: 2;
        flex-basis: 100%;
        width: 100%;
    }

    .masthead nav {
        order: 3;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 4px 18px;
    }

    .masthead nav a { padding: 6px 0; }

    .heraldic-banner,
    .court-surface {
        width: calc(100% - 24px);
        margin-top: 16px;
    }

    .court-surface { margin-top: 0; }

    .heraldic-banner { padding: 30px 22px 26px !important; }

    .heraldic-banner .banner-emblem { display: none !important; }

    .royal-title { font-size: 30px !important; }

    .royal-subtitle {
        font-size: 18px !important;
        width: 100%;
        padding-left: 12px;
    }

    .container { padding: 0 22px; }

    .article-breadcrumb {
        font-size: 11px;
        margin-bottom: 28px;
    }
}

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

    * {
        animation: none !important;
        transition: none !important;
    }
}
