/* =====================================================================
   TECMARC - animações e componentes dinâmicos
   ===================================================================== */

html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 84px; }

/* ---------------- Entradas ao rolar ([data-reveal]) ---------------- */
[data-reveal] {
    opacity: 0;
    transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1);
    will-change: opacity, transform;
}
[data-reveal="fade-up"]    { transform: translateY(40px); }
[data-reveal="fade-down"]  { transform: translateY(-30px); }
[data-reveal="fade-left"]  { transform: translateX(-50px); }
[data-reveal="fade-right"] { transform: translateX(50px); }
[data-reveal="zoom-in"]    { transform: scale(.88); }
[data-reveal="fade"]       { transform: none; }
[data-reveal].is-visible   { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------------- Cabeçalho fixo ---------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    transition: background-color .35s ease, box-shadow .35s ease, padding .35s ease;
}
.site-header.is-scrolled {
    background: rgba(3, 18, 31, .94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
    padding-top: .5rem;
    padding-bottom: .5rem;
}

/* Itens do menu nunca quebram linha; menos espaço em ecrãs médios */
.header-nav .nav-link,
.header-nav a,
.header-nav button { white-space: nowrap; }
@media (max-width: 1279px) {
    .header-nav .nav-link { padding: .5rem .55rem; font-size: .9rem; }
    .header-nav .lang-search { display: none !important; }
}
/* Com o menu completo visível, o subtítulo do logótipo só aparece em ecrãs muito largos */
@media (min-width: 1024px) and (max-width: 1599px) {
    .header-nav .brand-sub { display: none !important; }
}

/* ---------------- Topo com fundo dinâmico (foto da equipa) ---------------- */
.hero-dynamic {
    position: relative;
    overflow: hidden;
    background: #03121F;
    min-height: min(88vh, 820px);
    display: flex;
    align-items: center;
}
.hero-bg {
    position: absolute;
    inset: -4% 0 -4% 0;          /* margem para o parallax (pequena para não ampliar a foto) */
    z-index: 0;
}
.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 70% 30%;
    animation: heroKenBurns 28s ease-in-out infinite alternate;
    transform-origin: 70% 40%;
}
/* Zoom suave e limitado: ampliar demais tira nitidez à foto */
@keyframes heroKenBurns {
    0%   { transform: scale(1.0) translate3d(0, 0, 0); }
    50%  { transform: scale(1.06) translate3d(-1%, -.5%, 0); }
    100% { transform: scale(1.03) translate3d(1%, .3%, 0); }
}
.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(3,18,31,.97) 0%, rgba(3,18,31,.90) 32%, rgba(3,18,31,.55) 62%, rgba(3,18,31,.35) 100%),
        linear-gradient(0deg, rgba(3,18,31,.85) 0%, rgba(3,18,31,0) 35%);
}
/* Rede de pontos animada por cima da foto */
.hero-grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image: radial-gradient(rgba(22,199,69,.35) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(90deg, transparent 0%, #000 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%, transparent 100%);
    animation: gridDrift 40s linear infinite;
    opacity: .45;
}
@keyframes gridDrift { to { background-position: 340px 170px; } }
.hero-glow {
    position: absolute;
    width: 520px; height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(22,199,69,.22), transparent 65%);
    filter: blur(10px);
    z-index: 1;
    animation: glowFloat 14s ease-in-out infinite alternate;
}
@keyframes glowFloat {
    from { transform: translate(-10%, -10%); }
    to   { transform: translate(25%, 20%); }
}
.hero-content { position: relative; z-index: 2; }

