/* ================================================================
   TV Guide — guide.css
   Aesthetic: Radio Times print — heavy black serif headers,
   cream paper, pure ink, dense listings, hairline rules.
   No colour blocks. Black and cream only.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&family=DM+Mono:wght@500&display=swap');

/* ----------------------------------------------------------------
   Custom properties
---------------------------------------------------------------- */
:root {
  --paper:        #f5f0e4;
  --paper-mid:    #ece6d8;
  --paper-dark:   #e0d9ca;
  --paper-hover:  #fdf6e8;

  --ink:          #100e0b;
  --ink-mid:      #352e26;
  --ink-light:    #6b6055;
  --ink-faint:    #a0978a;

  --rule:         #bbb0a0;
  --rule-heavy:   #706558;

  --red:          #c0101e;   /* used sparingly: Today pill only */

  --font-display: 'Playfair Display', 'Times New Roman', serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --ease: 120ms ease;
}

/* ----------------------------------------------------------------
   Reset
---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 1.25rem; scroll-behavior: smooth; }

body {
  background: var(--paper-dark);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; color: var(--ink-mid); }

/* ----------------------------------------------------------------
   Site header
   "SUNDAY tv" masthead feel — italic serif, ink on paper
---------------------------------------------------------------- */
.site-header {
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem 0.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.site-header__logo {
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}
.site-header__logo:hover { color: var(--ink); text-decoration: none; }

/* Hide coloured mark, show text instead */
.site-header__logo-mark { display: none; }

.site-header__logo-text {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  font-style: italic;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Small "tv" after the big day name, like the original */
.site-header__logo-text::after {
  content: ' tv';
  font-size: 0.85rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--ink-light);
}

.site-header__region {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-light);
  letter-spacing: 0.02em;
  border: none;
  padding: 0;
}

/* ----------------------------------------------------------------
   Main
---------------------------------------------------------------- */
.site-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ----------------------------------------------------------------
   Guide
---------------------------------------------------------------- */
.guide { display: flex; flex-direction: column; }

/* ----------------------------------------------------------------
   Day navigation tabs
   Restrained — ink on paper, no colour fills
---------------------------------------------------------------- */
.day-nav {
  display: flex;
  flex-wrap: wrap;
  background: var(--paper);
  border-bottom: 2px solid var(--rule-heavy);
  margin-bottom: 0;
}

.day-btn {
  flex: 1 0 auto;
  background: none;
  border: none;
  border-right: 1px solid var(--rule);
  cursor: pointer;
  padding: 0.35rem 0.85rem 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  color: var(--ink-faint);
  transition: background var(--ease), color var(--ease);
  position: relative;
}

.day-btn:last-child { border-right: none; }
.day-btn:hover { background: var(--paper-mid); color: var(--ink); }

.day-btn--active {
  color: var(--ink);
  background: var(--paper);
}

/* Active indicator: thick bottom rule, like an underline */
.day-btn--active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--ink);
}

.day-btn__weekday {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.day-btn__today {
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}

/* ----------------------------------------------------------------
   Day panels
---------------------------------------------------------------- */
.day-panel { display: none; }
.day-panel--active { display: block; }

/* Date heading — italic serif, right-aligned like "SUNDAY tv" */
.day-heading {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  font-style: italic;
  color: var(--ink);
  text-align: right;
  padding: 0.4rem 0.35rem 0.35rem;
  border-bottom: 1px solid var(--rule-heavy);
  background: var(--paper);
  letter-spacing: 0.01em;
}

/* ----------------------------------------------------------------
   Two-column newspaper grid
---------------------------------------------------------------- */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--paper);
  /* Vertical rule between columns via box-shadow on left column */
}

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

/* ----------------------------------------------------------------
   Channel column
---------------------------------------------------------------- */
.column {
  background: var(--paper);
  min-width: 0;
  padding: 0 0 1rem;
}

/* Vertical rule — right border on first column */
.column:first-child {
  border-right: 1px solid var(--rule-heavy);
}

/* ---- Channel header ---- */
/* This is the key: massive black serif, like "BBC1" in the scan */
.column__header {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  font-style: italic;
  color: var(--ink);
  line-height: 1;
  padding: 0.5rem 0.85rem 0.3rem;
  border-bottom: 3px solid var(--ink);
  letter-spacing: -0.03em;
  background: var(--paper);
}

.column__empty {
  padding: 1.5rem 0.85rem;
  color: var(--ink-faint);
  font-style: italic;
  font-size: 0.85rem;
}

/* ----------------------------------------------------------------
   Listings — dense newspaper style
---------------------------------------------------------------- */
.listings { list-style: none; }

.listing {
  padding: 0.3rem 0.85rem 0.28rem;
  border-bottom: 1px solid var(--rule);
  transition: background var(--ease);
  background: var(--paper);
}

