/* KEK Theory Workshop 2026: group the Plenary conveners by day.
 * Presentation only: the eight timetable blocks and chair assignments stay intact.
 * Scope to session 2287 via its public PDF link. If the block count changes,
 * fall back to Indico's complete, ungrouped list instead of hiding new blocks.
 */
body:has(a[href$="/event/381/sessions/2287/session-timetable.pdf"])
.session-conveners:has(> ul:nth-of-type(8)):not(:has(> ul:nth-of-type(9))) {
  /* Direct children: main header, then alternating block header and chair list. */
  & > .header-row:is(:nth-child(4), :nth-child(6), :nth-child(10), :nth-child(12), :nth-child(16)),
  & > ul:is(:nth-of-type(2), :nth-of-type(3), :nth-of-type(5), :nth-of-type(6), :nth-of-type(8)) {
    display: none;
  }

  & > .header-row:nth-child(2) { --plenary-day: "Plenary Session Nov 25"; }
  & > .header-row:nth-child(8) { --plenary-day: "Plenary Session Nov 26"; }
  & > .header-row:nth-child(14) { --plenary-day: "Plenary Session Nov 27"; }

  & > .header-row:is(:nth-child(2), :nth-child(8), :nth-child(14)) > h4 {
    position: relative;
    visibility: hidden;
  }

  & > .header-row:is(:nth-child(2), :nth-child(8), :nth-child(14)) > h4::after {
    content: var(--plenary-day);
    visibility: visible;
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
  }
}

/* Parallel session 2288: keep each heading beside its own chair list,
 * and show the eight entries in IA, IB, IIA, IIB, IIIA, IIIB, IVA, IVB order.
 * Indico's source order is IB, IA, IIA, IIB, IIIA, IIIB, IVB, IVA.
 */
body:has(a[href$="/event/381/sessions/2288/session-timetable.pdf"])
.session-conveners:has(> ul:nth-of-type(8)):not(:has(> ul:nth-of-type(9))) {
  display: flex;
  flex-direction: column;

  & > .header { order: 0; }
  & > .header-row:nth-child(4) { order: 1; }
  & > ul:nth-of-type(2) { order: 2; }
  & > .header-row:nth-child(2) { order: 3; }
  & > ul:nth-of-type(1) { order: 4; }
  & > .header-row:nth-child(6) { order: 5; }
  & > ul:nth-of-type(3) { order: 6; }
  & > .header-row:nth-child(8) { order: 7; }
  & > ul:nth-of-type(4) { order: 8; }
  & > .header-row:nth-child(10) { order: 9; }
  & > ul:nth-of-type(5) { order: 10; }
  & > .header-row:nth-child(12) { order: 11; }
  & > ul:nth-of-type(6) { order: 12; }
  & > .header-row:nth-child(16) { order: 13; }
  & > ul:nth-of-type(8) { order: 14; }
  & > .header-row:nth-child(14) { order: 15; }
  & > ul:nth-of-type(7) { order: 16; }
}

/* Contribution cards: keep every time range inside the card, even when a
 * long title would make Indico's flex-column layout wrap out of view.
 * Row 1: title. Row 2: presenter and a reserved, non-wrapping time column.
 * Venue and full title remain available in the contribution details popup.
 */
.timetableBlock.timetableContribution > .entry-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  grid-template-rows: min-content min-content;
  gap: 2px 8px;
  align-content: space-between;
  align-items: baseline;
}

.timetableBlock.timetableContribution > .entry-content > .timetableBlockWrapper {
  display: contents;
}

.timetableBlock.timetableContribution > .entry-content .timetableBlockTitle {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timetableBlock.timetableContribution > .entry-content .timetableBlockPresenters {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  margin: 0;
  float: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timetableBlock.timetableContribution > .entry-content .timetableBlockTime {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.timetableBlock.timetableContribution > .entry-content .timetableBlockLocation {
  display: none;
}