/*
 * fabriccraft.net/player-stats/ (AGE-411). Loaded after site.css; the page
 * also loads the design system's tokens.css and components.css (with
 * data-theme="dark" on <html>) for its form controls, tabs, segmented
 * control, table, pagination, figures and empty states. Dark throughout,
 * like every public page. Only layout and the page's own pieces live here.
 */

/* ---------- Layout: page head, page tabs, lookup controls, result ---------- */

.ps {
    max-width: var(--max);
    margin: 0 auto;
    padding: clamp(3rem, 8vw, 6rem) var(--gutter) var(--band-pad);
}

.ps-pagehead h1 {
    font-size: var(--step-3);
    font-weight: 650;
    line-height: 1.08;
    letter-spacing: -0.025em;
}

.ps-home-link {
    text-decoration: none;
}

.ps-home-link:hover {
    color: var(--accent);
}

.ps-intro {
    margin-top: 0.75rem;
    max-width: 52ch;
    color: var(--text-soft);
}

/* Page tabs: links with aria-current (fc-tabs), one address per tab. */
.ps-page-tabs {
    margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

/* The search form takes the same measure as the teaser below it. */
.ps-lookup {
    max-width: 44rem;
    padding-top: 2rem;
}

.ps-lookup[hidden] {
    display: none;
}

.ps-noscript {
    margin-top: 1.5rem;
}

.ps-search-row {
    display: flex;
    gap: 0.5rem;
}

.ps-search-row .fc-input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
}

.ps-search-row .fc-button {
    flex: none;
}

.ps-view {
    margin-top: 2.5rem;
}

/* Notes at the foot of the page content, under every tab and state. */
.ps-notes {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}

.ps-side-note {
    max-width: 60ch;
    color: var(--text-soft);
    font-size: var(--step--1);
}

.ps-side-note + .ps-side-note {
    margin-top: 0.75rem;
}

/* ---------- Shared pieces ---------- */

.ps-title {
    font-size: var(--step-2);
    font-weight: 650;
    line-height: 1.15;
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.ps-title:focus {
    outline: none;
}

.ps-title:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.ps-asof {
    margin-top: 0.5rem;
    color: var(--text-soft);
    font-size: var(--step--1);
}

.ps-loading {
    padding: 2.25rem 0;
    border-top: 1px solid var(--rule);
    color: var(--text-soft);
}

.ps-view > .fc-empty:first-child {
    border-top: 0;
    padding-top: 0;
}

.ps-view .fc-empty .fc-empty__title {
    overflow-wrap: anywhere;
}

/* A name in the player's name colour. Stops are validated (#rrggbb, 4.5:1
   on the page and on the row-hover fill) and set from JS through the CSSOM. */
.ps-name {
    overflow-wrap: anywhere;
}

.ps-name.has-color {
    color: var(--ps-name-from);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
    .ps-name.has-gradient {
        color: transparent;
        background-image: var(--ps-name-gradient);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-box-decoration-break: clone;
        box-decoration-break: clone;
    }
}

@media (forced-colors: active) {
    .ps-name.has-color,
    .ps-name.has-gradient {
        color: CanvasText;
        background: none;
    }
}

.ps-head {
    flex: none;
    border-radius: 3px;
    background: var(--fill);
    image-rendering: pixelated;
}

.ps-head-128 {
    width: 128px;
    height: 128px;
}

.ps-head-32 {
    width: 32px;
    height: 32px;
}

/* ---------- Leaderboard teaser (Player lookup tab) ---------- */

.ps-teaser {
    max-width: 44rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}

.ps-teaser-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.ps-teaser-kicker {
    color: var(--text-soft);
    font-size: var(--step--1);
    font-weight: 600;
}

.ps-teaser-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* The crossfade: JS adds .is-leaving, swaps the board, then removes it. */
.ps-teaser-frame {
    margin-top: 1rem;
    transition: opacity 250ms ease;
}

.ps-teaser-frame.is-leaving {
    opacity: 0;
}

.ps-teaser-title {
    font-size: var(--step-1);
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -0.015em;
}

.ps-teaser-foot {
    margin-top: 1rem;
}

.ps-table--compact .ps-player {
    min-height: 2.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .ps-teaser-frame {
        transition: none;
    }
}

/* ---------- Profile ---------- */

.ps-profile-head {
    display: flex;
    align-items: flex-start;
    gap: clamp(1rem, 3vw, 2rem);
}

.ps-profile-id {
    min-width: 0;
}

.ps-profile-id .ps-title {
    font-size: var(--step-3);
    letter-spacing: -0.025em;
}

.ps-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.75rem;
    margin-top: 0.85rem;
}

