/* =========================================================
   HEATMAP PAGE
   ========================================================= */

.heatmap-page {
    width:
        min(
            var(--content-extra-wide),
            calc(100% - var(--page-gutter))
        );
    margin: 0 auto;
    padding: 92px 0 80px;
}

/* =========================================================
   HEADING
   ========================================================= */

.heatmap-heading {
    max-width: 820px;
    margin: 0 auto 42px;
    text-align: center;
}

.heatmap-eyebrow {
    display: inline-block;
    margin-bottom: 0;
    color: #7666e8;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.heatmap-heading h1 {
    margin: 12px 0 14px;
    font-size: clamp(38px, 6vw, 62px);
    line-height: 1.05;
    letter-spacing: -1.8px;
}

.heatmap-heading p {
    max-width: 760px;
    margin: 0 auto;
    color: var(--text-muted, #6f7485);
    font-size: 18px;
    line-height: 1.7;
}

/* =========================================================
   SUMMARY
   ========================================================= */

.heatmap-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.heatmap-summary > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border: 1px solid rgba(120, 130, 170, .14);
    border-radius: 18px;
    background: #fff;
}

.heatmap-summary span {
    color: var(--text-muted, #74798b);
    font-size: 13px;
    font-weight: 700;
}

.heatmap-summary strong {
    font-size: 26px;
    line-height: 1;
}

/* =========================================================
   MATRIX PANEL
   ========================================================= */

.heatmap-panel {
    overflow: visible;
    border: 1px solid rgba(120, 130, 170, .15);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 40px rgba(70, 80, 120, .07);
}

.heatmap-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(120, 130, 170, .12);
}

.heatmap-panel-heading h2 {
    margin: 4px 0 0;
    font-size: 24px;
}

.heatmap-panel-title p {
    margin: 7px 0 0;
    color: var(--text-muted, #6f7485);
    font-size: 14px;
    line-height: 1.5;
}

.heatmap-panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    flex: 0 0 auto;
}

.heatmap-panel-actions .cascade-filter {
    width: 240px;
    flex: 0 0 240px;
}

.heatmap-panel-actions .cascade-button {
    width: 100%;
}

/* =========================================================
   LEGEND
   ========================================================= */

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted, #74798b);
}

.heatmap-legend-scale {
    width: 112px;
    height: 18px;
    overflow: hidden;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        rgba(77, 166, 255, .08) 0%,
        rgba(82, 158, 255, .22) 25%,
        rgba(96, 142, 255, .42) 50%,
        rgba(117, 122, 255, .66) 75%,
        rgba(139, 108, 255, .88) 100%
    );
}

.heatmap-legend-scale i {
    display: none;
}

/* =========================================================
   MATRIX SCROLL AREA
   ========================================================= */

.heatmap-matrix-wrapper {
    position: relative;
    width: 100%;
    max-height: 72vh;
    overflow: auto;
    overscroll-behavior: contain;
}

.heatmap-matrix {
    position: relative;
    min-width: max-content;
}

.heatmap-loading {
    display: grid;
    place-items: center;
    min-width: min(1000px, 100vw);
    min-height: 420px;
    padding: 40px;
    color: var(--text-muted, #74798b);
    font-weight: 700;
}

/* =========================================================
   MATRIX TABLE
   ========================================================= */

.heatmap-table {
    border-collapse: separate;
    border-spacing: 2px;
    padding: 12px;
}

.heatmap-table th,
.heatmap-table td {
    box-sizing: border-box;
}

.heatmap-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 6;
    width: 190px;
    min-width: 190px;
    max-width: 190px;
    background: #fff;
}

/* =========================================================
   COLUMN HEADERS
   ========================================================= */

.heatmap-column-header {
    position: sticky;
    top: 0;
    z-index: 3;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 52px;
    padding: 0;
    background: #fff;
    vertical-align: bottom;
}

.heatmap-column-member {
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 34px;
    height: 34px;
    display: block;
    overflow: hidden;
    border: 2px solid rgba(120, 130, 170, .20);
    border-radius: 50%;
    background: #fff;
    transform: translateX(-50%);
    transition: transform .15s ease, box-shadow .15s ease;
}

.heatmap-column-member:hover {
    transform: translateX(-50%) scale(1.12);
    box-shadow: 0 4px 12px rgba(60, 70, 120, .18);
}

.heatmap-column-member img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================================
   ROW HEADERS
   ========================================================= */

.heatmap-row-header {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 190px;
    min-width: 190px;
    max-width: 190px;
    padding: 0 12px;
    background: #fff;
    text-align: left;
}

