@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -5%); }
  20% { transform: translate(-10%, 5%); }
  30% { transform: translate(5%, -10%); }
  40% { transform: translate(-5%, 15%); }
  50% { transform: translate(-10%, 5%); }
  60% { transform: translate(15%, 0); }
  70% { transform: translate(0, 10%); }
  80% { transform: translate(-15%, 0); }
  90% { transform: translate(10%, 5%); }
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  animation: grain 8s steps(10) infinite;
  will-change: transform;
}

/* ── Animações Globais ── */

/* Hero fade-in */
.hero-content, .page-hero-content {
  animation: fadeUp 0.8s ease-out both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stagger cards - cada card aparece com delay */
.service-card:nth-child(1) { animation-delay: 0.1s; }
.service-card:nth-child(2) { animation-delay: 0.2s; }
.service-card:nth-child(3) { animation-delay: 0.3s; }
.service-card:nth-child(4) { animation-delay: 0.4s; }
.service-card:nth-child(5) { animation-delay: 0.5s; }

/* Gallery hover zoom */
.gallery-item img {
  transition: transform 0.4s ease, filter 0.4s ease;
}
.gallery-item:hover img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* Feature icons pulse suave */
.desc-feature .icon {
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Pricing card glow (card featured) */
.pricing-card.featured {
  animation: glow 3s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(167, 139, 250, 0.1); }
  50% { box-shadow: 0 0 30px rgba(167, 139, 250, 0.2); }
}

/* Testimonials fade-in on scroll */
.testimonial-card {
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.testimonial-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Button glow hover */
.btn-primary:hover {
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
  transform: translateY(-2px);
}

/* Input focus glow */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #a78bfa !important;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}

/* Team card hover */
.team-card img {
  transition: transform 0.4s ease;
}
.team-card:hover img {
  transform: scale(1.05);
}

/* Active page indicator */
.header-nav a[style*="color:var(--color-white)"] {
  position: relative;
}
.header-nav a[style*="color:var(--color-white)"]::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: #a78bfa;
  border-radius: 1px;
}

/* Mobile menu animation */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 110;
}
.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #e0e0e5;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Stats counter - pulse on appear */
.stat-card .number {
  animation: countPulse 0.6s ease-out both;
}

/* Dark mode toggle (contraste) */
body.high-contrast {
  --color-bg: #000;
  --color-card: #0a0a0a;
  --color-border: #333;
  --color-muted: #bbb;
  --color-muted-dark: #888;
  --color-white: #fff;
}
body.high-contrast .header {
  background: rgba(0,0,0,0.95);
}
body.high-contrast .hero-bg img,
body.high-contrast .page-hero-bg img {
  opacity: 0.25;
}
.contrast-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #1e1e2a;
  background: #121218;
  color: #888;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.contrast-toggle:hover {
  border-color: #a78bfa;
  color: #a78bfa;
}
@keyframes countPulse {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Section reveal refinado */
.section {
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Header ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 110;
  height: var(--header-height);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(30, 30, 42, 0.5);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.header-logo img {
  height: 32px;
  width: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
}

.header-nav a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-decoration: none;
  padding: var(--spacing-2) var(--spacing-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.header-nav a:hover {
  color: var(--color-white);
  background: var(--accent-dim);
}

.header-cta {
  display: none;
  color: var(--color-white) !important;
}

@media (min-width: 768px) {
  .header-cta { display: inline-flex; }
}

/* ── Mobile menu ── */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

@media (min-width: 768px) {
  .menu-toggle { display: none; }
}

/* ── Hero ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--header-height);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
  z-index: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.15;
  transform: scale(1.05);
  animation: heroParallax 20s//* will-change auto-added */ ease-in-out infinite alternate;
}

@keyframes heroParallax {
  0% { transform: scale(1.05) translateY(0); }
  100% { transform: scale(1.1) translateY(-10px); }
}

.page-hero-bg img {
  transform: scale(1.05);
  animation: heroParallax 20s//* will-change auto-added */ ease-in-out infinite alternate;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--spacing-16) var(--container-padding);
}

.hero-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--spacing-6);
  border: 1px solid var(--color-accent-dim);
  background: var(--color-accent-dim);
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius-full);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: var(--weight-medium);
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--spacing-6);
  max-width: 900px;
}

.hero h1 .highlight {
  color: var(--color-accent);
}

/* Typewriter cursor */
#typewriter1, #typewriter2 {
  border-right: 2px solid var(--color-accent);
  animation: blink 0.8s step-end infinite;
}
@keyframes blink {
  50% { border-color: transparent; }
}

.hero p {
  font-size: var(--text-lg);
  color: var(--color-muted);
  max-width: 600px;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--spacing-8);
}

.hero-actions {
  display: flex;
  gap: var(--spacing-4);
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: var(--spacing-8);
  margin-top: var(--spacing-12);
  padding-top: var(--spacing-8);
  border-top: 1px solid var(--color-border);
}

.hero-stat h3 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-white);
  line-height: 1;
  margin-bottom: var(--spacing-1);
}

.hero-stat p {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin: 0;
}

/* ── Services Section ── */
.services {
  background: var(--color-dark);
}

.section-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--spacing-3);
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: var(--weight-medium);
  margin-bottom: var(--spacing-4);
}

.section-subtitle {
  color: var(--color-muted);
  font-size: var(--text-base);
  max-width: 600px;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--spacing-12);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-6);
}

.service-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.service-card:hover {
  background: var(--color-card-hover);
  border-color: var(--color-accent-dim);
  transform: translateY(-4px);
}

.service-card-image {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  aspect-ratio: 9/16;
  object-fit: cover;
  display: block;
}

