/* ==========================================================================
   SPLASH FRAMES — 4 frames + 3 themes + accessibility
   Carregado via <link rel="preload" as="style" href="/css/splash-frames.css">
   ========================================================================== */

/* --- CSS Custom Properties (tokens) --- */
:root {
  --splash-z: 9999;
  --splash-overlay-bg: rgba(0, 0, 0, 0.6);
  --splash-radius: 16px;
  --splash-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  --splash-transition: 0.3s ease;
  --splash-font: var(--font-sans, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif);

  /* Theme: default (verde Sonho Vivo) */
  --splash-primary: #1b5e20;
  --splash-primary-dark: #145218;
  --splash-accent: #ff6f00;
  --splash-text: #1a1a1a;
  --splash-text-muted: #444;
  --splash-text-light: #666;
  --splash-bg: #fff;
  --splash-border: #e5e5e5;
  --splash-badge-bg: var(--splash-accent);
  --splash-badge-text: #fff;
  --splash-cta-bg: linear-gradient(135deg, var(--splash-primary), var(--splash-primary-dark));
  --splash-cta-text: #fff;
  --splash-cta-shadow: rgba(27, 94, 32, 0.3);
  --splash-close-bg: rgba(255, 255, 255, 0.9);
  --splash-close-text: #333;
}

/* Theme: dark */
[data-splash-theme="dark"] {
  --splash-primary: #2e7d32;
  --splash-primary-dark: #1b5e20;
  --splash-accent: #ffb300;
  --splash-text: #f5f5f5;
  --splash-text-muted: #ddd;
  --splash-text-light: #aaa;
  --splash-bg: #1e1e1e;
  --splash-border: #333;
  --splash-badge-bg: var(--splash-accent);
  --splash-badge-text: #1a1a1a;
  --splash-cta-bg: linear-gradient(135deg, var(--splash-primary), var(--splash-primary-dark));
  --splash-cta-text: #fff;
  --splash-cta-shadow: rgba(46, 125, 50, 0.4);
  --splash-close-bg: rgba(30, 30, 30, 0.95);
  --splash-close-text: #f5f5f5;
}

