/* Events article + index system, November 10.
   Add after the source cascade; activate only on the assigned Events routes.
   Keep native metadata, booking links, source section order and image assets. */

/* Actions: include the native template, not only the old riot-event-detail alias. */
body[data-riot-layout~="events"] #page .eventitem-backlink,
body[data-riot-layout~="events"] #page .eventitem-meta a,
body[data-riot-layout~="events"] #page .sqs-block-button .sqs-block-button-element,
body[data-riot-layout~="events"] #page .riot-flow-primary,
body[data-riot-layout~="events"] #page .riot-flow-secondary,
body[data-riot-layout~="events"] #page .riot-flow-archive-card a,
body[data-riot-layout~="events"] #page .riot-form-fallback a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-riot-layout~="events"] #page .eventitem-meta-export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

body[data-riot-layout~="events"] #page .riot-flow-archive-card a {
  padding-block: 0.5rem;
}

/* Real flow-template intros, not Fluid Engine headings: the original .91
   line-height lets heading text ranges extend into the preceding eyebrow.
   Keep source heading size, font, weight, case and colors; reserve safe ink
   height and a positive gap at every viewport, including desktop. */
body[data-riot-layout~="events"] #page .riot-flow-events-current > .riot-flow-shell > .riot-flow-eyebrow,
body[data-riot-layout~="events"] #page .riot-flow-events-archive > .riot-flow-eyebrow {
  margin: 0 0 1rem;
  line-height: 1.4;
}

body[data-riot-layout~="events"] #page .riot-flow-events-current > .riot-flow-shell > .riot-flow-title,
body[data-riot-layout~="events"] #page .riot-flow-events-archive > .riot-flow-title {
  margin: 0;
  line-height: 1.15;
}

/* The real current-event card puts its date BEFORE h2. Give each unchanged
   child its own natural height, then add a positive date/title gap rather
   than compressing or concealing text. Do not override the featured navy
   background or the source white heading/date/body-copy correction. */
body[data-riot-layout~="events"] #page .riot-flow-events-current .riot-flow-event-card {
  height: auto;
  min-height: 0;
}

body[data-riot-layout~="events"] #page .riot-flow-events-current .riot-flow-event-card > * {
  flex-shrink: 0;
  min-width: 0;
}

body[data-riot-layout~="events"] #page .riot-flow-events-current .riot-flow-event-card > .riot-flow-event-meta {
  margin: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

body[data-riot-layout~="events"] #page .riot-flow-events-current .riot-flow-event-card > h2 {
  margin: 0.75rem 0 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

body[data-riot-layout~="events"] #page .riot-flow-events-current .riot-flow-event-card > :is(.riot-flow-primary, .riot-flow-secondary) {
  margin-top: 1.25rem;
}

/* Classic article posters already contain width/height attributes. Use those
   intrinsic dimensions instead of the few mismatched source padding crops. */
body[data-riot-layout~="events"] #page .eventitem-column-content .design-layout-inline .sqs-image-shape-container-element {
  height: auto !important;
  padding-bottom: 0 !important;
}

body[data-riot-layout~="events"] #page .eventitem-column-content .design-layout-inline img[data-sqsp-image-classic-block-image] {
  position: static !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  object-fit: contain !important;
}

/* Only the three studio photos on /eventslp. No decorative or footer images. */
body[data-riot-layout~="events"] #page :is(#block-ea7641a7aa583e0fea3c, #block-7fb8574af766b8eb48ba, #block-0523525e37b906d5b856) :is(.sqs-block-content, .fluid-image-component-root, .fluid-image-animation-wrapper, .fluid-image-container, .js-content-mode-element-wrapper, .content-fill) {
  position: relative;
  width: 100%;
  height: auto !important;
  min-height: 0;
}

body[data-riot-layout~="events"] #page :is(#block-ea7641a7aa583e0fea3c, #block-7fb8574af766b8eb48ba, #block-0523525e37b906d5b856) img {
  position: static !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  object-fit: contain !important;
}

/* The native header's first-section offset stays intact. Remove only the
   index hero's empty minimum-height reservation, not its colors/alignment. */
body[data-riot-layout~="events"] #page section[data-section-id="69f14564c0ed25d00f2169c4"] {
  min-height: 0 !important;
}

body[data-riot-layout~="events"] #page section[data-section-id="69f14564c0ed25d00f2169c4"] > .content-wrapper {
  min-height: 0 !important;
  padding-block: clamp(2rem, 5vw, 4rem);
}

/* The existing private-event fallback inherits the dark section's text color
   rather than forcing navy text on that same navy background. */
