/* Live Agenda — self-contained, theme-agnostic. Override via the --la-* knobs. */
.live-agenda {
  --la-accent: var(--secondary, #2b4c9b);
  --la-accent-contrast: #fff;
  --la-surface: var(--card-background-color, #f5f5f7);
  --la-border: rgba(0, 0, 0, 0.12);
  --la-text-muted: rgba(0, 0, 0, 0.62);
  --la-radius: var(--button-border-radius, 0.5rem);
  --la-gap: 1rem;
  --la-past-opacity: 0.58;
  --la-gutter: 7rem;
  --la-card-min: 17rem;
  --la-photo: 3rem;
}
.live-agenda > .foreground-content {
  container-type: inline-size;
}

.live-agenda .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Toolbar ---------------------------------------------------------------- */
.la-toolbar {
  --button-font-size: 0.875em;
  --button-padding: 0.35em 0.7em;

  margin-bottom: var(--la-gap);
  background: var(--la-toolbar-bg, #fff);
  border-bottom: 1px solid var(--la-border);
}
.la-toolbar > .container {
  display: flex; flex-wrap: wrap; gap: 0.5rem var(--la-gap); align-items: center; justify-content: space-between;
  padding: var(--size-root-md); margin: auto;
}
.la-status { flex: 1 1 18rem; min-height: 1.4em; font-weight: 600; margin-bottom: 0px !important; }
.la-status__count { font-weight: 400; color: var(--la-text-muted); }
.la-status:empty { display: none; }
.la-controls { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; }
.la-control { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875em; }


select.button {
  --button-background-color: transparent;
  --button-text-color: var(--dark);
  --button-border-color: var(--dark);
}
.la-button--quiet {
  --button-background-color: var(--tertiary);
  --button-border-color: var(--tertiary);
  --button-text-color: var(--primary);
}


.la-abstract summary:focus-visible {
  outline: 2px solid var(--la-accent); outline-offset: 2px;
}
.la-daynav { display: flex; gap: 0.25rem; }
.la-daynav a {
  --button-background-color: var(--primary);
  --button-border-color: var(--primary);
  --button-text-color: var(--light);
}
.la-daynav a[aria-current="date"] {
  --button-background-color: var(--tertiary);
  --button-border-color: var(--tertiary);
  --button-text-color: var(--primary);
}

/* Days & blocks ---------------------------------------------------------- */
.la-day { margin-bottom: calc(var(--la-gap) * 2.5); scroll-margin-top: 1rem; }
.la-day__title { font-size: 1.35em; margin-bottom: var(--la-gap); padding-bottom: 0.4em; border-bottom: 2px solid var(--la-accent); }
.la-blocks { display: flex; flex-direction: column; gap: var(--la-gap); }
.la-block { display: grid; grid-template-columns: var(--la-gutter) minmax(0, 1fr); gap: 0.35rem var(--la-gap); scroll-margin-top: 1rem; position: relative; }
.la-block__time { display: flex; flex-direction: column; padding-top: 0.9rem; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.3; }
.la-block__time > span[aria-hidden] { display: none; }
.la-block__time .la-time--end { color: var(--la-text-muted); font-weight: 400; }
.la-block__time span[aria-hidden] { margin: 0 0.2em; color: var(--la-text-muted); font-weight: 400; }
.la-time__date { display: block; font-size: 0.75em; font-weight: 400; color: var(--la-text-muted); }
.la-items { display: grid; gap: var(--la-gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--la-card-min)), 1fr)); }

@container (max-width: 44rem) {
  /* container queries only reach descendants of the container (.foreground-content) */
  .la-blocks { --la-gutter: 4.25rem; --la-gap: 0.75rem; }
  .la-block__time { font-size: 0.9em; }
}
@container (min-width: 44rem) {
  .la-toolbar { position: sticky; top: var(--navbar-height); z-index: 2; }
  .la-day, .la-block, .la-item { scroll-margin-top: var(--la-sticky, 4.5rem); }
  /* the theme chips add a row to the sticky toolbar */
  .live-agenda:has(.la-themes) { --la-sticky: 7.25rem; }
}

/* Item card -------------------------------------------------------------- */
.la-item {
  position: relative;
  display: flex; flex-direction: column; gap: 0.55rem;
  padding: 0.9rem 1rem; border-radius: var(--la-radius);
  background: var(--la-surface); border: 1px solid transparent;
  border-left: var(--la-radius) solid transparent;
  transition: opacity 0.3s, border-color 0.3s, background-color 0.3s;
  scroll-margin-top: 1rem;
}
.la-item--break { background: transparent; border: 1px dashed var(--la-border); border-left-width: 1px; }
.la-item--break .la-item__title { font-size: 1em; font-weight: 500; color: var(--la-text-muted); }
.la-item__head { display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; justify-content: space-between; align-items: baseline; }
.la-item__meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; align-items: baseline; font-size: 0.85em; color: var(--la-text-muted); }
.la-item__time { font-variant-numeric: tabular-nums; font-weight: 600; color: inherit; }
.la-item__room { font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.9em; }
.la-item__badges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.la-item__badges:empty { display: none; }
.la-item__title { font-size: 1.1em; line-height: 1.25; margin-bottom: 0px !important; }

