/*
 * .MD — station shell.
 *
 * The discipline: every element here does something. The band selector navigates, the
 * on-air lamp reads the globe's real rotation. Chrome that only looks like an instrument
 * is the failure mode this world is most exposed to.
 *
 * The tuning plate and the frequency numerals were removed at the client's request — the
 * column read as too heavy against the field. The globe is turned by dragging it.
 */

/* The rail is fixed for the whole site, so every page inherits the left navigation
   without restructuring its own layout. Reserving the column on <body> keeps that true
   for the pages that predate this shell as well as the ones built for it. */
body { padding-left: var(--pd-rail); }

.station {
    position: relative;
    z-index: 3;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ---------- Left rail: the band selector ---------- */

.station-rail {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--pd-rail);
    height: 100dvh;
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: clamp(20px, 3vh, 34px) 0 clamp(18px, 3vh, 28px);
    border-right: 1px solid var(--pd-hairline);
    /* Client: the solid strip "very much cuts the eye". Dropped to a wash so the
       propagation field, its grid and its drifting points stay visible behind the
       band names, with just enough ground left to hold their contrast. */
    background: linear-gradient(to right, color-mix(in oklab, var(--pd-void-0) 46%, transparent), color-mix(in oklab, var(--pd-void-0) 16%, transparent));
    backdrop-filter: blur(14px);
    overflow-y: auto;
    scrollbar-width: thin;
}

/* The .MD wordmark — a drawn dot, not the word "Punct" */
/* Baseline-aligned so the dot reads as the period in ".MD" rather than a bullet
   floating at cap height. It doubles as the on-air lamp, which is the point. */
.wordmark {
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding: 0 var(--pd-rail-pad) clamp(26px, 4vh, 44px);
    text-decoration: none;
}
/* Unlit until the station actually has something on air. A permanently red lamp
   reports nothing, which is the exact chrome this world must avoid. */
.wordmark-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--pd-ink-faint);
    flex: none;
    align-self: flex-end;
    margin-bottom: 2px;
    transition: background .5s var(--pd-ease), box-shadow .5s var(--pd-ease);
}
.wordmark-dot.is-live {
    background: var(--pd-live);
    box-shadow: 0 0 0 4px var(--pd-live-halo);
}
.wordmark-text {
    font-family: var(--pd-font-display);
    font-weight: 900;
    font-size: 27px;
    letter-spacing: -.04em;
    color: var(--pd-ink);
    line-height: 1;
}

.bands { display: flex; flex-direction: column; }

/* A band, not a nav link: name on the left, tick on the edge.
   The 42px column here used to hold the frequency numeral. The numerals were removed at
   the client's request and the column was not, so every band name was being laid into
   the 42px slot with 119px of empty grid beside it. */
.band {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 10px;
    /* 9px gave a 42px row: every band sat under the 44px touch minimum. */
    padding: 12px var(--pd-rail-pad);
    text-decoration: none;
    color: var(--pd-ink-dim);
    transition: color .18s var(--pd-ease), background .18s var(--pd-ease);
}
/* Scaled rather than animated on height: transitioning height thrashes layout. */
.band::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    width: 3px; height: 68%;
    background: var(--pd-carrier);
    transform: translateY(-50%) scaleY(0);
    transition: transform .22s var(--pd-ease), background .18s var(--pd-ease);
}
.band:hover { color: var(--pd-ink); background: var(--pd-signal-wash); }
.band:hover::before { transform: translateY(-50%) scaleY(.62); background: var(--pd-signal); }

.band-active { color: var(--pd-ink); }
.band-active::before { transform: translateY(-50%) scaleY(1); }

/* This rule and .band-active were separated by a bare newline, which made them one
   descendant selector — so the band name was styled ONLY inside the active band and
   every other band fell back to 16px/400. The active nav item was smaller and lighter
   than its siblings, and the row height changed as you navigated. */
/* Set like the station's call signs (mono, capitals, tracked) — the client asked for the
   menu to read like the "Artists →" link rather than as body copy. */
