/* The crest supplies the copper, silver-blue and stone control finishes. */
:is(body.element-site.element-unified, body.element-game.element-unified) {
    --crest-control-text: var(--unified-ink, #f9edda);
    --crest-ember: #642c27;
    --crest-ember-ledge: color-mix(in srgb, var(--crest-fire) 80%, #8d4838);
    --crest-ember-face: linear-gradient(145deg, #a95737aa, #6b2e2ab8 54%, #492124e8);
    --crest-control-steel: color-mix(in srgb, var(--crest-panel) 90%, #194050);
    --crest-steel-ledge: color-mix(in srgb, var(--crest-steel) 83%, var(--crest-air));
    --crest-steel-face: linear-gradient(145deg, #395962b2, #213a45cd 56%, #132934e8);
    --crest-danger: #4e232a;
    --crest-danger-ledge: #d5848b;
    --crest-danger-face: linear-gradient(145deg, #8d444aab, #592932ce 67%, #401b25dc);
    --crest-control-ease: cubic-bezier(.2, .8, .2, 1);
    --control-face: var(--crest-ember-face);
    --control-base: var(--crest-ember);
    --control-ledge: var(--crest-ember-ledge);
    --control-glint: #ffe0bd45;
    --control-symbol: #ffe1b6;
}

body.element-site.element-unified #content :is(
    a.button, button.button, a.icon-button, button.icon-button,
    a.unified-home-action, a.spirit-link-button, button.spirit-link-button,
    .bestiary-primary, .bestiary-button, button.dungeon-index-more,
    .home-calendar__controls button, .dg-map-zoom > button,
    button[data-map-prev], button[data-map-next], button[data-map-all-cancel],
    button[data-index-layer],
    form:not([method='dialog']) :is(button[type='submit'], button[type='reset'], button:not([type]), input[type='submit'], input[type='reset']):not([class])
) {
    min-block-size: 44px;
    border: 1px solid var(--control-ledge);
    border-radius: 3px;
    background: var(--control-face) var(--control-base);
    box-shadow: inset 0 1px var(--control-glint), 0 2px 5px #030f1766;
    color: var(--crest-control-text);
    text-shadow: 0 1px 1px #07151d;
    text-decoration: none;
}

body.element-site.element-unified #content :is(
    .button.ghost, .icon-button:not(.button),
    .spirit-link-button, .bestiary-button, .dungeon-index-more,
    .home-calendar__controls button, .dg-map-zoom > button,
    button[data-map-prev], button[data-map-next], button[data-map-all-cancel],
    button[data-index-layer], form button[type='reset'], form input[type='reset']
) {
    --control-face: var(--crest-steel-face);
    --control-base: var(--crest-control-steel);
    --control-ledge: var(--crest-steel-ledge);
    --control-glint: #d6e6e84a;
    --control-symbol: #c7deeb;
}

body.element-site.element-unified #content :is(.button.danger, .icon-button.danger-text) {
    --control-face: var(--crest-danger-face);
    --control-base: var(--crest-danger);
    --control-ledge: var(--crest-danger-ledge);
    --control-glint: #f6c3cb40;
    --control-symbol: #ffd3d5;
}

body.element-site.element-unified #content :is(.button, .icon-button, .unified-home-action, .spirit-link-button, .bestiary-primary, .bestiary-button) > svg.icon:not(.metal-icon),
body.element-site.element-unified :is(.header-actions > a, .mobile-menu-toggle, .element-drawer-close) > svg.icon,
body.element-site.element-unified #content .home-calendar__controls button > .icon {
    color: var(--control-symbol, #d4e4e7);
    stroke-width: 1.7;
}

body.element-site.element-unified #content :is(a.button, button.button):not(.icon-button) > .metal-icon:has(use[href$='#decorative-sword']),
body.element-site.element-unified #content :is(a.button, button.button):not(.icon-button) > svg.icon:has(use[href$='#book']) {
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

body.element-site.element-unified #content :is(a.button, button.button):not(.icon-button) > .metal-icon:has(use[href$='#decorative-sword']) {
    background-image: var(--crest-fire-mark);
}

body.element-site.element-unified #content :is(a.button, button.button):not(.icon-button) > svg.icon:has(use[href$='#book']) {
    background-image: var(--crest-earth-mark);
}

body.element-site.element-unified #content :is(a.button, button.button):not(.icon-button) > svg.icon > use:is([href$='#decorative-sword'], [href$='#book']) {
    visibility: hidden;
}