.heatmap-row-member {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: inherit;
    text-decoration: none;
}

.heatmap-row-member img {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 2px solid rgba(120, 130, 170, .18);
    border-radius: 50%;
    object-fit: cover;
}

.heatmap-row-member span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}

.heatmap-row-member:hover span {
    text-decoration: underline;
}

/* =========================================================
   MATRIX CELLS
   ========================================================= */

.heatmap-cell {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: #f4f5f8;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    cursor: default;
    transition: transform .12s ease, box-shadow .12s ease;
}

.heatmap-cell.has-collaboration {
    cursor: pointer;
}

.heatmap-cell.has-collaboration:hover {
    position: relative;
    z-index: 4;
    transform: scale(1.10);
    box-shadow: 0 5px 14px rgba(60, 70, 120, .18);
}

.heatmap-cell.is-diagonal {
    background: repeating-linear-gradient(
        135deg,
        #f1f2f5,
        #f1f2f5 4px,
        #e7e9ee 4px,
        #e7e9ee 8px
    );
}

/* =========================================================
   CONTINUOUS HEAT SCALE
   Color is calculated per cell in heatmap.js so every count can
   have its own shade instead of being grouped into five bands.
   ========================================================= */

/* =========================================================
   GROUP SEPARATORS
   ========================================================= */

.heatmap-table tr.is-generation-start > th,
.heatmap-table tr.is-generation-start > td {
    border-top: 2px solid rgba(120, 130, 170, .18);
}

.heatmap-table tr.is-branch-start > th,
.heatmap-table tr.is-branch-start > td {
    border-top: 4px solid rgba(90, 100, 145, .34);
}

.heatmap-column-header.is-generation-start,
.heatmap-cell.is-generation-start {
    border-left: 2px solid rgba(120, 130, 170, .22);
}

.heatmap-column-header.is-branch-start,
.heatmap-cell.is-branch-start {
    border-left: 4px solid rgba(90, 100, 145, .42);
}

/* =========================================================
   MATRIX TOOLTIP
   ========================================================= */

.heatmap-tooltip {
    position: fixed;
    z-index: 9999;
    width: 310px;
    padding: 22px 20px 18px;
    border: 1px solid rgba(126, 108, 255, .28);
    border-radius: 22px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 14px 38px rgba(70, 65, 130, .18);
    text-align: center;
    pointer-events: none;
}

.heatmap-tooltip[hidden] {
    display: none !important;
}