.band-name {
    font-family: var(--pd-font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* ---------- Language ---------- */

.rail-lang { padding: 14px var(--pd-rail-pad) 0; }

.lang-switch { display: flex; gap: 4px; }

.lang-btn {
    font-family: var(--pd-font-mono);
    font-size: 10px;
    letter-spacing: .16em;
    /* Was 35x27 — not reachable with a thumb, and this is the only way to change
       language on the whole site. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid var(--pd-hairline);
    border-radius: var(--pd-etch);
    color: var(--pd-ink-faint);
    cursor: pointer;
    transition: color .18s var(--pd-ease), border-color .18s var(--pd-ease);
}
.lang-btn:hover { color: var(--pd-ink); border-color: var(--pd-signal); }

/* Amber marks the tuned state, exactly as it does on the band scale. */
.lang-btn-active { color: var(--pd-carrier); border-color: var(--pd-carrier); }

/* ---------- Globe stage ---------- */

.stage { position: relative; overflow: hidden; flex: 1; min-height: 100dvh; }

/* Absolute, not in flow. As a flow child with height: 100% against a flex parent whose
   own height is content-derived, the canvas's intrinsic attribute height won the
   circular resolution and pushed the stage past the viewport — on a landscape phone the
   "full-bleed" stage scrolled 102px and the caption ended up under the band strip. */
#globeCanvas {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Standing caption, bottom of the stage */
.stage-caption {
    position: absolute;
    left: var(--pd-gutter);
    bottom: clamp(20px, 4vh, 40px);
    max-width: 34ch;
    pointer-events: none;
    z-index: 4;
}
/* Removed from view at the client's request; still the page's heading and hint for
   assistive technology and search, so they are clipped rather than deleted. */
.stage-caption .caption-title,
.stage-caption .caption-hint-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
/* The ghost hand (station.js) that now and then drags across the globe, which turns with
   it. Placed by script in viewport coordinates; a hairline in ink. */
.globe-hand {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 6;
    width: 40px;
    height: 40px;
    color: var(--pd-ink);
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}
.globe-hand svg {
    display: block;
    filter: drop-shadow(0 0 3px var(--pd-void-0));
    transform-origin: 13px 3px;
    transition: transform .15s var(--pd-ease);
}
.globe-hand.is-pressed svg { transform: scale(.9); }
.globe-hand-ring {
    position: absolute;
    left: 13px;
    top: 3px;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border: 1px solid var(--pd-ink);
    border-radius: 50%;
    opacity: 0;
}
.globe-hand.is-pressed .globe-hand-ring { animation: pd-hand-ring .7s var(--pd-ease) both; }
@keyframes pd-hand-ring {
    from { opacity: .7; transform: scale(.3); }
    to   { opacity: 0; transform: scale(1); }
}

/* Shown when the globe cannot start. Not an apology screen — the station still has to
   say who is on air, so this is the real list, reachable and readable. */
.stage-fallback {
    position: relative;
    z-index: 5;
    padding: clamp(32px, 7vh, 76px) var(--pd-gutter);
    max-width: 74ch;
}
.fallback-list { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; }
.fallback-list li { border-top: 1px solid var(--pd-hairline); }
.fallback-list li:last-child { border-bottom: 1px solid var(--pd-hairline); }
.fallback-list a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 13px 2px;
    text-decoration: none;
    flex-wrap: wrap;
}
.fallback-name {
    font-family: var(--pd-font-sans);
    font-weight: 600;
    font-size: 15px;
    color: var(--pd-ink);
}
.fallback-meta {
    font-family: var(--pd-font-mono);
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--pd-ink-faint);
}
.fallback-list a:hover .fallback-name { color: var(--pd-signal); }

.globe-tip {
    position: fixed;
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity .16s var(--pd-ease), transform .16s var(--pd-ease);
    background: var(--pd-panel);
    backdrop-filter: blur(9px);
    border: 1px solid var(--pd-hairline-bright);
    border-radius: 2px;
    padding: 8px 11px;
    max-width: 240px;
}
.globe-tip.on { opacity: 1; transform: translateY(0); }
.globe-tip .tn {
    font-family: var(--pd-font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--pd-ink);
    display: block;
}
.globe-tip .td {
    font-family: var(--pd-font-mono);
    font-size: 9.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--pd-carrier);
    display: block;
    margin-top: 3px;
}

/* ---------- Tuned-in panel: the globe keeps turning behind it ---------- */

