/*
 * A deliberately muted, typographic base.
 *
 * The brief for this boilerplate is that it demonstrates functionality without
 * carrying anybody's identity. So the palette is neutral greys with a single
 * accent taken from `radio.stations`.`primary_colour`, and the accent is used
 * only for small marks: the wordmark square, links, the live dot, the focus
 * ring. Nothing is a large field of colour, because a large field of colour
 * reads as branding and this site has none.
 *
 * A tenant replacing this file is the expected outcome, not a failure of it.
 */

:root {
    --bg: #f6f6f4;
    --surface: #ffffff;
    --border: #e3e3df;
    --text: #24272b;
    --text-soft: #5c6167;
    --radius: 6px;
    --wrap: 68rem;

    /* --accent is set inline from the station record. This is the fallback for
       a station with no colour recorded, and it is deliberately dull. */
    --accent: #5a6b7a;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #161819;
        --surface: #1e2123;
        --border: #303437;
        --text: #e6e7e8;
        --text-soft: #a2a8ad;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 1.25rem;
}

a { color: inherit; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.skip {
    position: absolute;
    left: -9999px;
}

.skip:focus {
    left: 1rem;
    top: 1rem;
    z-index: 10;
    background: var(--surface);
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.small { font-size: 0.85rem; color: var(--text-soft); }
.sep { margin: 0 0.5rem; color: var(--text-soft); }

/* ---- masthead ---------------------------------------------------------- */

.masthead {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.masthead-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 4.25rem;
    flex-wrap: wrap;
}

.wordmark {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    margin-right: auto;
}

.wordmark-mark {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 4px;
    background: var(--accent);
    flex: none;
}

.wordmark strong { display: block; font-size: 1.02rem; letter-spacing: -0.01em; }
.wordmark small { display: block; font-size: 0.78rem; color: var(--text-soft); }

.masthead nav ul {
    display: flex;
    gap: 1.15rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.masthead nav a {
    text-decoration: none;
    font-size: 0.92rem;
    color: var(--text-soft);
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
}

.masthead nav a:hover { color: var(--text); }

.masthead nav a[aria-current="page"] {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/*
 * The masthead on a phone.
 *
 * A station with news, a chart, a playlist, competitions, deals and voting has
 * ten navigation entries, and at 375px a wrapping row of ten sets itself on
 * three lines and pushes the whole page down. The answer is not smaller type and
 * it is not a hamburger, which hides the site behind a control that needs
 * scripting. The nav takes a line of its own and scrolls sideways: everything is
 * still there, still the same size, still reachable with no script, and the
 * header is two rows however many sections a station runs.
 */
@media (max-width: 60rem) {
    .masthead-inner {
        gap: 0.75rem 1rem;
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
    }

    .masthead nav {
        order: 3;
        width: 100%;

        /* The bleed lets the strip run to the edges of the screen, so a reader
           can see there is more of it past the last visible entry. */
        margin: 0 -1.25rem;
        padding: 0 1.25rem;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .masthead nav::-webkit-scrollbar { display: none; }

    .masthead nav ul {
        flex-wrap: nowrap;
        gap: 1rem;
    }

    .masthead nav a { white-space: nowrap; }
}

/* ---- generic pieces ---------------------------------------------------- */

.button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius);
    border: 0;
    cursor: pointer;

    /* A two word label on a button is one word, as far as line breaking goes.
       Without this the masthead's Listen Live is a flex item that shrinks below
       its content and sets itself on two lines at a narrow width. */
    white-space: nowrap;
}

.button:hover { filter: brightness(0.93); }

/* And it does not shrink at all. `flex: none` is the half that stops the
   squeeze; `white-space` above only stops the squeeze looking like a wrap. */
.listen-link { flex: none; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

h1 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 2rem 0 0.35rem; }
h2 { font-size: 1.12rem; letter-spacing: -0.01em; margin: 2.25rem 0 0.85rem; }
h3 { font-size: 0.98rem; margin: 0 0 0.3rem; }

.lede { color: var(--text-soft); margin: 0 0 1.5rem; }

.empty {
    color: var(--text-soft);
    font-size: 0.9rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.columns {
    display: grid;
    gap: 2rem;
    grid-template-columns: 2fr 1fr;
    align-items: start;
}

@media (max-width: 48rem) {
    .columns { grid-template-columns: 1fr; }
}

/* ---- now playing ------------------------------------------------------- */

.now {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.now-body { min-width: 12rem; flex: 1; }

.now .label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-soft);
    margin-bottom: 0.35rem;
}

.dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent);
}

.now .track { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.02em; }
.now .artist { color: var(--text-soft); }

/* ---- lists ------------------------------------------------------------- */

.rows { list-style: none; margin: 0; padding: 0; }

.rows li {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.rows li:last-child { border-bottom: 0; }

.rows .when,
.rows .rank {
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    flex: none;
    min-width: 2.6rem;
}

.rows .what { flex: 1; min-width: 0; }
.rows .what .artist { color: var(--text-soft); font-size: 0.88rem; }
.rows .meta { color: var(--text-soft); font-size: 0.82rem; flex: none; }

/* ---- schedule ---------------------------------------------------------- */

.day + .day { margin-top: 1.75rem; }

.day h2 {
    margin: 0 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border);
}

.slot-desc { color: var(--text-soft); font-size: 0.88rem; margin: 0.2rem 0 0; }

.on-air {
    display: inline-block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0 0.45rem;
    margin-left: 0.5rem;
    vertical-align: 0.1em;
}

/* ---- player ------------------------------------------------------------ */

.player { margin-top: 2rem; }
.player audio { width: 100%; margin-top: 1rem; }
.player .format { margin-top: 0.75rem; }

/* ---- footer ------------------------------------------------------------ */

.footer {
    margin-top: 4rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1.75rem 0;
}

.footer p { margin: 0 0 0.4rem; }
.footer-inner { max-width: 44rem; }

/* ---- station switcher --------------------------------------------------- */

/*
 * A thin bar above the masthead. It is deliberately quieter than the site's own
 * navigation: it is used once, on arrival, and then it should get out of the
 * way. Making it the loudest thing on the page would say the group matters more
 * than the station, which for a listener is the wrong way round.
 */
.switcher {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.switcher-inner {
    display: flex;
    align-items: center;
    min-height: 2.6rem;
}

/*
 * The picker itself.
 *
 * A <details> has no layout of its own, so the whole control is built out of
 * the <summary>, which is styled to read as the select-shaped thing it stands
 * in for: a bordered field with a value and a chevron. The panel is absolutely
 * positioned off the <details>, which is why that element is the positioning
 * context and why nothing above it may clip overflow.
 */
.picker {
    position: relative;
    flex: none;
}

.picker > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    cursor: pointer;
    user-select: none;

    /* Both are needed. Firefox draws the triangle through `list-style`, and
       WebKit through a pseudo element that ignores it. */
    list-style: none;
}

.picker > summary::-webkit-details-marker { display: none; }
.picker > summary::marker { content: ""; }

.picker > summary:hover { border-color: var(--text-soft); }
.picker[open] > summary { border-color: var(--accent); }

.picker-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-soft);
}

