/* Talisman /compare — extends styles.css and /artists/artists.css */
/* Adds the comparison table and its selector, the money panel (pies and the squeeze) and the
   source list. Colours, type and spacing come from the :root tokens in styles.css; the two
   accents here are the brand silver (Talisman's own column) and turquoise (a yes). */

.compare-gold { color: #d4dce5; }

/* ---- The selector ----
   One line, "Compared with: Spotify ▾". The panel it opens holds every app, grouped by kind. */
.grid-section { margin: var(--space-xl) 0 var(--space-lg); }

.rival {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    margin: var(--space-md) 0 var(--space-sm);
}

.rival-label {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.rival-button {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    font: inherit;
    font-size: var(--text-lg);
    font-weight: var(--weight-light);
    padding: 0.45rem 0.9rem 0.45rem 1rem;
    color: #fff;
    background: rgba(64, 224, 208, 0.07);
    border: 1px solid rgba(64, 224, 208, 0.5);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.rival-button:hover { background: rgba(64, 224, 208, 0.14); border-color: rgba(64, 224, 208, 0.8); }
.rival-button:focus-visible { outline: 2px solid var(--color-turquoise); outline-offset: 2px; }
.rival-caret { font-size: 0.8em; color: var(--color-turquoise); transition: transform 0.2s; }
.rival-button[aria-expanded="true"] .rival-caret { transform: rotate(180deg); }

/* The panel: every app at once, five kinds side by side; a scrolling column on a phone. */
.rival-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: rgba(6, 6, 10, 0.94);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
    animation: rival-in 0.18s ease-out;
}
.rival-menu[hidden] { display: none; }
@keyframes rival-in { from { opacity: 0; transform: translateY(-6px); } }

.rival-group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rival-group-label {
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    padding: 0.2rem 0.6rem 0.4rem;
}
.rival-option {
    font: inherit;
    font-size: var(--text-sm);
    text-align: left;
    padding: 0.4rem 0.6rem;
    color: rgba(255, 255, 255, 0.8);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
}
.rival-option:hover, .rival-option:focus-visible { background: rgba(255, 255, 255, 0.07); color: #fff; outline: none; }
.rival-option.is-active { color: #fff; background: rgba(64, 224, 208, 0.14); border-color: rgba(64, 224, 208, 0.55); }

@media (max-width: 760px) {
    .rival-menu {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 60vh;
        overflow-y: auto;
    }
}
@media (prefers-reduced-motion: reduce) {
    .rival-menu { animation: none; }
}

/* ---- The table ---- */
.grid-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: var(--text-base);
}

/* Only Talisman and the chosen rival show; the rest wait for their turn in the selector. */
.grid [data-col] { display: none; }
.grid [data-col].is-shown { display: table-cell; }

.grid th, .grid td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
    text-align: left;
}

.grid tbody tr:not(.group-head):hover > * { background-color: rgba(255, 255, 255, 0.03); }
.grid tbody tr:not(.group-head):hover > .cell--us { background-color: rgba(200, 212, 226, 0.11); }

.grid thead .row-head { width: 34%; }

.row-head {
    font-weight: var(--weight-regular);
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.35;
}

/* Column heads: Talisman wears a silver bar, the rival a quiet one. */
.col-head {
    padding-top: 0.9rem !important;
    padding-bottom: 0.7rem !important;
    border-top: 2px solid rgba(255, 255, 255, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
}

.col-name {
    display: block;
    font-weight: var(--weight-regular);
    font-size: var(--text-sm);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
}

.col-badge {
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #e0607a;
    border: 1px solid rgba(224, 96, 122, 0.5);
}

.col-head--us { border-top-color: #d4dce5; background: rgba(200, 212, 226, 0.1); }
.col-head--us .col-name { color: #d4dce5; }
.cell--us { background: rgba(200, 212, 226, 0.06); }

.row-head--label {
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    border-top: 2px solid transparent;
}

.grid tr[hidden] { display: none !important; }

.grid-scope {
    margin: 0.6rem 0 0;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.5);
}

.grid-scope-toggle {
    font: inherit;
    padding: 0;
    background: none;
    border: 0;
    color: var(--color-turquoise);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* A thin gap between related runs of rows. */
.grid tr.divider td {
    padding: 0;
    height: 0.6rem;
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Group headings run across the table as a quiet band. */
.grid .group-head th {
    padding: 0.85rem 0.75rem 0.45rem;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-turquoise);
    background: rgba(64, 224, 208, 0.035);
    border-bottom: 1px solid rgba(64, 224, 208, 0.18);
}

/* Mark and note share a line: the mark leads, the note follows, the source number trails. */
.cell-inner { display: flex; align-items: center; gap: 0.6rem; }

.mark {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    font-size: 0.95rem;
    line-height: 1;
}
.mark--y { color: var(--color-turquoise); background: rgba(64, 224, 208, 0.14); }
.mark--n { color: #e0607a; background: rgba(224, 96, 122, 0.13); }
.mark--p { color: #d9b54a; background: rgba(217, 181, 74, 0.14); }
.mark--u { color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.06); }

.cell-note, .cell-text { font-size: var(--text-sm); color: rgba(255, 255, 255, 0.66); line-height: 1.35; }
.cell-text { color: rgba(255, 255, 255, 0.92); }
.cell--us .cell-note { color: rgba(255, 255, 255, 0.8); }
.cell--us .cell-text { color: #d4dce5; font-weight: var(--weight-regular); }
.cell-src { font-size: 0.62rem; color: rgba(255, 255, 255, 0.3); text-decoration: none; vertical-align: super; margin-left: 0.2rem; }
.cell-src:hover { color: rgba(255, 255, 255, 0.9); }

.cell-inner > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* On a phone each row stacks: its name across the top, then Talisman and the rival side by side. */
@media (max-width: 760px) {
    .grid, .grid thead, .grid tbody { display: block; }
    .grid tr { display: grid; grid-template-columns: 1fr 1fr; }
    .grid tr.group-head, .grid tr.divider { display: block; }
    .grid tr.divider td { display: block; }
    .grid .group-head th { display: block; }
    .grid thead .row-head { display: none; }
    .grid tbody .row-head {
        grid-column: 1 / -1;
        padding: 0.6rem 0.5rem 0.2rem;
        border-bottom: 0;
        font-size: var(--text-sm);
        color: #fff;
    }
    .grid [data-col].is-shown { display: block; }
    .grid th, .grid td { padding: 0.35rem 0.5rem 0.6rem; }
    .col-head { padding-top: 0.7rem !important; }
    .mark { width: 1.35rem; height: 1.35rem; font-size: 0.8rem; }
    .cell-inner { gap: 0.45rem; align-items: flex-start; }
    .cell-note, .cell-text { font-size: var(--text-xs); }
}

/* ---- The money panel: Spotify's split beside ours, and the squeeze ---- */
.money-panel {
    margin: var(--space-xl) 0;
    padding: var(--space-md) var(--space-md) var(--space-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pies {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    margin: var(--space-md) 0;
}

.pie-card {
    flex: 1 1 200px;
    max-width: 280px;
    text-align: center;
}

.pie { width: min(130px, 40vw); height: auto; }

.pie-rest { fill: rgba(255, 255, 255, 0.06); stroke: rgba(255, 255, 255, 0.3); stroke-width: 1; }
.pie-take--them { fill: rgba(255, 255, 255, 0.88); }
.pie-take--us { fill: #d4dce5; }
.pie-goal { fill: none; stroke: #fff; stroke-width: 1.5; stroke-dasharray: 3 3; }

.pie-name { margin-top: var(--space-xs); letter-spacing: 0.16em; text-transform: uppercase; font-size: var(--text-xs); color: rgba(255, 255, 255, 0.7); }
.pie-name--us, .pie-figure--us { color: #d4dce5; }
.pie-figure { font-size: var(--text-base); margin: 0.2rem 0; }
.pie-note { font-size: var(--text-xs); color: rgba(255, 255, 255, 0.55); line-height: 1.5; }

.squeeze {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1px;
    margin: var(--space-md) 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.squeeze-stat { padding: 0.8rem 1rem; background: #000; }
.squeeze-label { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); }
.squeeze-value { font-size: clamp(1.6rem, 4.5vw, 2.1rem); font-weight: var(--weight-light); margin: 0.2rem 0; color: #e0607a; }
.squeeze-note { font-size: var(--text-xs); color: rgba(255, 255, 255, 0.5); }

/* ---- Sources ---- */
.compare-sources { margin-top: var(--space-xl); }
.sources-fold summary { display: flex; align-items: baseline; gap: var(--space-sm); cursor: pointer; list-style: none; }
.sources-fold summary::-webkit-details-marker { display: none; }
.sources-fold summary .artists-h2 { margin-bottom: 0; }
.sources-count { font-size: var(--text-xs); letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); border-bottom: 1px solid rgba(255, 255, 255, 0.25); }
.sources-fold[open] .sources-count { visibility: hidden; }
.sources-fold[open] .source-list { margin-top: var(--space-md); }
.compare-sources .artists-body { font-size: var(--text-sm); }
.source-list {
    columns: 2 18rem;
    column-gap: var(--space-lg);
    font-size: var(--text-xs);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.55);
    padding-left: 1.6rem;
}
.source-list li { break-inside: avoid; }
.source-list a, .compare-sources a { color: rgba(255, 255, 255, 0.75); text-underline-offset: 2px; }
.source-list li:target { color: #fff; }
