/**
 * @file
 * Styles for Ad Rotator & Fallback block.
 *
 * Provides a skeleton loading state so visitors never see a broken iframe
 * or blank window while the ad network loads or falls back.
 */

.ad-rotator {
  position: relative;
  margin: 1.5rem 0;
  width: 100%;
}

.ad-rotator__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a99ad;
  text-align: center;
  margin-bottom: 0.5rem;
}

.ad-rotator__stage {
  position: relative;
  width: 100%;
  min-height: 250px;
}

/* Skeleton Loading State */
.ad-rotator__skeleton {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Shimmer gradient animation */
@keyframes ad-rotator-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.ad-rotator__skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ad-rotator__skeleton-badge,
.ad-rotator__skeleton-title,
.ad-rotator__skeleton-line,
.ad-rotator__skeleton-btn {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: ad-rotator-shimmer 1.6s infinite ease-in-out;
  border-radius: 6px;
}

.ad-rotator__skeleton-badge {
  width: 90px;
  height: 18px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #e0f2fe 25%, #bae6fd 50%, #e0f2fe 75%);
}

.ad-rotator__skeleton-title {
  width: 75%;
  height: 22px;
  margin-top: 0.25rem;
}

.ad-rotator__skeleton-line {
  width: 95%;
  height: 14px;
}

.ad-rotator__skeleton-line--short {
  width: 60%;
}

.ad-rotator__skeleton-btn {
  width: 110px;
  height: 32px;
  margin-top: 0.5rem;
}

/* Primary Ad Tier (masked while loading so broken iframes cannot flash) */
.ad-rotator.is-loading .ad-rotator__primary {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ad-rotator.is-primary-active .ad-rotator__skeleton {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ad-rotator.is-primary-active .ad-rotator__primary {
  position: relative;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.ad-rotator__primary ins.adsbygoogle {
  display: block !important;
  width: 100% !important;
  min-height: 250px;
}

/* Fallback Ad Tier */
.ad-rotator.is-fallback-active .ad-rotator__skeleton {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ad-rotator.is-fallback-active .ad-rotator__primary {
  display: none !important;
}

.ad-rotator.is-fallback-active .ad-rotator__fallback {
  display: block !important;
  position: relative;
  animation: ad-rotator-fade-in 0.3s ease;
}

@keyframes ad-rotator-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* House Ad Card Styling */
.ad-rotator__house-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ad-rotator__house-card:hover {
  transform: translateY(-2px);
  border-color: #00d4ff;
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.ad-rotator__house-link {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  color: inherit;
  text-decoration: none;
}

.ad-rotator__house-link:hover,
.ad-rotator__house-link:focus {
  color: inherit;
  text-decoration: none;
}

.ad-rotator__house-media {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.ad-rotator__house-img {
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

.ad-rotator__house-body {
  display: flex;
  flex-direction: column;
}

.ad-rotator__house-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 9999px;
  background-color: #e0f2fe;
  color: #0369a1;
  margin-bottom: 0.5rem;
}

.ad-rotator__house-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.ad-rotator__house-text {
  font-size: 0.875rem;
  line-height: 1.45;
  color: #475569;
  margin-bottom: 0.85rem;
}

.ad-rotator__house-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0284c7;
  padding: 0.45rem 0.9rem;
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  width: fit-content;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ad-rotator__house-card:hover .ad-rotator__house-btn {
  background-color: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* Secondary Network Fallback container */
.ad-rotator__custom-ad {
  width: 100%;
  text-align: center;
}
