/*
 * TierBook Event Program (shortcode, Elementor widget, embed). Restyle through the --tbp-* custom
 * properties. Defaults (and the dark / auto / inherit theme presets) sit in :where() with zero
 * specificity, so a theme or companion plugin overrides them with a plain .tbp rule whatever the
 * load order; Elementor style controls ({{WRAPPER}} .tbp) and ?accent= / ?theme= embed params win.
 */

:where(.tbp) {
  --tbp-accent: #6b36dc;
  --tbp-bg: transparent;
  --tbp-surface: #ffffff;
  --tbp-text: #1d2327;
  --tbp-muted: #646970;
  --tbp-border: #dcdcde;
  --tbp-soft: #f0f0f1;
  --tbp-radius: 8px;
  --tbp-font: inherit;
  --tbp-type: var(--tbp-muted);
}

.tbp {
  background: var(--tbp-bg);
  color: var(--tbp-text);
  font-family: var(--tbp-font);
  font-size: 0.9375rem;
  line-height: 1.5;
}

:where(.tbp.tbp-theme-dark) {
  --tbp-bg: #1d2327;
  --tbp-surface: color-mix(in srgb, #1d2327 88%, #ffffff);
  --tbp-text: #f6f7fb;
  --tbp-muted: color-mix(in srgb, #f6f7fb 65%, #1d2327);
  --tbp-border: color-mix(in srgb, #f6f7fb 18%, #1d2327);
  --tbp-soft: color-mix(in srgb, #f6f7fb 8%, #1d2327);
  --tbp-accent: color-mix(in srgb, #6b36dc 70%, #ffffff);
}

.tbp.tbp-theme-dark {
  padding: 1rem;
  border-radius: var(--tbp-radius);
}

@media (prefers-color-scheme: dark) {
  :where(.tbp.tbp-theme-auto) {
    --tbp-surface: color-mix(in srgb, #1d2327 88%, #ffffff);
    --tbp-text: #f6f7fb;
    --tbp-muted: color-mix(in srgb, #f6f7fb 65%, #1d2327);
    --tbp-border: color-mix(in srgb, #f6f7fb 18%, #1d2327);
    --tbp-soft: color-mix(in srgb, #f6f7fb 8%, #1d2327);
    --tbp-accent: color-mix(in srgb, #6b36dc 70%, #ffffff);
  }
}

:where(.tbp.tbp-theme-inherit) {
  --tbp-surface: transparent;
  --tbp-text: inherit;
  --tbp-muted: inherit;
}

.tbp *,
.tbp *::before,
.tbp *::after {
  box-sizing: border-box;
}

:where(.tbp) .tbp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:where(.tbp) .tbp-heading {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}

:where(.tbp) .tbp-empty,
:where(.tbp) .tbp-tz {
  color: var(--tbp-muted);
}

:where(.tbp) .tbp-tz {
  font-size: 0.75rem;
  margin-top: 1rem;
}

/* Filters */
:where(.tbp) .tbp-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

:where(.tbp) .tbp-filters input,
:where(.tbp) .tbp-filters select {
  flex: 1 1 12rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--tbp-border);
  border-radius: 6px;
  background: var(--tbp-surface);
  color: var(--tbp-text);
  font: inherit;
  font-size: 0.875rem;
}

:where(.tbp) .tbp-filters input:focus-visible,
:where(.tbp) .tbp-filters select:focus-visible,
:where(.tbp) .tbp-day:focus-visible,
:where(.tbp) .tbp-person:focus-visible,
:where(.tbp) .tbp-details summary:focus-visible,
.tbp a:focus-visible {
  outline: 2px solid var(--tbp-accent);
  outline-offset: 2px;
}

:where(.tbp) .tbp-filter-empty {
  flex-basis: 100%;
  color: var(--tbp-muted);
  margin: 0.5rem 0 0;
}

/* Days */
:where(.tbp) .tbp-days {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--tbp-border);
  margin-bottom: 1rem;
  scrollbar-width: thin;
}

:where(.tbp) .tbp-day {
  flex: 0 0 auto;
  padding: 0.6rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--tbp-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

:where(.tbp) .tbp-day.is-active {
  color: var(--tbp-accent);
  border-bottom-color: var(--tbp-accent);
}

:where(.tbp) .tbp-day-title {
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tbp-muted);
  margin: 1.5rem 0 0.5rem;
}

/* Agenda */
:where(.tbp) .tbp-list,
:where(.tbp) .tbp-segments,
:where(.tbp) .tbp-people,
:where(.tbp) .tbp-speaker-grid {
  list-style: none;
  margin: 0;
  padding: 0;
}

:where(.tbp) .tbp-slot {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--tbp-border);
}

:where(.tbp) .tbp-time {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

:where(.tbp) .tbp-slot-items {
  display: grid;
  gap: 0.75rem;
}

:where(.tbp) .tbp-slot.is-concurrent .tbp-slot-items {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

:where(.tbp) .tbp-item {
  background: var(--tbp-surface);
  border: 1px solid var(--tbp-border);
  border-radius: var(--tbp-radius);
  padding: 0.9rem 1rem;
}

:where(.tbp) .tbp-item--break {
  background: var(--tbp-soft);
  padding: 0.6rem 1rem;
}

:where(.tbp) .tbp-item--break .tbp-title {
  font-size: 0.9375rem;
}

:where(.tbp) .tbp-item.is-cancelled .tbp-title {
  text-decoration: line-through;
  color: var(--tbp-muted);
}

:where(.tbp) .tbp-item[hidden],
:where(.tbp) .tbp-slot[hidden] {
  display: none;
}

:where(.tbp) .tbp-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

:where(.tbp) .tbp-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tbp-muted);
}

:where(.tbp) .tbp-type::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 6px;
  background: var(--tbp-type);
}

:where(.tbp) .tbp-flag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #d63638;
}

:where(.tbp) .tbp-label {
  font-size: 0.75rem;
  padding: 0.05rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--tbp-chip, var(--tbp-border));
}

:where(.tbp) .tbp-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 650;
  line-height: 1.3;
}

:where(.tbp) .tbp-subtitle {
  margin: 0.15rem 0 0;
  color: var(--tbp-muted);
}

:where(.tbp) .tbp-meta {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--tbp-muted);
}

:where(.tbp) .tbp-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.6rem;
}

:where(.tbp) .tbp-person {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

:where(.tbp) .tbp-person img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

:where(.tbp) .tbp-person strong {
  display: block;
  font-size: 0.875rem;
}

:where(.tbp) .tbp-person small {
  display: block;
  font-size: 0.75rem;
  color: var(--tbp-muted);
}

:where(.tbp) .tbp-person:hover strong {
  color: var(--tbp-accent);
}

:where(.tbp) .tbp-details {
  margin-top: 0.6rem;
}

:where(.tbp) .tbp-details summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tbp-accent);
}

