/*--------------------------------------------------------------
# Newsletter Section & Popup
# Theme via CSS custom properties — override in newsletter-config.js
--------------------------------------------------------------*/

:root {
  --nl-primary: #E50C7E;
  --nl-secondary: #0F5979;
  --nl-accent: #FBD8C7;
  --nl-surface: #ecc4ac;
  --nl-text-on-primary: #ffffff;
  --nl-border-radius: 50px;
  --nl-popup-border-radius: 20px;
  --nl-error: #ff6b6b;
  --nl-success: #18d26e;
}

/* ---- Section ---- */
.newsletter-section {
  padding: 70px 0;
  background: linear-gradient(135deg, var(--nl-secondary) 0%, color-mix(in srgb, var(--nl-secondary) 85%, #000) 100%);
  position: relative;
  overflow: hidden;
}

.newsletter-section::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, color-mix(in srgb, var(--nl-primary) 15%, transparent) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.newsletter-section::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, color-mix(in srgb, var(--nl-accent) 8%, transparent) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.newsletter-section .newsletter-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.newsletter-section .newsletter-eyebrow {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--nl-accent);
  font-family: inherit;
  margin: 0 0 8px;
}

.newsletter-section .newsletter-eyebrow::after {
  content: "";
  width: 80px;
  height: 1px;
  display: inline-block;
  background: color-mix(in srgb, var(--nl-accent) 50%, transparent);
  margin: 4px 10px;
  vertical-align: middle;
}

.newsletter-section .newsletter-title {
  font-size: 36px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 2px;
  color: var(--nl-primary);
  margin: 0 0 16px;
}

.newsletter-section .newsletter-description {
  font-size: 16px;
  color: var(--nl-accent);
  font-family: inherit;
  line-height: 1.6;
  margin: 0 0 32px;
  opacity: 0.9;
}

/* ---- Shared Form ---- */
.newsletter-form {
  width: 100%;
}

.newsletter-form__fields {
  display: flex;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}

.newsletter-form__input-wrap {
  flex: 1;
  position: relative;
}

.newsletter-form__input {
  width: 100%;
  height: 50px;
  padding: 0 22px;
  border: 2px solid color-mix(in srgb, var(--nl-accent) 30%, transparent);
  border-radius: var(--nl-border-radius);
  background: color-mix(in srgb, var(--nl-secondary) 60%, transparent);
  color: var(--nl-text-on-primary);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}

.newsletter-form__input::placeholder {
  color: color-mix(in srgb, var(--nl-accent) 60%, transparent);
}

.newsletter-form__input:focus {
  border-color: var(--nl-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nl-primary) 20%, transparent);
}

.newsletter-form__input:invalid:not(:placeholder-shown) {
  border-color: var(--nl-error);
}

.newsletter-form__submit {
  flex-shrink: 0;
  height: 50px;
  padding: 0 32px;
  border: 2px solid var(--nl-primary);
  border-radius: var(--nl-border-radius);
  background: var(--nl-primary);
  color: var(--nl-text-on-primary);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
  white-space: nowrap;
}

.newsletter-form__submit--outline {
  background: transparent;
  color: var(--nl-primary);
}

.newsletter-form__submit--outline:hover:not(:disabled) {
  background: var(--nl-primary);
  color: var(--nl-text-on-primary);
}

.newsletter-form__submit:hover:not(:disabled) {
  background: transparent;
  color: var(--nl-primary);
  transform: translateY(-1px);
}

.newsletter-form__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.newsletter-form__submit--loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.newsletter-form__submit--loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid color-mix(in srgb, var(--nl-text-on-primary) 30%, transparent);
  border-top-color: var(--nl-text-on-primary);
  border-radius: 50%;
  animation: newsletter-spin 0.7s linear infinite;
}

@keyframes newsletter-spin {
  to { transform: rotate(360deg); }
}

/* ---- Messages ---- */
.newsletter-form__message {
  display: none;
  margin-top: 16px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  line-height: 1.4;
  animation: newsletter-fade-in 0.4s ease;
}

