/* HPMR-1220 / HPMR-1223 — exhibitor portal only.
   Linked from layouts/exhibitor_portal.html.erb. The admin layout does not
   load this file, so Admin Portal grids stay on their own rules.

   HPMR-1220 — a 70vh cap on .contacts-table still let the window scroll,
   because the header plus that cap is taller than the viewport. Desktop and
   tablet lock the panel (same idea as the admin .list-layout lock) so only
   the table scrolls. Header, tabs, and the pagination bar stay put. A short
   table hugs its rows. Phone keeps one document scroller: the sidebar stacks
   above the panel, and pinning that would clip it. */

@media (min-width: 768px) {
  html:has(main.portal-content .contacts-table),
  body:has(main.portal-content .contacts-table) {
    overflow: hidden;
    height: 100%;
  }

  .portal-layout:has(main.portal-content .contacts-table) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  main.portal-content:has(.contacts-table) {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  main.portal-content:has(.contacts-table) > * {
    flex-shrink: 0;
  }

  main.portal-content:has(.contacts-table) > *:has(.contacts-table),
  main.portal-content:has(.contacts-table) [id$="-list"]:has(.contacts-table),
  main.portal-content:has(.contacts-table) .portal-activity:has(.contacts-table) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
  }

  main.portal-content:has(.contacts-table) .portal-tabs,
  main.portal-content:has(.contacts-table) .pagination-bar {
    flex-shrink: 0;
  }

  main.portal-content .contacts-table {
    flex: 0 1 auto;
    min-height: 7.5rem;
    overflow: auto;
  }
}

.contacts-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-bg-alt);
}

.portal-content .contacts-table .table__th,
.portal-content .contacts-table a.table__th {
  background: var(--color-bg-alt);
  color: var(--color-text-muted-strong);
  text-decoration: none;
}

.portal-content .contacts-table a.table__th:hover,
.portal-content .contacts-table a.table__th:focus-visible {
  color: var(--color-text);
}

.portal-content .contacts-table .table__th-sort {
  color: var(--color-text-muted-strong);
  opacity: 1;
}

.portal-content .contacts-table .table__th-sort--active,
.portal-media-toolbar .table__th-sort--active {
  color: var(--color-passion-text);
  opacity: 1;
}

/* Hug the message. flex:1 on the shared card was stretching it to the
   bottom of the panel. The border is the same frame the table card uses,
   so an empty list still reads as a bounded white card. */
.portal-content .empty-state--card {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  justify-content: flex-start;
  border: 1px solid var(--color-border);
}

.portal-media-card__grip {
  pointer-events: auto;
  cursor: grab;
  border: 0;
  padding: 0;
  color: var(--color-white);
  background: color-mix(in srgb, var(--color-soft-black) 72%, transparent);
}

.portal-media-card__grip:focus-visible,
.portal-media-card__preview:focus-visible,
.portal-media-card__caption-button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.portal-media-card__grip:disabled {
  cursor: default;
  opacity: 0.45;
}

.portal-media-card__preview {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.portal-media-card__preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portal-media-card__caption-button {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: zoom-in;
}

.portal-media-card__meta {
  margin: 0 0 var(--space-2);
}

.portal-media-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-3);
}

.portal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: color-mix(in srgb, var(--color-soft-black) 72%, transparent);
}

.portal-lightbox[hidden] {
  display: none;
}

.portal-lightbox__dialog {
  position: relative;
  width: min(60rem, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--color-bg);
  color: var(--color-text);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.portal-lightbox__close {
  align-self: flex-end;
}

.portal-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  margin: 0 auto;
}

.portal-lightbox__caption {
  margin: 0;
  color: var(--color-text);
}

.portal-lightbox__nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}
