/* ===================================
   MECSTAR — Premium Custom Styles
   =================================== */

/* ---------- Root & Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #D0021B #111111;
}

::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: #0A0A0A;
}
::-webkit-scrollbar-thumb {
  background: #D0021B;
  border-radius: 2px;
}

::selection {
  background: #D0021B;
  color: #fff;
}

/* ---------- Typography ---------- */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Header Scroll States ---------- */
#header {
  background: transparent;
  backdrop-filter: none;
  border-bottom: 1px solid transparent;
}

#header.scrolled {
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(42, 42, 42, 0.8);
  box-shadow: 0 2px 40px rgba(0, 0, 0, 0.6);
}

/* ---------- Nav Links Underline ---------- */
.nav-link {
  position: relative;
  padding-bottom: 2px;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: #D0021B;
  transition: width 0.3s ease;
}
.nav-link:hover::after {
  width: 100%;
}
.nav-link.active {
  color: #fff;
}
.nav-link.active::after {
  width: 100%;
}

/* ---------- Mobile Menu ---------- */
#mobile-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.ham-open .ham-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.ham-open .ham-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.ham-open .ham-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -4px);
  width: 24px;
}

/* ---------- Hero Video ---------- */
#hero-video {
  transition: none;
}

/* =============================================================
   HERO SECTION — Background Canvas Cinematográfico
   Canvas no fundo, textos flutuando sobre overlay escuro
   ============================================================= */

/*
 * O canvas é posicionado via Tailwind no HTML:
 *   absolute inset-0 w-full h-full z-0
 * Esta regra garante que drawImageCover funciona correctamente:
 * o canvas ocupa SEMPRE a totalidade do viewport sticky.
 */
#hero-canvas {
  /* Tailwind já aplica: position absolute, inset 0, z-index 0 */
  display: block;
  pointer-events: none;    /* nunca bloqueia cliques */
  object-fit: cover;       /* referência semântica; o JS faz o cover real */
}

/* Botões — z-index de segurança absoluto */
.hero-ctas {
  position: relative;
  z-index: 20;
}

/* Garante que o sticky tem pelo menos a altura do ecrã,
   mesmo em navegadores que interpretem min-h-screen de forma diferente */
#video-sticky {
  min-height: 100svh;      /* svh = small viewport height — melhor em mobile */
}

/* Pequenos ecrãs: aumenta o padding-top para o header não tapar o badge */
@media (max-width: 639px) {
  #video-sticky > .relative.z-20 {
    padding-top: 96px;
    padding-bottom: 56px;
  }
}


/* ---------- Scroll Indicator Animation ---------- */
.scroll-ind {
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.5; transform: scaleY(1); }
  50%       { opacity: 1;   transform: scaleY(1.15); }
}

/* ---------- Service Cards ---------- */
.service-card {
  position: relative;
  overflow: hidden;
}
.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 0;
  background: #D0021B;
  transition: height 0.4s ease;
}
.service-card:hover::before {
  height: 100%;
}

/* ---------- Reveal Animations ---------- */
.reveal-up,
.reveal-left,
.reveal-right {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-up    { transform: translateY(40px); }
.reveal-left  { transform: translateX(-50px); }
.reveal-right { transform: translateX(50px); }

.reveal-up.visible,
.reveal-left.visible,
.reveal-right.visible {
  opacity: 1;
  transform: translate(0);
}

/* ---------- Stat Counters ---------- */
.counter {
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

/* ---------- Contact Items ---------- */
.contact-item {
  transition: all 0.3s ease;
}
.contact-item:hover {
  transform: translateX(4px);
}

/* ---------- Social Buttons ---------- */
.social-btn {
  position: relative;
  overflow: hidden;
}
.social-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(208, 2, 27, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.social-btn:hover::after {
  opacity: 1;
}

/* ---------- Maps Dark Filter ---------- */
.grayscale-map-wrap {
  position: relative;
  background: #111;
}
.grayscale-map-wrap iframe {
  transition: filter 0.4s ease;
}
.grayscale-map-wrap:hover iframe {
  filter: grayscale(60%) invert(80%) contrast(0.9) !important;
}

/* ---------- WhatsApp FAB ---------- */
#whatsapp-fab {
  will-change: transform;
}
#whatsapp-fab:active {
  transform: scale(0.95);
}

/* ---------- Back to Top ---------- */
#back-to-top.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
#back-to-top:active {
  transform: scale(0.9);
}

/* ---------- Section Transitions ---------- */
section {
  position: relative;
}

/* ---------- Red accent line on page ---------- */
.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, #D0021B, transparent);
}

/* ---------- Image hover zoom ----------
   Aplicado apenas a imagens dentro de .reveal-right e secções específicas,
   para não interferir com o canvas da Hero.
   --------------------------------------- */
.reveal-right img,
.reveal-left img,
#sobre img {
  transition: transform 0.6s ease;
}
.reveal-right img:hover,
.reveal-left img:hover,
#sobre img:hover {
  transform: scale(1.02);
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 768px) {
  h1.hero-title {
    font-size: 2.8rem;
    line-height: 1.1;
  }
}

@media (max-width: 480px) {
  h1.hero-title {
    font-size: 2.2rem;
  }
}

/* ---------- Print ---------- */
@media print {
  #header, #whatsapp-fab, #back-to-top { display: none !important; }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