.picker-value {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 600;

    /* The name is the thing being chosen, so it never wraps and never breaks
       the pill in half. A very long station name is ellipsised instead. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 11rem;
}

.picker-chevron {
    color: var(--text-soft);
    transition: transform 0.12s ease;
}

.picker[open] .picker-chevron { transform: rotate(180deg); }

.picker-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 30;
    min-width: 16rem;

    /* A group of thirty stations scrolls rather than running off the page. */
    max-height: min(24rem, 70vh);
    overflow-y: auto;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
    padding: 0.3rem;
}

.picker-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.picker-menu a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.55rem;
    border-radius: 4px;
    text-decoration: none;
}

.picker-menu a:hover { background: var(--bg); }

.picker-name { min-width: 0; flex: 1; }
.picker-name strong { display: block; font-size: 0.9rem; font-weight: 600; }

.picker-name small {
    display: block;
    font-size: 0.76rem;
    color: var(--text-soft);
}

/* The tick states the current station. Colour alone would not, and a filled row
   would compete with the hover state. */
.picker-menu a[aria-current] .picker-name strong { color: var(--accent); }
.picker-tick { color: var(--accent); flex: none; }

.picker-menu img,
.wordmark-logo,
.tuner-option img,
.player-station img {
    object-fit: contain;
    flex: none;
}

