/* Kedma Tech — style.css (Fase 1: Tailwind via CDN + customs) */

:root {
  --kedma-blue: #1687FF;
  --kedma-deep: #0B4FC4;
  --kedma-navy: #010817;
  --kedma-bg-light: #EDF1F7;
}

html { scroll-behavior: smooth; }
body { font-family: 'Nexa', ui-sans-serif, system-ui, sans-serif; }

/* Nexa — fonte da marca (woff2 locais) */
@font-face {
  font-family: 'Nexa';
  src: url('../fonts/Nexa-ExtraLight.woff2') format('woff2');
  font-weight: 200 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nexa';
  src: url('../fonts/Nexa-Heavy.woff2') format('woff2');
  font-weight: 600 900;
  font-style: normal;
  font-display: swap;
}

/* Esconde scrollbar da fila de tabs mas mantém scroll */
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

@keyframes sweep-reflection {
  0% { transform: translateX(-160%) skewX(-22deg); opacity: 0; }
  10% { opacity: 1; }
  28% { transform: translateX(260%) skewX(-22deg); opacity: 0; }
  100% { transform: translateX(260%) skewX(-22deg); opacity: 0; }
}
.animate-sweep { animation: sweep-reflection 4.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
.animate-sweep-delayed { animation: sweep-reflection 4.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 2.25s; }

@keyframes float-gentle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}
.animate-float-gentle { animation: float-gentle 6s ease-in-out infinite; }

/* Tecnologia e Softwares: acentos sempre em azul elétrico */
#solucoes-panels .group:hover {
  border-color: #1687FF8C;
  box-shadow: 6px 6px 0 -1px rgba(22, 135, 255, 0.18);
}
#solucoes-panels .sol-tile { background-color: #DEEEFF; border: 1px solid #B4D9FF; }