.la-tag {
  display: inline-block; padding: 0.15em 0.55em; border-radius: 999px;
  font-size: 0.75em; font-weight: 500; text-transform: uppercase;
  background: var(--la-border); color: inherit;
  translate: 0px calc(.15em * -1);
}
.la-tag--now { background: var(--la-accent); color: var(--la-accent-contrast); }
.la-tag--next { border: 1px solid var(--la-accent); color: var(--la-accent); background: transparent; }
.la-tag--cancelled { background: var(--danger); color: contrast-color(var(--danger)); }
.la-tag--notice { background: var(--warning); color: contrast-color(var(--warning)); text-transform: none; }
.la-tag--type { background: transparent; border: 1px solid currentColor; }

/* Speakers --------------------------------------------------------------- */
.la-speakers { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 0px !important; }
.la-speaker { display: flex; align-items: center; gap: 0.6rem; }
.la-speaker__photo {
  flex: none; width: var(--la-photo); height: var(--la-photo); border-radius: 50%;
  object-fit: cover; background: var(--la-border);
  display: inline-grid; place-items: center; font-weight: 700; color: var(--la-text-muted);
}
.la-speaker__text { display: flex; flex-direction: column; font-size: 0.9em; line-height: 1.3; }
.la-speaker__name { font-weight: 600; }
.la-speaker__name a { color: inherit; }
.la-speaker__role { color: var(--la-text-muted); font-size: 0.9em; }

/* Abstract --------------------------------------------------------------- */
.la-abstract { font-size: 0.925em; }
.la-abstract summary { cursor: pointer; color: var(--la-accent); font-weight: 600; width: max-content; }
.la-abstract__body { padding-top: 0.4rem; color: var(--la-text-muted); }
.la-abstract__body > :last-child { margin-bottom: 0; }

/* States (set by module.js) ------------------------------------------------ */
.la-item.is-past { opacity: var(--la-past-opacity); }
.la-item.is-past .la-speaker__photo { filter: grayscale(1); }
.la-item.is-current { border-left-color: var(--la-accent); background: color-mix(in srgb, var(--la-accent) 9%, var(--la-surface)); }
.la-item.is-next { border-left-color: color-mix(in srgb, var(--la-accent) 45%, transparent); }
.la-item--cancelled .la-item__title { text-decoration: line-through; }
.la-item--cancelled .la-speakers, .la-item--cancelled .la-abstract { opacity: 0.7; }
.la-block.is-past .la-block__time { opacity: var(--la-past-opacity); }
.la-block.is-current .la-block__time { color: var(--la-accent); }
.la-block.is-current::before { background: var(--la-accent); border-color: var(--la-accent); animation: la-pulse 2s ease-in-out infinite; }
.la-block.is-next::before { border-color: var(--la-accent); }
.la-block.is-past::before { background: var(--la-border); }
.la-day.is-past .la-day__title { opacity: var(--la-past-opacity); border-bottom-color: var(--la-border); }
.la-item[hidden], .la-block[hidden], .la-day[hidden], .la-daynav a[hidden] { display: none; }
@keyframes la-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .la-block.is-current::before { animation: none; }
  .la-item { transition: none; }
}

