/**
 * Genre constellation — [genre_constellation].
 *
 * Two modes, one markup. The mu-plugin renders chips, a stage and a list of
 * genre blocks. With no JavaScript, or under prefers-reduced-motion, or if
 * WebGL is unavailable, the root carries .gc--static (or nothing at all) and
 * every genre block is shown as a card with a disc sized by track count: a
 * static chart. When the renderer comes up the root gains .gc--webgl, the
 * stage shows the planets, and the blocks become the side panel — only the
 * selected genre's block is displayed. Nothing is duplicated between modes;
 * the same buttons play the same songs.
 *
 * Scoped to .gc so it cannot leak. Colours ride the homepage's --sh-* tokens
 * where they exist and fall back to the same values where they do not.
 */

.gc {
    --gc-text: var(--sh-text, #e7ebf3);
    --gc-text-soft: var(--sh-text-soft, rgba(231,235,243,0.72));
    --gc-text-muted: var(--sh-text-muted, rgba(231,235,243,0.48));
    --gc-card: var(--sh-bg-card, #1f1f33);
    --gc-border: var(--sh-border, rgba(255,255,255,0.08));
    --gc-pink: var(--sh-pink, #e7565a);
    position: relative;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    color: var(--gc-text);
}

.gc .gc-title { margin-bottom: 8px; }
.gc .gc-sub   { margin-bottom: 22px; }

/* The Elementor kit styles every <button> on the site (pink fill, uppercase,
   its own padding). These are controls, not CTAs, so reset them here at a
   specificity the kit's element selectors cannot reach. */
.gc button.gc-chip,
.gc button.gc-link,
.gc button.gc-close,
.gc button.gc-song {
    background-image: none;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    border-radius: 999px;
    text-shadow: none;
    min-height: 0;
    width: auto;
}
.gc button.gc-song { border-radius: 10px; width: 100%; }
.gc button.gc-close { padding: 0; }

/* ---- Chips ---------------------------------------------------------- */

.gc-nav { margin: 0 0 18px; }
.gc-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.gc-chips li { margin: 0; }
.gc .gc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 9px;
    border: 1px solid var(--gc-border);
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    color: var(--gc-text-soft);
    font: inherit;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.gc .gc-chip:hover { background: rgba(255,255,255,0.07); color: var(--gc-text); }
.gc .gc-chip:focus-visible { outline: 2px solid var(--gc-c3, #fff); outline-offset: 2px; }
.gc .gc-chip[aria-pressed="true"] {
    background: color-mix(in srgb, var(--gc-c2, #e7565a) 28%, transparent);
    border-color: var(--gc-c3, #ff7b80);
    color: var(--gc-text);
}
.gc .gc-chip-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--gc-c3, #fff), var(--gc-c2, #888) 70%);
    box-shadow: 0 0 6px color-mix(in srgb, var(--gc-c3, #fff) 60%, transparent);
    flex: none;
}
.gc .gc-chip-n { color: var(--gc-text-muted); font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
    .gc-chips { gap: 6px; }
    .gc .gc-chip { padding: 6px 10px 6px 8px; font-size: 12px; gap: 6px; }
    .gc .gc-chip-dot { width: 10px; height: 10px; }
}

/* ---- Body: stage + panel -------------------------------------------- */

.gc-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.gc--webgl .gc-body {
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
}
@media (max-width: 860px) {
    .gc--webgl .gc-body { grid-template-columns: minmax(0, 1fr); }
}

/* The stage is hidden unless WebGL is running; there is nothing in it. */
.gc-stage {
    display: none;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 320px;
    max-height: 620px;
    border-radius: 18px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(226,55,178,0.07), transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(47,110,211,0.08), transparent 55%);
    touch-action: manipulation;
}
.gc--webgl .gc-stage { display: block; }
@media (max-width: 700px) {
    .gc-stage { aspect-ratio: 4 / 3; min-height: 280px; }
}
.gc-canvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}
.gc-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.gc-label {
    position: absolute;
    left: 0; top: 0;
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: .04em;
    color: var(--gc-text-soft);
    text-shadow: 0 1px 6px rgba(0,0,0,0.8);
    will-change: transform;
    transition: color .2s ease, font-size .2s ease;
}
.gc-label.is-active {
    color: var(--gc-c3, #fff);
    font-size: 14px;
    font-weight: 600;
}
@media (max-width: 700px) {
    .gc-label { font-size: 10px; }
    .gc-label.is-active { font-size: 12px; }
}
.gc-stage-hint {
    position: absolute;
    left: 14px; bottom: 10px;
    margin: 0;
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gc-text-muted);
    pointer-events: none;
    transition: opacity .3s ease;
}
.gc--has-selection .gc-stage-hint { opacity: 0; }

/* ---- Panel / genre blocks ------------------------------------------ */

.gc-panel { min-width: 0; }
.gc-genres {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}
/* Static chart: a responsive grid of cards. */
.gc:not(.gc--webgl) .gc-genres {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.gc-genre {
    position: relative;
    margin: 0;
    padding: 18px 18px 16px;
    border: 1px solid var(--gc-border);
    border-radius: 16px;
    background: var(--gc-card);
    box-shadow: inset 0 0 0 1px transparent;
}
/* WebGL: only the selected block is shown, as the side panel. */
.gc--webgl .gc-genre { display: none; }
.gc--webgl .gc-genre.is-active {
    display: block;
    border-color: color-mix(in srgb, var(--gc-c3) 45%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--gc-c2) 35%, transparent), 0 18px 40px -24px var(--gc-c2);
    animation: gc-panel-in .35s cubic-bezier(.22,.61,.36,1);
}
@keyframes gc-panel-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.gc--webgl .gc-panel:not(:has(.is-active)):not(:has(.gc-edge:not([hidden])))::before {
    content: "Tap a planet to hear its music, or a strand to see what two genres share.";
    display: block;
    padding: 18px;
    border: 1px dashed var(--gc-border);
    border-radius: 16px;
    color: var(--gc-text-muted);
    font-size: 14px;
}

.gc-genre-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding-right: 28px;
}
.gc-disc {
    flex: none;
    width: var(--gc-size, 56px);
    height: var(--gc-size, 56px);
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 28%, var(--gc-c4) 0%, var(--gc-c3) 22%, var(--gc-c2) 50%, var(--gc-c1) 78%, var(--gc-c0) 100%);
    box-shadow: 0 0 22px -4px var(--gc-c2);
}
.gc--webgl .gc-disc { width: 40px; height: 40px; }
.gc-genre-name {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
}
.gc-genre-name:focus { outline: none; }
.gc-genre-meta {
    margin: 4px 0 0;
    color: var(--gc-text-soft);
    font-size: 13px;
}
.gc-genre-includes {
    margin: 2px 0 0;
    color: var(--gc-text-muted);
    font-size: 12px;
}

.gc .gc-close {
    position: absolute;
    top: 10px; right: 10px;
    width: 30px; height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    color: var(--gc-text-soft);
    font: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.gc .gc-close:hover { background: rgba(255,255,255,0.12); color: var(--gc-text); }
.gc:not(.gc--webgl) .gc-genre .gc-close { display: none; }

.gc-links {
    margin: 0 0 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.gc-links-label { color: var(--gc-text-muted); margin-right: 2px; }
.gc .gc-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border: 1px solid var(--gc-border);
    border-radius: 999px;
    background: transparent;
    color: var(--gc-text-soft);
    font: inherit;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}
.gc .gc-link:hover { color: var(--gc-text); border-color: rgba(255,255,255,0.25); }
.gc .gc-link-n { color: var(--gc-text-muted); font-variant-numeric: tabular-nums; }

/* ---- Song buttons: the play mechanism ------------------------------- */

.gc-songs {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 4px;
}
.gc-songs li { margin: 0; }
.gc .gc-song {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 5px 8px 5px 5px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--gc-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .15s ease;
}
.gc .gc-song:hover, .gc-song:focus-visible { background: rgba(255,255,255,0.06); }
.gc .gc-song:focus-visible { outline: 2px solid var(--gc-c3, #fff); outline-offset: -2px; }
.gc .gc-song-art {
    position: relative;
    width: 40px; height: 40px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06) center / cover no-repeat;
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: none;
}
.gc .gc-song-art svg {
    width: 18px; height: 18px;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
    opacity: .85;
    transition: transform .15s ease, opacity .15s ease;
}
.gc .gc-song:hover .gc-song-art svg { transform: scale(1.15); opacity: 1; }
.gc .gc-song-text { display: grid; min-width: 0; }
.gc .gc-song-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gc .gc-song-artist {
    font-size: 12px;
    color: var(--gc-text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gc .gc-song-dur {
    font-size: 12px;
    color: var(--gc-text-muted);
    font-variant-numeric: tabular-nums;
}
.gc .gc-archive {
    display: inline-block;
    font-size: 13px;
}

/* ---- Edge (strand) info -------------------------------------------- */

.gc-edge {
    position: relative;
    padding: 18px 18px 16px;
    border: 1px solid var(--gc-border);
    border-radius: 16px;
    background: var(--gc-card);
    margin-bottom: 14px;
}
.gc-edge-title { margin: 0 28px 4px 0; font-size: 18px; font-weight: 700; }
.gc-edge-meta { margin: 0 0 10px; color: var(--gc-text-soft); font-size: 13px; }
.gc-edge-links { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; }
.gc .gc-edge-archive { color: var(--gc-pink); text-decoration: none; }
.gc .gc-edge-archive:hover { text-decoration: underline; }

/* ---- Footer line ---------------------------------------------------- */

.gc-foot {
    margin: 18px 0 0;
    text-align: center;
    color: var(--gc-text-muted);
    font-size: 12px;
}
.gc-foot .sh-link-arrow { margin-left: 6px; }

/* ---- Reduced motion ------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .gc--webgl .gc-genre.is-active { animation: none; }
    .gc-chip, .gc-song, .gc-song-art svg, .gc-label, .gc-stage-hint { transition: none; }
}