.tuned {
    position: absolute;
    top: 0; right: 0;
    height: 100%;
    width: min(432px, 42vw);
    z-index: 12;
    background: var(--pd-panel-solid);
    backdrop-filter: blur(18px);
    border-left: 1px solid var(--pd-hairline-bright);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .5s var(--pd-ease);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.tuned.open { transform: translateX(0); }

/* Only the close control: the "On air" label beside it was removed at the client's
   request. */
.tuned-head {
    display: flex;
    justify-content: flex-end;
    padding: 22px var(--pd-gutter) 0;
}

.tuned-close {
    font-family: var(--pd-font-mono);
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    background: none;
    border: 1px solid var(--pd-hairline-bright);
    border-radius: 2px;
    color: var(--pd-ink-faint);
    padding: 6px 10px;
    cursor: pointer;
    flex: none;
    transition: color .18s var(--pd-ease), border-color .18s var(--pd-ease);
}
.tuned-close:hover { color: var(--pd-ink); border-color: var(--pd-signal); }

.tuned-body { padding: 16px var(--pd-gutter) 34px; }

/* Content resolves in rather than snapping — the signal-lock raise */
.tuned-resolve { animation: pd-resolve .55s var(--pd-ease) both; }
@keyframes pd-resolve {
    from { opacity: 0; filter: blur(6px); transform: translateY(8px); }
    to   { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.tuned-portrait {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid var(--pd-hairline);
    background: var(--pd-void-2);
    display: block;
    margin-bottom: 16px;
}
.tuned-name {
    font-family: var(--pd-font-display);
    font-weight: 800;
    font-size: 27px;
    letter-spacing: -.03em;
    color: var(--pd-ink);
    margin: 0 0 8px;
    line-height: 1.08;
}
.tuned-bio {
    font-family: var(--pd-font-sans);
    font-size: 14px;
    line-height: 1.68;
    color: var(--pd-ink-dim);
    margin: 14px 0 0;
}
.tuned-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.tuned-fields {
    margin-top: 18px;
    border-top: 1px solid var(--pd-hairline);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.tuned-field {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 12px;
    font-family: var(--pd-font-mono);
    font-size: 10.5px;
    letter-spacing: .08em;
}
.tuned-field dt { color: var(--pd-ink-faint); text-transform: uppercase; margin: 0; }
.tuned-field dd { color: var(--pd-ink-dim); font-weight: 500; margin: 0; }

/* ---------- Intro: colour channels converge into the thin .MD, which becomes the wordmark ---------- */

/* The markup lives in App.razor, outside the interactive station. The pre-paint script
   there sets data-intro="play" on a first visit to the station; anything else hides the
   cover before it paints. intro.js flies the finished mark into the wordmark and then
   sets data-intro="done", which is what lets the globe and the real wordmark appear. */
:root:not([data-intro="play"]) .intro { display: none; }

.intro {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    background-color: var(--pd-void);
    pointer-events: none;
    transition: background-color .9s var(--pd-ease);
}

.intro-mark {
    display: grid;
    font-family: var(--pd-font-display);
    font-size: clamp(56px, 11vw, 132px);
    line-height: 1;
    letter-spacing: -.04em;
    transform-origin: 0 0;
    transition: transform .9s var(--pd-ease), opacity .35s var(--pd-ease);
}
.intro-ch,
.intro-thin {
    grid-area: 1 / 1;
    display: flex;
    align-items: flex-end;
    gap: .1em;
}
.intro-dot {
    flex: none;
    width: .26em;
    height: .26em;
    margin-bottom: .06em;
    border-radius: 50%;
}

/* The colour channels: four offset copies of the mark added together (screen), so where
   they overlap they read as light, the way a screen's subpixels do. They arrive heavy and
   apart, jitter, then close on one another while the variable face thins. */
.intro-ch {
    color: var(--intro-c);
    font-weight: 900;
    mix-blend-mode: screen;
    animation:
        pd-ch-converge 1.9s var(--pd-ease) .1s both,
        pd-ch-out .6s var(--pd-ease) 1.85s forwards;
}
.intro-ch .intro-dot { background: currentColor; }
.intro-ch-r { --intro-c: var(--pd-live);     --dx: -.15em; --dy: .03em; }
.intro-ch-g { --intro-c: var(--pd-phosphor); --dx: .07em;  --dy: -.08em; }
.intro-ch-b { --intro-c: var(--pd-signal);   --dx: .16em;  --dy: .04em; }
.intro-ch-a { --intro-c: var(--pd-carrier);  --dx: -.05em; --dy: .09em; }

@keyframes pd-ch-converge {
    0%   { opacity: 0; transform: translate(calc(var(--dx) * 1.8), calc(var(--dy) * 1.8)); filter: blur(8px); font-weight: 900; }
    12%  { opacity: 1; filter: blur(0); }
    16%  { transform: translate(calc(var(--dx) * 1.2), var(--dy)); }
    20%  { transform: translate(calc(var(--dx) * 1.6), calc(var(--dy) * -.6)); }
    24%  { transform: translate(var(--dx), calc(var(--dy) * 1.3)); }
    100% { opacity: 1; transform: translate(0, 0); filter: blur(0); font-weight: 300; }
}
@keyframes pd-ch-out { to { opacity: 0; } }

/* What they become: one thin outline in ink, the dot a ring. */
.intro-thin {
    color: transparent;
    font-weight: 300;
    -webkit-text-stroke: 1.2px var(--pd-ink);
    opacity: 0;
    animation: pd-thin-in .7s var(--pd-ease) 1.8s both;
}
.intro-thin .intro-dot {
    box-sizing: border-box;
    border: 1.5px solid var(--pd-ink);
}
@keyframes pd-thin-in { to { opacity: 1; } }

.intro-scan {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0 3px,
        var(--pd-signal-glow) 3px 4px);
    animation: pd-scanlines 1.8s linear both;
}
.intro-status {
    position: absolute;
    bottom: 12vh;
    font-family: var(--pd-font-mono);
    font-size: 10px;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--pd-ink-faint);
    animation: pd-status 2.6s steps(1) both;
}
@keyframes pd-scanlines {
    from { opacity: .85; transform: translateY(-6px); }
    to   { opacity: 0; transform: translateY(6px); }
}
@keyframes pd-status {
    0%   { opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { opacity: 0; }
}

/* The flight. intro.js sets the transform that lands the mark on the wordmark, the
   ground falls away under it, and on landing the mark hands over to the real wordmark. */
.intro.intro-fly { background-color: transparent; }
.intro.intro-fly .intro-scan,
.intro.intro-fly .intro-status { display: none; }
.intro.intro-land .intro-mark { opacity: 0; }

/* The station waits for the intro: the globe and the wordmark only appear once it is done. */
:root[data-intro="play"] #globeCanvas,
:root[data-intro="play"] .wordmark { opacity: 0; }
#globeCanvas { transition: opacity 1.2s var(--pd-ease); }
.wordmark { transition: opacity .35s var(--pd-ease); }

@media (prefers-reduced-motion: reduce) {
    /* No channels and no flight: the thin mark is shown briefly, then removed outright
       (intro.js), and the globe appears without a fade. */
    .intro-ch, .intro-scan { display: none; }
    .intro-thin { animation: none; opacity: 1; }
    .intro, .intro-mark, #globeCanvas, .wordmark { transition: none; }
    .tuned { transition: none; }
    .tuned-resolve { animation: none; }
}

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

@media (max-width: 900px) {
    /* The rail goes to the BOTTOM edge on phones. A horizontal strip at the top would
       re-derive precisely the nav bar this redesign removed; at the bottom it stays a
       band strip and is thumb-reachable. */
    /* The bands own the strip. The join invitation and the language switch used to share
       it and took 258 of the 331px a 375px phone offers, leaving the bands a 49px window —
       "Home" and nothing else, so the navigation looked removed. On a phone the join
       invitation is dropped (client's request) and the language switch goes to the top
       edge, opposite the wordmark. The height is reserved by body padding and the stage. */
    :root { --pd-rail-h: 66px; }
    body { padding-left: 0; padding-bottom: var(--pd-rail-h); }

    .station-rail {
        top: auto;
        bottom: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        border-right: none;
        border-top: 1px solid var(--pd-hairline-bright);
        background: color-mix(in oklab, var(--pd-void-0) 74%, transparent);
        padding: 10px var(--pd-rail-pad);
        overflow: visible;
        /* No backdrop-filter here: filter creates a containing block for fixed
           descendants, which anchored the wordmark to the strip instead of the
           viewport. The ground below is a wash, so the field shows through — which is
           the same trade the desktop rail makes deliberately. */
        backdrop-filter: none;
    }

    /* The station must not scroll: rail height is reserved by body padding, so the
       inner column has to stop short of a full viewport or the caption slides under. */
    .station { min-height: auto; }

    /* Wordmark leaves the strip and sits over the stage, where it reads as identity
       rather than as the first item of a menu. */
    .wordmark {
        position: fixed;
        top: 10px;
        left: calc(var(--pd-gutter) - 8px);
        z-index: 21;
        /* Was padding: 0, giving a 61x27 target. */
        padding: 9px 8px;
        min-height: 44px;
        align-items: center;
    }

    .bands {
        flex-direction: row;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 2px;
        flex: 1;
        min-width: 0;
        scroll-snap-type: x proximity;
        /* Fades the trailing edge so it is visible that more bands lie off-screen —
           at 375px three of the eight are. Without it the strip looked complete and most
           of the navigation was simply unreachable-looking. */
        mask-image: linear-gradient(to right, #000 0, #000 86%, transparent 100%);
    }
    .bands::-webkit-scrollbar { display: none; }

    /* Still a band: frequency above name, carrier tick along the top edge. */
    .band {
        grid-template-columns: 1fr;
        grid-auto-rows: min-content;
        align-items: center;
        justify-items: center;
        gap: 2px;
        /* Was 6px, giving a 32px row on the primary phone navigation. */
        padding: 12px 12px;
        white-space: nowrap;
        scroll-snap-align: center;
    }
    .band::before {
        left: 50%; top: 0;
        width: 100%; height: 2px;
        transform: translateX(-50%) scaleX(0);
        transition: transform .22s var(--pd-ease), background .18s var(--pd-ease);
    }
    .band:hover::before { transform: translateX(-50%) scaleX(.5); }
    .band-active::before { transform: translateX(-50%) scaleX(1); }
    .band-name { font-size: 13px; letter-spacing: .12em; }

    /* Top edge, mirroring the wordmark: language is a setting, not a destination. */
    .rail-lang {
        position: fixed;
        top: 10px;
        right: calc(var(--pd-gutter) - 8px);
        z-index: 21;
        padding: 0;
    }

    .stage { min-height: calc(100dvh - var(--pd-rail-h)); }
    /* A phone opens the profile instead of this panel (station.js); it still shows here if
       the window narrows while it is open. Full width, so it has to sit above the fixed
       wordmark and language switch (21) — below them, "Close" printed through RO/EN. It
       ends at the strip, so the bands stay reachable. */
    .tuned { width: 100%; z-index: 22; }
    .stage-caption { max-width: none; right: var(--pd-gutter); bottom: 20px; }
}

/* ---------- Short viewports: the landscape phone ---------- */

/* A phone turned sideways is not a small desktop and not a tall phone — it is a viewport
   with width to spare and almost no height. The portrait composition stacks a globe above
   a bottom-anchored caption, which needs vertical room that does not exist here: the
   caption ran past the fold and sat underneath the band strip.
   Landscape has the one thing portrait lacks, so the composition turns: caption in a left
   column, globe to the right of it. That is the desktop arrangement without the rail. */
@media (max-width: 900px) and (max-height: 560px) {
    .stage-caption {
        top: 50%;
        bottom: auto;
        right: auto;
        transform: translateY(-50%);
        max-width: min(42vw, 34ch);
    }

    /* Very little top edge to spare. */
    .wordmark, .rail-lang { top: 6px; }
}

/* ---------- Input method ---------- */

/* Screen size does not tell you how the visitor is pointing at it. Nothing in this build
   asked, so every hover affordance was simply dead on touch. */
@media (hover: none) {
    /* The card is already a link; on touch the overlay was an invitation that never
       appeared, covering the portrait it was supposed to reveal. */
    .artist-overlay { display: none; }

    /* Hover ticks and washes never fire on touch, and leaving them declared means a
       tapped element keeps the hover state until something else is tapped. */
    .band:hover { background: transparent; }
    .band:hover::before { transform: translateY(-50%) scaleY(0); }
}

@media (hover: none) and (max-width: 900px) {
    .band:hover::before { transform: translateX(-50%) scaleX(0); }
}

/* Coarse pointers need the room between targets, not just the targets. */
@media (pointer: coarse) {
    .lang-switch { gap: 8px; }
    .tuned-actions { gap: 14px; }
}

/* ---------- Safe areas ---------- */

/* The band strip is the primary navigation on a phone and it sits on the bottom edge —
   which on any device with a home indicator or a rounded corner is exactly where the
   system furniture is. App.razor now sets viewport-fit=cover so these resolve. */
@media (max-width: 900px) {
    .station-rail {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-left: max(var(--pd-rail-pad), env(safe-area-inset-left));
        padding-right: max(var(--pd-rail-pad), env(safe-area-inset-right));
    }

    body {
        padding-bottom: calc(var(--pd-rail-h) + env(safe-area-inset-bottom));
    }

    .stage { min-height: calc(100dvh - var(--pd-rail-h) - env(safe-area-inset-bottom)); }
}
