/* === NEWS & ARTICLES: list pages and story pages === */

:root,
[data-theme="light"] {
    /* --primary is too light for small text on white; this darker pink passes contrast */
    --news-accent: #c8174a;
    --news-rule: #1a1a2e;
}

[data-theme="dark"] {
    --news-accent: #ff7096;
    --news-rule: #f8f9fa;
}

.news-page {
    --news-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    font-family: 'Source Sans 3', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.news-page h1,
.news-page h2,
.news-page h3 {
    font-family: var(--news-serif);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.news-page a {
    color: inherit;
    text-decoration: none;
}

/* --- List page --- */
.news-masthead {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 2rem;
    border-bottom: 3px solid var(--news-rule);
}

.news-masthead h1 {
    font-size: clamp(2.5rem, 7vw, 4rem);
    font-weight: 700;
    line-height: 1;
}

.news-masthead p {
    color: var(--text-secondary);
}

.news-page .news-submit {
    color: var(--news-accent);
    font-weight: 600;
}

.news-page .news-submit:hover {
    text-decoration: underline;
}

/* The headline link covers the whole story, so anywhere on it opens the story */
.news-lead,
.news-item {
    position: relative;
}

.news-lead h2 a::after,
.news-item h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.news-lead:hover h2 a,
.news-item:hover h3 a,
.news-lead h2 a:focus-visible,
.news-item h3 a:focus-visible {
    text-decoration: underline;
    text-decoration-color: var(--primary);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.15em;
}

.news-image {
    overflow: hidden;
    border-radius: 4px;
    background: var(--bg-tertiary);
}

.news-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-summary {
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.news-lead {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2rem;
    align-items: center;
    padding-bottom: 2rem;
}

.news-lead:not(:has(.news-image)) {
    grid-template-columns: minmax(0, 46rem);
}

.news-lead .news-image {
    aspect-ratio: 3 / 2;
}

.news-lead h2 {
    font-size: clamp(1.8rem, 3.6vw, 2.6rem);
    font-weight: 700;
    line-height: 1.12;
    margin-bottom: 0.9rem;
}

.news-lead .news-summary {
    font-size: 1.05rem;
    line-clamp: 4;
    -webkit-line-clamp: 4;
    margin-bottom: 0.9rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 2rem;
}

.news-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.25rem 0 2rem;
    border-top: 1px solid var(--border-color);
}

.news-item .news-image {
    aspect-ratio: 16 / 9;
}

.news-item h3 {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.22;
    margin-bottom: 0.5rem;
}

.news-item .news-summary {
    font-size: 0.95rem;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    margin-bottom: 0.6rem;
}

.news-empty {
    padding: 3rem 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.news-pages {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.news-pages a {
    font-weight: 600;
    color: var(--news-accent);
}

.news-pages a:hover {
    text-decoration: underline;
}

.news-pages a[rel="next"] {
    justify-self: end;
}

.news-page-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@media (max-width: 900px) {
    .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .news-lead {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    /* On phones each story is a compact row: headline left, small picture right */
    .news-item {
        flex-direction: row-reverse;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem 0;
    }

    .news-item .news-image {
        flex: 0 0 96px;
        aspect-ratio: 1;
    }

    .news-item .news-text {
        flex: 1;
        min-width: 0;
    }

    .news-item h3 {
        font-size: 1.15rem;
    }

    .news-item .news-summary {
        display: none;
    }
}

/* --- Story page --- */
.story,
.story-more {
    width: 90%;
    max-width: var(--reader-width, 1100px);
    margin: 0 auto;
}

.story-section {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--news-accent) !important;
}

.story-section:hover {
    text-decoration: underline;
}

.story h1 {
    font-size: clamp(2rem, 5.5vw, 3.1rem);
    font-weight: 700;
    line-height: 1.1;
    margin: 0.6rem 0 1.25rem;
}

.story-byline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    margin-bottom: 1.75rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.story-byline p {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0;
}

/* Dots between author, date and reading time */
.story-byline p > * + *::before {
    content: "\00B7";
    margin: 0 0.5rem;
}

.story-author {
    font-weight: 600;
    color: var(--text-primary);
}

.story-cover {
    margin: 0 0 2rem;
}

.story-cover img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    border-radius: 4px;
}

.story-body {
    color: var(--text-primary);
    overflow-wrap: break-word;
}

.story-body p,
.story-body ul,
.story-body ol,
.story-body blockquote {
    margin-bottom: 1.1em;
}

.story-body ul,
.story-body ol {
    padding-left: 1.4em;
}

.story-body a {
    color: var(--news-accent);
    text-decoration: underline;
}

.story-body h2,
.story-body h3 {
    font-size: 1.35em;
    line-height: 1.25;
    margin: 1.6em 0 0.6em;
}

.story-body blockquote {
    padding-left: 1em;
    border-left: 3px solid var(--primary);
    font-style: italic;
}

.story-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.story-more {
    margin-top: 3.5rem;
    padding-top: 1rem;
    border-top: 3px solid var(--news-rule);
}

.story-more h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.story-more ul {
    list-style: none;
    padding: 0;
}

.story-more li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.story-more li a {
    font-family: var(--news-serif);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.3;
}

.story-more li a:hover {
    text-decoration: underline;
    text-decoration-color: var(--primary);
}

.story-more time {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.story-more-all {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 600;
    color: var(--news-accent) !important;
}

/* The reading options button sits quietly at the end of the byline */
.story-byline .reader-toggle {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: transparent;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* The transparent background above would otherwise leave tool-btn's white hover/open text on a light page */
.story-byline .reader-toggle:hover,
.story-byline .reader-toggle[aria-expanded="true"],
.story-bar .reader-toggle[aria-expanded="true"] {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

@media (max-width: 640px) {
    /* Author (or event status) gets its own line, so the wrapped line doesn't start with a dot */
    .story-author,
    .story-status {
        flex-basis: 100%;
    }

    .story-byline .story-author + *::before,
    .story-byline .story-status + *::before {
        content: none;
    }

    .story-more li {
        flex-direction: column;
        gap: 0.2rem;
    }
}

@media (max-width: 480px) {
    .story-byline .reader-toggle-label {
        display: none;
    }
}

/* --- Story title bar: slides in above the site header once the story's own title has scrolled away --- */
.has-story-bar > header {
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0s;
}

/* The bar pushes the site header down below it */
.story-scrolled > header {
    transform: translateY(var(--story-bar-height, 58px));
}

/* While reading downwards the pushed-down header fades away; scrolling up brings it back */
.story-scrolled.story-header-hidden > header {
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0s 0.25s;
}

.story-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: var(--header-bg);
    color: var(--text-inverse);
    /* Faint line so the bar and the pushed-down site header don't merge into one block */
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(-100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s 0.25s;
}

.story-scrolled .story-bar {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
}

.story-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 58px;
}

.story-bar-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.story-bar-section {
    font-family: 'Source Sans 3', 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.story-bar-title {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-bar .reader-toggle {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: transparent;
    color: var(--text-inverse);
    border-color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
}

.story-bar .reader-toggle-label {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .has-story-bar > header,
    .story-scrolled.story-header-hidden > header,
    .story-bar,
    .story-scrolled .story-bar {
        transition: none;
    }
}

/* --- Events --- */
.event-group {
    margin-bottom: 2.5rem;
}

.event-group-title {
    font-size: 1.5rem;
    font-weight: 700;
    padding-bottom: 0.5rem;
}

.event-group-title.is-live::before {
    content: "";
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    margin-right: 0.5rem;
    border-radius: 50%;
    background: var(--primary);
    vertical-align: 0.15em;
}

.event-item {
    position: relative;
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr) 220px;
    gap: 1.5rem;
    align-items: start;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border-color);
}

.event-item:not(:has(.news-image)) {
    grid-template-columns: 4.5rem minmax(0, 1fr);
}

/* Calendar-style date: weekday, big day number, month */
.event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary);
    border-radius: 4px;
    background: var(--bg-secondary);
    line-height: 1.1;
}

.event-weekday,
.event-month {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.event-day {
    font-family: var(--news-serif);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.event-date.is-tba {
    justify-content: center;
    min-height: 4.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.event-item h3 {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.22;
    margin-bottom: 0.3rem;
}

.event-item h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.event-item:hover h3 a,
.event-item h3 a:focus-visible {
    text-decoration: underline;
    text-decoration-color: var(--primary);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.15em;
}

.event-when {
    font-weight: 600;
    color: var(--news-accent);
    margin-bottom: 0.5rem;
}

.event-venue {
    color: var(--text-secondary);
    font-weight: 600;
}

.event-venue::before {
    content: "\00B7";
    margin: 0 0.45rem;
}

.event-item .news-summary {
    font-size: 0.95rem;
    line-clamp: 2;
    -webkit-line-clamp: 2;
}

.event-item .news-image {
    aspect-ratio: 16 / 9;
}

.event-past {
    list-style: none;
    padding: 0;
}

.event-past li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
}

.event-past a {
    font-family: var(--news-serif);
    font-size: 1.1rem;
    font-weight: 500;
}

.event-past a:hover {
    text-decoration: underline;
    text-decoration-color: var(--primary);
}

.event-past time {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Event status at the start of the byline on an event page */
.story-status {
    font-weight: 700;
    color: var(--news-accent);
}

@media (max-width: 640px) {
    .event-item,
    .event-item:not(:has(.news-image)) {
        grid-template-columns: 3.75rem minmax(0, 1fr);
        gap: 1rem;
    }

    .event-item .news-image {
        display: none;
    }

    .event-day {
        font-size: 1.6rem;
    }

    .event-item h3 {
        font-size: 1.15rem;
    }

    .event-past li {
        flex-direction: column;
        gap: 0.2rem;
    }
}

/* --- Schedule --- */
.on-air {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
    gap: 1.5rem 2rem;
    align-items: center;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    background: var(--header-bg);
    color: var(--text-inverse);
    border-radius: 6px;
}

/* In dark mode the header colour matches the page, so lift the panel */
[data-theme="dark"] .on-air {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.on-air-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 0.3rem;
}

.on-air-now .on-air-label {
    color: var(--primary);
}

.on-air-now .on-air-label::before {
    content: "";
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.45rem;
    border-radius: 50%;
    background: var(--primary);
    vertical-align: 0.05em;
    animation: on-air-pulse 1.6s ease-in-out infinite;
}

@keyframes on-air-pulse {
    50% { opacity: 0.35; }
}

.on-air-title {
    font-family: var(--news-serif);
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    font-weight: 700;
    line-height: 1.15;
}

.on-air-next-title {
    font-family: var(--news-serif);
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.25;
}

.on-air-time {
    margin-top: 0.3rem;
    color: rgba(255, 255, 255, 0.75);
}

.news-page .on-air-listen {
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    white-space: nowrap;
}

.news-page .on-air-listen:hover {
    filter: brightness(1.08);
}

.schedule-days {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    margin-bottom: 1.5rem;
    scrollbar-width: none;
}

.schedule-days::-webkit-scrollbar {
    display: none;
}

.schedule-day {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-width: 4.5rem;
    padding: 0.6rem 0.9rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.schedule-day:hover {
    border-color: var(--primary);
}

.schedule-day[aria-selected="true"] {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-primary);
}

.schedule-day-short {
    display: none;
}

.schedule-day-today {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--news-accent);
}

.schedule-day[aria-selected="true"] .schedule-day-today {
    color: var(--primary);
}

.schedule-stepper {
    position: relative;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
}

.schedule-stepper-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.schedule-stepper-pick i {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.schedule-stepper-pick[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.schedule-stepper-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    list-style: none;
    margin: 0;
    padding: 0.35rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.schedule-stepper-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
}

.schedule-stepper-list li:hover,
.schedule-stepper-list li:focus {
    background: var(--bg-tertiary);
    outline: none;
}

.schedule-stepper-list-today {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--news-accent);
}

.schedule-stepper-list li i {
    margin-left: auto;
    color: var(--primary);
    visibility: hidden;
}

.schedule-stepper-list li[aria-selected="true"] i {
    visibility: visible;
}

.schedule-step {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.schedule-stepper-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    font-family: var(--news-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.schedule-stepper-today,
.schedule-stepper-back {
    font-family: 'Source Sans 3', 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--news-accent);
}

.schedule-stepper-back {
    padding: 0;
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

/* The day heading repeats the stepper on phones */
@media (max-width: 768px) {
    .schedule-list-title {
        display: none;
    }
}

.schedule-list-title {
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
}

.schedule-list ol {
    list-style: none;
    padding: 0;
}

.schedule-slot {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 1.5rem;
    align-items: baseline;
    padding: 0.8rem 0;
    border-top: 1px solid var(--border-color);
}

.schedule-time {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.schedule-end {
    font-weight: 400;
    color: var(--text-secondary);
}

.schedule-programme {
    font-family: var(--news-serif);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.3;
}

.schedule-slot.is-done {
    opacity: 0.55;
}

.schedule-slot.is-on-air {
    margin: 0 -0.75rem;
    padding: 0.8rem 0.75rem;
    border-radius: 4px;
    background: rgba(255, 62, 108, 0.1);
    border-top-color: transparent;
}

.schedule-slot.is-on-air + .schedule-slot {
    border-top-color: transparent;
}

.schedule-live {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--primary);
    color: white;
    font-family: 'Source Sans 3', 'Segoe UI', Tahoma, sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: 0.2em;
}

@media (max-width: 768px) {
    .on-air {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.25rem;
    }

    .news-page .on-air-listen {
        justify-self: start;
    }

    /* Phones use the day stepper instead of the tabs */
    .schedule-days {
        display: none;
    }

    .schedule-stepper {
        display: flex;
    }

    .schedule-slot {
        grid-template-columns: 5.5rem minmax(0, 1fr);
        gap: 1rem;
    }

    /* On phones the start time is enough; the end is the next programme's start */
    .schedule-end {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .on-air-now .on-air-label::before {
        animation: none;
    }
}
