/*
 * Site popups — one stylesheet for the public site, the admin gallery and the admin live preview.
 * 10 layouts × 4 palettes. No shadows (depth = border + fill). Brand pink is reserved for the CTA button.
 */

.sp-root {
  --sp-ink: #1E242E;
  --sp-brand: #e20246;
  --sp-brand-hover: #c4013c;
  --sp-card: #fff;
  --sp-text: #1E242E;
  --sp-muted: #6B7280;
  --sp-border: #EBECEE;
  --sp-chip-bg: #F8F9FB;
  --sp-chip-text: #1E242E;
  --sp-media-bg: linear-gradient(135deg, #fff, #EBECEE);
  --sp-media-fg: #1E242E;
  --sp-focus: #1E242E;
  --sp-w: 440px;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  container-type: inline-size;
  font-family: inherit;
  color: var(--sp-text);
  -webkit-font-smoothing: antialiased;
}

.sp-root *,
.sp-root *::before,
.sp-root *::after {
  box-sizing: border-box;
}

.sp-root--embedded {
  position: absolute;
}

/* ── Palettes ─────────────────────────────────────────── */
.sp--pal-brand {
  --sp-media-bg: linear-gradient(100deg, #1E242E 0%, #5B1128 48%, #e20246 100%);
  --sp-media-fg: #fff;
}

.sp--pal-ink {
  --sp-card: #1E242E;
  --sp-text: #fff;
  --sp-muted: #C1C4CA;
  --sp-border: #3A3F4A;
  --sp-chip-bg: rgba(255, 255, 255, .1);
  --sp-chip-text: #fff;
  --sp-media-bg: linear-gradient(135deg, #2F3744, #1E242E);
  --sp-media-fg: #fff;
  --sp-focus: #fff;
}

.sp--pal-soft {
  --sp-card: #F8F9FB;
  --sp-media-bg: linear-gradient(135deg, #fff, #EBECEE);
  --sp-chip-bg: #fff;
}

.sp--pal-wash {
  --sp-media-bg: linear-gradient(135deg, #FFF1F5, #FFD9E4);
}

/* ── Overlay and card ─────────────────────────────────── */
.sp-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, .55);
  animation: sp-fade .2s ease-out;
}

.sp--floating .sp-overlay {
  display: none;
}

.sp--floating {
  pointer-events: none;
}

.sp--floating .sp-card {
  pointer-events: auto;
}

.sp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--sp-w);
  max-height: 100%;
  overflow: hidden;
  background: var(--sp-card);
  color: var(--sp-text);
  border: 1px solid var(--sp-border);
  border-radius: 16px;
  animation: sp-in .24s ease-out;
}

.sp-card:focus {
  outline: none;
}

.sp-root.is-closing .sp-card,
.sp-root.is-closing .sp-overlay {
  opacity: 0;
  transition: opacity .16s ease-in;
}

@keyframes sp-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes sp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Close button ─────────────────────────────────────── */
.sp-x {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #EBECEE;
  border-radius: 50%;
  background: #fff;
  color: #1E242E;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.sp-x:hover {
  background: #F8F9FB;
  border-color: #D7DAE0;
}

.sp-x svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── Media ────────────────────────────────────────────── */
.sp-media {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--sp-media-bg);
  color: var(--sp-media-fg);
}

.sp-media > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sp--hero .sp-media {
  aspect-ratio: 16 / 10;
}

.sp-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 24px;
}

.sp-lockup img {
  display: block;
  width: auto;
  max-width: 42%;
  height: 30px;
  object-fit: contain;
}

.sp-lockup__divider {
  flex: none;
  width: 1px;
  height: 38px;
  background: currentColor;
  opacity: .35;
}

.sp--lockup .sp-media {
  aspect-ratio: 16 / 8;
}

/* ── Body and type ────────────────────────────────────── */
.sp-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 28px 28px;
  overflow-y: auto;
}