.newsletter-form__message--visible {
  display: block;
}

.newsletter-form__message--success {
  background: color-mix(in srgb, var(--nl-success) 15%, transparent);
  color: color-mix(in srgb, var(--nl-success) 70%, var(--nl-accent));
  border: 1px solid color-mix(in srgb, var(--nl-success) 30%, transparent);
}

.newsletter-form__message--error {
  background: color-mix(in srgb, var(--nl-error) 15%, transparent);
  color: color-mix(in srgb, var(--nl-error) 70%, var(--nl-accent));
  border: 1px solid color-mix(in srgb, var(--nl-error) 30%, transparent);
}

@keyframes newsletter-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Popup Overlay ---- */
.newsletter-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: color-mix(in srgb, var(--nl-secondary) 70%, transparent);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.newsletter-popup-overlay--visible {
  opacity: 1;
  visibility: visible;
}

/* ---- Popup Dialog ---- */
.newsletter-popup {
  position: fixed;
  z-index: 9999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: calc(100% - 32px);
  max-width: 480px;
  background: var(--nl-surface);
  border-radius: var(--nl-popup-border-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s ease;
  overflow: hidden;
}

.newsletter-popup--visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.newsletter-popup__accent {
  height: 5px;
  background: linear-gradient(90deg, var(--nl-primary), var(--nl-secondary));
}

.newsletter-popup__body {
  padding: 36px 32px 32px;
  text-align: center;
  position: relative;
}

.newsletter-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--nl-secondary) 10%, transparent);
  color: var(--nl-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.newsletter-popup__close:hover {
  background: var(--nl-primary);
  color: var(--nl-text-on-primary);
}

.newsletter-popup__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--nl-primary) 10%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--nl-primary);
}

.newsletter-popup__title {
  font-size: 28px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 1px;
  color: var(--nl-primary);
  margin: 0 0 12px;
}

.newsletter-popup__description {
  font-size: 15px;
  color: var(--nl-secondary);
  font-family: inherit;
  line-height: 1.6;
  margin: 0 0 24px;
}

/* Popup form overrides */
.newsletter-popup .newsletter-form__fields {
  flex-direction: column;
  max-width: 100%;
}

.newsletter-popup .newsletter-form__input {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--nl-secondary) 20%, transparent);
  color: var(--nl-secondary);
}

.newsletter-popup .newsletter-form__input::placeholder {
  color: color-mix(in srgb, var(--nl-secondary) 45%, transparent);
}

.newsletter-popup .newsletter-form__input:focus {
  border-color: var(--nl-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nl-primary) 15%, transparent);
}

.newsletter-popup .newsletter-form__submit {
  width: 100%;
}

.newsletter-popup .newsletter-form__message--success {
  background: color-mix(in srgb, var(--nl-success) 12%, transparent);
  color: color-mix(in srgb, var(--nl-success) 80%, #000);
  border-color: color-mix(in srgb, var(--nl-success) 25%, transparent);
}

.newsletter-popup .newsletter-form__message--error {
  background: color-mix(in srgb, var(--nl-error) 12%, transparent);
  color: color-mix(in srgb, var(--nl-error) 80%, #000);
  border-color: color-mix(in srgb, var(--nl-error) 25%, transparent);
}

/* ---- Responsive ---- */
@media (max-width: 575px) {
  .newsletter-section {
    padding: 50px 0;
  }

  .newsletter-section .newsletter-title {
    font-size: 28px;
  }

  .newsletter-section .newsletter-description {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .newsletter-form__fields {
    flex-direction: column;
  }

  .newsletter-form__submit {
    width: 100%;
  }

  .newsletter-popup__body {
    padding: 28px 20px 24px;
  }

  .newsletter-popup__title {
    font-size: 24px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .newsletter-popup-overlay,
  .newsletter-popup,
  .newsletter-form__message,
  .newsletter-form__submit {
    transition: none;
    animation: none;
  }
}