.listing:last-child { border-bottom: none; }
.listing:hover { background: var(--paper-hover); }
.listing--repeat { opacity: 0.65; }

/* Time + title on one line — the RT way */
.listing__header {
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--ink);
}

.listing__time {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ink);
  margin-right: 0.3em;
  white-space: nowrap;
}

.listing__title {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

a.listing__title:hover {
  color: var(--ink-mid);
  text-decoration: underline;
}

.listing__subtitle {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-mid);
}

.listing__synopsis {
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--ink-light);
  line-height: 1.45;
  margin-top: 0.1rem;
}

/* Repeat marker — plain "(R)" like the original */
.badge--repeat {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-faint);
  margin-left: 0.2em;
}

/* ----------------------------------------------------------------
   Site footer
---------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: var(--ink-faint);
  padding: 0.9rem 0;
  font-family: var(--font-body);
  font-size: 0.72rem;
  margin-top: auto;
}

.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-footer a { color: #907f72; }
.site-footer a:hover { color: #ccc; text-decoration: none; }

/* ----------------------------------------------------------------
   Responsive tweaks
---------------------------------------------------------------- */
@media (max-width: 660px) {
  .site-header__region { display: none; }

  .column__header { font-size: 1.75rem; }

  .listing { padding: 0.3rem 0.6rem 0.28rem; }

  .listing__synopsis { display: none; }
}

/* ----------------------------------------------------------------
   Print — very close to the real thing
---------------------------------------------------------------- */
@media print {
  body { background: #fff; }
  .site-header { border-bottom: 3px solid #000; }
  .day-nav { display: none; }
  .day-panel { display: block !important; }
  .columns { border: none; }
  .column { background: #fff; }
  .column:first-child { border-right: 1px solid #888; }
  .column__header { border-bottom: 3px solid #000; }
  .listing { background: #fff !important; border-bottom: 1px solid #ccc; }
  .listing--repeat { opacity: 1; }
  .site-footer { display: none; }
}

/* ----------------------------------------------------------------
   Film image — newsprint halftone treatment
---------------------------------------------------------------- */

.film-image {
  position: relative;
  margin: 0.35rem 0 0.3rem;
  overflow: hidden;
  /* Constrain to column width */
  width: 100%;
}

.film-image img {
  display: block;
  width: 100%;
  height: auto;
  /* Greyscale + slight contrast boost, like a photo litho print */
  filter: grayscale(100%) contrast(1.15) brightness(0.95);
}

/* Halftone dot overlay — sits on top of the image */
.film-image::after {
  content: '';
  position: absolute;
  inset: 0;
  /* Tiny repeating radial dots — classic newsprint halftone */
  background-image: radial-gradient(
    circle,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px
  );
  background-size: 3px 3px;
  pointer-events: none;
}

/* Guidance markers */
.listing__markers {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  margin-left: 0.15em;
  white-space: nowrap;
}

/* Film title in italic, like RT's "FILM:" convention */
.listing--film .listing__title {
  font-style: italic;
}

/* ----------------------------------------------------------------
   "Now" marker — red top border on the currently-broadcasting
   programme. Calculated once on page load from data-start/data-end.
---------------------------------------------------------------- */
.listing--now {
  border-top: 2px solid var(--red);
  /* Nudge up slightly so the red line sits between the previous
     listing and this one, not inside the padding */
  margin-top: -1px;
}

/* Small "NOW" label in the time column */
.listing--now .listing__time::before {
  content: 'On now';
  display: block;
  font-family: var(--font-body);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.1rem;
}

/* ----------------------------------------------------------------
   Programme details expand — <details>/<summary> pattern
   Short synopsis visible by default, longer on click.
   Films are unaffected (they always show full synopsis directly).
---------------------------------------------------------------- */
.listing__details {
  display: block;
}

/* The summary IS the short synopsis — style it identically */
.listing__details summary.listing__synopsis {
  cursor: pointer;
  list-style: none;    /* remove default triangle in most browsers */
  display: block;
  position: relative;
  padding-right: 1.2em;
}

/* Remove Safari's default marker */
.listing__details summary.listing__synopsis::-webkit-details-marker {
  display: none;
}

/* Small expand indicator after the text */
.listing__details summary.listing__synopsis::after {
  content: '▸';
  position: absolute;
  right: 0;
  top: 0;
  font-size: 0.6rem;
  color: var(--ink-faint);
  transition: transform 120ms ease;
  line-height: 1.6;
}

.listing__details[open] summary.listing__synopsis::after {
  content: '▾';
}

.listing__details summary.listing__synopsis:hover {
  color: var(--ink);
}

/* The expanded long synopsis */
.listing__synopsis--long {
  margin-top: 0.25rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--rule-light, #d8d0c0);
  color: var(--ink-light);
}
