/* ============================================================
   FRAME, Lda - estilos personalizados
   Paleta e padrões alinhados com o site de referência
   ============================================================ */

:root {
  --frame-gradient: radial-gradient(circle at 20% 20%, rgba(26,79,143,.18), transparent 30%),
                    radial-gradient(circle at 80% 0%, rgba(192,138,62,.12), transparent 26%),
                    linear-gradient(135deg, #0b223f 0%, #123763 45%, #1a4f8f 100%);
}

html { scroll-behavior: smooth; }
/* "clip" (em vez de "hidden") evita a barra lateral sem criar uma caixa de
   deslocamento — mantém o cabeçalho sticky a funcionar. */
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }

/* Cabeçalho fixo: compensa a altura da barra ao saltar para âncoras */
:target { scroll-margin-top: 96px; }

/* ---------- Hero ---------- */
.hero-bg {
  background-image: var(--frame-gradient),
    url('../img/hero.jpg');
  background-size: cover;
  background-position: center;
  background-blend-mode: overlay;
}

.hero-grid {
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 30% 50%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 50%, black 20%, transparent 75%);
}

/* ---------- Animações de entrada ---------- */
.js .reveal        { opacity: 0; transform: translateY(30px); }
.js .reveal.visible{ animation: fadeUp .8s ease-out forwards; }

.js .reveal-left     { opacity: 0; transform: translateX(-40px); }
.js .reveal-left.visible { animation: slideInLeft .8s ease-out forwards; }

.js .reveal-right     { opacity: 0; transform: translateX(40px); }
.js .reveal-right.visible { animation: slideInRight .8s ease-out forwards; }

.js .reveal-scale     { opacity: 0; transform: scale(.9); }
.js .reveal-scale.visible { animation: scaleIn .6s ease-out forwards; }

/* Atraso escalonado das animações de entrada.
   Reduzido em 1 s face ao valor anterior (0.1s … 0.7s), pelo que passa a 0:
   tabelas, cartões e restantes elementos com animação igual ou mais longa
   (0.8s) começam a entrar de imediato, sem espera. */
.delay-1, .delay-2, .delay-3, .delay-4,
.delay-5, .delay-6, .delay-7 { animation-delay: 0s !important; }

@keyframes fadeUp       { from { opacity:0; transform: translateY(30px);} to { opacity:1; transform: translateY(0);} }
@keyframes slideInLeft  { from { opacity:0; transform: translateX(-40px);} to { opacity:1; transform: translateX(0);} }
@keyframes slideInRight { from { opacity:0; transform: translateX(40px);}  to { opacity:1; transform: translateX(0);} }
@keyframes scaleIn      { from { opacity:0; transform: scale(.9);} to { opacity:1; transform: scale(1);} }

