/**
 * Lead Magnet Hero Styles
 * Styles for the lead magnet hero section on single posts
 *
 * @package LeanPress
 */

/* Lead Magnet Hero Section */
.lead-magnet-hero {
  position: relative;
  background-color: rgba(0, 0, 0, 1);
  color: #fff;
  min-height: 400px; /* Consistent min-height across all breakpoints */
  display: flex;
  align-items: center;
  padding: 6rem 0 1.5rem;
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  contain: layout; /* Improve layout containment */
  overflow-x: hidden; /* Prevent horizontal overflow */
}

.lead-magnet-hero .hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--c-primary-dark);
  opacity: 0.9;
  z-index: 1;
}

.lead-magnet-hero .container {
  position: relative;
  z-index: 2;
  width: 100%;
}

.lead-magnet-grid {
  display: grid;
  grid-template-columns: 65% 30%;
  gap: 3rem;
  align-items: center;
}

.lead-magnet-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-left: 0.5rem;
}

.lead-magnet-hero .hero-title {
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: #fff;
  min-height: 3.5rem;
  font-display: swap; /* Ensure text renders while font loads */
}

.lead-magnet-hero .hero-title .emphasis {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--c-accent);
  font-weight: 800;
}

.lead-magnet-hero .hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 400;
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.9);
  min-height: 3rem; /* Reserve space for subtitle text */
}

.lead-magnet-image {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  overflow: hidden;
  min-height: 400px; /* Reserve consistent space for image */
}

.lead-magnet-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  object-fit: contain;
}

/* Specific styling for the hero image */
.lead-magnet-hero-image {
  width: 400px;
  height: 400px;
  display: block;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast; /* For Chrome/Safari */
  image-rendering: crisp-edges; /* For Firefox */
  contain: size layout; /* Improve layout containment */
}

/* Lead Magnet Form Wrapper */
.lead-magnet-form-wrapper {
  width: 100%;
}

/* Lead Magnet Toggle Button */
.lead-magnet-toggle {
  background-color: var(--button-on-black-bg);
  color: var(--button-on-black-text);
  border-color: var(--button-on-black-bg);
  display: inline-block;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border-radius: var(--button-border-radius);
  cursor: pointer;
  transition: var(--button-transition);
  box-sizing: border-box;
  border: 2px solid transparent;
}

.lead-magnet-toggle:hover,
.lead-magnet-toggle:focus {
  background-color: var(--button-on-black-hover-bg);
  color: var(--button-on-black-hover-text);
  border-color: var(--button-on-black-hover-bg);
  box-shadow: 0 6px 20px var(--button-hover-shadow);
  transform: translateY(-2px);
}

/* Post header styles unified in main.css */

/* Lead Magnet Modal Styles */
.lead-magnet-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 99999; /* Increased z-index to ensure modal appears above all content */
  align-items: center;
  justify-content: center;
  /* No padding needed since we're not hiding scrollbar */
  opacity: 0;
  visibility: hidden;
  display: flex;
  transition: opacity 0.25s ease-out, visibility 0.25s ease-out;
  pointer-events: none;
  contain: layout size style; /* Improve containment */
}

.lead-magnet-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Modal open styles removed - keeping scrollbar visible */

.lead-magnet-modal-content {
  background-color: #fff;
  padding: 0;
  border-radius: 10px;
  max-width: 850px;
  width: 92%;
  position: relative;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.25s ease;
  overflow: hidden;
}

.lead-magnet-modal.active .lead-magnet-modal-content {
  opacity: 1;
}

.lead-magnet-modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  z-index: 10;
}

.lead-magnet-modal-close:hover {
  color: #333;
}

.lead-magnet-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.lead-magnet-modal-image {
  background-color: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.lead-magnet-modal-image img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.lead-magnet-modal-content-column {
  padding: 2.25rem;
}

.lead-magnet-modal h2 {
  color: #333;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: clamp(1.75rem, 2.5vw, 2rem);
  font-weight: 600;
  text-align: center;
}

.newsletter-form__privacy {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
}

/* Remove p styles as they're no longer needed */

/* Newsletter form styling within modal */
.lead-magnet-modal-form .newsletter-signup {
  margin: 0;
  background-color: transparent;
  padding: 0;
}

.lead-magnet-modal-form .newsletter-signup__title,
.lead-magnet-modal-form .newsletter-signup__description {
  display: none;
}

.lead-magnet-modal-form .newsletter-signup__form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0 1.25rem;
}

.lead-magnet-modal-form .newsletter-signup__input {
  padding: 0.9rem 1.15rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  background-color: #f5f5f5;
  color: #333;
  width: 100%;
  margin-right: 1rem;
  box-sizing: border-box;
  font-size: 1.05rem;
}

/* Override default browser focus styles */
.lead-magnet-modal-form .newsletter-signup__input:focus {
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 1px rgba(125, 237, 6, 0.2);
}

.lead-magnet-modal-form .newsletter-signup__button {
  background-color: var(--button-on-white-bg);
  color: var(--button-on-white-text);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.9rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  width: 100%;
  margin-right: 1rem;
  box-sizing: border-box;
}

.lead-magnet-modal-form .newsletter-signup__button:hover,
.lead-magnet-modal-form .newsletter-signup__button:focus {
  background-color: var(--button-on-white-hover-bg);
  color: var(--button-on-white-hover-text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Modal responsive styles */
@media (max-width: 767px) {
  .lead-magnet-modal-grid {
    grid-template-columns: 1fr;
  }
  
  .lead-magnet-modal-image {
    display: none; /* Hide image column on mobile */
  }
  
  .lead-magnet-modal-content {
    max-width: 400px;
  }
  
  .lead-magnet-modal-content-column {
    padding: 1.75rem 1.5rem; /* Adjust padding for better mobile layout */
  }
}

/* Hero responsive styles */
@media (max-width: 992px) {
  .lead-magnet-grid {
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .lead-magnet-hero {
    min-height: 420px;
    padding: 6rem 0 1rem;
  }
  
  .lead-magnet-grid {
    grid-template-columns: 1fr;
  }
  
  .lead-magnet-content {
    align-items: center;
    order: 1; /* Changed to 1 so content is first */
  }
  
  .lead-magnet-image {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    min-height: 0; /* Override the desktop min-height */
  }
  
  .lead-magnet-hero .hero-title,
  .lead-magnet-hero .hero-subtitle {
    text-align: center;
  }
  
  .lead-magnet-form-wrapper {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .lead-magnet-hero {
    min-height: 420px;
    padding: 7rem 0 2rem;
  }
  
  .lead-magnet-hero .hero-title {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
  }
  
  .lead-magnet-hero .hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.2rem);
  }
}