@keyframes hero-enter {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 767px) {
  .hero-mobile-enter { animation: hero-enter 0.9s ease-out both; }
  [data-solucoes-tabs] {
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-mobile-enter { animation: none; }
}

#solucoes-panels .group::before {
  content: "";
  position: absolute;
  top: 0; left: 2rem; right: 2rem;
  height: 2px; border-radius: 9999px;
  background: linear-gradient(to right, transparent, #1687FF, transparent);
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
#solucoes-panels .group:hover::before { opacity: 1; }
#solucoes-panels .group h3 { color: #0B4FC4; }
#solucoes-panels .group h3 span { color: inherit; }
#solucoes-panels .sol-tile .sol-ico { color: #1687FF; }

/* Hero — slideshow de slides de produto (crossfade) */
.hero-slides { position: absolute; inset: 0; overflow: hidden; }
.hero-slide {
  position: absolute; inset: 0;
  opacity: 0; transition: opacity 1.1s ease-in-out;
}
.hero-slide.is-active { opacity: 1; }
.hero-slide img {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 72% 45%;
  -webkit-user-select: none; user-select: none; pointer-events: none;
}
@media (max-width: 767px) {
  .hero-slide img { object-position: 60% 40%; }
}
/* Imagens panorâmicas 21:9: preenchem a hero sem moldura; as extremidades
   já trazem um gradiente esbatido no próprio ficheiro, sem fundo duplicado. */
.hero-slide--product img { object-position: 50% 50%; }
@media (max-width: 767px) {
  .hero-slide--inogest img { object-position: 78% 50%; }
  .hero-slide--mandaflow img { object-position: 66% 50%; }
  .hero-slide--loja img { object-position: 42% 50%; }
}
/* Veus da legenda: so no mobile, onde o recorte deixa zonas ocupadas.
   No desktop e tablet o panorama ve-se sem qualquer camada por cima. */
@media (max-width: 767px) {
  .hero-caption__scrim[data-hero-scrim="inogest"] {
    background: linear-gradient(to top, rgba(10, 28, 110, 0.90), rgba(10, 28, 110, 0.55), rgba(10, 28, 110, 0));
  }
  .hero-caption__scrim[data-hero-scrim="mandaflow"] {
    background: linear-gradient(to top, rgba(110, 17, 4, 0.85), rgba(110, 17, 4, 0.50), rgba(110, 17, 4, 0));
  }
  .hero-caption__scrim[data-hero-scrim="loja"] {
    background: linear-gradient(to top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.70), rgba(255, 255, 255, 0));
  }
}
/* Legenda do slide activo — crossfade sincronizado com a imagem.
   visibility retira os links da legenda inactiva do fluxo de foco. */
.hero-caption {
  opacity: 0; visibility: hidden;
  transition: opacity 0.9s ease-in-out, visibility 0s linear 0.9s;
}
.hero-caption.is-active {
  opacity: 1; visibility: visible;
  transition: opacity 0.9s ease-in-out;
}
/* Sem JS: mostra o slide marcado no markup e esconde os controlos */
.hero-slideshow__controls { display: none; }
.hero-slideshow--ready .hero-slideshow__controls { display: flex; }
.hero-dot {
  width: 22px; height: 3px;
  background: rgba(255, 255, 255, 0.28);
  border: 0; padding: 0; cursor: pointer;
  transition: background 0.3s ease;
}
.hero-dot:hover { background: rgba(255, 255, 255, 0.55); }
.hero-dot.is-active { background: #1687FF; }
.hero-dot:focus-visible { outline: 2px solid #1687FF; outline-offset: 3px; }
.hero-arrow {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(1, 8, 23, 0.35);
  cursor: pointer;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.hero-arrow:hover { color: #fff; border-color: #1687FF; }
.hero-arrow:focus-visible { outline: 2px solid #1687FF; outline-offset: 2px; }
/* Tema dos controlos conforme o fundo do slide activo (hero.js poe data-hero-controls
   no root). Sem JS o atributo nao existe e mantem-se o tema escuro do slide 1. */
[data-hero-controls="light"] .hero-dot { background: rgba(1, 8, 23, 0.28); }
[data-hero-controls="light"] .hero-dot:hover { background: rgba(1, 8, 23, 0.5); }
[data-hero-controls="light"] .hero-dot.is-active { background: #0B4FC4; }
[data-hero-controls="light"] .hero-arrow {
  color: #010817;
  border-color: rgba(1, 8, 23, 0.22);
  background: rgba(255, 255, 255, 0.55);
}
[data-hero-controls="light"] .hero-arrow:hover { color: #0B4FC4; border-color: #1687FF; }
/* Mobile: alvos de toque com area real (WCAG 2.5.8). O ponto fino passa a ser
   o ::after, para que a caixa de 24px nao herde o fundo do proprio dot. */
@media (max-width: 767px) {
  .hero-arrow { width: 44px; height: 44px; }
  .hero-dot,
  .hero-dot.is-active { background: transparent; height: 24px; position: relative; }
  .hero-dot::after {
    content: ""; position: absolute; left: 0; right: 0; top: 50%;
    height: 3px; margin-top: -1.5px;
    background: rgba(255, 255, 255, 0.28);
    transition: background 0.3s ease;
  }
  .hero-dot:hover::after { background: rgba(255, 255, 255, 0.55); }
  .hero-dot.is-active::after { background: #1687FF; }
  [data-hero-controls="light"] .hero-dot,
  [data-hero-controls="light"] .hero-dot.is-active { background: transparent; }
  [data-hero-controls="light"] .hero-dot::after { background: rgba(1, 8, 23, 0.28); }
  [data-hero-controls="light"] .hero-dot:hover::after { background: rgba(1, 8, 23, 0.5); }
  [data-hero-controls="light"] .hero-dot.is-active::after { background: #0B4FC4; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-slide { transition: none; }
  .hero-caption { transition: none; }
}

/* Fallbacks em CSS puro (caso o Tailwind CDN falhe, o fundo escuro mantém-se) */
html, body { width: 100%; margin: 0; padding: 0; }
body { background-color: #010817; }
#presenca { background-color: #000 !important; color: #fff; }
#hero-section { background-color: #010817; }

/* Formulários Fase 1 */
.field { width: 100%; padding: 0.8rem 1rem; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; font-size: 0.9rem; }
.field:focus { outline: 2px solid #1687FF; outline-offset: 0; border-color: #1687FF; }
.label { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #334155; margin-bottom: 0.4rem; }

/* Efeito de sobreposicao / curtain reveal: Tecnologias prende e Presenca sobe */
#tecnologias-presenca-group { position: relative; width: 100%; }
#tecnologias { position: sticky; top: 0; z-index: 20; will-change: transform; }
#presenca { position: relative; z-index: 30; }

/* ==========================================================================
   Camada de Proteção de Mídia (Imagens, Vídeos, Fotos e Canvas)
   ========================================================================== */
img, video, canvas, [data-protected-media] {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
}

video::-webkit-media-controls-download-button {
  display: none !important;
}

video::-webkit-media-controls-enclosure {
  overflow: hidden;
}

.media-protected-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  background: transparent;
  pointer-events: auto;
}

/* ==========================================================================
   Popup Comercial Kedma — flutuante discreto no canto inferior direito.
   Sem overlay: a pagina continua navegavel atras do popup.
   ========================================================================== */
#kedma-popup {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 55;
  width: min(340px, calc(100vw - 32px));
  background: #010817;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 2px solid #1687FF;
  overflow: hidden;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 350ms ease, transform 350ms ease;
}
#kedma-popup[hidden] { display: none !important; }
#kedma-popup.is-visible { opacity: 1; transform: translateY(0); }

.kedma-popup__media { position: relative; }
.kedma-popup__media img { display: block; width: 100%; height: auto; }

.kedma-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: #fff;
  background: rgba(1, 8, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 9999px;
  cursor: pointer;
  transition: background 200ms ease;
}
.kedma-popup__close:hover { background: #1687FF; }

.kedma-popup__body { padding: 14px 14px 16px; }
.kedma-popup__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  background: linear-gradient(to right, #0B4FC4, #1687FF);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: filter 200ms ease;
}
.kedma-popup__cta:hover { filter: brightness(1.12); }

.kedma-popup__close:focus-visible,
.kedma-popup__cta:focus-visible {
  outline: 2px solid #1687FF;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  #kedma-popup {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  #kedma-popup { transition: none; transform: none; }
}

/* ==========================================================================
   Carrossel de Solucoes (#solucoes-carousel) — secao "Tecnologia e Softwares".
   Sem JS: os slides ficam empilhados em bloco (todos visiveis e legiveis).
   Com JS: .kedma-carousel--ready coloca-os na mesma celula de grelha (crossfade)
   e revela os controlos (setas + pontos + contador).
   ========================================================================== */
.kedma-carousel {
  position: relative;
  width: 100%;
}

.kedma-carousel__track {
  position: relative;
  width: 100%;
}

.kedma-slide {
  position: relative;
  width: 100%;
}

/* Controlos: so existem quando ha JS (evita botoes mortos sem JS) */
.kedma-carousel__controls {
  display: none;
}

.kedma-carousel--ready .kedma-carousel__track {
  display: grid;
}

/* Todos os slides na mesma celula: a grelha mede o slide mais alto
   (sem posicionamento absoluto => nunca corta conteudo em mobile). */
.kedma-carousel--ready .kedma-slide {
  grid-area: 1 / 1;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 700ms ease, visibility 0s linear 700ms;
}

.kedma-carousel--ready .kedma-slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 700ms ease, visibility 0s linear 0s;
}

.kedma-carousel--ready .kedma-carousel__controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 23, 42, 0.15);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.kedma-carousel__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #0F172A;
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 0;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.kedma-carousel__arrow svg {
  width: 18px;
  height: 18px;
}

.kedma-carousel__arrow:hover {
  color: #fff;
  background: #0F172A;
  border-color: #0F172A;
}

.kedma-carousel__arrow:focus-visible {
  outline: 2px solid #1687FF;
  outline-offset: 2px;
}

.kedma-carousel__dots {
  display: flex;
  align-items: center;
  gap: 2px;
}

.kedma-carousel__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.kedma-carousel__dot::before {
  content: '';
  width: 8px;
  height: 8px;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 9999px;
  transition: background-color 200ms ease, transform 200ms ease;
}

.kedma-carousel__dot:hover::before {
  background: rgba(15, 23, 42, 0.6);
}

.kedma-carousel__dot.is-active::before {
  background: #1687FF;
  transform: scale(1.3);
}

.kedma-carousel__dot:focus-visible {
  outline: 2px solid #1687FF;
  outline-offset: -2px;
}

.kedma-carousel__counter {
  margin: 0 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0F172A;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .kedma-carousel--ready .kedma-carousel__controls {
    right: 10px;
    bottom: 10px;
    gap: 4px;
    padding: 4px 6px;
  }
  .kedma-carousel__arrow { width: 34px; height: 34px; }
  .kedma-carousel__dot { width: 24px; height: 24px; }
  .kedma-carousel__counter { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .kedma-carousel--ready .kedma-slide,
  .kedma-carousel--ready .kedma-slide.is-active { transition: none; }
  .kedma-carousel__arrow,
  .kedma-carousel__dot::before { transition: none; }
}

/* ==========================================================================
   Mobile Menu Accordion (data-mobile-accordion)
   ========================================================================== */
.mobile-accordion-content {
  overflow: hidden;
  opacity: 1;
  /* max-height animated via JS */
}
.mobile-accordion-group {
  width: 100%;
}
.mobile-accordion-trigger {
  width: 100%;
  text-align: left;
}
.mobile-accordion-trigger:focus-visible {
  outline: 2px solid #1687ff;
  outline-offset: 2px;
  border-radius: 0;
}
@media (prefers-reduced-motion: reduce) {
  .mobile-accordion-content {
    transition: none !important;
  }
  .mobile-accordion-trigger svg {
    transition: none !important;
  }
}

/* Dropdowns no Header Desktop apenas por clique (.is-open) */
[data-desktop-dropdown] > [data-dropdown-menu] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
}
[data-desktop-dropdown="sobre"] > [data-dropdown-menu] {
  transform: translateY(8px);
}
[data-desktop-dropdown="solucoes"] > [data-dropdown-menu] {
  transform: translate(-50%, 8px);
}
[data-desktop-dropdown].is-open > [data-dropdown-menu] {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
[data-desktop-dropdown="sobre"].is-open > [data-dropdown-menu] {
  transform: translateY(0) !important;
}
[data-desktop-dropdown="solucoes"].is-open > [data-dropdown-menu] {
  transform: translate(-50%, 0) !important;
}
[data-desktop-dropdown].is-open [data-dropdown-trigger] svg {
  transform: rotate(180deg);
}