/* Theme: brand (usa variáveis do site se existirem) */
[data-splash-theme="brand"] {
  --splash-primary: var(--color-primary, #1b5e20);
  --splash-primary-dark: var(--color-primary-dark, #145218);
  --splash-accent: var(--color-accent, #ff6f00);
  --splash-text: var(--color-text, #1a1a1a);
  --splash-text-muted: var(--color-text-secondary, #444);
  --splash-text-light: var(--color-text-tertiary, #666);
  --splash-bg: var(--color-bg, #fff);
  --splash-border: var(--color-border, #e5e5e5);
  --splash-badge-bg: var(--splash-accent);
  --splash-badge-text: #fff;
  --splash-cta-bg: var(--color-primary-gradient, linear-gradient(135deg, var(--splash-primary), var(--splash-primary-dark)));
  --splash-cta-text: #fff;
  --splash-cta-shadow: rgba(27, 94, 32, 0.3);
  --splash-close-bg: var(--color-bg-card, rgba(255, 255, 255, 0.9));
  --splash-close-text: var(--color-text, #333);
}

/* ==========================================================================
   BASE OVERLAY (shared)
   ========================================================================== */
.splash-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--splash-z);
  background: var(--splash-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  animation: splashFadeIn var(--splash-transition) forwards;
  font-family: var(--splash-font);
}
@keyframes splashFadeIn { from { opacity: 0; } to { opacity: 1; } }

.splash-overlay[data-frame="full"] { align-items: stretch; justify-content: stretch; padding: 0; }

/* ==========================================================================
   FRAME: CARD (modal centralizado)
   ========================================================================== */
.splash-overlay[data-frame="card"] .splash-modal {
  background: var(--splash-bg);
  border-radius: var(--splash-radius);
  box-shadow: var(--splash-shadow);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  animation: splashPopIn var(--splash-transition) forwards;
  display: flex;
  flex-direction: column;
}
@keyframes splashPopIn { to { transform: scale(1); } }

.splash-overlay[data-frame="card"] .splash-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--splash-cta-bg);
  flex-shrink: 0;
}
.splash-overlay[data-frame="card"] .splash-image[src=""],
.splash-overlay[data-frame="card"] .splash-image:not([src]) { display: none; }

.splash-overlay[data-frame="card"] .splash-content {
  padding: 28px 24px;
  text-align: center;
  overflow-y: auto;
  flex: 1;
}

.splash-overlay[data-frame="card"] .splash-badge {
  display: inline-block;
  background: var(--splash-badge-bg);
  color: var(--splash-badge-text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.splash-overlay[data-frame="card"] .splash-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--splash-primary);
  line-height: 1.2;
  margin-bottom: 10px;
}

.splash-overlay[data-frame="card"] .splash-subtitle {
  color: var(--splash-text-muted);
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 22px;
}

.splash-overlay[data-frame="card"] .splash-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  font-size: 0.85rem;
  color: var(--splash-text-light);
}
.splash-overlay[data-frame="card"] .splash-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.splash-overlay[data-frame="card"] .splash-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--splash-cta-bg);
  color: var(--splash-cta-text);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 16px var(--splash-cta-shadow);
  border: none;
  cursor: pointer;
}
.splash-overlay[data-frame="card"] .splash-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px var(--splash-cta-shadow);
}
.splash-overlay[data-frame="card"] .splash-cta:focus-visible {
  outline: 3px solid var(--splash-accent);
  outline-offset: 3px;
}

.splash-overlay[data-frame="card"] .splash-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--splash-close-bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--splash-close-text);
  transition: background 0.2s, transform 0.2s;
  z-index: 1;
}
.splash-overlay[data-frame="card"] .splash-close:hover {
  background: var(--splash-bg);
  transform: rotate(90deg);
}
.splash-overlay[data-frame="card"] .splash-close:focus-visible {
  outline: 3px solid var(--splash-accent);
  outline-offset: 2px;
}

/* ==========================================================================
   FRAME: FULL (tela cheia)
   ========================================================================== */
.splash-overlay[data-frame="full"] .splash-modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  background: var(--splash-bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.splash-overlay[data-frame="full"] .splash-image {
  width: 100%;
  height: 60vh;
  min-height: 300px;
  max-height: 500px;
  object-fit: cover;
  background: var(--splash-cta-bg);
  flex-shrink: 0;
}
.splash-overlay[data-frame="full"] .splash-image[src=""],
.splash-overlay[data-frame="full"] .splash-image:not([src]) { display: none; }

.splash-overlay[data-frame="full"] .splash-content {
  padding: 40px 24px;
  text-align: center;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.splash-overlay[data-frame="full"] .splash-badge {
  margin-bottom: 16px;
}
.splash-overlay[data-frame="full"] .splash-title {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 16px;
}
.splash-overlay[data-frame="full"] .splash-subtitle {
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto 28px;
}
.splash-overlay[data-frame="full"] .splash-meta {
  gap: 24px;
  margin-bottom: 32px;
  font-size: 1rem;
}
.splash-overlay[data-frame="full"] .splash-cta {
  padding: 16px 36px;
  font-size: 1.1rem;
  align-self: center;
}

.splash-overlay[data-frame="full"] .splash-close {
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  background: var(--splash-close-bg);
}

/* ==========================================================================
   FRAME: BOTTOM-SHEET (mobile-first, desliza de baixo)
   ========================================================================== */
.splash-overlay[data-frame="bottom-sheet"] {
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0;
}
.splash-overlay[data-frame="bottom-sheet"] .splash-modal {
  width: 100%;
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--splash-radius) var(--splash-radius) 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  background: var(--splash-bg);
  transform: translateY(100%);
  animation: splashSlideUp var(--splash-transition) forwards;
  display: flex;
  flex-direction: column;
}
@keyframes splashSlideUp { to { transform: translateY(0); } }

.splash-overlay[data-frame="bottom-sheet"] .splash-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--splash-cta-bg);
  flex-shrink: 0;
  border-radius: var(--splash-radius) var(--splash-radius) 0 0;
}
.splash-overlay[data-frame="bottom-sheet"] .splash-image[src=""],
.splash-overlay[data-frame="bottom-sheet"] .splash-image:not([src]) { display: none; }

