/* Rich text rendering inside template iframe (TipTap HTML) */

/* Hero section spacing: ensure adequate gap between end date/time and venue */
.hero-until + .hero-venue,
[data-type="conditional-any"][data-fields="endDate,endTime"] + .hero-venue,
[data-type="conditional-any"][data-fields="endDate,endTime"] + [data-type="conditional"][data-field="venueName"] {
  margin-top: 1.5rem !important;
}

/* ============================================================
   Hero layout adjustment when end date/time is NOT visible
   ============================================================
   When end date/time block is hidden (display:none), push the 
   hero text content down and add extra spacing before venue.
*/

/* Increase spacing before venue when end date/time is hidden */
.hero-section:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display: none"]) [data-type="conditional"][data-field="venueName"],
.hero-section:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display:none"]) [data-type="conditional"][data-field="venueName"],
section.tpl-hero:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display: none"]) [data-type="conditional"][data-field="venueName"],
section.tpl-hero:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display:none"]) [data-type="conditional"][data-field="venueName"] {
  margin-top: 2.5rem !important;
}

/* Also handle venue blocks that are siblings of end date (not wrapped in conditional) */
.hero-section:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display: none"]) [data-field="venueName"][data-type="conditional"],
.hero-section:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display:none"]) [data-field="venueName"][data-type="conditional"],
section.tpl-hero:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display: none"]) [data-field="venueName"][data-type="conditional"],
section.tpl-hero:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display:none"]) [data-field="venueName"][data-type="conditional"] {
  margin-top: 2.5rem !important;
}

/* Push schedule section down (not the title) when end date/time is hidden */
/* Target the element after h1 (schedule section) */
.hero-section:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display: none"]) h1 + *,
.hero-section:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display:none"]) h1 + *,
section.tpl-hero:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display: none"]) h1 + *,
section.tpl-hero:has([data-type="conditional-any"][data-fields="endDate,endTime"][style*="display:none"]) h1 + * {
  margin-top: 2.5rem !important;
}

/* Title: prevent overflow from wide fonts (script/cursive) */
.tpl-title {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* End date/time: inherit same styling as start date/time */
.tpl-end-date {
  font-family: var(--tpl-date-font-family);
  font-size: var(--tpl-date-font-size) !important;
  font-weight: var(--tpl-date-font-weight) !important;
}
.tpl-end-time {
  font-family: var(--tpl-time-font-family);
  font-size: var(--tpl-time-font-size) !important;
  font-weight: var(--tpl-time-font-weight) !important;
}

/* Venue name: uses venue-specific variables, falls back to date variables */
.tpl-venue-name {
  font-family: var(--tpl-venue-name-font-family, var(--tpl-date-font-family));
  font-size: var(--tpl-venue-name-font-size, var(--tpl-date-font-size)) !important;
  font-weight: var(--tpl-venue-name-font-weight, var(--tpl-date-font-weight)) !important;
}

/* Container: preserve newlines/spaces */
*[data-html="true"],
.rich-text {
  white-space: pre-wrap;
}

/* Paragraph spacing */
*[data-html="true"] p,
.rich-text p {
  margin: 0.25rem 0;
}

/* Bold */
*[data-html="true"] strong,
*[data-html="true"] b,
.rich-text strong,
.rich-text b {
  /* Use relative bolding so it never makes already-bold text lighter (e.g. base 800). */
  font-weight: bolder;
}

/* Italic */
*[data-html="true"] em,
*[data-html="true"] i,
.rich-text em,
.rich-text i {
  font-style: italic;
}

/* Underline */
*[data-html="true"] u,
.rich-text u {
  text-decoration: underline;
}

/* Strikethrough */
*[data-html="true"] s,
*[data-html="true"] strike,
.rich-text s,
.rich-text strike {
  text-decoration: line-through;
}

/* Links (many templates reset a{ text-decoration: inherit }) */
*[data-html="true"] a,
.rich-text a {
  text-decoration: underline;
}

/* Lists (override templates that do `ol, ul { list-style: none; }`) */
*[data-html="true"] ul,
.rich-text ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

*[data-html="true"] ol,
.rich-text ol {
  list-style: decimal;
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

*[data-html="true"] li,
.rich-text li {
  margin: 0.25rem 0;
}

/* Centered containers: keep list body readable */
*[data-html="true"].text-center ul,
*[data-html="true"].text-center ol,
.rich-text.text-center ul,
.rich-text.text-center ol {
  display: inline-block;
  text-align: left;
}