.hero-title-line { display: block; overflow: hidden; }
.hero-title-line > span {
    display: inline-block;
    animation: heroLineUp 1s cubic-bezier(.2,.7,.2,1) both;
}
.hero-title-line:nth-child(2) > span { animation-delay: .12s; }
.hero-title-line:nth-child(3) > span { animation-delay: .24s; }
@keyframes heroLineUp { from { transform: translateY(105%); opacity: 0; } to { transform: none; opacity: 1; } }
.hero-fade-in { animation: heroFadeIn 1s .4s ease both; }
.hero-fade-in-2 { animation: heroFadeIn 1s .6s ease both; }
@keyframes heroFadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* Cartões flutuantes no topo */
.float-card {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1rem;
    color: #fff;
    animation: floatY 6s ease-in-out infinite;
}
.float-card:nth-child(2) { animation-delay: -2s; }
.float-card:nth-child(3) { animation-delay: -4s; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.scroll-cue {
    position: absolute; left: 50%; bottom: 22px; z-index: 2;
    width: 26px; height: 42px; border: 2px solid rgba(255,255,255,.5); border-radius: 14px;
    transform: translateX(-50%);
}
.scroll-cue::after {
    content: ''; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px;
    background: #16C745; border-radius: 2px; transform: translateX(-50%);
    animation: scrollCue 1.8s ease-in-out infinite;
}
@keyframes scrollCue { 0% { opacity: 0; transform: translate(-50%, 0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, 14px); } }

/* Cartões de soluções: no telemóvel a altura acompanha o texto (evita cortar a seta) */
@media (max-width: 768px) {
    .solution-card { height: auto !important; min-height: 240px; }
    .solution-card .solution-overlay { position: relative; min-height: 240px; gap: 1rem; }
}

@media (max-width: 1023px) {
    .hero-dynamic { min-height: auto; }
    .hero-overlay {
        background: linear-gradient(180deg, rgba(3,18,31,.70) 0%, rgba(3,18,31,.84) 55%, rgba(3,18,31,.96) 100%);
    }
    .hero-bg img { object-position: 60% 25%; }
    .scroll-cue { display: none; }
}

/* ---------------- Clientes: carrossel contínuo centralizado ---------------- */
.logo-marquee {
    position: relative;
    overflow: hidden;
    padding: 1rem 0;
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.logo-track {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: max-content;
    animation: logoScroll var(--marquee-duration, 30s) linear infinite;
}
.logo-marquee.reverse .logo-track { animation-direction: reverse; }
.logo-marquee:hover .logo-track,
.logo-marquee:focus-within .logo-track { animation-play-state: paused; }
@keyframes logoScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.client-logo-card {
    flex: 0 0 auto;
    width: 200px;
    height: 116px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #edf0f3;
    border-radius: 1rem;
    box-shadow: 0 2px 10px rgba(3,18,31,.06);
    padding: 1.25rem 1.5rem;
    transition: transform .4s ease, box-shadow .4s ease, border-color .4s ease;
}
.client-logo-card img {
    max-width: 100%;
    max-height: 64px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: .65;
    transition: filter .4s ease, opacity .4s ease, transform .4s ease;
}
.client-logo-card:hover {
    transform: translateY(-6px);
    border-color: rgba(22,199,69,.45);
    box-shadow: 0 14px 30px rgba(3,18,31,.12);
}
.client-logo-card:hover img { filter: none; opacity: 1; transform: scale(1.06); }

@media (max-width: 640px) {
    .client-logo-card { width: 150px; height: 92px; padding: 1rem; }
    .client-logo-card img { max-height: 52px; }
    .logo-track { gap: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .logo-marquee { mask-image: none; -webkit-mask-image: none; }
    .logo-track { animation: none; flex-wrap: wrap; justify-content: center; width: auto; }
    .logo-track [aria-hidden="true"] { display: none; }
}

/* ---------------- Como a Tecmarc se conecta (jornada) ---------------- */
.journey { position: relative; }
.journey-steps {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.25rem;
}
/* Linha tracejada animada que liga as etapas */
.journey-line {
    position: absolute;
    left: 10%; right: 10%;
    top: 44px;
    height: 4px;
    border-radius: 4px;
    background-image: repeating-linear-gradient(90deg, rgba(22,199,69,.9) 0 14px, transparent 14px 26px);
    background-size: 26px 4px;
    animation: dashFlow 1.2s linear infinite;
    opacity: .7;
}
@keyframes dashFlow { to { background-position: 26px 0; } }
/* "Pacote de dados" que percorre a linha */
.journey-packet {
    position: absolute;
    top: 50%;
    left: 0;
    width: 34px; height: 34px;
    margin-top: -17px; margin-left: -17px;
    border-radius: 50%;
    background: #16C745;
    color: #03121F;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    box-shadow: 0 0 0 6px rgba(22,199,69,.18), 0 0 24px rgba(22,199,69,.7);
    animation: packetMove 9s cubic-bezier(.45,0,.55,1) infinite;
}
@keyframes packetMove {
    0%   { left: 0%;   opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}
.journey-step {
    position: relative;
    text-align: center;
    color: #fff;
}
.journey-node {
    position: relative;
    z-index: 1;
    width: 92px; height: 92px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: #071E2D;
    border: 2px solid rgba(22,199,69,.55);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem;
    color: #16C745;
    transition: transform .4s ease, background .4s ease, color .4s ease;
}
.journey-node::after {
    content: '';
    position: absolute; inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(22,199,69,.35);
    animation: nodePulse 3s ease-out infinite;
}
.journey-step:nth-child(2) .journey-node::after { animation-delay: .6s; }
.journey-step:nth-child(3) .journey-node::after { animation-delay: 1.2s; }
.journey-step:nth-child(4) .journey-node::after { animation-delay: 1.8s; }
.journey-step:nth-child(5) .journey-node::after { animation-delay: 2.4s; }
@keyframes nodePulse { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.journey-step:hover .journey-node { transform: translateY(-6px); background: #16C745; color: #03121F; }
.journey-num {
    position: absolute; top: -4px; right: -4px;
    width: 28px; height: 28px; border-radius: 50%;
    background: #fff; color: #03121F;
    font-size: .75rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}
.spin-slow { animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.journey-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .72rem; font-weight: 600;
    padding: .3rem .6rem;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    color: #d1d9e0;
    white-space: nowrap;
}
/* Mensagens a "voar" entre etapas (detalhe decorativo) */
.journey-fly {
    position: absolute; top: 30px;
    font-size: 1rem; color: #fff; opacity: 0;
    animation: flyAcross 9s ease-in-out infinite;
}
.journey-fly.f2 { animation-delay: 3s; color: #16C745; }
.journey-fly.f3 { animation-delay: 6s; color: #7cc4ff; }
@keyframes flyAcross {
    0%   { left: 8%;  opacity: 0; transform: translateY(0) rotate(-8deg); }
    10%  { opacity: .9; }
    50%  { transform: translateY(-26px) rotate(6deg); }
    90%  { opacity: .9; }
    100% { left: 88%; opacity: 0; transform: translateY(0) rotate(-8deg); }
}

/* Telemóvel/tablet: jornada em vertical */
@media (max-width: 1023px) {
    .journey-steps { grid-template-columns: 1fr; gap: 2rem; }
    .journey-line {
        left: 45px; right: auto; top: 46px; bottom: 46px;
        width: 4px; height: auto;
        background-image: repeating-linear-gradient(180deg, rgba(22,199,69,.9) 0 14px, transparent 14px 26px);
        background-size: 4px 26px;
        animation-name: dashFlowV;
    }
    @keyframes dashFlowV { to { background-position: 0 26px; } }
    .journey-packet { left: 50%; top: 0; animation-name: packetMoveV; }
    @keyframes packetMoveV {
        0%   { top: 0%;   opacity: 0; }
        5%   { opacity: 1; }
        95%  { opacity: 1; }
        100% { top: 100%; opacity: 0; }
    }
    .journey-step {
        display: grid;
        grid-template-columns: 92px 1fr;
        gap: 1rem;
        text-align: left;
        align-items: start;
    }
    .journey-node { margin: 0; width: 92px; height: 92px; }
    .journey-step .journey-chips { justify-content: flex-start; }
    .journey-fly { display: none; }
}
@media (max-width: 420px) {
    .journey-step { grid-template-columns: 72px 1fr; }
    .journey-node { width: 72px; height: 72px; font-size: 1.5rem; }
    .journey-line { left: 35px; top: 36px; bottom: 36px; }
}

/* Plataformas (faixa de marcas/tecnologias) */
.platform-pill {
    display: inline-flex; align-items: center; gap: .6rem;
    padding: .7rem 1.1rem;
    border-radius: .9rem;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    color: #fff; font-weight: 600; font-size: .9rem;
    white-space: nowrap;
    transition: background .3s ease, border-color .3s ease, transform .3s ease;
}
.platform-pill:hover { background: rgba(22,199,69,.15); border-color: rgba(22,199,69,.5); transform: translateY(-3px); }
.platform-pill i { color: #16C745; }

/* Cartões com elevação suave */
.lift { transition: transform .35s ease, box-shadow .35s ease; }
.lift:hover { transform: translateY(-6px); box-shadow: 0 20px 40px rgba(3,18,31,.14); }