body.element-site.element-unified #content :is(
    a.button, button.button, a.icon-button, button.icon-button,
    a.unified-home-action, .spirit-link-button, .bestiary-primary, .bestiary-button, button.dungeon-index-more,
    .home-calendar__controls button, .dg-map-zoom > button,
    button[data-map-prev], button[data-map-next], button[data-map-all-cancel],
    button[data-index-layer],
    form:not([method='dialog']) :is(button[type='submit'], button[type='reset'], button:not([type]), input[type='submit'], input[type='reset']):not([class])
):is(:hover, [aria-pressed='true']):not(:disabled, [aria-disabled='true']) {
    border-color: color-mix(in srgb, var(--control-ledge) 72%, #fff0d2);
    background: var(--control-face) color-mix(in srgb, var(--control-base) 72%, #bec4c7);
    box-shadow: inset 0 1px color-mix(in srgb, var(--control-glint) 75%, #f0e4d688), 0 2px 5px #030f1780;
    color: #fff4df;
}

body.element-site.element-unified #content :is(.button, .icon-button, .unified-home-action, .spirit-link-button, .bestiary-primary, .bestiary-button):active:not(:disabled, [aria-disabled='true']) {
    box-shadow: inset 0 2px 4px #06131987;
}

body.element-site.element-unified #content :is(.link-button, .catalog-search-clear, .quests-directory-reset, .help-reset, .mine-secondary) {
    color: #cce1e9;
    text-decoration-thickness: 1px;
    text-underline-offset: .23em;
}

body.element-site.element-unified #content :is(.link-button, .catalog-search-clear, .quests-directory-reset, .help-reset, .mine-secondary):is(:hover, :focus-visible) {
    color: #eff7f5;
}

body.element-site.element-unified #content :is(.link-button, .mine-secondary)[data-confirm] {
    color: #ffbfbb;
}

body.element-site.element-unified #content :is(button, input[type='submit'], input[type='reset'], a.button, a.icon-button, a.unified-home-action, .spirit-link-button):focus-visible,
body.element-site.element-unified .site-header :is(.header-actions > a, .mobile-menu-toggle, .element-drawer-close):focus-visible,
body.element-game.element-unified .topbar .icon-button:focus-visible {
    outline: 2px solid #ffe2a7;
    outline-offset: 2px;
}

body.element-site.element-unified #content :is(button, input[type='submit'], input[type='reset'], a.button, a.icon-button, .spirit-link-button):is(:disabled, [aria-disabled='true']) {
    opacity: .57;
    cursor: not-allowed;
}

body.element-site.element-unified #content :is(button, a.button)[aria-busy='true'] {
    cursor: wait;
}

body.element-site.element-unified .site-header :is(.header-actions > a, .mobile-menu-toggle, .element-drawer-close),
body.element-game.element-unified .topbar .icon-button {
    --control-symbol: var(--crest-air);
    border-color: #829da7b3;
    background: var(--crest-steel-face) var(--crest-control-steel);
    box-shadow: inset 0 1px #d6e6e830;
    color: var(--crest-control-text);
}

body.element-site.element-unified .site-header :is(.header-actions > a, .mobile-menu-toggle, .element-drawer-close):is(:hover, [aria-expanded='true']),
body.element-game.element-unified .topbar .icon-button:hover {
    border-color: #ccbe9d;
    background: var(--crest-steel-face) #38545a;
    color: #fff3db;
}

@media (min-width: 761px) {
    body.element-site.element-unified #content .button.small:not(.icon-button) {
        min-block-size: 38px;
    }
}

@media (max-width: 760px) {
    body.element-site.element-unified #content :is(
        .link-button, .mine-secondary, .catalog-search-clear, .quests-directory-reset, .help-reset,
        .home-calendar__controls button, [data-map-zoom-in], [data-map-zoom-out]
    ) {
        min-block-size: 44px;
    }

    body.element-site.element-unified #content :is(a.icon-button, button.icon-button, .home-calendar__controls button, [data-map-zoom-in], [data-map-zoom-out]) {
        min-inline-size: 44px;
    }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    body.element-site.element-unified #content :is(a.button, button.button, a.icon-button, button.icon-button, .unified-home-action, .spirit-link-button, .bestiary-primary, .bestiary-button) {
        transition: border-color 150ms var(--crest-control-ease), color 150ms var(--crest-control-ease),
            background-color 150ms var(--crest-control-ease), box-shadow 150ms var(--crest-control-ease),
            translate 150ms var(--crest-control-ease);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.element-site.element-unified #content :is(.button, .icon-button, .unified-home-action, .spirit-link-button, .bestiary-primary, .bestiary-button),
    body.element-site.element-unified .site-header :is(.header-actions > a, .mobile-menu-toggle, .element-drawer-close),
    body.element-game.element-unified .topbar .icon-button {
        transition: none;
        translate: none;
    }
}

@media (forced-colors: active) {
    body.element-site.element-unified #content :is(.button, .icon-button, .unified-home-action, .spirit-link-button, .bestiary-primary, .bestiary-button, .home-calendar__controls button, .dg-map-zoom > button),
    body.element-site.element-unified .site-header :is(.header-actions > a, .mobile-menu-toggle, .element-drawer-close),
    body.element-game.element-unified .topbar .icon-button {
        border-color: ButtonText;
        background: ButtonFace;
        box-shadow: none;
        color: ButtonText;
        text-shadow: none;
    }

    body.element-site.element-unified #content :is(a.button, button.button):not(.icon-button) > svg.icon {
        background-image: none;
    }

    body.element-site.element-unified #content :is(a.button, button.button):not(.icon-button) > svg.icon > use {
        visibility: visible;
    }
}

