.home-popups {
  --popup-surface: #fff;
  --popup-text: #152238;
  --popup-muted: #526175;
  --popup-line: #d9e0e9;
  --popup-accent: #17489f;
  --popup-hover: #edf3fc;
  position: relative;
  z-index: 80;
  font-family: inherit;
}

html.home-popup-modal-open,
html.home-popup-modal-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

.home-popups[hidden],
.home-popups [hidden] {
  display: none !important;
}

html[data-theme="dark"] .home-popups {
  --popup-surface: #152033;
  --popup-text: #f2f6ff;
  --popup-muted: #b1c1d7;
  --popup-line: #35445c;
  --popup-accent: #a4c5ff;
  --popup-hover: #243750;
}

.home-popup-card {
  position: fixed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--popup-line);
  border-radius: 12px;
  background: var(--popup-surface);
  color: var(--popup-text);
  box-shadow: 0 16px 48px rgb(0 0 0 / 24%);
  pointer-events: auto;
}

.home-popup-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background: var(--popup-surface);
}

.home-popup-card.is-loading .home-popup-card__media {
  min-height: min(240px, 35dvh);
  background: var(--popup-hover);
}

.home-popup-card__media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: max(80px, calc(100dvh - 220px));
  object-fit: contain;
}

.home-popup-card__controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 4px 8px;
  border-top: 1px solid var(--popup-line);
  background: var(--popup-surface);
}

.home-popup-card--sized .home-popup-card__media {
  flex: 0 1 auto;
  min-height: 0;
  overflow: hidden;
}

.home-popup-card--sized .home-popup-card__media img {
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.home-popup-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--popup-text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.home-popup-button--muted {
  color: var(--popup-muted);
  font-weight: 500;
}

.home-popup-button:hover {
  background: var(--popup-hover);
  color: var(--popup-accent);
}

.home-popup-button:focus-visible,
.home-popup-card__media:focus-visible {
  outline: 3px solid var(--popup-accent);
  outline-offset: -3px;
}

.home-popup-button:disabled {
  opacity: .4;
  cursor: default;
}

.home-popup-card__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home-popup-panel {
  width: min(440px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--popup-line);
  border-radius: 14px;
  background: var(--popup-surface);
  color: var(--popup-text);
  box-shadow: 0 24px 80px rgb(0 0 0 / 30%);
}

.home-popup-panel[open] {
  display: flex;
  flex-direction: column;
}

.home-popup-panel::backdrop {
  background: rgb(9 18 33 / 55%);
}

.home-popup-panel__heading,
.home-popup-panel__navigation {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 4px 8px;
  background: var(--popup-surface);
}

.home-popup-panel__heading h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 8px;
  overflow: hidden;
  color: var(--popup-text);
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-popup-panel__heading .home-popup-button {
  flex: 0 0 auto;
}

.home-popup-panel__content {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.home-popup-panel__content .home-popup-card {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.home-popup-panel__content .home-popup-card__media {
  flex: 1 1 auto;
  min-height: 0;
  max-height: max(0px, calc(100dvh - 208px));
  overflow: hidden;
}

.home-popup-panel__content .home-popup-card.is-loading .home-popup-card__media {
  min-height: min(240px, max(0px, calc(100dvh - 208px)));
}

.home-popup-panel__content .home-popup-card__media img {
  height: 100%;
  max-height: max(0px, calc(100dvh - 208px));
}

.home-popup-panel__navigation {
  border-top: 1px solid var(--popup-line);
}

.home-popup-panel__counter {
  color: var(--popup-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.home-popup-card--preview-current {
  outline: 3px solid var(--popup-accent);
  outline-offset: 2px;
}

.home-popup-preview-status {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1;
  max-width: min(620px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--popup-line);
  border-radius: 8px;
  background: var(--popup-surface);
  color: var(--popup-text);
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 4px 20px rgb(0 0 0 / 15%);
  pointer-events: none;
}

.home-popup-preview-status.is-warning {
  border-color: #ba6d16;
}