.service-card-video {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  aspect-ratio: 9/16;
  overflow: hidden;
  position: relative;
}

.service-card-video iframe {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.service-card-body {
  padding: var(--spacing-6);
}

.service-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-4);
  font-size: 1.2rem;
  color: var(--color-accent);
}

.desc-feature .icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--color-accent);
}

.service-item .icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--color-accent);
}

.service-card h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  margin-bottom: var(--spacing-2);
}

.service-card p {
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  margin: 0;
}

.service-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  margin-top: var(--spacing-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.service-card:hover .card-link {
  gap: var(--spacing-3);
}

/* ── Gallery Section ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-3);
}

@media (max-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.95);
  justify-content: center;
  align-items: center;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  z-index: 201;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.lightbox-close:hover {
  opacity: 1;
}

/* ── Testimonials Section ── */
.testimonials {
  background: var(--color-dark);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-6);
}

.testimonial-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  transition: all var(--transition-base);
}

.testimonial-card:hover {
  border-color: var(--color-accent-dim);
}

.testimonial-card .quote {
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--spacing-4);
  font-style: italic;
}

.testimonial-card .author {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.testimonial-card .author-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: var(--weight-bold);
  color: var(--color-accent);
}

.testimonial-card .author-info h4 {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin: 0;
}

.testimonial-card .author-info span {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ── CTA Section ── */
.cta-section {
  text-align: center;
  padding: var(--spacing-20) 0;
}

.cta-section h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: var(--spacing-4);
}

.cta-section p {
  color: var(--color-muted);
  max-width: 500px;
  margin: 0 auto var(--spacing-8);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.cta-section .btn {
  font-size: var(--text-base);
  padding: var(--spacing-4) var(--spacing-8);
}

/* ── Back to Top ── */
.back-to-top {
  position: fixed;
  bottom: var(--spacing-8);
  right: var(--spacing-8);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent-dim);
  border: 1px solid var(--color-border);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  z-index: 100;
  font-size: 1.2rem;
  text-decoration: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-accent);
  color: var(--color-white);
  border-color: var(--color-accent);
}

/* ── Footer ── */
.footer {
  background: var(--color-dark);
  border-top: 1px solid var(--color-border);
  padding: var(--spacing-16) 0 var(--spacing-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--spacing-8);
  margin-bottom: var(--spacing-12);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-8);
  }
}

.footer-brand p {
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: var(--leading-relaxed);
  max-width: 350px;
  margin-top: var(--spacing-4);
}

.footer-col h4 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--spacing-4);
}

.footer-col a {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-decoration: none;
  padding: var(--spacing-1) 0;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--color-white);
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: var(--spacing-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-4);
}

.footer-bottom p {
  font-size: var(--text-xs);
  color: var(--color-muted-dark);
  margin: 0;
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

.animate-in-fast {
  animation: fadeIn 0.4s ease forwards;
}

/* Stagger children */
.stagger > * {
  opacity: 0;
}

.stagger > *:nth-child(1) { animation: fadeInUp 0.5s ease 0.1s forwards; }
.stagger > *:nth-child(2) { animation: fadeInUp 0.5s ease 0.2s forwards; }
.stagger > *:nth-child(3) { animation: fadeInUp 0.5s ease 0.3s forwards; }
.stagger > *:nth-child(4) { animation: fadeInUp 0.5s ease 0.4s forwards; }
.stagger > *:nth-child(5) { animation: fadeInUp 0.5s ease 0.5s forwards; }

/* Service cards hover enhancement */
.service-card {
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.service-card:hover {
  box-shadow: 0 8px 30px rgba(167,139,250,0.1);
}

/* Gallery item hover overlay */
.gallery-item::after {
  content: '+';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  background: rgba(0,0,0,0);
  transition: background var(--transition-base);
  opacity: 0;
}

.gallery-item:hover::after {
  background: rgba(0,0,0,0.3);
  opacity: 1;
}

/* Hero entrance */
.hero-content {
  animation: fadeInUp 0.8s ease 0.2s both;
}

.hero-stats {
  animation: fadeInUp 0.6s ease 0.6s both;
}

/* Section transitions */
.section {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

.footer-social {
  display: flex;
  gap: var(--spacing-4);
}

.footer-social a {
  color: var(--color-muted);
  text-decoration: none;
  font-size: var(--text-base);
  transition: color var(--transition-fast);
}

.footer-social a:hover {
  color: var(--color-white);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-nav {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: #0a0a0a;
    border-left: 1px solid #1e1e2a;
    flex-direction: column;
    align-items: flex-start;
    padding: 80px 32px 32px;
    gap: 8px;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 105;
  }
  .header-nav.open {
    transform: translateX(0);
    opacity: 1;
  }
  .header-nav a {
    font-size: 16px;
    width: 100%;
  }
  .header-cta {
    display: flex !important;
    margin-top: 16px;
    width: 100%;
    justify-content: center;
  }
  body.menu-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 104;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-stats {
    flex-direction: column;
    gap: var(--spacing-4);
    align-items: center;
    width: 100%;
  }
  .hero-stat {
    width: 100%;
  }
  .hero-stat p {
    word-break: break-word;
    font-size: 12px;
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: normal;
  }
  .hero h1 { font-size: clamp(1.3rem, 7vw, 2rem); word-break: break-word; }
  .hero h1 .highlight {
    word-break: break-word;
  }
  .hero-tag {
    font-size: 10px;
    white-space: normal;
  }
  .hero p {
    font-size: var(--text-sm);
    word-break: break-word;
  }
  .service-card h3 {
    font-size: var(--text-sm);
    word-break: break-word;
  }
}