/* IMPERIVM ranking systems: UI Rank, Guild Rank and IMPERIVM League. */

.ranking-page .content-shell.wide {
    width: min(1480px, calc(100% - 64px));
}

.ranking-page .page-heading {
    position: relative;
    max-width: none;
    min-height: 360px;
    margin-bottom: 28px;
    padding: 92px clamp(28px, 7vw, 104px) 72px;
    border: 1px solid rgba(207, 153, 60, 0.3);
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(4, 5, 5, 0.98) 0%, rgba(5, 6, 6, 0.86) 47%, rgba(5, 6, 6, 0.35) 100%),
        linear-gradient(0deg, rgba(5, 6, 6, 0.9), transparent 65%),
        url('../media/home-hero-imperivm.webp') center 38% / cover no-repeat;
}

.ranking-page .page-heading::before,
.ranking-page .page-heading::after {
    position: absolute;
    content: "";
    pointer-events: none;
}

.ranking-page .page-heading::before {
    inset: 14px;
    border: 1px solid rgba(207, 153, 60, 0.13);
}

.ranking-page .page-heading::after {
    right: 5%;
    bottom: 0;
    width: 42%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #a36a23, transparent);
}

.ranking-page .page-heading > * {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

.ranking-page .page-heading h1 {
    font-size: clamp(3rem, 6vw, 6.5rem);
    line-height: 0.92;
    text-transform: uppercase;
}

.ranking-system-summary {
    display: grid;
    margin: -64px clamp(20px, 4vw, 64px) 44px;
    position: relative;
    z-index: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid rgba(207, 153, 60, 0.34);
    background: rgba(207, 153, 60, 0.18);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.ranking-summary-card {
    min-height: 116px;
    padding: 24px 26px;
    background:
        linear-gradient(135deg, rgba(104, 66, 24, 0.2), transparent 52%),
        rgba(8, 9, 8, 0.97);
}

.ranking-summary-card strong {
    display: block;
    margin-bottom: 8px;
    color: #e1b75e;
    font-family: var(--serif);
    font-size: 2rem;
    line-height: 1;
}

.ranking-summary-card span {
    color: #b6ac99;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.ranking-workbench {
    padding-top: 12px;
}

.ranking-workbench > .tabs {
    position: sticky;
    top: 86px;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    backdrop-filter: blur(16px);
}

.ranking-workbench > .tabs .tab-button {
    min-height: 54px;
}

.ranking-system-panel {
    padding: clamp(24px, 4vw, 48px);
    border: 1px solid rgba(201, 146, 53, 0.28);
    background:
        radial-gradient(circle at 88% 6%, rgba(164, 103, 36, 0.14), transparent 28%),
        linear-gradient(145deg, rgba(14, 15, 13, 0.98), rgba(7, 8, 7, 0.98));
}

.ranking-system-panel[hidden],
.ranking-category-panel[hidden] {
    display: none !important;
}

.ranking-system-head {
    display: flex;
    margin-bottom: 28px;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.ranking-system-head .eyebrow {
    margin-bottom: 8px;
}

.ranking-system-head h2 {
    color: #ecdfc2;
    font-size: clamp(2rem, 4vw, 3.8rem);
    font-weight: 500;
}

.ranking-source-note {
    max-width: 420px;
    color: #918a7c;
    font-size: 0.78rem;
    text-align: right;
}

.ranking-category-switcher {
    min-width: 0;
}

.ranking-category-toolbar {
    position: relative;
    margin-bottom: 22px;
    padding: 14px;
    border-block: 1px solid rgba(199, 145, 54, 0.24);
    background: rgba(0, 0, 0, 0.22);
}

.ranking-category-label {
    display: block;
    margin-bottom: 10px;
    color: #857b6c;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

.ranking-category-buttons {
    display: flex;
    padding-bottom: 5px;
    gap: 8px;
    overflow-x: auto;
    scrollbar-color: #9d6b2b rgba(0, 0, 0, 0.25);
    scrollbar-width: thin;
}

.ranking-category-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid rgba(190, 136, 47, 0.23);
    color: #9f9789;
    background: rgba(10, 11, 10, 0.72);
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.035em;
    cursor: pointer;
}

.ranking-category-button:hover,
.ranking-category-button:focus-visible {
    border-color: rgba(223, 171, 74, 0.68);
    color: #eadbb9;
}

.ranking-category-button.is-active {
    border-color: #a96d29;
    color: #f2dfb5;
    background: linear-gradient(180deg, rgba(142, 81, 31, 0.62), rgba(69, 42, 21, 0.72));
    box-shadow: inset 0 0 20px rgba(232, 167, 65, 0.08);
}

.ranking-category-select {
    display: none;
    width: 100%;
    min-height: 46px;
    padding: 10px 38px 10px 13px;
    border: 1px solid rgba(205, 151, 59, 0.42);
    border-radius: 0;
    color: #eadbb9;
    background: #11110e;
}

.ranking-category-heading {
    display: flex;
    margin-bottom: 18px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.ranking-category-heading h3 {
    margin: 0;
    color: #e7d8b9;
    font-size: clamp(1.45rem, 3vw, 2.35rem);
}

.ranking-category-heading span {
    color: #a77a36;
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ranking-rework-table .rank {
    width: 64px;
    font-family: var(--serif);
    font-size: 1.05rem;
}

.ranking-rework-table tbody tr {
    background: linear-gradient(90deg, rgba(110, 69, 24, 0.05), transparent 48%);
    transition: background-color 180ms ease, box-shadow 180ms ease;
}

.ranking-rework-table tbody tr:hover {
    background-color: rgba(151, 96, 34, 0.1);
    box-shadow: inset 3px 0 0 rgba(218, 164, 70, 0.52);
}

.rank-character {
    display: flex;
    min-width: 240px;
    align-items: center;
    gap: 14px;
}

.rank-character-avatar {
    position: relative;
    display: grid;
    flex: 0 0 54px;
    width: 54px;
    height: 58px;
    border: 1px solid rgba(202, 148, 58, 0.38);
    overflow: hidden;
    place-items: end center;
    background:
        radial-gradient(circle at 50% 38%, rgba(190, 125, 43, 0.28), transparent 55%),
        linear-gradient(155deg, rgba(52, 37, 20, 0.92), rgba(7, 8, 7, 0.98));
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.rank-character-avatar::after {
    position: absolute;
    inset: auto 7px 4px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(232, 180, 84, 0.75), transparent);
    content: "";
}

.rank-character-avatar img {
    width: auto;
    max-width: 52px;
    height: 57px;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.62));
}

.rank-character-copy {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.ranking-rework-table .rank-player-cell strong {
    display: block;
    color: #eee2c8;
    font-family: var(--serif);
    font-size: 1.08rem;
    letter-spacing: 0.015em;
}

.ranking-rework-table .rank-player-cell small {
    color: #9b8768;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ranking-rework-table tbody tr:nth-child(-n + 3) .rank-character-avatar {
    border-color: rgba(224, 171, 73, 0.64);
    box-shadow: 0 0 24px rgba(167, 104, 31, 0.12);
}

.ranking-rework-table .rank-result {
    color: #e0ad52;
    font-family: var(--serif);
    font-size: 1.08rem;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.ranking-rework-table th:last-child {
    text-align: right;
}

.ranking-rework-table tbody tr:nth-child(1) .rank::after,
.ranking-rework-table tbody tr:nth-child(2) .rank::after,
.ranking-rework-table tbody tr:nth-child(3) .rank::after {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 9px;
    border: 1px solid currentColor;
    content: "";
    transform: rotate(45deg);
}

/* Homepage: the five best players in every player category. */

.home-cinematic .ranking-legends-section {
    width: min(1480px, calc(100% - 56px));
    padding-top: 96px;
}

.ranking-legends-section::before {
    position: absolute;
    inset: 22% -12vw auto;
    height: 420px;
    background: radial-gradient(ellipse, rgba(112, 68, 25, 0.16), transparent 68%);
    content: "";
    pointer-events: none;
}

.legend-showcase {
    position: relative;
    border: 1px solid rgba(199, 145, 54, 0.34);
    background:
        linear-gradient(90deg, rgba(5, 6, 5, 0.97), rgba(13, 13, 10, 0.93)),
        url('../media/home-hero-imperivm.webp') center 54% / cover no-repeat;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
}

.legend-showcase::before {
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(212, 159, 65, 0.1);
    content: "";
    pointer-events: none;
}

.legend-selector {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid rgba(199, 145, 54, 0.28);
}

.legend-selector-group {
    min-width: 0;
    padding: 22px 24px 18px;
}

.legend-selector-group + .legend-selector-group {
    border-left: 1px solid rgba(199, 145, 54, 0.22);
}

.legend-selector-group > span {
    display: block;
    margin-bottom: 12px;
    color: #ba8941;
    font-family: var(--serif);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.legend-selector .ranking-category-buttons {
    padding-bottom: 7px;
}

.legend-selector .ranking-category-button {
    min-height: 34px;
    padding-inline: 12px;
    font-size: 0.64rem;
}

.legend-stage {
    position: relative;
    z-index: 1;
    min-height: 520px;
    padding: clamp(26px, 4vw, 54px);
}

.legend-panel[hidden] {
    display: none !important;
}

.legend-panel-head {
    display: flex;
    margin-bottom: 26px;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.legend-panel-head p {
    margin-bottom: 6px;
    color: #9d7335;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.15em;
}

.legend-panel-head h3 {
    color: #eee0bf;
    font-size: clamp(2rem, 4vw, 3.6rem);
    font-weight: 500;
}

.legend-panel-head > span {
    padding: 8px 13px;
    border: 1px solid rgba(206, 153, 59, 0.34);
    color: #c9994a;
    font-family: var(--serif);
    font-size: 0.76rem;
    letter-spacing: 0.12em;
}

.legend-list {
    display: grid;
    margin: 0;
    padding: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    list-style: none;
}

.legend-entry {
    position: relative;
    min-height: 276px;
    padding: 24px 18px 22px;
    border: 1px solid rgba(193, 139, 48, 0.24);
    overflow: hidden;
    background:
        radial-gradient(circle at 82% 22%, rgba(183, 119, 37, 0.17), transparent 34%),
        linear-gradient(155deg, rgba(69, 45, 22, 0.4), rgba(7, 8, 7, 0.94) 62%);
    box-shadow: inset 0 1px rgba(255, 223, 157, 0.025);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.legend-entry:hover {
    z-index: 2;
    border-color: rgba(220, 163, 66, 0.56);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34), inset 0 0 28px rgba(169, 105, 31, 0.07);
    transform: translateY(-4px);
}

.legend-entry::before {
    position: absolute;
    inset: 9px;
    border: 1px solid rgba(231, 183, 93, 0.065);
    content: "";
    pointer-events: none;
}

.legend-entry::after {
    position: absolute;
    right: -18px;
    bottom: -46px;
    color: rgba(213, 158, 61, 0.055);
    content: attr(data-rank);
    font-family: var(--serif);
    font-size: 9rem;
    line-height: 1;
}

.legend-entry:nth-child(1) {
    border-color: rgba(224, 174, 78, 0.64);
    background:
        radial-gradient(circle at 80% 18%, rgba(224, 167, 64, 0.24), transparent 38%),
        linear-gradient(155deg, rgba(139, 87, 28, 0.48), rgba(8, 9, 8, 0.95) 64%);
}

.legend-entry:nth-child(2) {
    border-color: rgba(181, 187, 185, 0.38);
}

.legend-entry:nth-child(3) {
    border-color: rgba(157, 94, 50, 0.46);
}

.legend-rank {
    position: relative;
    z-index: 3;
    display: inline-grid;
    width: 36px;
    height: 36px;
    margin-bottom: 68px;
    border: 1px solid #9c6d30;
    place-items: center;
    color: #e0b465;
    font-family: var(--serif);
    background: rgba(8, 8, 7, 0.58);
    box-shadow: 0 0 18px rgba(174, 112, 39, 0.12);
    transform: rotate(45deg);
}

.legend-rank > span {
    transform: rotate(-45deg);
}

.legend-portrait {
    position: absolute;
    z-index: 2;
    top: 17px;
    right: 10px;
    display: grid;
    width: 106px;
    height: 119px;
    place-items: end center;
    pointer-events: none;
}

.legend-portrait::before {
    position: absolute;
    inset: 14px 2px 0;
    border: 1px solid rgba(207, 151, 58, 0.2);
    border-radius: 50% 50% 12px 12px;
    background: radial-gradient(circle at 50% 42%, rgba(174, 106, 34, 0.3), transparent 64%);
    content: "";
    filter: blur(1px);
}

.legend-portrait img {
    position: relative;
    z-index: 1;
    width: auto;
    max-width: 96px;
    height: 112px;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.7));
}

.legend-entry:nth-child(1) .legend-portrait {
    transform: scale(1.06);
    transform-origin: top right;
}

.legend-entry-copy {
    position: relative;
    z-index: 3;
    min-width: 0;
}

.legend-entry h4 {
    margin-bottom: 5px;
    color: #f0e3c8;
    font-family: var(--serif);
    font-size: 1.38rem;
    overflow-wrap: anywhere;
}

.legend-archetype {
    display: block;
    margin-bottom: 7px;
    color: #b98b45;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.legend-entry p {
    min-height: 20px;
    color: #878074;
    font-size: 0.7rem;
}

.legend-entry > strong {
    position: relative;
    z-index: 3;
    display: block;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid rgba(190, 136, 48, 0.17);
    color: #dfae55;
    font-family: var(--serif);
    font-size: 1.34rem;
}
.legend-empty {
    min-height: 260px;
    padding: 70px 24px;
    border: 1px dashed rgba(190, 137, 48, 0.3);
    color: #968e80;
    text-align: center;
}

.legend-footer {
    position: relative;
    z-index: 1;
    display: flex;
    padding: 0 clamp(26px, 4vw, 54px) 42px;
    justify-content: center;
}

@media (max-width: 1050px) {
    .ranking-system-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ranking-workbench > .tabs {
        top: 74px;
    }

    .legend-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .legend-entry:nth-child(4),
    .legend-entry:nth-child(5) {
        min-height: 205px;
    }
}

@media (max-width: 760px) {
    .ranking-page .content-shell.wide,
    .home-cinematic .ranking-legends-section {
        width: calc(100% - 28px);
    }

    .ranking-page .page-heading {
        min-height: 330px;
        padding: 72px 24px 54px;
        background-position: 64% center;
    }

    .ranking-page .page-heading h1 {
        font-size: clamp(2.65rem, 15vw, 4.5rem);
    }

    .ranking-system-summary {
        margin: -34px 12px 34px;
    }

    .ranking-summary-card {
        min-height: 96px;
        padding: 18px;
    }

    .ranking-workbench > .tabs {
        position: static;
        display: flex;
        overflow-x: auto;
    }

    .ranking-workbench > .tabs .tab-button {
        flex: 0 0 auto;
        min-width: 132px;
    }

    .ranking-system-panel {
        padding: 22px 16px;
    }

    .ranking-system-head {
        display: block;
    }

    .ranking-source-note {
        margin-top: 12px;
        text-align: left;
    }

    .ranking-category-buttons {
        display: none;
    }

    .ranking-category-select {
        display: block;
    }

    .ranking-category-heading {
        display: block;
    }

    .ranking-category-heading span {
        display: block;
        margin-top: 8px;
    }

    .ranking-rework-table {
        min-width: 620px !important;
    }

    .legend-selector {
        display: block;
        padding: 14px;
    }

    .legend-selector-group {
        padding: 8px 0;
    }

    .legend-selector-group + .legend-selector-group {
        border-left: 0;
    }
    .legend-selector .ranking-category-buttons {
        display: none;
    }

    .legend-selector .ranking-category-select {
        display: block;
    }

    .legend-stage {
        min-height: 0;
        padding: 30px 18px;
    }

    .legend-panel-head {
        align-items: start;
    }

    .legend-list {
        grid-template-columns: 1fr;
    }

    .legend-entry,
    .legend-entry:nth-child(4),
    .legend-entry:nth-child(5) {
        display: grid;
        min-height: 0;
        padding: 14px 16px;
        align-items: center;
        grid-template-columns: 36px 64px minmax(0, 1fr) auto;
        gap: 4px 12px;
    }

    .legend-entry:hover {
        transform: none;
    }

    .legend-rank {
        grid-column: 1;
        grid-row: 1;
        width: 28px;
        height: 28px;
        margin: 0;
    }

    .legend-portrait,
    .legend-entry:nth-child(1) .legend-portrait {
        position: relative;
        top: auto;
        right: auto;
        grid-column: 2;
        grid-row: 1 / span 2;
        width: 62px;
        height: 68px;
        transform: none;
    }

    .legend-portrait img {
        max-width: 60px;
        height: 68px;
    }

    .legend-portrait::before {
        inset: 8px 0 0;
    }

    .legend-entry-copy {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .legend-entry h4,
    .legend-entry p,
    .legend-entry > strong {
        margin: 0;
    }

    .legend-entry > strong {
        grid-column: 4;
        grid-row: 1 / span 2;
        padding: 0;
        border-top: 0;
        text-align: right;
    }

    .legend-entry::after {
        display: none;
    }
}

@media (max-width: 460px) {
    .ranking-system-summary {
        grid-template-columns: 1fr 1fr;
    }

    .ranking-summary-card strong {
        font-size: 1.55rem;
    }

    .ranking-summary-card span {
        font-size: 0.58rem;
    }

    .legend-panel-head {
        display: block;
    }

    .legend-panel-head > span {
        display: inline-block;
        margin-top: 12px;
    }

    .legend-entry {
        grid-template-columns: 32px 56px minmax(0, 1fr);
    }

    .legend-portrait,
    .legend-entry:nth-child(1) .legend-portrait {
        width: 54px;
        height: 62px;
    }

    .legend-portrait img {
        max-width: 52px;
        height: 62px;
    }

    .legend-entry > strong {
        grid-column: 3;
        grid-row: 3;
        margin-top: 7px;
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ranking-category-button,
    .legend-entry {
        transition: none !important;
    }
}
