:root {
    --paper: #ffffff;
    --ink: #000000;
    --signal: #ff3fa4;
    --static: #c8c8c8;
    --rule: var(--ink);
    --font-display: "Arial Black", Helvetica, Arial, sans-serif;
    --font-body: Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #000000;
        --ink: #ffffff;
    }
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    position: relative;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.4;
    overflow: hidden;
}

/* The w7cby move, everywhere: the same ugly photo, tiled at full size. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("tower.png") repeat;
    filter: grayscale(1);
    z-index: -1;
    pointer-events: none;
}

a {
    color: var(--ink);
}

a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 4px solid var(--signal);
    outline-offset: 2px;
}

img {
    max-width: 100%;
    display: block;
}

.layout {
    display: grid;
    grid-template-columns: minmax(84px, 11vw) 1fr;
    height: 100vh;
}

/* The spine: five stacked letters, T O W E R, each a link. Its visual state
   (still black / beacon chase / hollow outline) is the one thing on the page
   that tells you the station's condition before you read a word. */
.spine {
    display: flex;
    flex-direction: column;
    border-right: 3px solid var(--rule);
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 0;
    overflow: hidden;
}

.spine a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    /* Each letter fills one fifth of the window's height, so size it off
       viewport height (not width) to feel proportioned to the window
       itself, tall windows get a genuinely monumental spine. */
    font-size: clamp(2rem, 12vh, 9rem);
    text-decoration: none;
    color: var(--ink);
    border-bottom: 3px solid var(--rule);
}

.spine a:last-child {
    border-bottom: none;
}

@keyframes beacon {
    0%, 19% {
        background: var(--signal);
        color: var(--ink);
    }
    20%, 100% {
        background: transparent;
        color: var(--ink);
    }
}

.spine.is-on-air a {
    animation: beacon 5s steps(1, end) infinite;
    animation-delay: calc(var(--i) * 1s);
}

.spine.is-off-air a {
    background: transparent;
    color: var(--ink);
}

.spine.is-signal-lost a {
    background: transparent;
    color: transparent;
    -webkit-text-stroke: 2px var(--ink);
}

@media (prefers-reduced-motion: reduce) {
    .spine.is-on-air a {
        animation: none;
        background: var(--signal);
        color: var(--ink);
    }
}

@media (max-width: 700px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .spine {
        flex-direction: row;
        border-right: none;
        border-bottom: 3px solid var(--rule);
    }
    .spine a {
        font-size: clamp(1.6rem, 9vw, 3rem);
        border-bottom: none;
        border-right: 3px solid var(--rule);
    }
    .spine a:last-child {
        border-right: none;
    }
}

main {
    background: var(--paper);
    padding: 1.25rem 1.5rem 2rem;
    max-width: 70ch;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
}

.masthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 3px solid var(--rule);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.masthead .freq {
    font-weight: bold;
}

.listen-btn {
    font-family: var(--font-body);
    font-weight: bold;
    font-size: 1rem;
    border: 3px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    padding: 0.4em 1em;
    cursor: pointer;
}

.listen-btn:hover {
    background: var(--signal);
}

.status-line {
    margin: 0 0 1rem;
}

.now {
    margin-bottom: 1.5rem;
}

.now-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 7vw, 4.5rem);
    line-height: 0.9;
    margin: 0.2em 0 0.1em;
    overflow-wrap: break-word;
}

.now-artist {
    font-size: 1rem;
    font-weight: normal;
    margin: 0 0 0.6em;
}

.progress {
    font-family: var(--font-mono);
    white-space: pre;
    font-size: 1rem;
    margin: 0;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1.5rem;
}

th, td {
    border: 3px solid var(--rule);
    padding: 0.4em 0.6em;
    text-align: left;
    vertical-align: top;
}

.time-col {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.artist-link {
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--ink);
    cursor: pointer;
}

.stats-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3em 1.5em;
    margin: 0 0 1.5rem;
    padding: 0;
}

.stats-list dt {
    font-weight: bold;
}

.stats-list dd {
    margin: 0;
}

.day-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.day-controls input[type="date"],
.day-controls input[type="search"] {
    font: inherit;
    border: 3px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    padding: 0.3em 0.5em;
}

.day-controls button {
    font: inherit;
    border: 3px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    padding: 0.3em 0.8em;
    cursor: pointer;
}


.no-js-note {
    border: 3px solid var(--rule);
    padding: 0.6em 0.8em;
    margin-bottom: 1.5rem;
}
