/* ═══ CORNERSTONE LIFE — Spanish Class popup (lightboxed dialog) ═══
   Announces the Calgary Spanish class after 5s of scrolling and
   funnels to Eventbrite. All tokens inherited from main.css. */

/* ── Dialog shell ───────────────────────────────
   The dialog element fills the viewport so any click outside the
   card reads as "backdrop". Layout only applies while [open] — a
   bare .popup rule would override the UA's display:none. */
.popup { border: 0; padding: 0; background: transparent; }
.popup::backdrop { background: transparent; } /* the shade div below handles it */
.popup[open] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(1rem, 3vw, 2.5rem);
  display: grid;
  overflow: auto;
  overscroll-behavior: contain;
}

/* ── Shade (the lightbox) ─────────────────────── */
.popup__shade {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 51, 0.66);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
}

/* ── Card ─────────────────────────────────────────
   margin:auto centers in the grid AND keeps the card reachable
   when it outgrows the viewport (unlike place-items:center). */
.popup__card {
  position: relative;
  z-index: 1;
  margin: auto;
  width: min(940px, 100%);
  max-height: calc(100dvh - clamp(2rem, 6vw, 5rem));
  display: grid;
  grid-template-columns: minmax(0, 50%) minmax(0, 1fr);
  background: var(--c-paper);
  border-radius: 0;
  overflow: hidden;
  box-shadow:
    0 48px 140px rgba(10, 22, 51, 0.55),
    0 8px 32px rgba(10, 22, 51, 0.25);
  overscroll-behavior: contain;
}

/* ── Media panel ─────────────────────────────────
   Teal base doubles as the image's loading backdrop. */
.popup__media {
  position: relative;
  min-height: 100%;
  background: linear-gradient(160deg, #86ece6, #46d2c9);
}
.popup__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 25% center;   /* tuned via on-screen comparison: all 3 students in frame */
}
.popup__sticker {
  position: absolute;
  left: 1.1rem;
  bottom: 1.1rem;
  font-size: clamp(1.2rem, 1.9vw, 1.55rem);
  transform: rotate(-5deg);
}

/* ── Content panel ───────────────────────────────
   Wider left padding pushes the text block right of the image
   edge (the image column grew to 50%), keeping whitespace even
   on the text block's own right side. */
.popup__body {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  padding: clamp(2rem, 3.6vw, 3.1rem) clamp(1.9rem, 3.6vw, 2.9rem);
  padding-left: clamp(2.4rem, 4.5vw, 3.4rem);
}

/* ── Close ───────────────────────────────────────
   Naked X glyph — no button chrome, just a very subtle
   drop-shadow. The dialog itself takes focus on open, so
   nothing is visibly focused until the user tabs; the X's
   keyboard cue is a blue color shift, never a box. */
.popup__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--c-navy);
  cursor: pointer;
  transition: transform 0.3s var(--ease-out), color 0.3s var(--ease-out);
}
.popup__close:hover { transform: rotate(90deg); }
.popup__close:focus-visible { outline: none; color: var(--c-blue); }
.popup__close:focus-visible svg { filter: drop-shadow(0 3px 10px rgba(10, 22, 51, 0.3)); }
.popup__close svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 2px 6px rgba(10, 22, 51, 0.18));
}

/* ── Badge ─────────────────────────────────────── */
.popup__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.55em 1.15em 0.55em 0.95em;
  border-radius: 999px;
  background: var(--c-sky);
  color: var(--c-navy);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.popup__badge i {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--c-blue);
  animation: popupPulse 2.4s ease-out infinite;
}
@keyframes popupPulse {
  0%   { box-shadow: 0 0 0 0 rgba(5, 75, 222, 0.4); }
  70%  { box-shadow: 0 0 0 0.8em rgba(5, 75, 222, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 75, 222, 0); }
}

/* ── Title & copy ───────────────────────────────── */
.popup__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-stretch: 95%;
  font-size: clamp(1.75rem, 3.2vw, 2.2rem);
  text-transform: uppercase;
  line-height: 1.02;
  letter-spacing: 0.005em;
  color: var(--c-navy);
}
.popup__title em {
  display: inline-block;
  color: var(--c-blue);
  font-family: var(--font-handwriting);
  font-size: 1.22em;
  font-weight: 400;
  font-style: normal;
  line-height: 0.82;
  text-transform: none;
  letter-spacing: 0.01em;
  padding: 0.06em 0 0.14em;
}
.popup__title .popup__flag {
  display: inline-block;
  height: 0.55em;             /* width follows the file's own 3:2 ratio */
  width: auto;
  margin-left: 0.3em;         /* clean gap after "Spanish" */
  vertical-align: baseline;
  transform: translateY(0.06em);
  border-radius: 3px;         /* subtle rounding — premium touch */
}
.popup__sub {
  max-width: 32ch;
  font-size: clamp(0.98rem, 1.2vw, 1.08rem);
  line-height: 1.6;
  color: var(--c-charcoal);
}

/* ── Meta chips ─────────────────────────────────── */
.popup__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  width: 100%;
}
.popup__meta li {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em 1em;
  border-radius: 999px;
  background: var(--c-white);
  border: 1px solid rgba(10, 22, 51, 0.08);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--c-navy);
  white-space: nowrap;
}
.popup__meta svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--c-blue);
}

/* ── CTA ────────────────────────────────────────── */
.popup__cta {
  width: 100%;
  justify-content: center;
  text-align: center;
  font-size: 1.02rem;
  padding: 1.05em 2em;
  margin-top: 0.35rem;
}
.popup__cta:focus-visible { outline: 4px solid var(--c-blue); outline-offset: 4px; }
.popup__note {
  font-size: 0.85rem;
  color: var(--c-charcoal);
  opacity: 0.75;
}

/* ── Mobile ─────────────────────────────────────── */
@media (max-width: 720px) {
  .popup__card {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .popup__media { min-height: 0; aspect-ratio: 16 / 10; }
  .popup__body { padding: 1.7rem 1.4rem 2rem; gap: 0.9rem; }
  .popup__sticker { left: 0.9rem; bottom: 0.9rem; }
  .popup__sub { max-width: none; }
}

/* ── Reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .popup__badge i { animation: none; }
  .popup__close { transition: none; }
}