.ps-meta dt {
    color: var(--text-soft);
    font-size: var(--step--1);
}

.ps-meta dd {
    margin-top: 0.1rem;
    overflow-wrap: anywhere;
}

.ps-profile-id .ps-asof {
    margin-top: 0.85rem;
}

.ps-profile-id .fc-button-row {
    margin-top: 1rem;
}

.ps-tabs {
    margin-top: clamp(2rem, 5vw, 3rem);
}

.ps-panel {
    padding-top: 1.5rem;
}

.ps-panel:focus-visible {
    outline-offset: 4px;
}

.ps-figures {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1.25rem 1.5rem;
}

.ps-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem clamp(1.5rem, 4vw, 3.5rem);
    margin-top: 2.5rem;
}

.ps-section h3 {
    font-size: var(--step-0);
    font-weight: 650;
}

.ps-section h4 {
    margin: 1.25rem 0 0;
    color: var(--text-soft);
    font-size: var(--step--1);
    font-weight: 600;
}

/* Label-and-figure rows divided by hairlines. */
.ps-rows {
    margin-top: 0.6rem;
    border-top: 1px solid var(--rule);
}

.ps-rows > div,
.ps-rows > li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--rule);
}

.ps-rows dt,
.ps-rows li > span:first-child {
    min-width: 0;
    color: var(--text-soft);
}

.ps-rows dd,
.ps-rows .ps-num {
    font-family: var(--font-figure);
    font-size: 0.92rem;
    font-stretch: 75%;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    text-align: right;
    white-space: nowrap;
}

/* A counter stopped at Minecraft's maximum: the hint is in the title. */
.ps-capped {
    white-space: normal;
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;
    cursor: help;
}

.ps-top-list {
    margin-top: 0.4rem;
    list-style: none;
}

.ps-panel-foot {
    margin-top: 2.5rem;
}

/* ---------- Leaderboards ---------- */

.ps-board-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem 1.5rem;
    margin-top: 1.25rem;
}

.ps-board-stat {
    flex: 1 1 14rem;
    max-width: 22rem;
}

.ps-board-note {
    flex-basis: 100%;
    margin-top: -0.25rem;
}

.ps-board .ps-asof,
.ps-view > .ps-asof {
    margin-top: 1.25rem;
}

.ps-table-wrap {
    margin-top: 1rem;
}

.ps-table-wrap:focus-visible {
    outline-offset: 2px;
}

.ps-table {
    font-size: var(--step--1);
}

.ps-table thead th {
    top: 0;
}

.ps-table tbody th {
    font-weight: 500;
}

.ps-rank-cell {
    width: 4.5rem;
    color: var(--text-soft);
}

.ps-player {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.75rem;
    text-decoration: none;
}

a.ps-player:hover .ps-name:not(.has-gradient) {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

a.ps-player:hover .ps-name.has-gradient {
    filter: brightness(1.15);
}

.ps-pager {
    margin-top: 1.25rem;
}

.ps-pager .fc-page {
    min-width: 2.75rem;
    height: 2.75rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    .ps-sections {
        grid-template-columns: minmax(0, 1fr);
    }

    .ps-profile-head {
        flex-direction: column;
    }

    .ps-head-128 {
        width: 96px;
        height: 96px;
    }

    .ps-board-stat {
        max-width: none;
    }

    .ps-table th,
    .ps-table td {
        padding-inline: 0.5rem;
    }

    .ps-rank-cell {
        width: 3rem;
    }

    .ps-player {
        gap: 0.5rem;
    }

    .ps-pager .fc-pagination__summary {
        flex-basis: 100%;
        padding-bottom: 0.25rem;
    }
}
