.faction-showcase,
.feature-showcase {
    position: relative;
    overflow: hidden;
    scroll-margin-top: 5rem;
    color: #fff0d3;
}

.faction-showcase {
    padding-top: clamp(30px, 4.2vw, 70px);
    background:
        linear-gradient(180deg, rgb(40 3 2 / 42%), rgb(32 3 3 / 66%)),
        #390906 var(--site-image-faction-battle-jpg, url("reference/faction-battle.jpg")) center / cover no-repeat;
    box-shadow: inset 0 1px rgb(255 214 114 / 55%);
}

.showcase-heading {
    width: min(94%, 1256px);
    margin: 0 auto;
}

.showcase-heading img,
.faction-card img,
.feature-carousel img {
    display: block;
    max-width: 100%;
    height: auto;
}

.faction-showcase__body {
    position: relative;
    display: flex;
    flex-direction: column-reverse;
}

.faction-card {
    display: grid;
    grid-template: "name portrait" auto "skills portrait" auto "description portrait" 1fr / minmax(0, 43%) minmax(0, 57%);
    align-items: start;
    width: min(calc(100% - 72px), 1500px);
    min-height: clamp(470px, 43vw, 650px);
    margin: 0 auto;
    padding-top: clamp(18px, 3vw, 36px);
}

.faction-card[hidden] {
    display: none;
}

.faction-card__name {
    position: relative;
    display: grid;
    grid-area: name;
    min-width: 0;
    height: clamp(94px, 9vw, 135px);
    margin: 0;
    padding-inline: clamp(34px, 6vw, 78px);
    place-items: center;
}

.faction-card__name img {
    width: auto;
    max-height: 100%;
    object-fit: contain;
}

.faction-card__name::before,
.faction-card__name::after {
    position: absolute;
    width: clamp(35px, 5vw, 78px);
    aspect-ratio: 78 / 94;
    content: "";
    pointer-events: none;
    background: no-repeat center / contain;
}

.faction-card__name::before {
    left: 0;
    background-image: var(--site-image-role-left-png, url("reference/role/left.png"));
}

.faction-card__name::after {
    right: 0;
    background-image: var(--site-image-role-right-png, url("reference/role/right.png"));
}

.faction-card__portrait {
    display: grid;
    grid-area: portrait;
    place-items: center;
    align-self: center;
}

.faction-card__portrait img {
    width: auto;
    max-height: clamp(460px, 42vw, 630px);
    object-fit: contain;
    animation: showcase-enter 260ms ease-out;
}

.faction-card__skills {
    grid-area: skills;
    margin: clamp(12px, 2vw, 22px) 0 0;
    color: #ffe8ac;
    font-size: clamp(16px, 1.55vw, 24px);
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    text-wrap: balance;
}

.faction-card__description {
    grid-area: description;
    margin: clamp(20px, 3vw, 40px) 0 0;
    border-left: 1px solid rgb(248 219 162 / 55%);
    padding: 0 8px 20px clamp(15px, 2.4vw, 36px);
    color: #f9e7c5;
    font-size: clamp(17px, 1.6vw, 24px);
    line-height: 1.42;
    text-shadow: 0 2px 4px #270401;
}

.faction-tabs {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    align-items: end;
    min-height: clamp(73px, 7.6vw, 116px);
    padding-inline: max(16px, calc((100% - 1460px) / 2));
    background: #bc7900 var(--site-image-role-bg-jpg, url("reference/role/bg.jpg")) center bottom / 100% 100% no-repeat;
}

.faction-tabs__tab {
    position: relative;
    z-index: 1;
    display: grid;
    min-width: 0;
    min-height: clamp(73px, 7.6vw, 116px);
    place-content: center;
    justify-items: center;
    border: 0;
    border-right: 1px solid rgb(232 181 57 / 54%);
    padding: 6px 7px;
    background: linear-gradient(180deg, transparent, rgb(93 16 5 / 50%));
    color: #fff9dc;
    font: inherit;
    font-size: clamp(13px, 1.6vw, 24px);
    font-weight: 800;
    line-height: 1.12;
    text-shadow: 0 2px 5px #740907;
    cursor: pointer;
}

.faction-tabs__tab:first-child {
    border-left: 1px solid rgb(232 181 57 / 54%);
}

.faction-tabs__tab[aria-selected="true"] {
    z-index: 2;
    height: clamp(139px, 13vw, 196px);
    margin-top: calc(clamp(73px, 7.6vw, 116px) - clamp(139px, 13vw, 196px));
    gap: 9px;
    border: 0;
    padding-top: 17px;
    background: var(--site-image-role-role-active-png, url("reference/role/role-active.png")) center bottom / 100% 100% no-repeat;
}

.faction-tabs__tab img {
    display: none;
    width: clamp(54px, 6vw, 96px);
}

.faction-tabs__tab[aria-selected="true"] img {
    display: block;
}

.faction-tabs__tab:hover {
    filter: brightness(1.14);
}

.faction-showcase :focus-visible,
.feature-showcase :focus-visible {
    outline: 2px solid #fff2a5;
    outline-offset: -3px;
}

