/* Materials shared by the Element home, the library and the clan pages. */
:root:has(.element-unified) {
    color-scheme: dark;
    scrollbar-color: #a38b6b #0c2029;
    background:
        linear-gradient(180deg, #06192263, #071b24b3 360px, #071a22e8 790px),
        url('fortress/fortress-art.webp') center top / max(100%, 1440px) auto no-repeat,
        url('fortress/slate-material.webp') center top / 1080px auto repeat #081b23;
    background-attachment: fixed;
}

body.element-unified {
    --crest-slate: #101f28;
    --crest-panel: #192e37;
    --crest-steel: #8e9fa3;
    --crest-bronze: #ac946e;
    --crest-fire: #efad86;
    --crest-earth: #dbc497;
    --crest-air: #cfdee7;
    --crest-water: #a9d9ee;
    --crest-seam: linear-gradient(90deg, transparent, #879faaaa 22%, #c4ae88 55%, #879faaaa 78%, transparent);
    --crest-fire-mark: url('reference-ui/masthead-fire.webp');
    --crest-earth-mark: url('reference-ui/masthead-earth.webp');
    --crest-air-mark: url('reference-ui/masthead-air.webp');
    --crest-water-mark: url('reference-ui/masthead-water.webp');
    --unified-ink: #f4e9d3;
    --unified-muted: #d5dbd9;
    --unified-gold: var(--crest-earth);
    --unified-rule: #8f836e;
    --unified-panel: var(--crest-panel);
    --unified-deep: var(--crest-slate);
    --unified-serif: 'Times New Roman', Georgia, serif;
    --unified-texture: url('reference-ui/texture-panel.webp');
    --unified-strip: url('reference-ui/texture-teal.webp');
    --unified-copper: url('reference-ui/texture-red.webp');
    --unified-surface: linear-gradient(108deg, #243d49c2, #0d222ce8), var(--unified-texture) center / 520px auto repeat var(--crest-slate);
}

body.element-site.element-unified {
    --site-frame-corner-size: clamp(34px, 3.55vw, 52px);
    --site-frame-corner-height: calc(var(--site-frame-corner-size) * 64 / 72);
    --site-frame-stroke: 2px;
    --site-frame-upper-inset: 1px;
    --site-frame-lower-inset: 2px;
    --site-frame-edge: linear-gradient(90deg, #a28051, #b8a17c 35%, #c59a66 65%, #8d795c);
    --site-frame-sides:
        linear-gradient(90deg, #7c633f, #c0a778) left center / var(--site-frame-stroke) 100% no-repeat,
        linear-gradient(270deg, #7c633f, #c0a778) right 1px center / var(--site-frame-stroke) 100% no-repeat;
    --site-frame-surface: linear-gradient(90deg, #11212aee 24%, #182b35e0 63%, #12252ec9),
        url('reference-ui/header-elemental-v2.webp') center 53% / cover no-repeat #10252e;
    --element-width: 1506px;
    --element-content-width: 1506px;
    --element-content-inset: clamp(14px, 2.65vw, 40px);
    --fortress-ink: var(--unified-ink);
    --fortress-muted: var(--unified-muted);
    --fortress-ivory: var(--unified-ink);
    --fortress-accent: var(--unified-gold);
    --fortress-line: #746e62;
    --fortress-recess: #142a33;
    --fortress-surface: var(--unified-panel);
    --fortress-sheet: var(--unified-deep);
    --fortress-glaze: #0f232d;
    --fortress-header: #142c36;
    --fortress-border-soft: #8f836e80;
    --fortress-border-bright: var(--unified-rule);
    --fortress-cover-radius: 4px;
    --fortress-banner-height: 134px;
    --fortress-slate-skin: var(--unified-texture);
    --fortress-copper-skin: var(--unified-copper);
    --frame-inset: 0px;
}

:is(.element-unified[data-page-facet='fire'], .element-unified [data-facet='fire']) { --crest-accent: var(--crest-fire); --crest-mark: var(--crest-fire-mark); }
:is(.element-unified[data-page-facet='earth'], .element-unified [data-facet='earth']) { --crest-accent: var(--crest-earth); --crest-mark: var(--crest-earth-mark); }
:is(.element-unified[data-page-facet='air'], .element-unified [data-facet='air']) { --crest-accent: var(--crest-air); --crest-mark: var(--crest-air-mark); }
:is(.element-unified[data-page-facet='water'], .element-unified [data-facet='water']) { --crest-accent: var(--crest-water); --crest-mark: var(--crest-water-mark); }
body.element-site.element-unified[data-page-facet] { --fortress-accent: var(--crest-accent, var(--unified-gold)); }

.element-unified .crest-mark {
    display: block;
    inline-size: var(--crest-mark-size, 1.35rem);
    block-size: var(--crest-mark-size, 1.35rem);
    flex: none;
    background: var(--crest-mark, none) center / contain no-repeat;
}

.element-unified ::selection { color: #11262c; background: #ebc987; }
.element-unified :focus-visible { outline: 2px solid #ffe4a0; outline-offset: 3px; }
.element-unified :is(input, textarea) { caret-color: var(--crest-accent, var(--crest-earth)); }
.element-unified :is(time, td, input[type='number'], output) { font-variant-numeric: tabular-nums; }

body.element-site.element-unified > .site-wrap {
    inline-size: min(var(--element-width), calc(100% - clamp(14px, 2.1vw, 36px)));
    max-inline-size: none;
    margin: clamp(7px, .85vw, 15px) auto;
    padding: 0;
    border: 0;
    background: var(--unified-deep);
    box-shadow: none;
}

.element-unified .element-frame-corners {
    --frame-corner: clamp(48px, 5vw, 71px);
    border: 1px solid #c1a16b;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px #4c3b26;
}

body.element-site.element-unified .site-wrap > .element-frame-corners {
    --frame-corner: var(--site-frame-corner-size);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background:
        var(--site-frame-edge) center bottom var(--site-frame-lower-inset) / calc(100% - 2px) var(--site-frame-stroke) no-repeat,
        var(--site-frame-sides);
}

body.element-site.element-unified .site-wrap > .element-frame-corners > :is([data-facet='earth'], [data-facet='water']) {
    inset-block-end: 0;
    block-size: var(--site-frame-corner-height);
}

body.element-site.element-unified .site-wrap > .element-frame-corners > [data-facet='earth'] { inset-inline-start: 0; }
body.element-site.element-unified .site-wrap > .element-frame-corners > [data-facet='water'] { inset-inline-end: 0; }

.element-unified .element-frame-corners > [data-facet] {
    aspect-ratio: 70 / 64;
    block-size: auto;
    background: center / 100% 100% no-repeat;
}

.element-unified .element-frame-corners > [data-facet]::before,
.element-unified .element-frame-corners > [data-facet]::after,
.element-unified .element-frame-corners .element-glyph { display: none; }

.element-unified .element-frame-corners > [data-facet='fire'] { background-image: url('reference-ui/corner-tl.webp'); }
.element-unified .element-frame-corners > [data-facet='air'] { background-image: url('reference-ui/corner-tr.webp'); }
.element-unified .element-frame-corners > [data-facet='earth'] { background-image: url('reference-ui/corner-bl.webp'); }
.element-unified .element-frame-corners > [data-facet='water'] { background-image: url('reference-ui/corner-br.webp'); }

body.element-site.element-unified .site-wrap > .site-header { border: 0; }

body.element-site.element-unified .element-masthead {
    min-height: clamp(101px, 8.18vw, 128px);
    padding: 7px clamp(60px, 6.8vw, 104px);
    background: url('reference-ui/header.webp') center / 100% 100% no-repeat #152c36;
}

body.element-site.element-unified:not(.page-home) .element-masthead {
    min-height: clamp(80px, 6.65vw, 101px);
}

body.element-site.element-unified .site-header .clan-logo {
    gap: 6px;
    align-items: center;
}

body.element-site.element-unified .site-header .clan-emblem {
    inline-size: clamp(72px, 8.5vw, 117px);
    block-size: auto;
    aspect-ratio: 120 / 94;
}

body.element-site.element-unified .site-header .clan-emblem img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: none;
}

body.element-site.element-unified .site-header .clan-wordmark {
    color: var(--unified-ink);
    font: 700 clamp(36px, 4.1vw, 57px)/.99 var(--unified-serif);
    letter-spacing: .03em;
    text-transform: uppercase;
    text-shadow: 0 2px 3px #061017, 0 4px 12px #02090c;
}

body.element-site.element-unified:not(.page-home) .site-header .clan-wordmark {
    font-size: clamp(33px, 3.5vw, 48px);
}

body.element-site.element-unified .site-header .clan-logo small {
    justify-content: center;
    color: var(--unified-ink);
    font: 400 clamp(11px, .9vw, 13px)/1.2 var(--unified-serif);
    letter-spacing: .105em;
}

body.element-site.element-unified .site-header :is(.header-telegram, .icon-button) {
    color: var(--unified-ink);
    border-color: #be9d60;
    border-radius: 4px;
    background: #0b2429e6;
    box-shadow: inset 0 0 0 1px #886f472e;
}

body.element-site.element-unified .site-header :is(.header-telegram, .icon-button):hover {
    color: #fff0ca;
    border-color: #e4c17c;
    background: #1b3c42;
}

body.element-site.element-unified .site-header .header-telegram {
    font: 700 clamp(1rem, 1.2vw, 1.2rem)/1.1 var(--unified-serif);
}

body.element-site.element-unified .site-header .element-primary-nav {
    gap: 7px;
    border-block: 1px solid #a68b57;
    background: linear-gradient(#05282e77, #10363a66), url('reference-ui/texture-nav.webp') center / auto 100% repeat-x #0d3338;
}

body.element-site.element-unified .element-primary-nav :is(a, summary) {
    color: var(--unified-ink);
    font-family: var(--unified-serif);
    font-weight: 700;
}

body.element-site.element-unified .element-primary-nav .element-nav-group {
    --tab-color: linear-gradient(180deg, #5c5637, #25291e 59%, #39341f);
    --tab-material: var(--unified-texture);
    --tab-lit: #a88e55;
    --tab-dark: #82734a;
    --beveled-cut: inset(0 round 5px 5px 0 0);
}

body.element-site.element-unified .element-primary-nav .element-nav-group[data-facet='fire'] {
    --tab-color: linear-gradient(180deg, #9b342255, #521c12a3);
    --tab-material: var(--unified-copper);
    --tab-lit: #d17948;
    --tab-dark: #aa5e38;
}

body.element-site.element-unified .element-primary-nav .element-nav-group[data-facet='air'] {
    --tab-color: linear-gradient(180deg, #426b79, #294b54 63%, #345f66);
    --tab-lit: #9da89a;
    --tab-dark: #698580;
}

body.element-site.element-unified .element-primary-nav .element-nav-group::after {
    box-shadow: inset 0 1px 2px #efe5bc40, inset 0 -1px 1px #04171a92;
}

.element-unified .element-nav-group[data-facet='fire'] { --nav-symbol: url('reference-ui/icon-nav-fire.webp'); }
.element-unified .element-nav-group[data-facet='earth'] { --nav-symbol: url('reference-ui/icon-nav-earth.webp'); }
.element-unified .element-nav-group[data-facet='air'] { --nav-symbol: url('reference-ui/icon-nav-air.webp'); }

body.element-site.element-unified .element-primary-nav :is(.element-nav-tab, .element-disclosure-full > summary) > .element-glyph {
    background: var(--nav-symbol) center / contain no-repeat;
    filter: none;
}

.element-unified .element-nav-group :is(.element-nav-tab, .element-disclosure-full > summary) > .element-glyph use { visibility: hidden; }

.element-unified a[data-facet] { --reference-symbol: var(--crest-mark); }

body.element-site.element-unified :is(.element-nav-panel, .element-quicklinks) a[data-facet] > .element-glyph {
    background: var(--reference-symbol) center / contain no-repeat;
    filter: none;
}

.element-unified :is(.element-nav-panel, .element-quicklinks) a[data-facet] > .element-glyph use { visibility: hidden; }

body.element-site.element-unified .element-primary-nav .element-nav-panel {
    border-color: #c3a36a;
    background: linear-gradient(140deg, #252e20e8, #102b2ff5), var(--unified-texture) center / cover;
}

body.element-site.element-unified .element-primary-nav .element-nav-panel a {
    font-weight: 400;
    text-shadow: none;
}

body.element-site.element-unified .element-primary-nav .element-community-nav a:hover,
body.element-site.element-unified .element-primary-nav .element-community-nav a[aria-current] {
    color: #ffe6ad;
    text-decoration: underline;
    text-underline-offset: .25em;
}

body.element-site.element-unified .element-quicklinks,
body.element-site.element-unified .mobile-bottom,
body.element-site.element-unified .site-header > .mobile-drawer {
    border-color: #9d815362;
    background: linear-gradient(#0d292eea, #0a2229fa), var(--unified-texture) center / 510px;
}

body.element-site.element-unified .element-quicklinks a {
    color: var(--unified-ink);
    font-family: var(--unified-serif);
}

body.element-site.element-unified .site-wrap > .site-footer {
    margin-top: 0;
    border-top: 0;
    content-visibility: visible;
    color: var(--unified-muted);
    background: var(--site-frame-edge) center top / 100% 1px no-repeat, var(--site-frame-surface);
}

body.element-site.element-unified .site-footer .footer-brand img {
    width: 67px;
    height: 52px;
    object-fit: contain;
    filter: none;
}

body.element-game.element-unified { background: transparent; }

.element-game.element-unified .knowledge-standalone {
    background: #0b232a;
    box-shadow: 0 15px 48px #030d15bf;
}

.element-game.element-unified .topbar {
    --game-ink: #f4e6c7;
    --game-muted: #d9d5c5;
    --game-paper: #0b2429;
    --game-green: #eac98b;
    border-color: #a48a59;
    background: linear-gradient(#0e222d80, #0e222de8), url('reference-ui/header-elemental-v2.webp') center 31% / cover var(--crest-slate);
}

.element-game.element-unified .nav-row {
    background: linear-gradient(#05282e88, #10363a88), url('reference-ui/texture-nav.webp') center / auto 100% repeat-x #0d3338;
    border-color: #a68b57;
}

@media (max-width: 950px) {
    :root:has(.element-unified) {
        background: linear-gradient(#071d26d4, #071b22f3), url('fortress/slate-material.webp') center / 780px auto repeat #081b23;
    }

    body.element-site.element-unified {
        --element-content-inset: clamp(9px, 2.4vw, 22px);
        --site-frame-corner-size: clamp(26px, 7.8vw, 37px);
        --site-frame-lower-inset: 1px;
    }

    body.element-site.element-unified > .site-wrap {
        inline-size: min(100% - 8px, var(--element-width));
        margin-block-start: 4px;
    }

    .element-unified .element-frame-corners { --frame-corner: 40px; }

    body.element-site.element-unified .element-masthead,
    body.element-site.element-unified:not(.page-home) .element-masthead {
        min-height: 75px;
        padding: 9px 16px 7px;
        background-size: cover;
        background-position: 55% center;
    }

    body.element-site.element-unified .site-header .clan-emblem {
        inline-size: clamp(43px, 10vw, 71px);
        min-inline-size: 0;
    }

    body.element-site.element-unified .site-header .clan-wordmark,
    body.element-site.element-unified:not(.page-home) .site-header .clan-wordmark {
        font-size: clamp(22px, 5.5vw, 38px);
    }

    body.element-site.element-unified .site-header .clan-logo small {
        font-size: 11px;
        letter-spacing: .025em;
    }

    body.element-site.element-unified .mobile-bottom {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        border-color: var(--crest-steel);
        background: linear-gradient(180deg, #203542, var(--crest-slate));
    }

    body.element-site.element-unified .mobile-bottom a {
        min-block-size: 44px;
        border-color: transparent;
        color: var(--unified-muted);
        font-size: clamp(.6875rem, 2.85vw, .75rem);
    }

    body.element-site.element-unified .mobile-bottom a[aria-current='page'] {
        border-color: var(--crest-bronze);
        background: linear-gradient(150deg, #3b474a, #203640);
        color: var(--crest-earth);
    }

    body.element-site.element-unified .mobile-bottom a:focus-visible { outline-offset: -2px; }
}

@media (max-width: 365px) {
    body.element-site.element-unified .element-masthead,
    body.element-site.element-unified:not(.page-home) .element-masthead { padding-inline: 7px; gap: 4px; }
    body.element-site.element-unified .site-header .clan-logo { gap: 2px; }
    body.element-site.element-unified .site-header .clan-emblem { inline-size: clamp(30px, 10vw, 36px); }

    body.element-site.element-unified .site-header .clan-wordmark,
    body.element-site.element-unified:not(.page-home) .site-header .clan-wordmark { font-size: clamp(17px, 5.3vw, 20px); }

    body.element-site.element-unified .site-header .clan-logo small { display: none; }
}

@media (forced-colors: active) {
    :root:has(.element-unified) { background: Canvas; }
    .element-unified :focus-visible { outline-color: Highlight; }
    body.element-site.element-unified .mobile-bottom a[aria-current='page'] { border-color: Highlight; }
}
