/*
 * THE AGENDA POPUP, drawn by the registration app itself.
 *
 * ┌─ WHY IT IS NOT AN IFRAME ───────────────────────────────────────────────────────────────────┐
 * │ It was. The congress site sends an anti-framing header, so "View agenda" showed a delegate  │
 * │ "www.rhicoman.com refused to connect." — measured in the browser, on the live link.         │
 * │ The data now comes from this app's own endpoint, which reads Reception directly.            │
 * └─────────────────────────────────────────────────────────────────────────────────────────────┘
 *
 * ## What the first version got wrong, in the client's hands
 *
 * Sessions were separated by a hairline rail and nothing else. With a speaker block under most
 * titles, two sessions ran together into one wall of text, and "Lunch Break" was a row in the
 * same box with grey text — so the shape of a day, which is exactly what a delegate reads a
 * programme for, was invisible.
 *
 * Now every session is its own bordered card, and the breaks are coloured rather than greyed: a
 * meal break in warm orange, a short break in slate. Morning, lunch and afternoon can be told
 * apart without reading a single title. The colour is never the only signal — each break also
 * carries an icon and a dashed edge, for anyone who cannot separate the two shades.
 *
 * ON A PHONE THE TIME COLUMN STOPS BEING A COLUMN. 112px leaves about 180px for a title on a
 * 360px screen, which wraps a session name to five lines — see the media query at the end.
 */

.ag-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(15, 23, 42, .62);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.ag-overlay.is-open { display: flex; }