/* Print -------------------------------------------------------------------- */
@media print {
  .la-toolbar { display: none; }
  .la-item, .la-block { break-inside: avoid; }
  .la-item { border: 1px solid #999; background: #fff; }
  .la-item.is-past { opacity: 1; }
  .la-item.is-past .la-speaker__photo { filter: none; }
  .la-tag--now, .la-tag--next, .la-tag--ended { display: none; }
  .la-abstract summary { display: none; }
  .la-print-header { display: block; }
  .la-day + .la-day { break-before: page; }
  .la-blocks::before, .la-block::before, .la-block.is-current::after { display: none; }
}

/* Status link, change banner, updated badge ------------------------------- */
.la-status a { color: inherit; text-decoration: underline; text-underline-offset: 0.15em; }
.la-status a:hover { color: var(--la-accent); }
.la-banner {
  flex: 1 1 100%; margin: 0 !important; padding: 0.5em 0.8em; border-radius: var(--la-radius);
  background: var(--warning, #f5c33b); color: contrast-color(var(--warning, #f5c33b)); font-weight: 600;
}
.la-banner a { color: inherit; font-weight: 400; margin-left: 0.4em; }
.la-tag--updated { background: var(--la-accent); color: var(--la-accent-contrast); }
.la-item[data-updated] { border-color: var(--la-accent); }

/* Timeline gutter ---------------------------------------------------------- */
.la-blocks { position: relative; }
.la-blocks::before {
  content: ""; position: absolute; top: 0.5rem; bottom: 0.5rem;
  left: calc(var(--la-gutter) - 0.5rem); border-left: 2px dashed var(--la-border);
}
.la-block::before {
  content: ""; position: absolute; z-index: 1; top: 1.15rem;
  left: calc(var(--la-gutter) - 0.5rem - 5px); width: 12px; height: 12px; box-sizing: border-box;
  border-radius: 50%; background: var(--la-toolbar-bg, #fff); border: 2px solid var(--la-border);
}
.la-block.is-current::after {
  /* now-line: --la-progress is set by module.js (elapsed share of the block) */
  content: ""; position: absolute; z-index: 1;
  left: calc(var(--la-gutter) - 1.25rem); width: 1.5rem; height: 0;
  top: clamp(1.15rem, var(--la-progress, 0%), calc(100% - 0.5rem));
  border-top: 2px solid var(--la-accent);
}
.la-block.is-current::after::before { content: none; }

/* Live view (?view=live) ---------------------------------------------------- */
.la-view-toggle { --button-padding: 0.35em 0.6em; line-height: 1; }
.la-view-toggle[aria-pressed="true"] { --button-background-color: var(--la-accent); --button-border-color: var(--la-accent); --button-text-color: var(--la-accent-contrast); }
.live-agenda.is-live { font-size: 1.15em; }
.live-agenda.is-live .la-daynav, .live-agenda.is-live .la-filter { display: none; }
.live-agenda.is-live .la-day:not(.is-active) { display: none; }
.live-agenda.is-live .la-block:not(.is-current):not(.is-next) { display: none; }
.live-agenda.is-live .la-item.is-past { display: none; }
.live-agenda.is-live .la-blocks::before { display: none; }

/* Change history (set by polling) -------------------------------------------- */
.la-was { color: var(--la-text-muted); font-weight: 400; margin-right: 0.35em; text-decoration: line-through; }

/* Print header (hidden on screen) -------------------------------------------- */
.la-print-header { display: none; font-size: 0.85em; color: var(--la-text-muted); margin: 0 0 0.25rem; }

/* Themes (?theme=) ------------------------------------------------------------
   --la-theme is a validated hex, set inline on a themed card, on each theme
   label and on each chip. --la-theme-ink is that colour capped in lightness so
   it reads as text on the card whatever colour the client picked. */
.la-item--themed, .la-chip, .la-theme-about {
  --la-theme-ink: color-mix(in srgb, var(--la-theme) 60%, #000);
}
@supports (color: oklch(from red l c h)) {
  .la-item--themed, .la-item__theme span, .la-chip, .la-theme-about { --la-theme-ink: oklch(from var(--la-theme) min(l, 0.5) c h); }
}
.la-item.la-item--themed {
  border-left-color: var(--la-theme);
  background: color-mix(in srgb, var(--la-theme) 7%, var(--la-surface));
}
.la-item.la-item--themed.is-current {
  border-color: var(--la-theme);
  background: color-mix(in srgb, var(--la-theme) 16%, var(--la-surface));
}
.la-item__theme {
  display: flex; flex-wrap: wrap; gap: 0 0.9em; margin-bottom: 0 !important;
  font-size: 0.75em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--la-theme-ink);
}
.la-item__theme span { color: var(--la-theme-ink); }
.la-item--themed .la-abstract summary { color: var(--la-theme-ink); }
.la-item--themed .la-tag--now { background: var(--la-theme-ink); }
.la-item--themed .la-tag--next { border-color: var(--la-theme-ink); color: var(--la-theme-ink); }

/* Theme chips: the filter, and the legend for the card colours. A chip is a
   theme button, so it is shaped through the theme's --button-* properties. */
.la-themes { display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 0.4rem; }
.la-chip {
  --button-background-color: transparent; --button-text-color: currentColor;
  --button-border-color: var(--la-border); --button-border-width: 1px; --button-border-radius: 999px;
  --button-padding: 0.45em 0.8em; --button-text-transform: none; --button-all-filter: none; --btngap: 0.45em;
  flex: none;
}
.la-chip[style]::before { content: ""; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--la-theme); }
.la-chip:hover { --button-border-color: currentColor; }
.la-chip:focus-visible { outline: 2px solid var(--la-accent); outline-offset: 2px; }
.la-chip[aria-pressed="true"] { --button-border-color: currentColor; --button-background-color: var(--la-border); }
.la-chip[style][aria-pressed="true"] {
  --button-border-color: var(--la-theme); --button-text-color: var(--la-theme-ink);
  --button-background-color: color-mix(in srgb, var(--la-theme) 12%, transparent);
}
@container (min-width: 44rem) {
  /* one row in the sticky toolbar: more chips than fit scroll sideways */
  .la-themes { flex-wrap: nowrap; overflow-x: auto; }
}
/* A theme's description, shown while the theme filter is set to it */
.la-theme-about {
  margin-bottom: calc(var(--la-gap) * 1.5); padding: 0.9rem 1rem; border-radius: var(--la-radius);
  border-left: var(--la-radius) solid var(--la-theme);
  background: color-mix(in srgb, var(--la-theme) 7%, var(--la-surface));
}
.la-theme-about .la-item__theme { margin-bottom: 0.4rem !important; }
.la-theme-about > :last-child { margin-bottom: 0; }
.live-agenda.is-live .la-theme-about { display: none; }
.la-empty .button { margin-left: 0.5em; }
@media print {
  .la-item--themed { border-left: var(--la-radius) solid var(--la-theme); }
}
