/* Editorial covers preserve real titles when no original image is available. */
.editorial-cover {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  padding: 7% 7% 7% 37%;
  background: #efe4d0 url("assets/media/library-editorial-fallback.webp") center / cover;
  color: #173c5d;
  text-align: right;
  overflow: hidden;
  border-radius: inherit;
}
.editorial-cover-label { font-size: 11px; font-weight: 500; color: #43586b; }
.editorial-cover strong {
  font-size: clamp(16px, 1.5vw, 24px);
  line-height: 1.5;
  font-weight: 700;
  text-wrap: balance;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.editorial-cover-rule { width: 25px; height: 2px; background: #456b88; }
.episode-row > .editorial-cover { width: 154px; height: auto; flex: 0 0 154px; padding: 8px 8px 8px 35%; }
.episode-row > .editorial-cover { padding-inline-end: 48px; }
.episode-row .editorial-cover-label, .episode-row .editorial-cover-rule { display: none; }
.episode-row .editorial-cover strong { font-size: 12px; line-height: 1.4; -webkit-line-clamp: 3; }
.watch-aside .episode-row > .editorial-cover { width: 94px; flex-basis: 94px; padding: 6px; background-position: right; }
.watch-aside .editorial-cover strong { font-size: 11px; -webkit-line-clamp: 2; }
.program-heading > .editorial-cover { height: auto; border-radius: 12px; }
.editorial-cover.player-cover { opacity: 1; }
.player-frame:has(.editorial-cover) .play-live { position: absolute; inset-inline-end: 5%; top: 50%; transform: translateY(-50%); max-width: 28%; }
.player-frame:has(.editorial-cover) .play-live > span:last-child { display: none; }
.player-frame:has(.editorial-cover) .play-circle { background: #164b8d; color: white; border-color: #bed5ed; }

.theme-toggle { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 50%; }
.theme-toggle:hover { background: var(--blue-soft); }
.theme-toggle svg { width: 21px; height: 21px; }
.social-links { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.social-links a { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; color: var(--blue); border: 1px solid var(--line); border-radius: 50%; background: var(--paper); transition: background 160ms, color 160ms; }
.social-links a:hover { color: var(--ink); background: var(--blue-soft); }
.social-links svg { width: 20px; height: 20px; }
.footer-inner { display: grid; grid-template-columns: 112px 1fr auto; gap: 24px 32px; }
.footer-inner > nav:not(.social-links) { grid-column: 1 / -1; grid-row: 2; margin: 0; gap: 18px 28px; }
.footer .social-links { grid-column: 1 / 3; grid-row: 3; justify-content: flex-start; gap: 10px; min-width: 260px; flex-wrap: nowrap; margin: 0; }
.footer small { grid-column: 3; grid-row: 3; }

.watch-toolbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; padding-top: 16px; }
.watch-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 13px; border: 1px solid #48617d; border-radius: 8px; background: #163451; color: #f0f6fc; font-size: 14px; font-weight: 500; }
.watch-action svg { width: 19px; height: 19px; }
.watch-action:hover { background: #234d73; }
.watch-action[aria-pressed="true"] { background: #dcecff; color: #10396c; border-color: #dcecff; }
[data-watch-status] { color: #c6daee; text-align: center; font-size: 13px; min-height: 1.5em; margin: 8px 0 0; }
.theater-mode { overflow: hidden; }
.viewing-stage.is-theater { position: fixed; inset: 0; z-index: 1000; border-radius: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.viewing-stage.is-theater .player-frame { width: min(100%, calc((100dvh - 140px) * 1.7778)); max-width: 1440px; flex: 0 1 auto; }
.viewing-stage.is-theater .watch-toolbar { flex-shrink: 0; }
.saved-tabs { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.saved-tabs button { border: 1px solid var(--line); border-radius: 8px; padding: 10px 20px; min-height: 44px; background: var(--paper); color: var(--ink); }
.saved-tabs button[aria-selected="true"], .saved-tabs button[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.saved-card .card-copy { padding-top: 12px; }
.saved-card .card-picture { display: block; aspect-ratio: 16 / 9; }
.saved-card .card-picture > img { width: 100%; height: 100%; object-fit: cover; }
.watch-library-link { color: #dceaff; font-size: 14px; padding: 10px 6px; min-height: 44px; }
.watch-toolbar [data-watch-status]:empty { display: none; }
[data-saved-view] [data-watch-status] { color: var(--muted); }
.saved-card .card-copy h3 { margin: 0 0 8px; }
.saved-remove { padding: 8px 0; min-height: 44px; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.saved-remove:hover { color: var(--ink); }
.saved-empty { padding: 30px; border-radius: 12px; background: var(--ground); color: var(--muted); }
[data-saved-list] > .empty-state { grid-column: 1 / -1; }

/* Optional dark appearance; original photographs and brand artwork stay intact. */
:root { --copy: #334c65; color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #94c0f4;
  --blue-deep: #3373b5;
  --blue-night: #071323;
  --blue-soft: #1b314a;
  --ink: #e7eff8;
  --muted: #afc0d2;
  --copy: #c6d3e3;
  --paper: #0b1522;
  --ground: #111f31;
  --line: #2b4057;
}
.program-heading p, .watch-main > p, .service-card p, .reading .article-body { color: var(--copy); }
html[data-theme="dark"] .header, html[data-theme="dark"] .header nav { background: var(--paper); }
html[data-theme="dark"] .brand img, html[data-theme="dark"] .footer-brand img { background: #f6f7f8; border-radius: 7px; padding: 4px; }
html[data-theme="dark"] .hero { background: #12345b; }
html[data-theme="dark"] .button, html[data-theme="dark"] .live-button, html[data-theme="dark"] .pagination span { background: #2764a6; color: #fff; }
html[data-theme="dark"] .button:hover, html[data-theme="dark"] .live-button:hover { background: #3377bc; }
html[data-theme="dark"] .button.secondary { background: var(--blue-soft); color: var(--blue); }
html[data-theme="dark"] .carousel-controls button, html[data-theme="dark"] .service-card, html[data-theme="dark"] .skip-link { background: var(--ground); color: var(--ink); }
html[data-theme="dark"] .carousel-controls button:hover:not(:disabled) { background: #2764a6; color: white; }
html[data-theme="dark"] .search-form input, html[data-theme="dark"] .filters select { background: var(--ground); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .search-form input::placeholder { color: var(--muted); }
html[data-theme="dark"] .play-small { background: #e1edfb; color: #173c5d; }
html[data-theme="dark"] select { background: var(--ground); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .article-body [style*="color"] { color: inherit !important; }
html[data-theme="dark"] .article-body a { color: var(--blue); }
html[data-theme="dark"] .editorial-cover { color: #173c5d; }

@media (max-width: 850px) {
  .header-actions { gap: 10px; }
}
@media (max-width: 560px) {
  .footer-inner { grid-template-columns: 94px 1fr; gap: 22px; }
  .footer .social-links { grid-column: 1 / -1; width: auto; }
  .footer small { grid-column: 1 / -1; grid-row: 4; }
  .header-inner { padding-inline: 14px; gap: 8px; }
  .header-actions { gap: 5px; }
  .theme-toggle { flex-basis: 44px; width: 44px; height: 44px; border-color: transparent; }
  .header .live-button { padding-inline: 10px; }
  .card .editorial-cover strong { font-size: 14px; line-height: 1.4; -webkit-line-clamp: 3; }
  .card .editorial-cover-label, .card .editorial-cover-rule { display: none; }
  .watch-action { padding: 8px; font-size: 12px; gap: 5px; }
  .watch-toolbar { gap: 6px; }
  .viewing-stage.is-theater { padding: 10px; }
  .viewing-stage.is-theater .player-frame { width: min(100%, calc((100dvh - 160px) * 1.7778)); }
}
@media (prefers-reduced-motion: reduce) { .social-links a { transition: none; } }

/* Genuine portrait art is limited to the program library and its home carousel. */
.card.program-card.portrait .card-picture {
  aspect-ratio: 522 / 760;
  background: #e8edf3;
  border: 1px solid var(--line);
}
.card.program-card.portrait .card-picture img {
  object-fit: contain;
  object-position: center;
  transform: none;
}
.card.program-card.portrait h3 { font-size: 17px; line-height: 1.5; margin-top: 13px; }
.card.program-card.portrait p { font-size: 13px; }
.cards.program-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 34px 24px; }
.program-carousel > .card { flex-basis: calc((100% - 96px) / 5); }
html[data-theme="dark"] .card.program-card.portrait .card-picture { background: #08111e; }
@media (max-width: 1099px) {
  .cards.program-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .program-carousel > .card { flex-basis: calc((100% - 72px) / 4); }
}
@media (max-width: 849px) {
  .cards.program-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; }
  .program-carousel > .card { flex-basis: calc((100% - 48px) / 3); }
}
@media (max-width: 599px) {
  .cards.program-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
  .program-carousel { gap: 16px; }
  .program-carousel > .card { flex-basis: calc((100% - 16px) / 2); }
  .card.program-card.portrait h3 { font-size: 16px; }
}