.ag-box {
  background: #fff; border-radius: 16px;
  width: min(980px, 100%); max-height: min(90vh, 940px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
}

.ag-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid rgba(15, 23, 42, .10);
  flex: none;
}
.ag-head__text { flex: 1; min-width: 0; }
.ag-head h2 {
  margin: 0; font-size: 17px; font-weight: 700; color: #0f172a; line-height: 1.3;
  overflow-wrap: anywhere;
}
.ag-head__sub { margin: 4px 0 0; font-size: 12.5px; color: #667085; }
.ag-x {
  flex: none; border: 1px solid rgba(15, 23, 42, .18); background: #fff; color: #0f172a;
  border-radius: 10px; padding: 8px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
  line-height: 1;
}
.ag-x:hover { border-color: rgba(15, 23, 42, .4); }

.ag-body { overflow-y: auto; padding: 4px 18px 22px; flex: 1; }

/* ---- states -------------------------------------------------------------- */
.ag-state { padding: 46px 18px; text-align: center; color: #667085; font-size: 14px; line-height: 1.6; }
.ag-state strong { display: block; color: #0f172a; font-size: 15px; margin-bottom: 6px; }
.ag-spin {
  width: 26px; height: 26px; margin: 0 auto 14px;
  border: 3px solid rgba(15, 23, 42, .12); border-top-color: #0f766e; border-radius: 50%;
  animation: ag-spin .8s linear infinite;
}
@keyframes ag-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ag-spin { animation-duration: 2.4s; } }

/* ---- the day chooser ---------------------------------------------------- */
/*
 * ┌─ DAYS ARE CHOSEN, NOT SCROLLED PAST ────────────────────────────────────────────────────────┐
 * │ The days used to be stacked, so day 3 of a three-day workshop was sixty sessions below the  │
 * │ fold and you only learned it existed by reaching it. They are chips now: what the programme │
 * │ covers is visible before reading a word.                                                    │
 * │                                                                                             │
 * │ Sticky, because the chooser is useless the moment it scrolls away — you would have to       │
 * │ scroll back up through the day you are reading to change day.                               │
 * └─────────────────────────────────────────────────────────────────────────────────────────────┘
 */
.ag-tabs {
  position: sticky; top: 0; z-index: 3;
  display: flex; gap: 8px;
  padding: 12px 0 11px;
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, .10);
  /* A six-day programme must scroll sideways rather than squeeze every chip unreadable. */
  overflow-x: auto; scrollbar-width: thin;
}
.ag-tab {
  flex: 0 0 auto; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 118px; padding: 9px 14px;
  background: #fff; border: 1px solid rgba(15, 23, 42, .14); border-radius: 11px;
  font: inherit; color: #0f172a;
}
.ag-tab:hover { border-color: rgba(15, 23, 42, .34); }
.ag-tab__day { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.ag-tab__date { font-size: 12px; font-weight: 600; color: #475569; line-height: 1.25; }
.ag-tab__n { font-size: 10.5px; font-weight: 600; color: #94a3b8; letter-spacing: .02em; }

/* The chosen day. A border change alone is too quiet on a row of five. */
.ag-tab.is-on {
  background: #0f766e; border-color: #0f766e;
  box-shadow: 0 2px 8px rgba(15, 118, 110, .28);
}
.ag-tab.is-on .ag-tab__day { color: #fff; }
.ag-tab.is-on .ag-tab__date { color: rgba(255, 255, 255, .9); }
.ag-tab.is-on .ag-tab__n { color: rgba(255, 255, 255, .72); }
.ag-tab:focus-visible { outline: 2px solid #0f766e; outline-offset: 2px; }

.ag-panel { padding-top: 14px; }

/* Named only where two specialties share one day of a workshop. */
.ag-track__label {
  margin: 16px 0 8px; font-size: 12px; font-weight: 700; color: #0f766e;
  text-transform: uppercase; letter-spacing: .07em;
}

/* ---- rows -------------------------------------------------------------- */
/*
 * ┌─ EVERY ROW NEEDS AN EDGE ───────────────────────────────────────────────────────────────────┐
 * │ The first version separated sessions with a hairline rail and nothing else. With a speaker  │
 * │ block under most titles, two sessions ran together into one wall of text and a reader       │
 * │ could not see where one talk ended. The client's whole ask was that this be readable at a   │
 * │ glance.                                                                                     │
 * │                                                                                             │
 * │ So each session is its own bordered card with its own white ground, and the breaks that     │
 * │ separate them are coloured rather than greyed. The day's shape — morning, lunch, afternoon  │
 * │ — is now visible without reading a single title.                                            │
 * └─────────────────────────────────────────────────────────────────────────────────────────────┘
 */
.ag-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.ag-block {
  margin: 20px 0 4px; padding: 10px 14px;
  background: #0f172a; border-radius: 10px;
  font-size: 12.5px; font-weight: 700; color: #fff; line-height: 1.4;
  letter-spacing: .02em;
}

.ag-row {
  display: grid; grid-template-columns: 112px 1fr; gap: 0 18px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .11);
  border-left: 3px solid #0f766e;
  border-radius: 12px;
}

/* A keynote is the one session people plan a day around. */
.ag-row--keynote { border-left-color: #8a6a35; background: linear-gradient(180deg, rgba(138,106,53,.05), #fff 70%); }

/*
 * THE BREAKS, IN THEIR OWN COLOURS. A meal break is an hour out of the room and a coffee break
 * is ten minutes beside it; they are not the same event and do not look the same.
 */
.ag-row--break { border-style: dashed; }
.ag-row--lunch {
  background: #fff7ed; border-color: #fdba74; border-left-color: #ea580c;
}
.ag-row--lunch .ag-topic { color: #9a3412; font-weight: 700; }
.ag-row--lunch .ag-time, .ag-row--lunch .ag-start, .ag-row--lunch .ag-end { color: #9a3412; }
.ag-row--break:not(.ag-row--lunch) {
  background: #f8fafc; border-color: #cbd5e1; border-left-color: #94a3b8;
}
.ag-row--break:not(.ag-row--lunch) .ag-topic { color: #475569; font-weight: 600; }

.ag-break-ico { font-size: 15px; margin-right: 7px; }

.ag-time {
  font-size: 12.5px; font-weight: 600; color: #334155;
  /* tabular figures so the times form a column the eye runs down instead of jittering */
  font-variant-numeric: tabular-nums; white-space: nowrap;
  /*
   * A GRID ITEM WILL NOT SHRINK BELOW ITS CONTENT UNLESS TOLD TO.
   *
   * The row is `112px 1fr`, and this cell also holds the type chip. A grid item's automatic
   * minimum is its min-content width — which, with `nowrap` above, is the WHOLE chip on one
   * line — so a long type like "Hands-On Demonstration" pushed the cell past its 112px and out
   * over the title beside it.
   */
  min-width: 0;
}
.ag-time--tba { color: #98a2b3; font-weight: 500; }
.ag-start { display: block; font-size: 15px; font-weight: 700; color: #0f172a; line-height: 1.25; }
.ag-end {
  display: block; font-size: 12px; font-weight: 500; color: #64748b; line-height: 1.25; margin-top: 2px;
  /* An en dash before the end time, so "09:00 / 09:20" cannot read as two separate sessions. */
}
.ag-end::before { content: "– "; }

.ag-tag {
  display: block; width: fit-content; margin-top: 8px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: #0f766e; background: rgba(15, 118, 110, .10);
  /*
   * The chip WRAPS; the times above it do not.
   *
   * `.ag-time` sets `white-space: nowrap` so "03:00 PM" can never break across two lines. The
   * chip inherits it, and a long session type then had nowhere to go but sideways. `max-width`
   * holds it inside the column and `overflow-wrap` lets a single long word break rather than
   * sit proud of it.
   */
  white-space: normal; max-width: 100%; overflow-wrap: anywhere;
}
.ag-tag--keynote { color: #8a6a35; background: rgba(138, 106, 53, .12); }

.ag-body-cell { min-width: 0; }
.ag-topic { font-size: 15px; font-weight: 600; color: #0f172a; line-height: 1.45; overflow-wrap: anywhere; }
.ag-topic--tba { color: #98a2b3; font-style: italic; font-weight: 500; }
.ag-venue {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  font-size: 12.5px; color: #64748b;
}

/* The people, set apart from the title by a rule rather than by spacing alone. */
.ag-group { margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(15, 23, 42, .07); }
.ag-group + .ag-group { margin-top: 8px; }
.ag-glabel {
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: #94a3b8; margin-bottom: 7px;
}
.ag-people { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.ag-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ag-av {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700;
  color: #0f766e; background: rgba(15, 118, 110, .10); border: 1px solid rgba(15, 118, 110, .22);
  /* So a photograph is clipped to the circle. Here rather than on the image, because the image
     is REMOVED when it fails to load and a radius on a removed element clips nothing. */
  overflow: hidden;
}
/* A moderator gets the same circle in sand, so the roles stay tellable apart at a glance. */
.ag-av--mod { color: #8a6a35; background: rgba(138, 106, 53, .09); border-color: rgba(138, 106, 53, .22); }
/*
 * THE PHOTOGRAPH FILLS THE SAME CIRCLE the initials had, so a programme where only some speakers
 * have one still lines up: every row is 34px, whichever it draws.
 *
 * `overflow: hidden` on the circle rather than a border-radius on the image — the image is
 * replaced by text when it fails to load, and a radius on a removed element clips nothing.
 */
.ag-av-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ag-who { min-width: 0; font-size: 13px; line-height: 1.35; }
.ag-nm { font-weight: 600; color: #0f172a; }
.ag-rl { display: block; color: #64748b; font-size: 11.5px; }

/* ---- the phone ---------------------------------------------------------- */
/*
 * A 110px gutter leaves about 180px for a title on a 360px screen, which wraps a session name to
 * five lines. So the column stops being a column: the time becomes one line above the title, the
 * rail and its tick go, and the row is a block.
 */
@media (max-width: 640px) {
  .ag-overlay { padding: 0; }
  .ag-box { width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .ag-head { padding: 13px 14px; }
  .ag-body { padding: 4px 12px 20px; }
  /*
   * A 112px time column leaves about 180px for a title on a 360px screen, which wraps a session
   * name to five lines. So the column stops being a column: the time becomes one line above the
   * title, with the type chip pushed to the right of it.
   */
  .ag-row { grid-template-columns: 1fr; gap: 8px; padding: 13px 14px; }
  .ag-time { display: flex; align-items: baseline; gap: 7px; white-space: normal; }
  .ag-start { font-size: 13.5px; }
  .ag-end { margin-top: 0; }
  /* Narrow screens lay the row out in one column, so the chip sits beside the time instead of
     under it — `max-width` would then bound it to the whole row, which is not a constraint. */
  .ag-tag { display: inline-block; margin-top: 0; margin-left: auto; max-width: none; }
  .ag-topic { font-size: 14.5px; }
  .ag-people { gap: 9px 14px; }
  .ag-block { margin: 16px 0 4px; }
  /* The chips stay full size and scroll sideways: shrinking them to fit three on a phone makes
     the date unreadable, which is the one thing the chip is for. */
  .ag-tabs { padding: 10px 0 9px; gap: 7px; }
  .ag-tab { min-width: 104px; padding: 8px 12px; }
}
