/* Base pública directa. No se genera con Gulp ni se carga en BackOffice. */
:root {
    color-scheme: light;
    --page: #F6F7F8;
    --surface: #FFFFFF;
    --surface-muted: #EEF0F2;
    --text: #17191D;
    --text-muted: #565D67;
    --line: #D8DCE1;
    --control-border: #737B85;
    --accent: #C60019;
    --action-bg: #C60019;
    --on-action: #FFFFFF;
    --live-bg: #FFF1F3;
    --focus: #005FCC;
    --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #111315;
    --surface: #191C20;
    --surface-muted: #24282D;
    --text: #F3F4F6;
    --text-muted: #B5BDC8;
    --line: #414750;
    --control-border: #87919E;
    --accent: #FF7181;
    --live-bg: #321F25;
    --focus: #8AB4FF;
}

/* Sin JavaScript se sigue el sistema; la navegación queda visible. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --page: #111315;
        --surface: #191C20;
        --surface-muted: #24282D;
        --text: #F3F4F6;
        --text-muted: #B5BDC8;
        --line: #414750;
        --control-border: #87919E;
        --accent: #FF7181;
        --live-bg: #321F25;
        --focus: #8AB4FF;
    }
}

.public-site {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--page);
    color: var(--text);
    font: 1rem/1.5 var(--font);
    accent-color: var(--accent);
    caret-color: var(--accent);
}

.public-site *, .public-site *::before, .public-site *::after { box-sizing: border-box; }
.public-site [hidden] { display: none !important; }
.public-site ::selection { color: var(--on-action); background: var(--action-bg); }
.public-site a { color: var(--accent); text-underline-offset: .2em; }
.public-site a:hover { text-decoration-thickness: 2px; }
.public-site :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: none; }
.public-site img { max-width: 100%; }
.public-site button, .public-site select { font: inherit; }

.site-container { width: min(100% - 2rem, 75rem); margin-inline: auto; }
.site-content { flex: 1; padding-block: 2rem 3rem; }
.site-content main { min-width: 0; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; padding-block: 1rem; }
.site-brand { display: inline-flex; align-items: center; min-height: 44px; flex-shrink: 0; width: min(180px, calc(100% - 112px)); }
.site-brand img { width: 100%; height: 40px; object-fit: contain; object-position: left center; }
.site-brand .brand-dark { display: none; }
:root[data-theme="dark"] .site-brand .brand-light { display: none; }
:root[data-theme="dark"] .site-brand .brand-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .site-brand .brand-light { display: none; }
    :root:not([data-theme]) .site-brand .brand-dark { display: block; }
}

.menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-left: auto;
    min-height: 44px;
    padding: .5rem .75rem;
    border: 1px solid var(--control-border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.menu-toggle:hover, .menu-toggle[aria-expanded="true"] { background: var(--surface-muted); }
.site-navigation { display: flex; flex-direction: column; flex-basis: 100%; gap: 1rem; }
.site-links { display: flex; flex-direction: column; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.site-links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: .5rem .25rem;
    border-bottom: 3px solid transparent;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
.site-links a:hover { text-decoration: underline; }
.site-links a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.theme-control { position: relative; align-self: flex-end; }
:root[data-enhanced] .theme-control[hidden] { display: block !important; }
@media (max-width: 63.999rem) {
    :root[data-enhanced] .site-navigation:not([data-open="true"]) { display: none; }
    :root[data-enhanced] .menu-toggle[hidden] { display: inline-flex !important; }
}
.theme-control summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 44px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
}
.theme-control summary::-webkit-details-marker { display: none; }
.theme-control summary:hover, .theme-control[open] summary { background: var(--surface-muted); color: var(--text); }
.theme-control svg { width: 20px; height: 20px; flex-shrink: 0; }
.theme-options {
    position: absolute;
    z-index: 10;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 10rem;
    padding: .25rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
}
.theme-options button {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    min-height: 44px;
    padding: .5rem .75rem;
    border: 0;
    border-radius: 6px;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.theme-options button:hover { background: var(--surface-muted); }
.theme-options button[aria-pressed="true"] { background: var(--surface-muted); font-weight: 700; }
.theme-options button[aria-pressed="true"]::after {
    content: '';
    width: 6px;
    height: 10px;
    margin-left: auto;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.site-footer { padding-block: 1.5rem; background: var(--surface); border-top: 1px solid var(--line); font-size: .875rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 2rem; }
.footer-inner > span { color: var(--text-muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.skip-link { position: fixed; inset: 1rem auto auto 1rem; z-index: 1100; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--control-border); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

@media (min-width: 48rem) {
    .site-container { width: min(100% - 3rem, 75rem); }
}
@media (min-width: 64rem) {
    .header-inner { flex-wrap: nowrap; gap: 2.5rem; }
    .site-navigation { flex: 1; flex-direction: row; align-items: center; justify-content: space-between; gap: 1.5rem; }
    .site-links { flex-direction: row; gap: 1.5rem; }
    .theme-control { align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
    .public-site *, .public-site *::before, .public-site *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Plantillas públicas: filas editoriales, tipografía del sistema y anuncios reservados. */
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.2; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); letter-spacing: -.025em; margin-bottom: .65rem; }
h2 { font-size: 1.3rem; margin-bottom: 1rem; }
h3 { font-size: 1.0625rem; margin-bottom: .3rem; }
p { margin-bottom: 1rem; }
.page-heading { margin-bottom: 2rem; }
.page-heading p, .page-intro { color: var(--text-muted); margin-bottom: 0; }
.page-intro { margin-bottom: 1.5rem; }
.content-columns { display: grid; gap: 2rem; }
.content-columns > * { min-width: 0; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin: 0; }
.section-heading > span { font-size: .8125rem; }
.live-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); margin-right: .6rem; vertical-align: .1rem; }
.muted, .programme-subtitle, .programme-time, .programme-duration { color: var(--text-muted); }
.programme-subtitle, .programme-time, .programme-duration { font-size: .875rem; margin-bottom: .3rem; }
.programme-time, .schedule-time { font-variant-numeric: tabular-nums; }
.live-label, .programme-status { display: block; font-size: .75rem; font-weight: 700; margin-bottom: .4rem; }
.live-label { color: var(--accent); }
.now-table { container: now-grid / inline-size; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: clip; }
.now-labels { display: none; }
.now-row { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: .75rem 1rem; padding: 1.25rem 1rem; border-bottom: 1px solid var(--line); }
.now-row:last-child { border-bottom: 0; }
.channel-identity { display: flex; flex-direction: column; align-items: center; gap: .4rem; font-size: .8125rem; text-align: center; text-decoration: none; color: var(--text) !important; font-weight: 600; overflow-wrap: anywhere; }
.channel-identity:hover span:last-child { text-decoration: underline; }
.logo-support { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 80px; height: 48px; background: #fff; border-radius: 4px; }
.logo-support img { width: 80px; height: 48px; object-fit: contain; }
.next-programme { grid-column: 2; border-top: 1px solid var(--line); padding-top: .75rem; }
.next-programme h3 { font-size: .9375rem; font-weight: 600; }
.next-programme p:last-child { margin-bottom: 0; }
.next-label { display: block; color: var(--text-muted); font-size: .75rem; margin-bottom: .4rem; }
progress { display: block; appearance: none; border: 0; width: 100%; height: 4px; margin: .65rem 0 .35rem; border-radius: 4px; overflow: hidden; background: var(--surface-muted); color: var(--accent); }
progress::-webkit-progress-bar { background: var(--surface-muted); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.full-synopsis > summary { min-height: 44px; padding: .5rem 0; background: none; border: 0; color: var(--accent); text-align: left; cursor: pointer; font-size: .875rem; text-decoration: underline; text-underline-offset: .2em; }
.detail-trigger, .programme-details > summary { display: block; min-height: 44px; padding: 0 0 .4rem; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; overflow-wrap: anywhere; text-underline-offset: .2em; }
.detail-trigger { display: flex; align-items: flex-start; }
.programme-details > summary { list-style: none; }
.programme-details > summary::-webkit-details-marker { display: none; }
.programme-details > summary h3 { margin: 0; }
.detail-trigger:hover, .detail-trigger:focus-visible, .programme-details > summary:hover, .programme-details > summary:focus-visible { text-decoration: underline; }
.detail-icon { display: inline-block; width: .8em; height: .8em; margin-inline-start: .2em; color: var(--text-muted); vertical-align: -.05em; }
.detail-content { overflow-wrap: anywhere; }
.programme-details .detail-content { padding-top: 1rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .75rem; min-height: 44px; padding: .65rem 1rem; border: 1px solid var(--action-bg); border-radius: 6px; color: var(--on-action) !important; background: var(--action-bg); font-weight: 600; text-decoration: none; cursor: pointer; }
.button:hover { text-decoration: underline; }
.button-secondary { color: var(--text) !important; background: var(--surface); border-color: var(--control-border); }
.more-channels { margin-top: 1.5rem; }
.sidebar-note { padding-block: 1.25rem; border-top: 2px solid var(--line); }
.sidebar-note h2 { font-size: 1.0625rem; }
.sidebar-note p { color: var(--text-muted); font-size: .9375rem; }
.link-list, .relatedLinks { padding-left: 1.25rem; margin-bottom: 0; }
.link-list a, .relatedLinks a { display: inline-flex; align-items: center; min-height: 44px; }
.channel-heading { display: flex; align-items: center; gap: 1.25rem; }
.channel-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }
.day-navigation { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.day-navigation a { min-height: 44px; padding: .6rem 1rem; color: var(--text); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; }
.day-navigation a[aria-current] { color: var(--accent); border-color: var(--accent); }
.day-navigation a:hover { background: var(--surface-muted); }
.day-period { margin-bottom: 1.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: clip; }
.day-period > summary { position: relative; list-style: none; display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem 1rem; padding: 1rem 2.75rem 1rem 1rem; cursor: pointer; background: var(--surface-muted); min-height: 56px; }
.day-period > summary::-webkit-details-marker { display: none; }
.day-period > summary::after { content: '+'; position: absolute; right: 1rem; font-size: 1.25rem; }
.day-period[open] > summary::after { content: '−'; }
.day-period > summary h2 { display: inline; margin: 0; font-size: 1.125rem; }
.period-count { font-size: .8125rem; color: var(--text-muted); }
.schedule-row { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 1rem; padding: 1.25rem 1rem; border-top: 1px solid var(--line); }
.schedule-row.is-live { background: var(--live-bg); box-shadow: inset 3px 0 var(--accent); }
.schedule-time time { display: block; font-weight: 700; }
.schedule-time span, .schedule-time small { display: block; color: var(--text-muted); font-size: .75rem; }
.schedule-programme > :last-child { margin-bottom: 0; }
.synopsis { white-space: pre-line; overflow-wrap: anywhere; font-size: .9375rem; line-height: 1.6; margin-top: .65rem; }
.categories { color: var(--text-muted); font-size: .75rem; margin-block: .75rem 0; }
.movie-channel { display: flex; align-items: center; gap: .5rem; min-height: 44px; margin-bottom: .75rem; font-size: .8125rem; }
.movie-channel .logo-support, .movie-channel img { width: 60px; height: 36px; }
.empty-state { padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.channel-directory { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: 1rem; }
.directory-channel { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 1.5rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; color: var(--text) !important; text-align: center; overflow-wrap: anywhere; }
.directory-channel:hover { border-color: var(--accent); text-decoration: underline; }
.channel-directory .ad-space { grid-column: 1 / -1; }
.ad-space { display: flex; flex-direction: column; align-items: center; gap: .5rem; width: 100%; margin-block: 1.5rem; padding: .75rem 0; background: var(--surface-muted); --slot-height: 280px; min-height: calc(var(--slot-height) + 3.5rem); }
.ad-label { color: var(--text-muted); font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; }
.ad-unit { display: block; width: 100%; max-width: 336px; height: var(--slot-height); }
.ad-sidebar-high { --slot-height: 250px; }
.ad-sidebar-high .ad-unit { max-width: 300px; }
.programme-dialog { width: min(40rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0 1.5rem 1.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px #0005; }
.programme-dialog::backdrop { background: #0009; }
.dialog-toolbar { position: sticky; top: 0; display: flex; justify-content: flex-end; padding-block: .75rem; background: var(--surface); }
.dialog-close { width: 44px; height: 44px; padding: 0; }
.dialog-open { overflow: hidden; }
.reading-page { max-width: 70ch; margin-inline: auto; overflow-wrap: anywhere; }
.reading-page h2 { margin-top: 2rem; }
.reading-page p, .reading-page li { line-height: 1.7; }
.error-page { max-width: 42rem; padding-block: 2rem 3rem; }
.error-code { color: var(--accent); font-size: 1.5rem; font-weight: 700; }
.incident-id { font-size: .75rem; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 48rem) {
    .now-labels, .now-row { display: grid; grid-template-columns: 5.5rem minmax(0, 1.4fr) minmax(0, 1fr); column-gap: 1.5rem; }
    .now-labels { padding: .75rem 1.25rem; background: var(--surface-muted); font-size: .75rem; color: var(--text-muted); }
    .now-row { padding: 1.25rem; }
    .next-programme { grid-column: auto; border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 1.5rem; }
    .next-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .channel-directory { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .schedule-row { grid-template-columns: 5rem minmax(0, 1fr); padding: 1.5rem; }
}
@media (min-width: 64rem) {
    .content-columns { grid-template-columns: minmax(0, 1fr) 300px; }
    .channel-directory { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .ad-sidebar-high { --slot-height: 600px; }
    .ad-sidebar-high .ad-unit { height: 600px; }
}
@media (forced-colors: active) {
    .live-dot { background: CanvasText; }
    .schedule-row.is-live { border-left: 3px solid Highlight; }
    .button { border: 1px solid ButtonText; }
}
@media (max-width: 30rem) {
    .schedule-row { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
    .schedule-time { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; }
    .schedule-time small { flex-basis: 100%; }
}
@container now-grid (max-width: 18rem) {
    .now-row { grid-template-columns: minmax(0, 1fr); }
    .channel-identity { flex-direction: row; text-align: left; }
    .next-programme { grid-column: auto; border-left: 0; border-top: 1px solid var(--line); padding: .75rem 0 0; }
    .now-labels { display: none; }
    .next-label { position: static; width: auto; height: auto; clip-path: none; white-space: normal; }
}