.sp-eyebrow {
  align-self: flex-start;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--sp-border);
  border-radius: 999px;
  background: var(--sp-chip-bg);
  color: var(--sp-chip-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sp-title {
  margin: 0;
  color: var(--sp-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: -.01em;
}

.sp-text p {
  margin: 0 0 8px;
  color: var(--sp-muted);
  font-size: 14px;
  line-height: 22px;
}

.sp-text p:last-child {
  margin-bottom: 0;
}

.sp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 8px;
}

.sp-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--sp-brand);
  color: #fff !important;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color .15s ease, transform .15s ease;
}

.sp-cta:hover {
  background: var(--sp-brand-hover);
  transform: translateY(-1px);
}

.sp-cta__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
}

.sp-cta__icon svg {
  width: 12px;
  height: 12px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sp-secondary {
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--sp-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s ease;
}

.sp-secondary:hover {
  color: var(--sp-text);
  text-decoration: underline;
}

.sp-cta:focus-visible,
.sp-secondary:focus-visible,
.sp-x:focus-visible {
  outline: 2px solid var(--sp-focus);
  outline-offset: 2px;
}

.sp--pal-ink .sp-x:focus-visible {
  outline-color: #fff;
}

/* ── Centered layouts: hero, lockup, minimal ──────────── */
.sp--hero .sp-body,
.sp--lockup .sp-body,
.sp--minimal .sp-body {
  align-items: center;
  text-align: center;
}

.sp--hero .sp-eyebrow,
.sp--lockup .sp-eyebrow,
.sp--minimal .sp-eyebrow {
  align-self: center;
}

.sp--hero .sp-actions,
.sp--lockup .sp-actions,
.sp--minimal .sp-actions {
  justify-content: center;
}

.sp--minimal {
  --sp-w: 400px;
}

.sp--minimal .sp-body {
  padding: 36px 32px 32px;
}

/* ── Split layouts ────────────────────────────────────── */
.sp--split-left,
.sp--split-right {
  --sp-w: 760px;
}

.sp--split-left .sp-card,
.sp--split-right .sp-card {
  flex-direction: row;
  min-height: 360px;
}

.sp--split-right .sp-card {
  flex-direction: row-reverse;
}

.sp--split-left .sp-media,
.sp--split-right .sp-media {
  width: 44%;
}

.sp--split-left .sp-body,
.sp--split-right .sp-body {
  flex: 1;
  justify-content: center;
  padding: 36px;
}

.sp--split-left .sp-x,
.sp--split-right .sp-x {
  top: 14px;
  right: 14px;
}

.sp--split-left .sp-title,
.sp--split-right .sp-title {
  font-size: 26px;
  line-height: 32px;
}

@container (max-width: 640px) {
  .sp--split-left .sp-card,
  .sp--split-right .sp-card {
    flex-direction: column;
    min-height: 0;
  }

  .sp--split-left .sp-media,
  .sp--split-right .sp-media {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .sp--split-left .sp-body,
  .sp--split-right .sp-body {
    padding: 24px 24px 28px;
  }
}

/* ── Full image cover ─────────────────────────────────── */
.sp--cover {
  --sp-w: 460px;
}

.sp--cover .sp-card {
  aspect-ratio: 4 / 5;
  justify-content: flex-end;
  color: #fff;
}

.sp--cover .sp-media {
  position: absolute;
  inset: 0;
}

.sp--cover .sp-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(30, 36, 46, .92) 0%, rgba(30, 36, 46, .55) 45%, rgba(30, 36, 46, 0) 80%);
}

.sp--cover.sp--pal-brand .sp-media::after {
  background: linear-gradient(to top, rgba(226, 2, 70, .88) 0%, rgba(91, 17, 40, .55) 45%, rgba(30, 36, 46, 0) 80%);
}

.sp--cover .sp-body {
  position: relative;
  z-index: 1;
  padding: 28px;
}

.sp--cover .sp-title,
.sp--cover .sp-text p {
  color: #fff;
}

.sp--cover .sp-text p {
  opacity: .86;
}