:where(.tbp) .tbp-content > :last-child {
  margin-bottom: 0;
}

:where(.tbp) .tbp-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.6rem 0 0;
  font-size: 0.875rem;
}

:where(.tbp) .tbp-links a {
  color: var(--tbp-accent);
  font-weight: 600;
}

:where(.tbp) .tbp-sponsors {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--tbp-border);
}

:where(.tbp) .tbp-sponsor {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

:where(.tbp) .tbp-sponsor small {
  font-size: 0.75rem;
  color: var(--tbp-muted);
}

:where(.tbp) .tbp-sponsor img {
  max-height: 28px;
  max-width: 120px;
  object-fit: contain;
}

:where(.tbp) .tbp-segments {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

:where(.tbp) .tbp-item--segment {
  padding: 0.6rem 0.8rem;
  background: var(--tbp-soft);
  border-color: transparent;
}

/* Speakers grid */
:where(.tbp) .tbp-speaker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1rem;
}

:where(.tbp) .tbp-speaker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 1rem 0.75rem;
  border: 1px solid var(--tbp-border);
  border-radius: var(--tbp-radius);
  background: var(--tbp-surface);
  text-align: center;
}

:where(.tbp) .tbp-speaker-card img,
:where(.tbp) .tbp-initials {
  width: 88px;
  height: 88px;
  border-radius: var(--tbp-radius);
  object-fit: cover;
}

