/* Previous Events: preserve the approved desktop/mobile compositions while
 * allowing the card grid and gallery dialog to fit intermediate viewports.
 */
/* Staging 2 v1.0.498: long supplied titles and copy set the mobile card height. */
@media (max-width: 640px) {
  html body.previous-events-page .previous-events-list {
    padding-bottom: 32px !important;
  }

  html body.previous-events-page .event-card-grid {
    padding-bottom: 0 !important;
    align-items: flex-start !important;
  }

  html body.previous-events-page .event-card {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    grid-template-rows: 345.16px auto !important;
  }

  html body.previous-events-page .event-card-copy {
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 20.91px 22px 24px clamp(24px, 11vw, 45.74px) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  html body.previous-events-page .event-card h2,
  html body.previous-events-page .event-card h2:not(#toc-card-h2-size-lock),
  html body.previous-events-page .event-card p {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  html body.previous-events-page .event-card h2,
  html body.previous-events-page .event-card h2:not(#toc-card-h2-size-lock) {
    line-height: 1.1 !important;
  }

  html body.previous-events-page .event-card h2 span,
  html body.previous-events-page .event-card h2 em {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  html body.previous-events-page .event-card-action {
    position: static !important;
    align-self: flex-end !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
    margin: 24px 0 0 !important;
  }
}


@font-face {
  font-family: 'TOC Gallery NATS';
  src: url('../fonts/gallery/NATS-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'TOC Gallery Lato';
  src: url('../fonts/gallery/Lato-Light.woff2?v=2.015') format('woff2');
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

/* Cards retain their approved mobile carousel and full desktop grid. Between
 * those endpoints, an explicit inner track prevents fixed copy widths from
 * expanding the image and text beyond the outer card. */
@media (min-width: 641px) {
  html body.previous-events-page .event-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 403px !important;
    height: auto !important;
    min-height: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto 1fr !important;
  }

  html body.previous-events-page .event-card-media,
  html body.previous-events-page .event-card-copy {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body.previous-events-page .event-card-media {
    height: auto !important;
    aspect-ratio: 403 / 380.15 !important;
  }

  html body.previous-events-page .event-card-copy {
    height: auto !important;
    min-height: 333.71px !important;
    padding: 30px 24px 84px clamp(24px, calc(30vw - 349.52px), 50.38px) !important;
  }

  html body.previous-events-page .event-card h2,
  html body.previous-events-page .event-card h2:not(#toc-card-h2-size-lock) {
    width: min(310.93px, 100%) !important;
    max-width: 100% !important;
  }

  html body.previous-events-page .event-card p {
    width: min(310.91px, 100%) !important;
    max-width: 100% !important;
  }

  html body.previous-events-page .event-card h2,
  html body.previous-events-page .event-card h2:not(#toc-card-h2-size-lock) {
    height: auto !important;
    font-size: clamp(32px, 3.9vw, 40.3px) !important;
  }

  html body.previous-events-page .event-card h2 span,
  html body.previous-events-page .event-card h2 em {
    white-space: normal !important;
  }
}

@media (min-width: 641px) and (max-width: 1180px) {
  html body.previous-events-page .event-card-grid {
    width: min(840px, calc(100% - 40px)) !important;
    grid-template-columns: repeat(2, minmax(0, 403px)) !important;
    column-gap: 30px !important;
  }
}

html body.previous-events-page .event-gallery-panel {
  overscroll-behavior: contain !important;
  scroll-padding-top: calc(70px + var(--toc-gallery-admin-offset, 0px));
}

/* Document scroll locking disables the normal sticky positioning context.
 * Keep the shared header at the viewport edge above the gallery instead. */
html body.previous-events-page.event-gallery-open .site-header {
  position: fixed !important;
  top: var(--toc-gallery-admin-offset, 0px) !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  visibility: visible !important;
  transform: none !important;
  z-index: 2147483001 !important;
}

html body.previous-events-page.event-gallery-open #wpadminbar {
  z-index: 2147483002 !important;
}

html body.previous-events-page .event-gallery-header h2,
html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock),
html body.previous-events-page .event-gallery-header h2 span {
  font-family: 'TOC Gallery NATS', sans-serif !important;
  font-weight: 400 !important;
  font-style: normal !important;
  font-synthesis: none;
  line-height: 1 !important;
  letter-spacing: .01em !important;
  color: #fefefe !important;
}

html body.previous-events-page .event-gallery-header h2 span {
  font-size: inherit !important;
  white-space: nowrap !important;
}

html body.previous-events-page .event-gallery-header p {
  font-family: 'TOC Gallery Lato', Lato, sans-serif !important;
  font-weight: 300 !important;
  font-synthesis: none;
  color: #fefefe !important;
}

html body.previous-events-page .event-gallery-thumb:focus-visible,
html body.previous-events-page .event-gallery-arrow:focus-visible {
  outline: 2px solid #fff !important;
  outline-offset: -4px !important;
  box-shadow: inset 0 0 0 6px #111 !important;
}

/* Preserve the Figma artwork without the former second CSS outline. */
html body.previous-events-page .event-gallery-arrow {
  border: 0 !important;
  background: transparent !important;
}

html body.previous-events-page .event-gallery-arrow img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

/* Transient image feedback sits inside the existing frame without changing
 * the approved gallery dimensions or replacing the last loaded photograph. */
html body.previous-events-page .event-gallery-viewer {
  position: relative;
}

html body.previous-events-page .is-gallery-awaiting-image [data-gallery-main] {
  visibility: hidden !important;
}

html body.previous-events-page .event-gallery-image-feedback {
  position: absolute;
  z-index: 3;
  top: min(50%, 120px);
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .85);
  color: #fff;
  font: 400 14px/1.4 Arial, sans-serif;
  text-align: center;
}

html body.previous-events-page .event-gallery-image-feedback[hidden],
html body.previous-events-page .event-gallery-image-feedback button[hidden] {
  display: none !important;
}

html body.previous-events-page .event-gallery-image-feedback p {
  margin: 0;
  color: inherit;
  font: inherit;
}

html body.previous-events-page .event-gallery-image-feedback button {
  margin-top: 8px;
  padding: 7px 12px;
  min-height: 36px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: #000;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

html body.previous-events-page .event-gallery-image-feedback button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (min-width: 981px) {
  html body.previous-events-page .event-gallery-panel,
  html body.previous-events-page.admin-bar .event-gallery-panel {
    /* One design pixel at 1920px; smaller desktop widths scale uniformly. */
    --toc-gallery-unit: min(1px, .052083333333vw);
    --toc-gallery-admin-offset: 0px;
    position: fixed !important;
    inset: var(--toc-gallery-admin-offset, 0px) 0 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: calc(238 * var(--toc-gallery-unit)) 0 calc(40 * var(--toc-gallery-unit)) !important;
    display: block !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    container-type: size !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable both-edges;
  }

  html body.previous-events-page.admin-bar .event-gallery-panel,
  html.admin-bar body.previous-events-page .event-gallery-panel {
    --toc-gallery-admin-offset: 32px;
  }

  html body.previous-events-page .event-gallery-panel[hidden],
  html body.previous-events-page.admin-bar .event-gallery-panel[hidden] {
    display: none !important;
  }

  html body.previous-events-page .event-gallery-shell,
  html body.previous-events-page.admin-bar .event-gallery-shell {
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
    width: calc(1580 * var(--toc-gallery-unit)) !important;
    max-width: calc(100% - 40px) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 auto !important;
    padding: calc(20 * var(--toc-gallery-unit)) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header {
    width: 100% !important;
    height: calc(179 * var(--toc-gallery-unit)) !important;
    min-height: calc(179 * var(--toc-gallery-unit)) !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    padding: 0 calc(20 * var(--toc-gallery-unit)) !important;
    display: grid !important;
    grid-template-columns: calc(299 * var(--toc-gallery-unit)) minmax(0, 1fr) !important;
    column-gap: calc(47 * var(--toc-gallery-unit)) !important;
    align-items: center !important;
  }

  html body.previous-events-page .event-gallery-header h2,
  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    font-size: calc(55 * var(--toc-gallery-unit) * var(--gallery-title-scale, 1)) !important;
    align-self: center !important;
  }

  html body.previous-events-page .event-gallery-header p {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: calc(24.7938385 * var(--toc-gallery-unit)) !important;
    line-height: 1.1 !important;
    letter-spacing: .05em !important;
    align-self: center !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-viewer {
    width: 100% !important;
    height: calc(902 * var(--toc-gallery-unit)) !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
  }

  html body.previous-events-page .event-gallery-main {
    width: calc(1539 * var(--toc-gallery-unit)) !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }

  html body.previous-events-page .event-gallery-arrow {
    width: calc(93.733246 * var(--toc-gallery-unit)) !important;
    height: calc(91.895355 * var(--toc-gallery-unit)) !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: none !important;
    max-height: none !important;
    top: calc(353 * var(--toc-gallery-unit)) !important;
    transform: none !important;
    padding: 0 !important;
  }

  html body.previous-events-page .event-gallery-prev {
    left: calc(33.025391 * var(--toc-gallery-unit)) !important;
  }

  html body.previous-events-page .event-gallery-next {
    right: calc(33.628906 * var(--toc-gallery-unit)) !important;
  }

  html body.previous-events-page .event-gallery-thumbs {
    width: 100% !important;
    height: calc(278 * var(--toc-gallery-unit)) !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: calc(24 * var(--toc-gallery-unit)) 0 0 !important;
    gap: calc(24.0625 * var(--toc-gallery-unit)) !important;
  }
}

/* The design supplies desktop and mobile endpoints. Between them, stack the
 * header so its full description stays readable rather than clipping it. */
@media (min-width: 641px) and (max-width: 980px) {
  html body.previous-events-page .event-gallery-panel,
  html body.previous-events-page.admin-bar .event-gallery-panel {
    box-sizing: border-box !important;
    padding: 145px 20px 40px !important;
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable both-edges;
  }

  html body.previous-events-page .event-gallery-panel[hidden],
  html body.previous-events-page.admin-bar .event-gallery-panel[hidden] {
    display: none !important;
  }

  html body.previous-events-page .event-gallery-shell {
    width: min(940px, 100%) !important;
    max-width: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 auto !important;
    padding: 20px !important;
    gap: 0 !important;
    box-shadow: none !important;
  }

  html body.previous-events-page .event-gallery-header {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 24px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 20px !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header h2,
  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    font-size: calc(40px * var(--gallery-title-scale, 1)) !important;
  }

  html body.previous-events-page .event-gallery-header p {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 20px !important;
    line-height: 1.1 !important;
    letter-spacing: .05em !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-thumbs {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 1540 / 278 !important;
    margin: 24px 0 0 !important;
    gap: 1.5625% !important;
  }
}

@media (max-width: 640px) {
  html body.previous-events-page .event-gallery-panel,
  html body.previous-events-page.admin-bar .event-gallery-panel {
    padding-top: calc(145px + var(--toc-gallery-admin-offset, 0px)) !important;
  }

  html body.previous-events-page .event-gallery-header {
    grid-template-rows: 36px 85px !important;
  }

  html body.previous-events-page .event-gallery-header h2 span {
    line-height: 30px !important;
  }

  html body.previous-events-page .event-gallery-header h2,
  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    display: grid !important;
    align-content: center !important;
    font-size: calc(30px * var(--gallery-title-scale, 1)) !important;
  }
}

/* Below the 375px frame plus its page inset, let wrapped copy grow the card. */
@media (max-width: 382px) {
  html body.previous-events-page .event-gallery-shell {
    aspect-ratio: auto !important;
    grid-template-rows: auto 223px 10px 63.96px !important;
  }

  html body.previous-events-page .event-gallery-header {
    height: auto !important;
    max-height: none !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 36px auto !important;
  }

  html body.previous-events-page .event-gallery-header p {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
  }
}

/* Supplied 1018.36 x 917 desktop frame: 1580 x 1423 artwork at .64453 scale.
 * Scale this composition uniformly only when viewport clearance requires it. */
@media (min-width: 641px) {
  html body.previous-events-page .event-gallery-panel,
  html body.previous-events-page.admin-bar .event-gallery-panel {
    --toc-gallery-top: calc(100px + var(--toc-gallery-admin-offset, 0px));
    --toc-gallery-unit: min(.64453165px, calc((100dvh - 140px - var(--toc-gallery-admin-offset, 0px)) / 1423), calc((100vw - 64px) / 1580));
    inset: 0 !important;
    padding: var(--toc-gallery-top) 20px 40px !important;
  }

  html body.previous-events-page .event-gallery-shell,
  html body.previous-events-page.admin-bar .event-gallery-shell {
    position: relative !important;
    width: calc(1580 * var(--toc-gallery-unit)) !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
    padding: calc(20 * var(--toc-gallery-unit)) !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header {
    height: calc(179 * var(--toc-gallery-unit)) !important;
    min-height: calc(179 * var(--toc-gallery-unit)) !important;
    max-height: none !important;
    position: static !important;
    overflow: visible !important;
    padding: 0 calc(20 * var(--toc-gallery-unit)) !important;
    display: grid !important;
    grid-template-columns: calc(299 * var(--toc-gallery-unit)) minmax(0, 1fr) !important;
    column-gap: calc(47 * var(--toc-gallery-unit)) !important;
    align-items: center !important;
  }

  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    font-size: calc(55 * var(--toc-gallery-unit) * var(--gallery-title-scale, 1)) !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  html body.previous-events-page .event-gallery-header p {
    font-size: calc(24.7938385 * var(--toc-gallery-unit)) !important;
    line-height: 1.1 !important;
    letter-spacing: .05em !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    align-self: center !important;
  }

  html body.previous-events-page .event-gallery-viewer {
    width: 100% !important;
    height: calc(902 * var(--toc-gallery-unit)) !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }

  html body.previous-events-page .event-gallery-main {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }

  html body.previous-events-page .event-gallery-main img[data-gallery-main][data-gallery-orientation] {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  html body.previous-events-page .event-gallery-arrow {
    top: calc(353 * var(--toc-gallery-unit)) !important;
    transform: none !important;
    width: calc(93.733246 * var(--toc-gallery-unit)) !important;
    height: calc(91.895355 * var(--toc-gallery-unit)) !important;
  }

  html body.previous-events-page .event-gallery-thumbs {
    height: calc(278 * var(--toc-gallery-unit)) !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: calc(24 * var(--toc-gallery-unit)) 0 0 !important;
    gap: calc(24.0625 * var(--toc-gallery-unit)) !important;
  }

  html body.previous-events-page .event-gallery-thumb {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
  }

  html body.previous-events-page .event-gallery-shell .event-gallery-close {
    position: absolute !important;
    display: block !important;
    inset: 0 0 auto auto !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translate(50%, -50%) !important;
    z-index: 5 !important;
    border: 0 !important;
    border-radius: 50% !important;
    color: transparent !important;
    font-size: 0 !important;
    background: url('../rsc/icons/quick-form-corner-close.png?v=30bde3fa77ce') center / 42.46px 42.46px no-repeat !important;
  }

  html body.previous-events-page .event-gallery-shell .event-gallery-close:focus-visible {
    outline: 2px solid #7eb7ce !important;
    outline-offset: 2px !important;
  }
}

@media (max-width: 640px) {
  html body.previous-events-page .event-gallery-shell {
    padding: 8px !important;
    aspect-ratio: auto !important;
    grid-template-rows: auto 223px 63.96px !important;
    gap: 8px !important;
  }

  html body.previous-events-page .event-gallery-thumbs {
    grid-row: 3 !important;
    gap: 8px !important;
  }
}

/* Staging 2 v1.0.585: keep the supplied gallery typography at its actual
 * size. Shorter viewports scroll the panel instead of scaling its text. */
@media (min-width: 641px) {
  html body.previous-events-page .event-gallery-panel,
  html body.previous-events-page.admin-bar .event-gallery-panel {
    --toc-gallery-top: calc(104px + var(--toc-gallery-admin-offset, 0px));
    padding: var(--toc-gallery-top) 20px 40px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html body.previous-events-page .event-gallery-shell,
  html body.previous-events-page.admin-bar .event-gallery-shell {
    box-sizing: border-box !important;
    width: min(1018px, calc(100vw - 48px)) !important;
    max-width: 100% !important;
    min-height: 0 !important;
    padding: 13px !important;
    gap: 0 !important;
    background: #fff !important;
  }

  html body.previous-events-page .event-gallery-header {
    box-sizing: border-box !important;
    width: 100% !important;
    height: auto !important;
    min-height: 115px !important;
    max-height: none !important;
    padding: 0 13px !important;
    display: grid !important;
    grid-template-columns: minmax(190px, max-content) minmax(0, 1fr) !important;
    column-gap: 30px !important;
    align-items: center !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header h2,
  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    width: max-content !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    display: block !important;
    font-family: 'TOC Gallery NATS', sans-serif !important;
    font-size: 35px !important;
    font-weight: 400 !important;
    line-height: .95 !important;
    letter-spacing: .01em !important;
    text-transform: uppercase !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header h2 span {
    display: block !important;
    font: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
  }

  html body.previous-events-page .event-gallery-header p {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'TOC Gallery Lato', Lato, sans-serif !important;
    font-size: 16px !important;
    font-weight: 300 !important;
    line-height: 1.1 !important;
    letter-spacing: .05em !important;
    text-transform: capitalize !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-viewer {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 992 / 581 !important;
  }

  html body.previous-events-page .event-gallery-main {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
  }

  html body.previous-events-page .event-gallery-arrow {
    top: 39.1% !important;
    width: 60px !important;
    height: 59px !important;
  }

  html body.previous-events-page .event-gallery-prev {
    left: 21px !important;
  }

  html body.previous-events-page .event-gallery-next {
    right: 21px !important;
  }

  html body.previous-events-page .event-gallery-thumbs {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 992 / 179 !important;
    margin: 16px 0 0 !important;
    gap: 16px !important;
  }

  html body.previous-events-page .event-gallery-thumb {
    height: 100% !important;
    min-height: 0 !important;
  }
}

/* The supplied mobile composition is 375 x 494 with a 354px content area,
 * 176px header, 223px photograph, 10px separation, and 64px thumbnails. */
@media (max-width: 640px) {
  html body.previous-events-page .event-gallery-shell {
    position: relative !important;
    box-sizing: border-box !important;
    width: 375px !important;
    max-width: calc(100vw - 8px) !important;
    height: auto !important;
    min-height: 494px !important;
    padding: 10px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto 223px 10px 64px !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header {
    box-sizing: border-box !important;
    grid-row: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 176px !important;
    max-height: none !important;
    padding: 30px 20px 24px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0 !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header h2,
  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    box-sizing: border-box !important;
    width: 230px !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    font-family: 'TOC Gallery NATS', sans-serif !important;
    font-size: 30px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    letter-spacing: .01em !important;
    text-transform: uppercase !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-header h2 span {
    display: block !important;
    width: 100% !important;
    font: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* These two first lines are longer than the shared 230px mobile title box.
   * Keep the two-line title without changing the other gallery typography. */
  html body.previous-events-page .event-gallery-header h2[data-gallery-id="president-cyril-ramaphosa-zeitz-mocaa"] span:first-child,
  html body.previous-events-page .event-gallery-header h2[data-gallery-id="james-bond-grand-pavilion"] span:first-child {
    font-size: 26px !important;
    line-height: 30px !important;
  }

  html body.previous-events-page .event-gallery-header p {
    box-sizing: border-box !important;
    width: 314px !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'TOC Gallery Lato', Lato, sans-serif !important;
    font-size: 14px !important;
    font-weight: 300 !important;
    line-height: 1.1 !important;
    letter-spacing: .05em !important;
    text-transform: capitalize !important;
    overflow: visible !important;
  }

  html body.previous-events-page .event-gallery-viewer {
    grid-row: 2 !important;
    width: 100% !important;
    height: 223px !important;
  }

  html body.previous-events-page .event-gallery-thumbs {
    grid-row: 4 !important;
    width: 100% !important;
    height: 64px !important;
    margin: 0 !important;
    gap: 6px !important;
  }

  html body.previous-events-page .event-gallery-shell .event-gallery-close {
    position: absolute !important;
    display: block !important;
    inset: 0 0 auto auto !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translate(50%, -50%) !important;
    z-index: 5 !important;
    border: 0 !important;
    border-radius: 50% !important;
    color: transparent !important;
    font-size: 0 !important;
    background: url('../rsc/icons/quick-form-corner-close.png?v=30bde3fa77ce') center / 24px 24px no-repeat !important;
  }

  html body.previous-events-page .event-gallery-shell .event-gallery-close::before,
  html body.previous-events-page .event-gallery-shell .event-gallery-close::after {
    display: none !important;
    content: none !important;
  }

  html body.previous-events-page .event-gallery-shell .event-gallery-close:focus-visible {
    outline: 2px solid #7eb7ce !important;
    outline-offset: 2px !important;
  }
}

@media (max-width: 390px) {
  html body.previous-events-page .event-gallery-shell .event-gallery-close {
    transform: translateY(-50%) !important;
  }
}

/* At the narrowest phones, let a long word wrap instead of crossing the frame. */
@media (max-width: 360px) {
  html body.previous-events-page .event-gallery-header h2 span {
    white-space: normal !important;
  }
}

/* Keep the desktop popup's title and description as independent, content-sized
 * columns. Long titles may use more width, while longer copy adds height. */
@media (min-width: 981px) {
  html body.previous-events-page .event-gallery-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 30px !important;
  }

  html body.previous-events-page .event-gallery-header h2,
  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    max-width: clamp(305px, 48%, calc(100% - 220px)) !important;
  }

  html body.previous-events-page .event-gallery-header h2 span {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body.previous-events-page .event-gallery-header p {
    flex: 1 1 0 !important;
    min-width: 190px !important;
    width: auto !important;
  }
}

/* At intermediate widths, give longer descriptions the full row. The title
 * and description remain separate content-sized blocks in a growing header. */
@media (min-width: 641px) and (max-width: 980px) {
  html body.previous-events-page .event-gallery-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  html body.previous-events-page .event-gallery-header h2,
  html body.previous-events-page .event-gallery-header h2:not(#toc-h2-size-lock) {
    flex: none !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body.previous-events-page .event-gallery-header p {
    flex: none !important;
    min-width: 0 !important;
    width: 100% !important;
  }
}