.feature-showcase {
    padding: clamp(28px, 5.2vw, 78px) 0 clamp(32px, 5vw, 74px);
    background: #3e0805 var(--site-image-stage-desktop-jpg, url("reference/stage-desktop.jpg")) center bottom / cover no-repeat;
}

.feature-carousel {
    margin-top: clamp(20px, 4vw, 55px);
}

.feature-carousel__stage {
    position: relative;
    width: min(78%, 1080px);
    margin: 0 auto;
}

.feature-carousel__track {
    position: relative;
    aspect-ratio: 1080 / 618;
    touch-action: pan-y;
}

.feature-carousel__slide {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    visibility: hidden;
    margin: 0;
    padding: 1.8% 2.2%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease, transform 350ms ease, visibility 250ms;
}

.feature-carousel__slide img {
    width: 100%;
}

.feature-carousel__slide.is-current,
.feature-carousel__slide.is-previous,
.feature-carousel__slide.is-next {
    visibility: visible;
}

.feature-carousel__slide.is-current {
    z-index: 2;
    opacity: 1;
}

.feature-carousel__slide.is-current::after {
    position: absolute;
    inset: 0;
    content: "";
    background: var(--site-image-galery-mask-png, url("reference/galery-mask.png")) center / 100% 100% no-repeat;
}

.feature-carousel__slide.is-previous {
    transform: translateX(-96%);
    opacity: .3;
}

.feature-carousel__slide.is-next {
    transform: translateX(96%);
    opacity: .3;
}

.feature-carousel__arrow {
    position: absolute;
    z-index: 3;
    top: 50%;
    display: grid;
    width: clamp(48px, 7vw, 104px);
    aspect-ratio: 1;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.feature-carousel__arrow--previous {
    left: clamp(-110px, -7.6vw, -52px);
}

.feature-carousel__arrow--next {
    right: clamp(-110px, -7.6vw, -52px);
}

.feature-carousel__arrow:hover {
    filter: brightness(1.2);
}

.feature-carousel__navigation {
    display: flex;
    justify-content: center;
    gap: clamp(3px, 1.2vw, 18px);
    margin: clamp(8px, 2vw, 26px) auto 0;
}

.feature-carousel__status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.feature-carousel__dot {
    display: grid;
    min-width: 27px;
    min-height: 36px;
    place-items: center;
    border: 0;
    padding: 0 4px;
    background: transparent;
    cursor: pointer;
}

.feature-carousel__dot::after {
    display: block;
    width: clamp(9px, 1.6vw, 23px);
    aspect-ratio: 1;
    border-radius: 100px;
    content: "";
    background: #fff6df;
    transition: width 180ms ease, background 180ms ease;
}

.feature-carousel__dot[aria-current="true"]::after {
    width: clamp(32px, 5vw, 88px);
    aspect-ratio: auto;
    height: clamp(9px, 1.6vw, 23px);
    background: #ffce28;
}

@keyframes showcase-enter {
    from { opacity: .2; }
    to { opacity: 1; }
}

@media (max-width: 850px) {
    .faction-showcase__body {
        flex-direction: column;
    }

    .faction-tabs {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        padding-inline: 0;
        border-block: 1px solid rgb(255 211 112 / 56%);
        background: linear-gradient(180deg, #340705, #650d06);
    }

    .faction-tabs__tab,
    .faction-tabs__tab[aria-selected="true"] {
        height: 67px;
        min-height: 0;
        margin: 0;
        gap: 3px;
        border: 0;
        border-right: 1px solid rgb(255 211 112 / 24%);
        border-bottom: 1px solid rgb(255 211 112 / 24%);
        padding: 3px 4px;
        font-size: clamp(11px, 3.1vw, 16px);
    }

    .faction-tabs__tab[aria-selected="true"] {
        background: linear-gradient(180deg, #cf5b1d, #81160d);
        box-shadow: inset 0 0 0 1px #fac774;
    }

    .faction-tabs__tab img {
        width: 30px;
    }

    .faction-card {
        grid-template: "name" auto "portrait" auto "skills" auto "description" 1fr / minmax(0, 1fr);
        width: min(100% - 38px, 620px);
        min-height: 0;
        padding: 26px 0 25px;
    }

    .faction-card__name {
        width: min(100%, 340px);
        height: clamp(58px, 13vw, 95px);
        justify-self: center;
        padding-inline: 38px;
    }

    .faction-card__portrait img {
        width: min(100%, 430px);
        max-height: none;
    }

    .faction-card__skills {
        margin-top: 1px;
        font-size: clamp(13px, 3.5vw, 20px);
    }

    .faction-card__description {
        min-height: 5.3em;
        margin-top: 16px;
        padding-bottom: 0;
        font-size: clamp(14px, 4vw, 18px);
    }

    .feature-carousel__stage {
        width: min(94%, 680px);
    }

    .feature-carousel__arrow--previous {
        left: 0;
    }

    .feature-carousel__arrow--next {
        right: 0;
    }

    .feature-carousel__arrow img {
        width: 44px;
    }

    .feature-carousel__slide.is-previous,
    .feature-carousel__slide.is-next {
        visibility: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .faction-card__portrait img {
        animation: none;
    }

    .feature-carousel__slide,
    .feature-carousel__dot::after {
        transition: none;
    }
}
