/* Funnyeye — generic modal (driven by lib/modal.js)
   One root appended to <body>; shown when .is-open is toggled.
   z-index 1100 sits above age-gate (1000), mobile menu (1001),
   and loader (500). */

.fe-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.fe-modal.is-open {
  display: flex;
}

.fe-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  animation: fe-modal-fade 0.2s ease forwards;
}

@keyframes fe-modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fe-modal-dialog {
  position: relative;
  max-width: 760px;
  width: 100%;
  max-height: calc(100vh - 48px);
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  color: var(--colors--white, #ffffff);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fe-modal-pop 0.25s ease forwards;
}

@keyframes fe-modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.fe-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--colors--white, #ffffff);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, background-color 0.2s;
  z-index: 1;
}

.fe-modal-close:hover,
.fe-modal-close:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.fe-modal-header {
  padding: 32px 32px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: none;
}

.fe-modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0;
}

:lang(zh) .fe-modal-title {
  font-family: var(--font-zh);
}

.fe-modal-body {
  /* flex: 1 + min-height: 0 is the canonical fix for "flex column
     child won't scroll" — without min-height: 0 the body shrinks
     only down to its content's intrinsic height (auto), which
     pushes the dialog past max-height instead of scrolling. */
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px 32px 32px;
  overflow-y: auto;
  font-family: var(--font-body-en);
  font-size: 14px;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

:lang(zh) .fe-modal-body {
  font-family: var(--font-zh);
  font-size: 14.5px;
  line-height: 1.85;
  letter-spacing: 0.04em;
}

.fe-modal-block {
  margin: 0 0 20px;
}

.fe-modal-block:last-child {
  margin-bottom: 0;
}

.fe-modal-block h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
  color: var(--colors--brand-gold-500);
}

:lang(zh) .fe-modal-block h3 {
  font-family: var(--font-zh);
}

.fe-modal-block h4 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
  opacity: 0.95;
}

:lang(zh) .fe-modal-block h4 {
  font-family: var(--font-zh);
}

.fe-modal-block p {
  margin: 0 0 10px;
  opacity: 0.85;
}

.fe-modal-block ul {
  margin: 0 0 10px;
  padding-left: 1.4rem;
}

.fe-modal-block li {
  margin: 0 0 6px;
  opacity: 0.85;
}

.fe-modal-note {
  margin: 0 0 20px;
  padding: 8px 12px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  font-size: 12.5px;
  opacity: 0.75;
  letter-spacing: 0.04em;
}

/* In-gate links: cursor-pointer buttons that look like inline links. */
.fe-modal-link {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--colors--brand-gold-500);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
  transition: color 0.2s;
}

.fe-modal-link:hover,
.fe-modal-link:focus-visible {
  color: var(--colors--brand-gold-400);
  outline: none;
}

@media (max-width: 480px) {
  .fe-modal {
    padding: 12px;
  }
  .fe-modal-header {
    padding: 24px 20px 10px;
  }
  .fe-modal-body {
    padding: 18px 20px 24px;
  }
  .fe-modal-title {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fe-modal-overlay,
  .fe-modal-dialog {
    animation: none !important;
  }
}

/* ============================ Image lightbox variant ============================
   Toggled by lib/modal.js when the provider body is image-only (single
   <img> chunk).  Hides the text header + close-button chrome, swaps
   the dark dialog for a white card so the image (e.g. a QR code) reads
   cleanly.  Close button keeps its position but flips to a dark circle
   so the white X is visible over the white card. */

.fe-modal[data-fe-modal-image="true"] .fe-modal-dialog {
  background: var(--colors--white, #ffffff);
  border: 0;
  max-width: min(560px, 92vw);
  padding: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.fe-modal[data-fe-modal-image="true"] .fe-modal-header {
  display: none;
}

.fe-modal[data-fe-modal-image="true"] .fe-modal-body {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fe-modal[data-fe-modal-image="true"] .fe-modal-body .fe-modal-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.fe-modal[data-fe-modal-image="true"] .fe-modal-close {
  /* Sit outside the white card so the white × is visible without
     needing a fill — same offset as the text variant. */
  top: -44px;
  right: 0;
  color: var(--colors--white, #ffffff);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
}

@media (max-width: 480px) {
  .fe-modal[data-fe-modal-image="true"] .fe-modal-dialog {
    max-width: 92vw;
  }
  .fe-modal[data-fe-modal-image="true"] .fe-modal-body {
    padding: 16px;
  }
  .fe-modal[data-fe-modal-image="true"] .fe-modal-close {
    top: -40px;
  }
}