.heatmap-tooltip-portraits {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.heatmap-tooltip-portraits img {
    width: 68px;
    height: 68px;
    border: 3px solid #fff;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(50, 60, 100, .12);
}

.heatmap-tooltip-portraits img + img {
    margin-left: -10px;
}

.heatmap-tooltip-names {
    display: block;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
    color: var(--text, #202333);
}

.heatmap-tooltip-count {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted, #74798b);
}

/* =========================================================
   ERROR
   ========================================================= */

.heatmap-error {
    margin-top: 20px;
    padding: 22px;
    border-radius: 18px;
    background: rgba(255, 80, 100, .08);
}

.heatmap-error h2 {
    margin: 0 0 6px;
}


/* =========================================================
   MOBILE STICKY COLUMN HEADER
   ========================================================= */

.heatmap-mobile-sticky-header {
    display: none;
}


/* =========================================================
   RESPONSIVE — TABLET
   ========================================================= */

@media(max-width:900px) {

    .heatmap-summary {
        grid-template-columns: 1fr;
    }

    .heatmap-panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .heatmap-panel-actions {
        width: 100%;
        justify-content: space-between;
    }

    .heatmap-panel-actions .cascade-filter {
        width: min(320px, 100%);
        flex: 0 1 320px;
    }

}

/* =========================================================
   RESPONSIVE — MOBILE / 390 PX
   ========================================================= */

@media(max-width:650px) {

    .heatmap-page {
        width: calc(100% - 20px);
        padding: 32px 0 64px;
    }


    /* =====================================================
       PAGE HEADING
       ===================================================== */

    .heatmap-heading {
        margin-bottom: 30px;
        padding: 0 8px;
    }

    .heatmap-eyebrow {
        margin-bottom: 14px;
        font-size: 12px;
    }

    .heatmap-heading h1 {
        margin-bottom: 14px;
        font-size: 42px;
    }

    .heatmap-heading p {
        font-size: 16px;
        line-height: 1.55;
    }


    /* =====================================================
       SUMMARY
       ===================================================== */

    .heatmap-summary {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .heatmap-summary > div {
        padding: 16px 18px;
        border-radius: 16px;
    }

    .heatmap-summary span {
        font-size: 12px;
    }

    .heatmap-summary strong {
        font-size: 24px;
    }


    /* =====================================================
       PANEL
       ===================================================== */

    .heatmap-panel {
        border-radius: 20px;
        overflow: visible;
    }

    .heatmap-panel-heading {
        position: relative;
        z-index: 20;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        padding: 20px 16px;
    }

    .heatmap-panel-title {
        width: 100%;
    }

    .heatmap-panel-title h2 {
        font-size: 22px;
    }

    .heatmap-panel-title p {
        margin-top: 6px;
        font-size: 13px;
        line-height: 1.45;
    }


    /* =====================================================
       PANEL ACTIONS
       ===================================================== */

    .heatmap-panel-actions {
        position: relative;
        z-index: 21;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        width: 100%;
    }

    .heatmap-panel-actions .cascade-filter {
        position: relative;
        z-index: 22;
        width: 100%;
        flex: 0 0 auto;
    }

    .heatmap-panel-actions .cascade-button {
        width: 100%;
        min-height: 48px;
    }

    .heatmap-panel-actions .cascade-menu {
        z-index: 100;
    }

    .heatmap-legend {
        justify-content: center;
        width: 100%;
        margin: 0;
    }


    /* =====================================================
       MOBILE STICKY COLUMN HEADER
       ===================================================== */

    .heatmap-mobile-sticky-header {
        position: sticky;
        top: 0;
        z-index: 30;

        display: flex;

        width: 100%;
        height: 48px;

        /*
        Keep the sticky clone out of the document flow so
        showing it never pushes the matrix downward.
        */
        margin-bottom: -48px;

        overflow: hidden;

        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        background: rgba(255, 255, 255, .96);

        border-bottom:
            1px solid
            rgba(120, 130, 170, .14);

        backdrop-filter:
            blur(8px);

        -webkit-backdrop-filter:
            blur(8px);

        transform:
            translateY(-4px);

        transition:
            opacity .16s ease,
            transform .16s ease,
            visibility 0s linear .16s;
    }


    .heatmap-mobile-sticky-header.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;

        transform:
            translateY(0);

        transition:
            opacity .16s ease,
            transform .16s ease,
            visibility 0s;
    }


    .heatmap-mobile-sticky-corner {
        position: relative;
        z-index: 2;

        width: 125px;
        min-width: 125px;
        flex: 0 0 125px;

        background: #fff;
    }


    .heatmap-mobile-sticky-viewport {
        position: relative;

        flex: 1 1 auto;
        min-width: 0;

        overflow: hidden;

        pointer-events: none;
    }


    .heatmap-mobile-sticky-track {
        position: relative;

        display: block;

        height: 48px;

        will-change: transform;
    }


    .heatmap-mobile-sticky-member {
        position: absolute;
        top: 0;

        display: grid;
        place-items: center;

        box-sizing: border-box;

        height: 48px;

        color: inherit;
        text-decoration: none;

        pointer-events: auto;
    }


    .heatmap-mobile-sticky-member img {
        display: block;

        width: 30px;
        height: 30px;

        border:
            2px solid
            rgba(120, 130, 170, .18);

        border-radius: 50%;

        object-fit: cover;

        background: #fff;
    }


    .heatmap-mobile-sticky-member.is-generation-start {
        border-left:
            2px solid
            rgba(120, 130, 170, .22);
    }


    .heatmap-mobile-sticky-member.is-branch-start {
        border-left:
            4px solid
            rgba(90, 100, 145, .42);
    }


    /* =====================================================
       MATRIX SCROLL
       ===================================================== */

    .heatmap-matrix-wrapper {
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: visible;
        border-radius: 0 0 20px 20px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;
        touch-action: pan-x pan-y;
    }

    .heatmap-matrix {
        min-width: max-content;
    }


    /* =====================================================
       TABLE DIMENSIONS
       ===================================================== */

    .heatmap-table {
        border-spacing: 2px;
        padding: 8px 0;
    }

    .heatmap-corner,
    .heatmap-row-header {
        width: 125px;
        min-width: 125px;
        max-width: 125px;
    }

    .heatmap-row-header {
        padding: 0 6px;
    }

    .heatmap-column-header {
        width: 38px;
        min-width: 38px;
        max-width: 38px;
        height: 48px;
    }

    .heatmap-cell {
        width: 38px;
        min-width: 38px;
        height: 38px;
        font-size: 10px;
        border-radius: 6px;
    }


    /* =====================================================
       ORIGINAL TOP PORTRAITS
       ===================================================== */

    .heatmap-column-member {
        width: 30px;
        height: 30px;
        bottom: 6px;
    }


    /* =====================================================
       LEFT TALENT LABELS
       ===================================================== */

    .heatmap-row-member {
        min-height: 38px;
        gap: 6px;
    }

    .heatmap-row-member img {
        width: 28px;
        height: 28px;
        flex: 0 0 28px;
    }

    .heatmap-row-member span {
        overflow: hidden;
        font-size: 10px;
        white-space: nowrap;
        text-overflow: ellipsis;
    }


    /* =====================================================
       TOOLTIP
       ===================================================== */

    .heatmap-tooltip {
        width: min(280px, calc(100vw - 24px));
        padding: 18px 16px 16px;
        border-radius: 18px;
    }

    .heatmap-tooltip-portraits img {
        width: 56px;
        height: 56px;
    }

    .heatmap-tooltip-names {
        font-size: 14px;
    }

    .heatmap-tooltip-count {
        font-size: 12px;
    }

}

/* ==========================================================
   HEATMAP — DARK MODE
   ========================================================== */

html[data-theme="dark"] .heatmap-summary > div,
html[data-theme="dark"] .heatmap-panel {
    background: var(--surface-primary);
    border-color: var(--border-primary);
}

html[data-theme="dark"] .heatmap-panel {
    box-shadow: 0 8px 20px rgba(0, 0, 0, .07);
}

html[data-theme="dark"] .heatmap-panel-heading {
    border-bottom-color: var(--border-primary);
}

html[data-theme="dark"] .heatmap-corner,
html[data-theme="dark"] .heatmap-column-header,
html[data-theme="dark"] .heatmap-row-header {
    background: var(--surface-primary);
}

html[data-theme="dark"] .heatmap-column-member,
html[data-theme="dark"] .heatmap-row-member img,
html[data-theme="dark"] .heatmap-mobile-sticky-member img {
    background: var(--surface-secondary);
    border-color: var(--border-primary);
}

html[data-theme="dark"] .heatmap-cell {
    background: var(--surface-secondary);
    color: var(--text-secondary);
}

html[data-theme="dark"] .heatmap-cell.is-diagonal {
    background:
        repeating-linear-gradient(
            135deg,
            var(--surface-secondary),
            var(--surface-secondary) 4px,
            var(--surface-hover) 4px,
            var(--surface-hover) 8px
        );
}

html[data-theme="dark"] .heatmap-table tr.is-generation-start > th,
html[data-theme="dark"] .heatmap-table tr.is-generation-start > td,
html[data-theme="dark"] .heatmap-column-header.is-generation-start,
html[data-theme="dark"] .heatmap-cell.is-generation-start,
html[data-theme="dark"] .heatmap-mobile-sticky-member.is-generation-start {
    border-color: rgba(145, 153, 190, .24);
}

html[data-theme="dark"] .heatmap-table tr.is-branch-start > th,
html[data-theme="dark"] .heatmap-table tr.is-branch-start > td,
html[data-theme="dark"] .heatmap-column-header.is-branch-start,
html[data-theme="dark"] .heatmap-cell.is-branch-start,
html[data-theme="dark"] .heatmap-mobile-sticky-member.is-branch-start {
    border-color: rgba(157, 144, 255, .42);
}

html[data-theme="dark"] .heatmap-tooltip {
    background: color-mix(in srgb, var(--surface-primary) 97%, transparent);
    border-color: rgba(157, 144, 255, .34);
    box-shadow: 0 14px 38px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] .heatmap-tooltip-portraits img {
    border-color: var(--surface-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .24);
}

html[data-theme="dark"] .heatmap-tooltip-names {
    color: var(--text-primary);
}

html[data-theme="dark"] .heatmap-tooltip-count {
    color: var(--text-muted);
}

@media(max-width:650px) {

    html[data-theme="dark"] .heatmap-mobile-sticky-header {
        background: color-mix(in srgb, var(--surface-primary) 96%, transparent);
        border-bottom-color: var(--border-primary);
    }

    html[data-theme="dark"] .heatmap-mobile-sticky-corner {
        background: var(--surface-primary);
    }

}


/* ==========================================================
   HEATMAP — TALENT HOVER CARD
   ========================================================== */

.heatmap-talent-hover-card {

    width:
        180px;

    padding:
        16px 18px;

}

.heatmap-talent-hover-card
.holo-hover-card-portraits {

    margin-bottom:
        10px;

}

.heatmap-talent-hover-card
.holo-hover-card-portraits img {

    width:
        64px;

    height:
        64px;

}

.heatmap-talent-hover-card
.holo-hover-card-title {

    margin:
        0;

    text-align:
        center;

}

