/**
 * Special Event Popup Styles
 * Responsive, accessible, and matches The Tonk Chicago brand
 * Optimized for vertical/portrait format images (4:5 aspect ratio)
 */

/* Overlay backdrop */
#special-event-popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 1rem;
}

#special-event-popup-overlay.show {
  opacity: 1;
}

/* Main popup container */
#special-event-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  background: linear-gradient(135deg, #4d0710, #36080d);
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  overflow: hidden;
}

#special-event-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Popup content wrapper */
.popup-content {
  position: relative;
  display: flex;
  flex-direction: column;
  color: white;
  overflow-y: auto;
  max-height: 90vh;
}

/* Close button - redesigned for better visibility */
.popup-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  color: white;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.popup-close svg {
  width: 20px;
  height: 20px;
  display: block;
}

.popup-close:hover,
.popup-close:focus {
  background: rgba(255, 186, 8, 1);
  border-color: rgba(255, 186, 8, 1);
  color: #000;
  transform: scale(1.1) rotate(90deg);
  outline: none;
  box-shadow: 0 4px 12px rgba(255, 186, 8, 0.5);
}

/* Image container - optimized for vertical images */
.popup-image-container {
  width: 100%;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Set a max height to prevent overly tall images */
  max-height: 60vh;
}

.popup-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain; /* Changed from cover to contain */
  max-height: 60vh;
}

/* Text content container */
.popup-text-container {
  padding: 2rem 1.5rem;
  text-align: center;
}

/* Title */
.popup-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: white;
  text-transform: capitalize;
  line-height: 1.2;
}

/* Description */
.popup-description {
  font-size: clamp(1rem, 3vw, 1.2rem);
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
  color: rgba(255, 255, 255, 0.9);
  max-width: none;
  padding: 0;
}

/* Button container */
.popup-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Button styles */
.popup-btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  border-radius: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  cursor: pointer;
  text-transform: capitalize;
}

/* Primary button */
.popup-btn-primary {
  background-color: #ffba08;
  color: #000;
  border-color: #ffba08;
}

.popup-btn-primary:hover,
.popup-btn-primary:focus {
  background-color: #e36414;
  border-color: #e36414;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 186, 8, 0.4);
}

/* Secondary button */
.popup-btn-secondary {
  background-color: transparent;
  color: white;
  border-color: white;
}

.popup-btn-secondary:hover,
.popup-btn-secondary:focus {
  background-color: white;
  color: #4d0710;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

/* Tablet and up - horizontal buttons */
@media screen and (min-width: 576px) {
  .popup-buttons {
    flex-direction: row;
    justify-content: center;
  }

  .popup-btn {
    flex: 1;
    max-width: 200px;
  }

  .popup-text-container {
    padding: 2.5rem 2rem;
  }

  #special-event-popup {
    max-width: 550px;
  }
}

/* Desktop adjustments */
@media screen and (min-width: 768px) {
  #special-event-popup {
    max-width: 600px;
  }

  .popup-text-container {
    padding: 3rem 2.5rem;
  }
}

/* Large screens */
@media screen and (min-width: 992px) {
  #special-event-popup {
    max-width: 650px;
  }
}

/* Mobile-specific adjustments */
@media screen and (max-width: 575px) {
  #special-event-popup {
    width: 95%;
    max-height: 95vh;
  }

  .popup-close {
    width: 40px;
    height: 40px;
    top: 0.5rem;
    right: 0.5rem;
  }

  .popup-close svg {
    width: 18px;
    height: 18px;
  }

  .popup-text-container {
    padding: 1.5rem 1rem;
  }

  .popup-image-container {
    max-height: 50vh;
  }

  .popup-image {
    max-height: 50vh;
  }

  .popup-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

/* Extra small screens */
@media screen and (max-width: 400px) {
  .popup-title {
    font-size: 1.3rem;
  }

  .popup-description {
    font-size: 0.95rem;
  }

  .popup-text-container {
    padding: 1.25rem 0.875rem;
  }

  .popup-image-container {
    max-height: 45vh;
  }

  .popup-image {
    max-height: 45vh;
  }
}

/* Very tall screens - adjust image to not dominate */
@media screen and (min-height: 900px) {
  .popup-image-container {
    max-height: 55vh;
  }

  .popup-image {
    max-height: 55vh;
  }
}

/* Accessibility - focus indicators */
.popup-btn:focus,
.popup-close:focus {
  outline: 3px solid #ffba08;
  outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  #special-event-popup-overlay,
  #special-event-popup,
  .popup-close,
  .popup-btn {
    transition: none;
  }

  #special-event-popup {
    transform: translate(-50%, -50%);
  }

  #special-event-popup.show {
    transform: translate(-50%, -50%);
  }

  .popup-close:hover {
    transform: scale(1.1);
  }
}

/* Print - hide popup */
@media print {
  #special-event-popup-overlay,
  #special-event-popup {
    display: none !important;
  }
}

/* Landscape orientation on mobile - reduce image height */
@media screen and (max-width: 767px) and (orientation: landscape) {
  .popup-image-container {
    max-height: 40vh;
  }

  .popup-image {
    max-height: 40vh;
  }

  .popup-text-container {
    padding: 1rem 1rem;
  }

  .popup-title {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
  }

  .popup-description {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  .popup-buttons {
    margin-top: 1rem;
  }
}