.splash-overlay[data-frame="bottom-sheet"] .splash-content {
  padding: 24px 20px;
  text-align: center;
  overflow-y: auto;
  flex: 1;
}

.splash-overlay[data-frame="bottom-sheet"] .splash-handle {
  width: 40px;
  height: 4px;
  background: var(--splash-border);
  border-radius: 2px;
  margin: 0 auto 16px;
  flex-shrink: 0;
}

.splash-overlay[data-frame="bottom-sheet"] .splash-title {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  margin-bottom: 8px;
}
.splash-overlay[data-frame="bottom-sheet"] .splash-subtitle {
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.splash-overlay[data-frame="bottom-sheet"] .splash-meta {
  gap: 12px;
  margin-bottom: 18px;
  font-size: 0.8rem;
}
.splash-overlay[data-frame="bottom-sheet"] .splash-cta {
  width: 100%;
  justify-content: center;
  padding: 16px;
  font-size: 1rem;
  border-radius: 999px;
}

.splash-overlay[data-frame="bottom-sheet"] .splash-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  font-size: 1.4rem;
}

/* ==========================================================================
   FRAME: SIDE-PANEL (painel lateral direito, desktop)
   ========================================================================== */
.splash-overlay[data-frame="side-panel"] {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}
.splash-overlay[data-frame="side-panel"] .splash-modal {
  width: 420px;
  max-width: 90vw;
  height: 100%;
  max-height: none;
  border-radius: 0;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
  background: var(--splash-bg);
  transform: translateX(100%);
  animation: splashSlideLeft var(--splash-transition) forwards;
  display: flex;
  flex-direction: column;
}
@keyframes splashSlideLeft { to { transform: translateX(0); } }

.splash-overlay[data-frame="side-panel"] .splash-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: var(--splash-cta-bg);
  flex-shrink: 0;
}
.splash-overlay[data-frame="side-panel"] .splash-image[src=""],
.splash-overlay[data-frame="side-panel"] .splash-image:not([src]) { display: none; }

.splash-overlay[data-frame="side-panel"] .splash-content {
  padding: 32px 28px;
  text-align: left;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.splash-overlay[data-frame="side-panel"] .splash-badge {
  margin-bottom: 16px;
}
.splash-overlay[data-frame="side-panel"] .splash-title {
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
  margin-bottom: 12px;
  text-align: left;
}
.splash-overlay[data-frame="side-panel"] .splash-subtitle {
  font-size: 0.95rem;
  margin-bottom: 24px;
  text-align: left;
}
.splash-overlay[data-frame="side-panel"] .splash-meta {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 28px;
  font-size: 0.85rem;
}
.splash-overlay[data-frame="side-panel"] .splash-cta {
  width: 100%;
  justify-content: center;
  padding: 14px 24px;
  font-size: 1rem;
}
.splash-overlay[data-frame="side-panel"] .splash-close {
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 640px) {
  .splash-overlay[data-frame="side-panel"] .splash-modal { width: 100%; max-width: 100%; }
  .splash-overlay[data-frame="side-panel"] { justify-content: stretch; }
}

@media (max-width: 480px) {
  .splash-overlay[data-frame="card"] .splash-modal { margin: 10px; }
  .splash-overlay[data-frame="full"] .splash-content { padding: 24px 16px; }
}

/* ==========================================================================
   ACCESSIBILITY — prefers-reduced-motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .splash-overlay,
  .splash-overlay .splash-modal {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ==========================================================================
   FOCUS TRAP HELPER (aplicado via JS)
   ========================================================================== */
.splash-focus-trap { position: fixed; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }