/* ============================================================
   PAGE LOAD
   ============================================================ */
@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body { animation: pageFadeIn 0.4s ease forwards; }

/* ============================================================
   THEME TRANSITION OVERLAY
   ============================================================ */
#theme-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  clip-path: circle(0% at 50% 50%);
  will-change: clip-path;
}

/* ============================================================
   MARQUEE — seamless infinite loop
   ============================================================ */
@keyframes marquee-loop {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
/* Override Tailwind's marquee to use the correct keyframe name */
.animate-marquee {
  animation: marquee-loop 15s linear infinite !important;
}
.animate-marquee-slow {
  animation: marquee-loop 30s linear infinite !important;
}

/* ============================================================
   GLOBAL TRANSITIONS
   ============================================================ */
body,
nav,
section:not(#hero-container),
.bento-card {
  transition:
    background-color 0.45s ease,
    color 0.45s ease,
    border-color 0.45s ease;
}

/* ============================================================
   THEME VARIABLES — Original 4
   ============================================================ */
/* --stat-color: number color in the dark stats section.
   Most themes: use accent. Dark-accent themes (minimal, scandinavian): use a light tint. */
:root { --stat-color: var(--accent); }
:root[data-theme='minimal']      { --stat-color: #e8e4dc; }
:root[data-theme='scandinavian'] { --stat-color: #e0ddd8; }

:root[data-theme='saas'] {
  --bg-base: #f7f9fb;
  --bg-card: #ffffff;
  --text-main: #191c1e;
  --text-muted: #484455;
  --accent: #521bda;
  --accent-text: #ffffff;
  --border-color: #e0e3e5;
  --border-width: 1px;
  --radius-card: 1rem;
  --radius-button: 9999px;
  --shadow-card: 0 4px 20px rgba(82,27,218,0.05);
  --shadow-hover: 0 16px 40px rgba(82,27,218,0.12);
  --hover-y: -4px;
  --hover-x: 0px;
  --font-heading: '"Plus Jakarta Sans"', sans-serif;
  --font-body: '"Inter"', sans-serif;
}

:root[data-theme='editorial'] {
  --bg-base: #f7f5f0;
  --bg-card: #ffffff;
  --text-main: #2c2c2c;
  --text-muted: #6b6b6b;
  --accent: #5a6b5d;
  --accent-text: #ffffff;
  --border-color: #e6e2d8;
  --border-width: 1px;
  --radius-card: 0px;
  --radius-button: 0px;
  --shadow-card: 0 4px 20px rgba(0,0,0,0.02);
  --shadow-hover: 0 10px 30px rgba(0,0,0,0.08);
  --hover-y: -2px;
  --hover-x: 0px;
  --font-heading: '"Playfair Display"', serif;
  --font-body: '"Lato"', sans-serif;
}

:root[data-theme='brutalist'] {
  --bg-base: #ffffff;
  --bg-card: #ffffff;
  --text-main: #000000;
  --text-muted: #000000;
  --accent: #ffe600;
  --accent-text: #000000;
  --border-color: #000000;
  --border-width: 4px;
  --radius-card: 0px;
  --radius-button: 0px;
  --shadow-card: 8px 8px 0px 0px #000000;
  --shadow-hover: 2px 2px 0px 0px #000000;
  --hover-y: 6px;
  --hover-x: 6px;
  --font-heading: '"Archivo Black"', sans-serif;
  --font-body: '"Space Grotesk"', sans-serif;
}

:root[data-theme='retropop'] {
  --bg-base: #f4e8ff;
  --bg-card: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #4a4a4a;
  --accent: #ff90e8;
  --accent-text: #1a1a1a;
  --border-color: #1a1a1a;
  --border-width: 3px;
  --radius-card: 24px;
  --radius-button: 9999px;
  --shadow-card: 4px 4px 0px 0px #1a1a1a;
  --shadow-hover: 0px 0px 0px 0px #1a1a1a;
  --hover-y: 4px;
  --hover-x: 4px;
  --font-heading: '"Fredoka"', sans-serif;
  --font-body: '"Quicksand"', sans-serif;
}

/* ============================================================
   THEME VARIABLES — 5 from JSON + 1 Minimal Luxury bonus
   ============================================================ */

/* Swiss Typography Fintech — qonto.com */
:root[data-theme='swiss-fintech'] {
  --bg-base: #ffffff;
  --bg-card: #faf9ff;
  --text-main: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #6b41f2;
  --accent-text: #ffffff;
  --border-color: #ede9ff;
  --border-width: 1px;
  --radius-card: 12px;
  --radius-button: 8px;
  --shadow-card: 0 2px 20px rgba(107,65,242,0.07);
  --shadow-hover: 0 12px 40px rgba(107,65,242,0.18);
  --hover-y: -4px;
  --hover-x: 0px;
  --font-heading: '"Syne"', sans-serif;
  --font-body: '"DM Sans"', sans-serif;
}

/* Minimalismo Escandinavo — stringfurniture.com */
:root[data-theme='scandinavian'] {
  --bg-base: #fafafa;
  --bg-card: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #888888;
  --accent: #1a1a1a;
  --accent-text: #ffffff;
  --border-color: #dedede;
  --border-width: 1px;
  --radius-card: 0px;
  --radius-button: 0px;
  --shadow-card: none;
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.07);
  --hover-y: -2px;
  --hover-x: 0px;
  --font-heading: '"Cormorant Garamond"', serif;
  --font-body: '"DM Sans"', sans-serif;
}

/* Vintage Rustic Chic — bakeribrooklyn.com */
:root[data-theme='rustic'] {
  --bg-base: #fdfcf7;
  --bg-card: #faf8f2;
  --text-main: #2c2218;
  --text-muted: #8a7260;
  --accent: #4a5d7c;
  --accent-text: #fdfcf7;
  --border-color: #d8c9aa;
  --border-width: 1px;
  --radius-card: 2px;
  --radius-button: 2px;
  --shadow-card: 0 2px 16px rgba(44,34,24,0.06);
  --shadow-hover: 0 8px 28px rgba(44,34,24,0.12);
  --hover-y: -2px;
  --hover-x: 0px;
  --font-heading: '"IM Fell English"', serif;
  --font-body: '"Lora"', serif;
}

/* Eco-Tech Minimalist — airsign.co */
:root[data-theme='eco-tech'] {
  --bg-base: #f0f5ec;
  --bg-card: #ffffff;
  --text-main: #1a2214;
  --text-muted: #5a6e50;
  --accent: #2d6a3f;
  --accent-text: #ffffff;
  --border-color: #ccdfc0;
  --border-width: 1px;
  --radius-card: 18px;
  --radius-button: 9999px;
  --shadow-card: 0 4px 28px rgba(45,106,63,0.07);
  --shadow-hover: 0 16px 44px rgba(45,106,63,0.14);
  --hover-y: -5px;
  --hover-x: 0px;
  --font-heading: '"Outfit"', sans-serif;
  --font-body: '"Outfit"', sans-serif;
}

/* Lúdico e Moderno — littlebagelco.co.uk */
:root[data-theme='playful-modern'] {
  --bg-base: #fffcf0;
  --bg-card: #ffffff;
  --text-main: #0a0a0a;
  --text-muted: #444444;
  --accent: #ff7b54;
  --accent-text: #0a0a0a;
  --border-color: #0a0a0a;
  --border-width: 3px;
  --radius-card: 14px;
  --radius-button: 10px;
  --shadow-card: 5px 5px 0px 0px #0a0a0a;
  --shadow-hover: 0px 0px 0px 0px #0a0a0a;
  --hover-y: 5px;
  --hover-x: 5px;
  --font-heading: '"Paytone One"', sans-serif;
  --font-body: '"Nunito"', sans-serif;
}

/* Minimal Luxury — bonus */
:root[data-theme='minimal'] {
  --bg-base: #f7f5f1;
  --bg-card: #fefefe;
  --text-main: #1c1b18;
  --text-muted: #a09990;
  --accent: #1c1b18;
  --accent-text: #f7f5f1;
  --border-color: #e4dfd6;
  --border-width: 1px;
  --radius-card: 0px;
  --radius-button: 0px;
  --shadow-card: none;
  --shadow-hover: 0 12px 48px rgba(28,27,24,0.09);
  --hover-y: -3px;
  --hover-x: 0px;
  --font-heading: '"Inter"', sans-serif;
  --font-body: '"Inter"', sans-serif;
}
/* Inter thin — cap heading/body weight for minimal identity */
:root[data-theme='minimal'] .font-heading { font-weight: 200 !important; letter-spacing: -0.04em; }
:root[data-theme='minimal'] .font-body    { font-weight: 300; }
:root[data-theme='minimal'] h1,
:root[data-theme='minimal'] h2,
:root[data-theme='minimal'] h3 { font-weight: 200 !important; }

/* ============================================================
   UTILITY: BENTO CARD
   ============================================================ */
.bento-card {
  background-color: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition:
    box-shadow 0.22s ease,
    transform 0.22s ease,
    background-color 0.45s ease,
    border-color 0.45s ease;
}
.bento-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translate(var(--hover-x), var(--hover-y));
}

/* ============================================================
   UTILITY: PRIMARY BUTTON
   ============================================================ */
.btn-primary {
  background-color: var(--accent);
  color: var(--accent-text);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-button);
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-weight: bold;
  cursor: pointer;
}
.btn-primary:hover {
  box-shadow: var(--shadow-hover);
  transform: translate(var(--hover-x), var(--hover-y));
}
/* Active press physics (rule: physics-active-state) */
.btn-primary:active {
  transform: scale(0.96) !important;
  box-shadow: var(--shadow-card);
  transition-duration: 0.1s;
}

/* ============================================================
   HERO VARIANTS
   ============================================================ */
.hero-variant {
  display: none;
  opacity: 0;
}
.hero-variant.active {
  display: block;
  animation: heroReveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes heroReveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
/* Scale variant — for cards and prominent elements */
.reveal.reveal-scale {
  transform: translateY(20px) scale(0.96);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }
.reveal-delay-5 { transition-delay: 0.40s; }
.reveal-delay-6 { transition-delay: 0.48s; }

/* ============================================================
   REDUCED MOTION — respect user preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .animate-marquee,
  .animate-marquee-slow {
    animation-duration: 60s !important;
  }
  #theme-overlay {
    display: none;
  }
}

/* ============================================================
   THEME SWITCHER ACTIVE STATE
   ============================================================ */
.theme-btn {
  position: relative;
  cursor: pointer;
  transition: all 0.22s ease;
}
.theme-btn.is-active {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.theme-btn::after {
  content: 'Ativo';
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}
.theme-btn.is-active::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   BLOB ANIMATION DELAYS
   ============================================================ */
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }

/* ============================================================
   PROCESS — Bento Card Grid
   ============================================================ */
.process-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 640px) {
  .process-grid { grid-template-columns: 1fr; }
}

.process-card {
  position: relative;
  overflow: hidden;
  padding: 2rem;
  background-color: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  opacity: 1;
  transition:
    box-shadow 0.22s ease,
    transform 0.22s ease,
    opacity 0.22s ease,
    background-color 0.45s ease,
    border-color 0.45s ease;
}
/* Hidden before JS triggers the animation */
#processGrid:not(.is-visible) .process-card {
  opacity: 0;
  transform: translateY(36px) scale(0.94);
  pointer-events: none;
}
#processGrid:not(.is-visible) .process-icon {
  transform: scale(0);
  opacity: 0;
}
.process-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translate(var(--hover-x), var(--hover-y));
}
/* Active press physics (rule: physics-active-state) */
.process-card:active {
  transform: scale(0.97) !important;
  box-shadow: var(--shadow-card);
  transition-duration: 0.12s;
}

/* Large decorative step number */
.process-bg-num {
  position: absolute;
  bottom: -1.25rem;
  right: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 7rem;
  line-height: 1;
  color: var(--text-main);
  opacity: 0.045;
  pointer-events: none;
  user-select: none;
  font-variant-numeric: tabular-nums;
  transition: color 0.45s ease;
}

/* Accent icon container */
.process-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius-card) * 0.55);
  background-color: var(--accent);
  color: var(--accent-text);
  margin-bottom: 1.25rem;
  flex-shrink: 0;
  transform-origin: center;
  transition: background-color 0.45s ease;
}

/* "Passo 01" label */
.process-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
  transition: color 0.45s ease;
}

.process-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  text-transform: uppercase;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  transition: color 0.45s ease;
}

.process-desc {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
  transition: color 0.45s ease;
}

/* Card entrance: lift + fade */
@keyframes processCardIn {
  from { opacity: 0; transform: translateY(36px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Icon spring overshoot (rule: physics-spring-for-overshoot) */
@keyframes processIconIn {
  0%   { transform: scale(0) rotate(-18deg); }
  55%  { transform: scale(1.18) rotate(4deg); }
  78%  { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* Triggered when JS adds .is-visible to #processGrid */
#processGrid.is-visible .process-card {
  animation: processCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
#processGrid.is-visible .process-card:nth-child(1) { animation-delay: 0ms; }
#processGrid.is-visible .process-card:nth-child(2) { animation-delay: 70ms; }
#processGrid.is-visible .process-card:nth-child(3) { animation-delay: 140ms; }
#processGrid.is-visible .process-card:nth-child(4) { animation-delay: 210ms; }

#processGrid.is-visible .process-icon {
  animation: processIconIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
#processGrid.is-visible .process-card:nth-child(1) .process-icon { animation-delay: 200ms; }
#processGrid.is-visible .process-card:nth-child(2) .process-icon { animation-delay: 270ms; }
#processGrid.is-visible .process-card:nth-child(3) .process-icon { animation-delay: 340ms; }
#processGrid.is-visible .process-card:nth-child(4) .process-icon { animation-delay: 410ms; }

/* Reduced motion: skip animations, show immediately */
@media (prefers-reduced-motion: reduce) {
  #processGrid .process-card {
    opacity: 1;
    animation: none !important;
  }
  #processGrid .process-icon {
    animation: none !important;
  }
}

/* Full-height heroes (scandinavian, minimal) need display:flex when active */
#hero-scandinavian.active,
#hero-minimal.active {
  display: flex !important;
  flex-direction: column;
}
#hero-scandinavian.active > div,
#hero-minimal.active > div {
  flex: 1;
  min-height: inherit;
}

/* ============================================================
   STATS COUNTER SECTION
   ============================================================ */
.stat-number {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   TESTIMONIAL CARD
   ============================================================ */
.testimonial-card {
  background-color: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  transition: box-shadow 0.22s ease, transform 0.22s ease,
              background-color 0.45s ease, border-color 0.45s ease;
}
.testimonial-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translate(var(--hover-x), calc(var(--hover-y) * 0.5));
}