body[data-riot-layout~="events"] #page #block-yui_3_17_2_1_1771625324729_6931 :is(.form-wrapper, .riot-form-fallback) {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body[data-riot-layout~="events"] #page #block-yui_3_17_2_1_1771625324729_6931 .riot-form-fallback,
body[data-riot-layout~="events"] #page #block-yui_3_17_2_1_1771625324729_6931 .riot-form-fallback :is(h2, p, a) {
  color: inherit;
  overflow-wrap: anywhere;
}

body[data-riot-layout~="events"] #page #block-yui_3_17_2_1_1771625324729_6931 .riot-form-fallback a {
  justify-content: flex-start;
  margin-block: 0.25rem;
}

@media (min-width: 768px) {
  /* Keep /eventslp's original 24-column horizontal positions and alternating
     photo/copy arrangement; replace vacant fixed rows with content rows. */
  body[data-riot-layout~="events"] #page :is(.fe-6998da137012bf0ee048147e, .fe-6998dbb4fad61623b475f179, .fe-6998db2dbe7ba56f139235ba) {
    grid-template-rows: auto auto auto;
    row-gap: clamp(1.5rem, 3vw, 3rem);
    padding-block: clamp(2rem, 4vw, 3rem);
    align-items: start;
  }

  body[data-riot-layout~="events"] #page .fe-6998da137012bf0ee048147e > .fe-block-yui_3_17_2_1_1771953490281_680373 {
    grid-area: 1 / 3 / 2 / 12;
  }

  body[data-riot-layout~="events"] #page .fe-6998da137012bf0ee048147e > .fe-block-ea7641a7aa583e0fea3c {
    grid-area: 1 / 16 / 2 / 25;
    align-self: center;
  }

  body[data-riot-layout~="events"] #page .fe-6998da137012bf0ee048147e > .fe-block-7fb8574af766b8eb48ba {
    grid-area: 2 / 4 / 4 / 12;
  }

  body[data-riot-layout~="events"] #page .fe-6998da137012bf0ee048147e > .fe-block-221b24b025a51cbddd07 {
    grid-area: 2 / 14 / 3 / 25;
    align-self: end;
  }

  body[data-riot-layout~="events"] #page .fe-6998da137012bf0ee048147e > .fe-block-37d4f8d4ad30ee1e6ce5 {
    grid-area: 3 / 14 / 4 / 24;
  }

  body[data-riot-layout~="events"] #page .fe-6998dbb4fad61623b475f179 {
    grid-template-rows: auto auto;
  }

  body[data-riot-layout~="events"] #page .fe-6998dbb4fad61623b475f179 > .fe-block-8cfffe125de2c4a443e4 {
    grid-area: 1 / 3 / 2 / 13;
  }

  body[data-riot-layout~="events"] #page .fe-6998dbb4fad61623b475f179 > .fe-block-8db5c1197ccde933a167 {
    grid-area: 2 / 3 / 3 / 13;
  }

  body[data-riot-layout~="events"] #page .fe-6998dbb4fad61623b475f179 > .fe-block-yui_3_17_2_1_1771625324729_6931 {
    grid-area: 1 / 14 / 3 / 23;
  }

  body[data-riot-layout~="events"] #page .fe-6998db2dbe7ba56f139235ba > .fe-block-09407f053028d2a9fa33 {
    grid-area: 1 / 4 / 2 / 15;
  }

  body[data-riot-layout~="events"] #page .fe-6998db2dbe7ba56f139235ba > .fe-block-dc1b6a6c42cb6b3e7179 {
    grid-area: 2 / 4 / 3 / 14;
  }

  body[data-riot-layout~="events"] #page .fe-6998db2dbe7ba56f139235ba > .fe-block-yui_3_17_2_1_1771625324729_7839 {
    grid-area: 3 / 5 / 4 / 11;
  }

  body[data-riot-layout~="events"] #page .fe-6998db2dbe7ba56f139235ba > .fe-block-0523525e37b906d5b856 {
    grid-area: 1 / 16 / 4 / 25;
    align-self: center;
  }
}