/* ---------- Navegação ---------- */
.nav-link { position: relative; }
.nav-link::after {
  content: ''; position: absolute; bottom: -6px; left: 0;
  width: 0; height: 2px; background: #1a4f8f; transition: width .3s ease;
}
.nav-link:hover::after, .nav-link.is-active::after { width: 100%; }
.nav-link.is-active { color: #1a4f8f; }

.mobile-menu { transform: translateX(100%); transition: transform .3s ease; }
.mobile-menu.open { transform: translateX(0); }

@media (max-width: 1023px) {
  header { background-color: #fff !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}

/* ---------- Botão primário ---------- */
.btn-primary { position: relative; overflow: hidden; z-index: 1; }
.btn-primary::before {
  content: ''; position: absolute; top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transition: left .5s ease; z-index: -1;
}
.btn-primary:hover::before { left: 100%; }

/* ---------- Cartões de serviço ---------- */
.service-card { position: relative; overflow: hidden; transition: transform .35s ease, box-shadow .35s ease; }
.service-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
  background: linear-gradient(90deg, #1a4f8f, #c08a3e);
  transform: scaleX(0); transform-origin: left; transition: transform .4s ease; z-index: 2;
}
.service-card:hover::before { transform: scaleX(1); }
.service-card:hover { transform: translateY(-6px); box-shadow: 0 24px 48px rgba(11,34,63,.14); }

/* ---------- Cartões de valor ---------- */
.value-card { transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease; }
.value-card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(11,34,63,.12); border-color: #c08a3e; }

/* ---------- Cartão de projecto ---------- */
.project-card { transition: transform .4s ease, box-shadow .4s ease; }
.project-card:hover { transform: translateY(-6px); box-shadow: 0 24px 48px rgba(11,34,63,.16); }
.project-card img { transition: transform .6s ease; }
.project-card:hover img { transform: scale(1.06); }

/* ---------- Galeria ---------- */
.gallery-item { position: relative; overflow: hidden; border-radius: .9rem; }
.gallery-item img { transition: transform .6s ease, filter .4s ease; }
.gallery-item:hover img { transform: scale(1.07); }
.gallery-caption {
  position: absolute; inset: auto 0 0 0; padding: 1.5rem 1rem 1rem;
  background: linear-gradient(to top, rgba(11,34,63,.95), rgba(11,34,63,0));
  color: #fff; transform: translateY(8px); opacity: 0; transition: all .35s ease;
}
.gallery-item:hover .gallery-caption { transform: translateY(0); opacity: 1; }

/* ---------- Imagens clicáveis (pré-visualização) ---------- */
.lightbox-trigger { display: block; cursor: zoom-in; }
.lightbox-trigger img { transition: transform .5s ease, filter .35s ease; }
.lightbox-trigger:hover img { transform: scale(1.03); filter: brightness(.92); }
.lightbox-trigger:focus-visible { outline: 3px solid #c08a3e; outline-offset: 4px; border-radius: 1rem; }

/* ---------- Contadores ---------- */
.counter-number { font-variant-numeric: tabular-nums; }

/* ---------- Carrossel de clientes ---------- */
.partners-carousel {
  position: relative; overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.partners-track { display: flex; width: max-content; gap: 1.25rem; animation: partnersScroll 40s linear infinite; }
.partners-carousel:hover .partners-track { animation-play-state: paused; }
.partner-slide {
  flex: 0 0 auto; min-width: 170px; height: 74px; padding: 0 1.25rem;
  border: 1px solid #e2e8f0; border-radius: .9rem; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: Montserrat, sans-serif; font-weight: 700; font-size: .8rem;
  letter-spacing: .04em; color: #0b223f; text-align: center;
  transition: all .3s ease;
}
.partner-slide:hover { border-color: #c08a3e; color: #1a4f8f; transform: translateY(-3px); box-shadow: 0 12px 24px rgba(11,34,63,.10); }
@keyframes partnersScroll { from { transform: translateX(0);} to { transform: translateX(-50%);} }

/* ---------- Linha do tempo / processo ---------- */
.timeline-line {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, #1a4f8f, #c08a3e); transform: translateX(-50%);
}
@media (max-width: 768px) { .timeline-line { left: 20px; } }

/* ---------- Organograma ---------- */
.org-box {
  border: 1px solid #e2e8f0; border-radius: .8rem; background: #fff;
  transition: all .3s ease;
}
.org-box:hover { border-color: #c08a3e; box-shadow: 0 14px 28px rgba(11,34,63,.10); transform: translateY(-3px); }
.org-connector { width: 2px; height: 26px; background: linear-gradient(180deg,#1a4f8f,#c08a3e); margin: 0 auto; }
.org-branch { position: relative; }
.org-branch::before {
  content:''; position: absolute; top: -13px; left: 12.5%; right: 12.5%; height: 2px;
  background: linear-gradient(90deg, #1a4f8f, #c08a3e);
}

/* ---------- Tabela ---------- */
.table-frame thead th { background: #0b223f; color: #fff; font-family: Montserrat, sans-serif; }
.table-frame tbody tr:nth-child(even) { background: #f5f7fa; }
.table-frame tbody tr:hover { background: #eef4fc; }

/* Rolagem horizontal da tabela em telemóvel */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c7d2e0 #eef2f7;
}
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: #eef2f7; border-radius: 9999px; }
.table-scroll::-webkit-scrollbar-thumb { background: #c7d2e0; border-radius: 9999px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #9db4d0; }

/* Aviso "deslize para ver mais colunas" — só em ecrãs pequenos */
.table-hint {
  display: none;
  align-items: center;
  gap: .45rem;
  margin-bottom: .6rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: #64748b;
}
.table-hint i { color: #c08a3e; }
@media (max-width: 900px) { .table-hint { display: flex; } }

/* ---------- Lightbox / pré-visualização ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: rgba(4,12,24,.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.lightbox.open { opacity: 1; visibility: visible; }

.lightbox-stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  max-width: min(1100px, 88vw);
  transform: scale(.95) translateY(10px);
  transition: transform .3s ease;
}
.lightbox.open .lightbox-stage { transform: scale(1) translateY(0); }

.lightbox-stage img {
  max-width: 100%; max-height: 74vh; object-fit: contain;
  border-radius: .75rem; background: #0b1524;
  box-shadow: 0 30px 70px rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.12);
  transition: opacity .25s ease;
}

/* Indicador de carregamento da imagem */
.lightbox-stage.is-loading img { opacity: .2; }
.lightbox-stage.is-loading::after {
  content: ''; position: absolute; top: 35%; left: 50%;
  width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border: 3px solid rgba(255,255,255,.22);
  border-top-color: #c08a3e; border-radius: 50%;
  animation: lbSpin .8s linear infinite;
}
@keyframes lbSpin { to { transform: rotate(360deg); } }

.lightbox-caption {
  margin-top: .9rem; max-width: 60ch; text-align: center;
  color: #e2e8f0; font-size: .9rem; line-height: 1.5;
}

.lightbox-counter {
  position: absolute; top: 1.6rem; left: 50%; transform: translateX(-50%);
  color: #94a3b8; font-size: .72rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  padding: .35rem .8rem; border-radius: 9999px;
}

/* Botão "X" - fechar e voltar à página */
.lightbox-close {
  position: absolute; top: 1.25rem; right: 1.25rem; z-index: 3;
  width: 48px; height: 48px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff; font-size: 1.25rem; line-height: 1; cursor: pointer;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: background .25s ease, border-color .25s ease, transform .35s ease;
}
.lightbox-close:hover, .lightbox-close:focus-visible {
  background: #c08a3e; border-color: #c08a3e;
  transform: rotate(90deg); outline: none;
}

/* Navegação anterior / seguinte */
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 50px; height: 50px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff; font-size: 1.05rem; cursor: pointer;
  transition: background .25s ease, border-color .25s ease;
}
.lightbox-prev { left: 1.35rem; }
.lightbox-next { right: 1.35rem; }
.lightbox-nav:hover, .lightbox-nav:focus-visible {
  background: #1a4f8f; border-color: #1a4f8f; outline: none;
}
.lightbox-nav[hidden] { display: none; }

@media (max-width: 700px) {
  .lightbox { padding: 1rem; }
  .lightbox-close { top: .85rem; right: .85rem; width: 44px; height: 44px; }
  .lightbox-nav { width: 42px; height: 42px; }
  .lightbox-prev { left: .5rem; }
  .lightbox-next { right: .5rem; }
  .lightbox-stage img { max-height: 64vh; }
  .lightbox-counter { top: 1rem; }
  .lightbox-caption { font-size: .82rem; margin-top: .7rem; }
}

/* ---------- Vários ---------- */
.glass-card {
  background: rgba(255,255,255,.08); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.15);
}
.stat-card { transition: transform .3s ease, box-shadow .3s ease; }
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(11,34,63,.12); }

.badge { display: inline-flex; align-items: center; gap: .4rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .js .reveal, .js .reveal-left, .js .reveal-right, .js .reveal-scale { opacity: 1 !important; transform: none !important; }
}