.picker-menu img { width: 1.6rem; height: 1.6rem; }
.picker > summary img { object-fit: contain; flex: none; width: 1.25rem; height: 1.25rem; }
.wordmark-logo { width: 2.1rem; height: 2.1rem; border-radius: 4px; }

/* ---- artwork ------------------------------------------------------------ */

/*
 * A record sleeve is square and should stay square whatever falcon returns, so
 * the aspect is enforced here rather than trusted. `object-fit: cover` crops
 * rather than distorts, which for a sleeve is the lesser damage.
 */
.rows .art {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 4px;
    object-fit: cover;
    background: var(--border);
    flex: none;
    align-self: center;
}

.now-art {
    width: 7rem;
    height: 7rem;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--border);
    flex: none;
}

/* ---- artist and title --------------------------------------------------- */

/*
 * The house pairing, and it is a pairing rather than two separate decisions:
 * the title in bold and the artist in italic beneath it is how a track is set
 * everywhere in the product, so a listener reads the same shape on the website
 * as in the app. Italic is reserved for an artist name; secondary text that is
 * not one uses .sub.
 */
.rows .what .title {
    display: block;
    font-weight: 650;
}

.rows .what .artist,
.rows .what .sub {
    display: block;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.rows .what .artist,
.now .artist,
.player .artist {
    font-style: italic;
}

.now .track,
.player .track {
    font-weight: 700;
}

.sub { color: var(--text-soft); font-size: 0.88rem; }

/* ---- presenters --------------------------------------------------------- */

.person {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.person-body { min-width: 0; }

/*
 * The monogram sits underneath the photograph rather than instead of it. The
 * photograph endpoint substitutes its own generic portrait when a presenter has
 * none, so this layer is not for that case - it is for falcon being unreachable,
 * where the <img> fails to paint and the initials show through.
 */
.portrait {
    position: relative;
    display: grid;
    place-items: center;
    width: 4.5rem;
    height: 4.5rem;
    flex: none;
    border-radius: 50%;
    overflow: hidden;
    background: var(--border);
}

.portrait .monogram {
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--text-soft);
}

.portrait img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- events ------------------------------------------------------------- */

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

.event-image {
    width: calc(100% + 2.5rem);
    margin: -1.25rem -1.25rem 0.9rem;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--border);
}

/* ---- the player --------------------------------------------------------- */

.player-now {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.player-now-body { min-width: 0; flex: 1; }
.player .track { font-size: 1.3rem; letter-spacing: -0.02em; }
.player .artist { color: var(--text-soft); }

.player-art {
    width: 6rem;
    height: 6rem;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--border);
    flex: none;
}

.player-station {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0 0;
}

.player-station img { width: 1.25rem; height: 1.25rem; }

.tuner {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    margin-top: 1rem;
}

.tuner-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem;
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.tuner-option:hover { border-color: var(--text-soft); }

.tuner-option.is-current {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.tuner-option img { width: 3rem; height: 3rem; }
.tuner-option strong { display: block; font-size: 0.95rem; }
.tuner-option small { display: block; font-size: 0.8rem; color: var(--text-soft); }

/* ---- voting ------------------------------------------------------------- */

/*
 * The tally is text and is always on the page. The buttons are not: they are
 * revealed by the script that makes them work, because a thumb that does nothing
 * when pressed is a worse outcome than no thumb, and a reader cannot tell the
 * difference between "did not register" and "already voted" if nothing moves.
 *
 * `.votes` keeps its width either way, so nothing shifts when the script lands.
 */
.votes {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: none;
    min-width: 7.5rem;
    justify-content: flex-end;
}

.vote {
    /* Hidden until the script that makes it work has run. `has-js` is put on
       the root element by app.js, so with scripting off this rule is the last
       word and the buttons never appear. */
    display: none;
    align-items: center;
    gap: 0.3rem;
    font: inherit;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-soft);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    cursor: pointer;
}

.has-js .vote { display: inline-flex; }