:where(.tbp) .tbp-initials {
  display: grid;
  place-items: center;
  background: var(--tbp-soft);
  color: var(--tbp-muted);
  font-size: 1.5rem;
  font-weight: 650;
}

/* Dialog */
:where(.tbp) .tbp-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.5rem;
  border: 1px solid var(--tbp-border);
  border-radius: var(--tbp-radius);
  background: var(--tbp-surface, #ffffff);
  color: var(--tbp-text);
}

:where(.tbp) .tbp-dialog::backdrop {
  background: color-mix(in srgb, #1d2327 55%, transparent);
}

:where(.tbp) .tbp-dialog-close {
  float: right;
  width: 2rem;
  height: 2rem;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

:where(.tbp) .tbp-dialog-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

:where(.tbp) .tbp-dialog-head img {
  width: 72px;
  height: 72px;
  border-radius: var(--tbp-radius);
  object-fit: cover;
}

:where(.tbp) .tbp-dialog h3 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
}

:where(.tbp) .tbp-dialog-sub {
  color: var(--tbp-muted);
  margin: 0.15rem 0 0;
}

:where(.tbp) .tbp-dialog-sessions {
  padding-left: 1.1rem;
}

@media (max-width: 640px) {
  :where(.tbp) .tbp-slot {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.4rem;
  }
}

:where(.tbp) .tbp-dialog a {
  color: var(--tbp-accent);
  font-weight: 600;
}

/* Room map: a session's room link and the venue map dialog (public/js/program.js). */
:where(.tbp) .tbp-room-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--tbp-accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

:where(.tbp) .tbp-room-link:focus-visible {
  outline: 2px solid var(--tbp-accent);
  outline-offset: 2px;
}

:where(.tbp) .tbp-dialog:has(.tbp-map) {
  width: min(64rem, calc(100vw - 2rem));
}

:where(.tbp) .tbp-map {
  position: relative;
  margin-top: 1rem;
  line-height: 0;
}

:where(.tbp) .tbp-map img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(var(--tbp-radius) / 2);
}

:where(.tbp) .tbp-map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

:where(.tbp) .tbp-map polygon {
  fill: transparent;
  stroke: color-mix(in srgb, var(--tbp-accent) 35%, transparent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

:where(.tbp) .tbp-map polygon.is-target {
  fill: color-mix(in srgb, var(--tbp-accent) 30%, transparent);
  stroke: var(--tbp-accent);
  stroke-width: 3;
}

:where(.tbp) .tbp-map-label {
  fill: #1d2327;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 4px;
  vector-effect: non-scaling-stroke;
}

/* Theme resets: some themes (Hello Elementor) fill every button on hover/focus and stop it
   wrapping. These outrank those rules so tabs, speakers and room links keep this look. */
.tbp button.tbp-day,
.tbp button.tbp-person,
.tbp button.tbp-room-link,
.tbp button.tbp-dialog-close {
  white-space: normal;
  text-transform: none;
}

.tbp button.tbp-day:is(:hover, :focus) {
  background: none;
  color: var(--tbp-text);
}

.tbp button.tbp-day.is-active:is(:hover, :focus) {
  color: var(--tbp-accent);
}

.tbp button.tbp-person:is(:hover, :focus),
.tbp button.tbp-dialog-close:is(:hover, :focus) {
  background: none;
  color: inherit;
}

.tbp button.tbp-room-link:is(:hover, :focus) {
  background: none;
  color: var(--tbp-accent);
}