.sp--cover .sp-eyebrow {
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.sp--cover .sp-secondary {
  color: rgba(255, 255, 255, .8);
}

.sp--cover .sp-secondary:hover {
  color: #fff;
}

.sp--cover .sp-cta:focus-visible,
.sp--cover .sp-secondary:focus-visible {
  outline-color: #fff;
}

/* ── Corner card ──────────────────────────────────────── */
.sp--corner {
  --sp-w: 360px;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
}

.sp--corner .sp-media {
  aspect-ratio: 16 / 8;
}

.sp--corner .sp-body {
  padding: 18px 20px 20px;
}

.sp--corner .sp-title {
  font-size: 18px;
  line-height: 24px;
}

/* ── Floating bar ─────────────────────────────────────── */
.sp--bar {
  --sp-w: 760px;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
}

.sp--bar .sp-card {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 12px 56px 12px 18px;
  border-radius: 14px;
}

.sp--bar .sp-body {
  flex: 1;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 0;
  overflow: visible;
}

.sp--bar .sp-title {
  flex: 1 1 220px;
  font-size: 15px;
  line-height: 22px;
}

.sp--bar .sp-text,
.sp--bar .sp-secondary {
  display: none;
}

.sp--bar .sp-actions {
  margin-top: 0;
}

.sp--bar .sp-cta {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}

.sp--bar .sp-x {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

/* ── Video layouts ────────────────────────────────────── */
.sp--video-wide,
.sp--video-tall {
  --sp-media-bg: #12151B;
}

.sp-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #12151B;
  object-fit: cover;
  pointer-events: none;
}

.sp-video.is-interactive {
  pointer-events: auto;
}

.sp-video-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2F3744, #12151B);
}

.sp-video-empty svg {
  box-sizing: border-box;
  width: 56px;
  height: 56px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  fill: #fff;
}

/* Horizontal: 16:9 video on top, text below. The card shrinks with the window height so it always fits. */
.sp--video-wide {
  --sp-w: min(720px, max(320px, calc((100vh - 240px) * 1.7778)));
}

.sp--video-wide .sp-media {
  aspect-ratio: 16 / 9;
}

.sp--video-wide .sp-body {
  padding: 24px 28px 28px;
}

.sp--video-wide .sp-title {
  font-size: 24px;
  line-height: 30px;
}

/* Vertical: 9:16 video beside the text; stacked on narrow screens. */
.sp--video-tall {
  --sp-w: 760px;
}

.sp--video-tall .sp-card {
  flex-direction: row;
  align-items: stretch;
}

.sp--video-tall .sp-media {
  height: min(560px, calc(100vh - 64px));
  aspect-ratio: 9 / 16;
}

.sp--video-tall .sp-body {
  flex: 1;
  justify-content: center;
  padding: 36px;
}

.sp--video-tall .sp-title {
  font-size: 26px;
  line-height: 32px;
}

@container (max-width: 640px) {
  .sp--video-tall .sp-card {
    flex-direction: column;
  }

  .sp--video-tall .sp-media {
    width: 100%;
    height: min(46vh, 340px);
    aspect-ratio: auto;
  }

  .sp--video-tall .sp-body {
    padding: 24px 24px 28px;
  }
}

/* ── Page scroll lock while a blocking popup is open ──── */
html.sp-lock {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .sp-card,
  .sp-overlay {
    animation: none;
  }

  .sp-cta {
    transition: none;
  }

  .sp-cta:hover {
    transform: none;
  }
}

/* ── Admin: gallery thumbnails and editor stage ───────── */
.sp-thumb {
  position: relative;
  aspect-ratio: 19 / 16;
  overflow: hidden;
  border: 1px solid #EBECEE;
  border-radius: 12px;
  background: #F3F4F6;
}

.sp-thumb__frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 760px;
  height: 640px;
  transform-origin: top left;
  pointer-events: none;
}

.sp-stage {
  position: relative;
  height: min(640px, calc(100vh - 160px));
  min-height: 420px;
  overflow: hidden;
  border: 1px solid #EBECEE;
  border-radius: 12px;
  background: #F3F4F6;
}

.sp-stage__page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.sp-stage__page i {
  display: block;
  height: 10px;
  border-radius: 6px;
  background: #E3E5E9;
}

.sp-stage__page i:nth-child(1) { width: 38%; height: 14px; }
.sp-stage__page i:nth-child(2) { width: 82%; }
.sp-stage__page i:nth-child(3) { width: 64%; }
.sp-stage__page i:nth-child(4) { width: 76%; }
.sp-stage__page i:nth-child(5) { width: 52%; }