.vote-word {
    /* Present for a screen reader, absent on screen: the icon and the number
       carry it visually and a page of eight rows does not need "Like" written
       sixteen times. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.vote:hover:not([disabled]) { color: var(--text); border-color: var(--text-soft); }
.vote-up:hover:not([disabled]) { color: var(--accent); border-color: var(--accent); }

.vote[disabled] { cursor: default; opacity: 0.65; }
.vote.is-mine { color: var(--accent); border-color: var(--accent); font-weight: 600; }

.now-votes { margin-top: 0.7rem; }
.now-votes .votes { justify-content: flex-start; }

/* A vote that landed. Short, and once. */
@keyframes vote-bump {
    50% { transform: scale(1.18); }
}

.vote.is-bumped { animation: vote-bump 0.28s ease; }

@media (prefers-reduced-motion: reduce) {
    .vote.is-bumped { animation: none; }
}

/* ---- promo cards: news, competitions, deals ------------------------------ */

/*
 * One card shape for all three. They are the same object as far as a reader is
 * concerned - a picture, a name, a line about it and a way in - and giving each
 * section its own would make the site look like three sites.
 */
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }

.promo {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.promo-image {
    width: calc(100% + 2.5rem);
    margin: -1.25rem -1.25rem 0.9rem;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--border);
}

.promo h2,
.promo h3 { margin: 0 0 0.4rem; }
.promo h2 { font-size: 1.05rem; }
.promo h2 a,
.promo h3 a { text-decoration: none; }
.promo h2 a:hover,
.promo h3 a:hover { text-decoration: underline; }
.promo p { margin: 0 0 0.6rem; }
.promo p:last-child { margin-bottom: 0; }

.promo-headline {
    font-size: 0.95rem;
    font-weight: 600;
}

.promo-prize { font-size: 0.9rem; }

.promo-prize-label {
    display: inline-block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-soft);
    margin-right: 0.4rem;
}

/*
 * The badge. `deals`.`badges` records a colour by name, and the name reaches
 * this stylesheet, so it is matched against a list in PHP first and only these
 * classes can be produced. An unrecognised colour lands on the station accent,
 * which is never wrong, only less specific.
 */
.flag {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #fff;
    background: var(--accent);
    border-radius: 3px;
    padding: 0.1rem 0.45rem;
    margin-bottom: 0.5rem;
}

.flag-red { background: #b23a34; }
.flag-orange { background: #b5651d; }
.flag-green { background: #3f7a4a; }
.flag-purple { background: #6a4a86; }
.flag-blue { background: #35618f; }
.flag-grey { background: #5c6167; }

/* ---- prices ------------------------------------------------------------- */

.price-line {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    flex: none;
}

.price { font-weight: 700; font-size: 1.05rem; }

.rrp {
    color: var(--text-soft);
    font-size: 0.9rem;
    text-decoration: line-through;
}

.saving {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.products li { align-items: center; }
.products .is-gone,
.rows li.is-gone { opacity: 0.55; }
.rows li.is-gone .price { text-decoration: line-through; }

/* ---- facts and terms ---------------------------------------------------- */

.facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.9rem;
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
}

.facts dt {
    color: var(--text-soft);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    align-self: center;
}

.facts dd { margin: 0; }

.terms { margin-top: auto; padding-top: 0.5rem; }

.terms > summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-soft);
}

.terms > summary:hover { color: var(--text); }
.terms p { margin: 0.5rem 0 0; }

/* ---- news ---------------------------------------------------------------- */

.hero {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--border);
    margin: 1.25rem 0 0.5rem;
}

.story { max-width: 44rem; }
.story-figure { margin: 1.25rem 0; }
.story-figure figcaption { margin-top: 0.4rem; }

.story-body { margin-top: 1.5rem; }
.story-body p { margin: 0 0 1.1rem; }
.story-body h2 { font-size: 1.15rem; margin: 1.9rem 0 0.6rem; }
.story-body h3 { font-size: 1rem; margin: 1.6rem 0 0.5rem; }
.story-body ul,
.story-body ol { margin: 0 0 1.1rem; padding-left: 1.3rem; }
.story-body li { margin-bottom: 0.35rem; }

.story-body blockquote {
    margin: 1.3rem 0;
    padding-left: 1rem;
    border-left: 3px solid var(--accent);
    color: var(--text-soft);
}

/*
 * The article body is the only place on this site where an <h2> the daemon did
 * not write reaches the page, and its first one repeats the headline. Hiding it
 * would be a lie to a screen reader; setting it as a heading of the body rather
 * than of the page is the honest version.
 */
.story-body > h2:first-child { margin-top: 0; }