@media (max-width: 767px) {
  /* All event articles share these native template columns and classic rows.
     Let the existing column contents stack in their unchanged DOM sequence. */
  body[data-riot-layout~="events"] #page .eventitem {
    display: block;
  }

  body[data-riot-layout~="events"] #page :is(.eventitem-column-meta, .eventitem-column-content) {
    float: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  body[data-riot-layout~="events"] #page .eventitem-column-content .sqs-row {
    display: block;
    margin-inline: 0;
  }

  body[data-riot-layout~="events"] #page .eventitem-column-content .sqs-row > .col {
    float: none;
    width: 100%;
    min-width: 0;
  }

  body[data-riot-layout~="events"] #page .eventitem-column-content .sqs-block {
    padding: 0.625rem 0;
  }

  body[data-riot-layout~="events"] #page .eventitem-column-content .sqs-html-content p {
    margin-block: 0.75rem;
  }

  body[data-riot-layout~="events"] #page .eventitem-column-content .sqs-block-button .sqs-block-button-element {
    padding: 0.8rem 1.15rem;
    line-height: 1.25;
  }

  /* Fix the measured 27/54px pagination title columns without hiding dates,
     titles, native arrow controls or either previous/next link. */
  body[data-riot-layout~="events"] #page .events-item #itemPagination {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
    padding: 1.5rem 0 !important;
  }

  body[data-riot-layout~="events"] #page .events-item #itemPagination .item-pagination-link {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0;
    min-height: 44px;
    max-width: 100%;
    margin: 0 !important;
    padding: 0.875rem !important;
  }

  body[data-riot-layout~="events"] #page .events-item #itemPagination .pagination-title-wrapper {
    flex: 1 1 0;
    width: auto !important;
    min-width: 0;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
  }

  body[data-riot-layout~="events"] #page .events-item #itemPagination .item-pagination-title {
    font-size: clamp(1.125rem, 4.5vw, 1.5rem);
    line-height: 1.2;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  body[data-riot-layout~="events"] #page .events-item #itemPagination .item-pagination-icon {
    position: static !important;
    flex: 0 0 16px;
    width: 16px;
    margin: 0 !important;
  }

  /* Only the index hero and four populated /eventslp source grids. The empty
     decorative divider and all shared footer Fluid Engine grids stay native. */
  body[data-riot-layout~="events"] #page :is(section[data-section-id="69f14564c0ed25d00f2169c4"], section[data-section-id="6998da137012bf0ee048147c"], section[data-section-id="6998da137012bf0ee048147f"], section[data-section-id="6998dbb4fad61623b475f17b"], section[data-section-id="6998db2dbe7ba56f139235bb"]) {
    min-height: 0 !important;
  }

  body[data-riot-layout~="events"] #page :is(section[data-section-id="69f14564c0ed25d00f2169c4"], section[data-section-id="6998da137012bf0ee048147c"], section[data-section-id="6998da137012bf0ee048147f"], section[data-section-id="6998dbb4fad61623b475f17b"], section[data-section-id="6998db2dbe7ba56f139235bb"]) > .content-wrapper {
    min-height: 0 !important;
    padding-block: 0 !important;
  }

  body[data-riot-layout~="events"] #page :is(.fe-69f145646a7c79963c112a5e, .fe-6998da137012bf0ee048147b, .fe-6998da137012bf0ee048147e, .fe-6998dbb4fad61623b475f179, .fe-6998db2dbe7ba56f139235ba) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-rows: auto;
    gap: 1.5rem;
    box-sizing: border-box;
    padding: 2rem var(--sqs-mobile-site-gutter, 6vw);
    overflow: visible;
  }

  body[data-riot-layout~="events"] #page :is(.fe-69f145646a7c79963c112a5e, .fe-6998da137012bf0ee048147b, .fe-6998da137012bf0ee048147e, .fe-6998dbb4fad61623b475f179, .fe-6998db2dbe7ba56f139235ba) > .fe-block {
    grid-area: auto;
    min-width: 0;
    min-height: 0;
  }

  body[data-riot-layout~="events"] #page :is(.fe-69f145646a7c79963c112a5e, .fe-6998da137012bf0ee048147b, .fe-6998da137012bf0ee048147e, .fe-6998dbb4fad61623b475f179, .fe-6998db2dbe7ba56f139235ba) > .fe-block > .sqs-block {
    height: auto;
    min-height: 0;
  }

  /* Preserve the source's heading-before-copy presentation in this one grid. */
  body[data-riot-layout~="events"] #page .fe-6998dbb4fad61623b475f179 > .fe-block-8cfffe125de2c4a443e4 {
    grid-row: 1;
  }

  body[data-riot-layout~="events"] #page .fe-6998dbb4fad61623b475f179 > .fe-block-8db5c1197ccde933a167 {
    grid-row: 2;
  }

  body[data-riot-layout~="events"] #page .fe-6998dbb4fad61623b475f179 > .fe-block-yui_3_17_2_1_1771625324729_6931 {
    grid-row: 3;
  }

  body[data-riot-layout~="events"] #page :is(#block-69f14564ed0c86e8a2752d0b, #block-221b24b025a51cbddd07, #block-8cfffe125de2c4a443e4, #block-09407f053028d2a9fa33, #block-yui_3_17_2_1_1771625324729_6931) h2 {
    font-size: clamp(2rem, 8vw, 2.75rem);
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  body[data-riot-layout~="events"] #page .riot-flow-event-card {
    min-height: 0;
  }

  body[data-riot-layout~="events"] #page .riot-flow-event-card :is(.riot-flow-primary, .riot-flow-secondary) {
    margin-top: 1.25rem;
  }
}
