/* ==========================================================================
   CLICA — camada mobile (mobile first no uso: toque, polegar, ecrã pequeno).
   Só atua em ecrãs pequenos; no desktop nada muda.
   Muitos estilos da homepage vêm inline (do mockup), por isso aqui usa-se !important.
   ========================================================================== */

/* O botão e o menu móveis só existem em ecrãs pequenos */
.hb-burger, .hb-menu, .hb-logo-w { display: none; }

/* Toque: sem atraso nem zoom ao tocar duas vezes, sem "flash" cinzento */
a, button, summary, [role="button"] { touch-action: manipulation; }
@media (hover: none) {
  html { -webkit-tap-highlight-color: transparent; }
  /* Sem rato não há hover: os títulos do compromisso ficam legíveis logo */
  .clica-hl .t { color: #FFFFFF; }
}

/* ---------- Até 860px: cabeçalho compacto + menu, serviços em acordeão ---------- */
@media (max-width: 860px) {
  /* Cabeçalho: uma só linha */
  header.hb nav { padding: 10px 20px !important; flex-wrap: nowrap !important; gap: 12px !important; }
  header.hb .hb-logo { height: 34px !important; }
  .hb-links { display: none !important; }
  header.hb { transition: background .3s, border-color .3s; }

  .hb-burger {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    flex: none; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 999px;
    background: #0A0A0A; cursor: pointer;
    transition: background .3s, transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .hb-burger:active { transform: scale(.92); }
  .hb-burger span {
    display: block; width: 20px; height: 2px; border-radius: 2px; background: #FFFFFF;
    transition: transform .45s cubic-bezier(.7, 0, .2, 1), width .3s;
  }
  .hb-burger span:nth-child(2) { width: 13px; }
  html.hb-open .hb-burger { background: var(--accent); }
  html.hb-open .hb-burger span:nth-child(1) { transform: translateY(4px) rotate(45deg); }
  html.hb-open .hb-burger span:nth-child(2) { width: 20px; transform: translateY(-4px) rotate(-45deg); }

  /* Com o menu aberto o cabeçalho fica escuro, com o logo branco */
  html.hb-open { overflow: hidden; }
  html.hb-open header.hb { background: #0A0A0A !important; border-bottom-color: rgba(255, 255, 255, .12) !important; }
  html.hb-open .hb-logo-d { display: none !important; }
  html.hb-open .hb-logo-w { display: block !important; }
  html.hb-open [data-fab], html.hb-open .clica-clicks { opacity: 0 !important; pointer-events: none; }

  /* Menu em ecrã inteiro */
  .hb-menu {
    display: flex; position: fixed; inset: 0; z-index: 19;
    padding-top: var(--hb-h, 68px);
    overflow-y: auto; overscroll-behavior: contain;
    background-color: #0A0A0A; color: #FFFFFF;
    background-image: radial-gradient(rgba(255, 255, 255, .1) 1px, transparent 1px); background-size: 22px 22px;
    visibility: hidden; clip-path: inset(0 0 100% 0);
    transition: clip-path .6s cubic-bezier(.7, 0, .2, 1), visibility 0s .6s;
  }
  html.hb-open .hb-menu { visibility: visible; clip-path: inset(0); transition: clip-path .6s cubic-bezier(.7, 0, .2, 1), visibility 0s; }
  .hb-menu-in {
    width: 100%; min-height: 100%;
    display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
    padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  }
  .hb-menu-list { margin: 0; padding: 0; list-style: none; counter-reset: hb; }
  .hb-menu-list li { overflow: hidden; border-top: 1px solid rgba(255, 255, 255, .14); }
  .hb-menu-list li:last-child { border-bottom: 1px solid rgba(255, 255, 255, .14); }
  .hb-menu-list a {
    counter-increment: hb;
    display: flex; align-items: baseline; gap: 16px; min-height: 68px; padding: 14px 0;
    font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: clamp(36px, 12vw, 56px); line-height: 1; letter-spacing: -.045em;
    color: #FFFFFF; text-decoration: none;
    transform: translateY(105%);
    transition: transform .55s cubic-bezier(.2, .8, .2, 1), color .2s;
  }
  html.hb-open .hb-menu-list a { transform: none; transition-delay: calc(var(--i) * 55ms + 160ms), 0s; }
  .hb-menu-list a::before {
    content: counter(hb, decimal-leading-zero); flex: none; width: 30px;
    font-size: 14px; font-weight: 600; letter-spacing: .06em; color: #5B8CFF;
  }
  .hb-menu-list a[aria-current] { color: #5B8CFF; }
  .hb-menu-list a:active { color: #5B8CFF; }
  .hb-menu-list .hb-arrow { margin-left: auto; font-size: .6em; opacity: .5; }

  .hb-menu-foot { display: grid; gap: 18px; opacity: 0; transform: translateY(18px); transition: opacity .3s, transform .4s cubic-bezier(.2, .8, .2, 1); }
  html.hb-open .hb-menu-foot { opacity: 1; transform: none; transition-delay: .4s; }
  .hb-menu-cta {
    justify-content: center; gap: 10px; min-height: 58px; padding: 0 24px; border-radius: 999px;
    display: inline-flex; align-items: center; text-decoration: none;
    background: var(--accent); color: #FFFFFF;
    font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px;
  }
  .hb-menu-contacts { display: flex; flex-wrap: wrap; gap: 0 22px; font-size: 16px; }
  .hb-menu-contacts a { display: inline-flex; align-items: center; min-height: 44px; color: #BDBDB8; text-decoration: none; }
  .hb-menu-contacts a:active { color: #FFFFFF; }

  /* ===== Popup do orçamento (mobile) =====
     Folha de altura fixa que acompanha a área visível (também com o teclado aberto, ver quote.js).
     De cima para baixo: progresso + fechar, carta compacta, pergunta/campo (a única parte que
     deslizar) e barra de ações SEMPRE à vista junto ao polegar. */
  .q-bg {
    inset: auto !important; left: 0 !important; right: 0 !important;
    top: var(--q-top, 0px) !important; height: var(--q-h, 100svh);
    padding: 8px 0 0 !important; align-items: flex-end !important;
  }
  .q-dlg {
    display: flex !important; flex-direction: column;
    width: 100% !important; height: min(640px, 100%); max-height: 100% !important; overflow: hidden !important;
    border-radius: 26px 26px 0 0 !important;
    animation: q-sheet .5s cubic-bezier(.2, .9, .2, 1) both !important;
  }
  /* A coluna do formulário "dissolve-se" para poder reordenar os seus blocos */
  .q-col-form { display: contents !important; }
  .q-eyebrow { display: none; }

  .q-progress { order: -3; flex: none; margin: 0 !important; padding: 24px 66px 0 20px; }
  .q-col-letter { order: -2; flex: none; display: block !important; padding: 16px 20px 0 !important; }
  .q-col-form .wpcf7 { order: 0; flex: 1 1 auto; min-height: 0; }
  .q-done { order: 0; flex: 1 1 auto; padding: 0 20px 24px; justify-content: center; }
  .q-close { top: 7px !important; right: 12px !important; width: 40px !important; height: 40px !important; }

  /* Carta: só o papel, a mostrar o fim do texto */
  .q-letter { transform: none !important; border-radius: 14px; box-shadow: 0 12px 34px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .12); }
  .q-letter-head { padding: 7px 14px; font-size: 11px; letter-spacing: .02em; }
  .q-letter-dots, .q-letter-meta { display: none; }
  .q-letter-body {
    height: 96px; min-height: 0 !important; max-height: none !important; overflow-y: hidden;
    padding: 10px 14px 14px !important; font-size: 15px !important; line-height: 1.4;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px); mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
  }
  .q-letter.is-sent .q-letter-body { height: 150px; -webkit-mask-image: none; mask-image: none; }
  .q-stamp { right: 14px !important; bottom: 12px !important; font-size: 13px !important; padding: 6px 11px !important; }

  /* Formulário */
  .q-form { flex: 1 1 auto; min-height: 0; padding: 0 20px; }
  .q-step { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-top: 18px; gap: 8px; }
  .q-count { font-size: 14px; }
  .q-question { font-size: clamp(28px, 8.4vw, 38px) !important; }
  .q-input { margin-top: 4px; padding: 8px 0 12px; font-size: 22px; }
  .q-textarea { flex: 1 1 auto; min-height: 84px; font-size: 19px; }
  .q-sub { font-size: 15px; }
  .q-consent { margin-top: 10px; }
  .q-consent label { min-height: 48px; align-items: center; }
  .q-consent input[type="checkbox"] { width: 24px; height: 24px; margin: 0; }
  .q-error { flex: none; min-height: 20px; margin: 6px 0 0; font-size: 14px; }

  /* Barra de ações fixa em baixo: o "Seguinte" nunca fica escondido atrás do teclado */
  .q-actions { flex: none; margin-top: 0; padding: 8px 0 calc(14px + env(safe-area-inset-bottom)); gap: 8px; flex-wrap: nowrap; }
  .q-back, .q-skip { flex: none; min-height: 54px; padding: 0 14px; white-space: nowrap; }
  .q-next { flex: 1 1 auto; min-width: 0; margin-left: 0 !important; min-height: 54px; justify-content: center; white-space: nowrap; font-size: 17px; padding: 0 20px; }
  .q-done .q-next { flex: none; align-self: stretch; }

  /* Com o teclado aberto sobra pouco ecrã: tudo mais compacto */
  html.q-kb .q-letter-head { display: none; }
  html.q-kb .q-letter-body { height: 66px; }
  html.q-kb .q-col-letter { padding-top: 12px !important; }
  html.q-kb .q-progress { padding-top: 20px; }
  html.q-kb .q-step { padding-top: 12px; }
  html.q-kb .q-question { font-size: 25px !important; }
  html.q-kb .q-input { font-size: 20px; padding-bottom: 8px; }
  html.q-kb .q-actions { padding-bottom: 10px; }

  /* Serviços: o cartão abre debaixo do próprio serviço (acordeão), em vez de ficar lá em baixo */
  #servicos .svc-side { display: none; }
  #servicos [data-svc-panel] { position: relative; }
  .svc-btn .arrow { transition: opacity .3s, transform .4s cubic-bezier(.2, .8, .2, 1); }
  .svc-btn.is-active .arrow { transform: rotate(90deg); }
}

/* ---------- Até 860px: botão CLICA e popup "Assim nasce o teu site" ---------- */
@media (max-width: 860px) {
  /* Botão flutuante compacto, com área de toque de 68px e safe-area do iPhone */
  [data-fab] {
    scale: 1 !important;
    width: 78px !important; height: 78px !important;
    right: calc(12px + env(safe-area-inset-right)) !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
  }
  [data-fab]::before {
    content: ""; position: absolute; inset: -7px; border-radius: 999px;
    border: 1px dashed rgba(0, 74, 255, .55);
    animation: clica-fab-orbit 18s linear infinite;
    pointer-events: none;
  }
  [data-fab] .clica-fab-ring { display: none !important; }
  [data-fab] .clica-fab-btn {
    left: 5px !important; top: 5px !important;
    width: 68px !important; height: 68px !important;
    font-size: 16px !important;
    box-shadow: 0 8px 22px rgba(0, 74, 255, .45);
    animation: clica-fab-pulse 2.4s ease-out infinite !important;
  }
  [data-fab] .clica-fab-btn:hover { transform: none; }
  [data-fab] .clica-fab-btn:active { transform: scale(.94); }
  .clica-clicks { left: 10px !important; bottom: calc(10px + env(safe-area-inset-bottom)) !important; padding: 9px 13px !important; font-size: 13px !important; gap: 8px !important; }

  /* Popup: uma coluna, texto compacto e demo mais baixa para caber sem rolar muito */
  .clica-dlg-bg { padding: 12px !important; }
  .clica-dlg {
    grid-template-columns: 1fr !important;
    width: 100% !important; max-height: calc(100svh - 24px) !important;
    border-radius: 24px !important;
    overflow-y: auto !important; -webkit-overflow-scrolling: touch;
  }
  .clica-dlg-copy { padding: 56px 20px 22px !important; gap: 14px !important; }
  .clica-dlg-copy > p:nth-of-type(2) { font-size: clamp(30px, 9vw, 40px) !important; }
  .clica-dlg-copy > p:nth-of-type(3) { font-size: 16px !important; line-height: 1.5 !important; }
  .clica-dlg-tag { font-size: 13px !important; padding: 7px 11px !important; }
  .clica-dlg-cta { width: 100% !important; justify-content: center; align-self: stretch !important; margin-top: 2px !important; }
  .clica-dlg-art { padding: 0 16px calc(20px + env(safe-area-inset-bottom)) !important; }
  .clica-dlg-bar { padding: 9px 11px !important; gap: 9px !important; }
  .clica-dlg-bar > div:last-child { padding: 5px 10px !important; font-size: 11px !important; }
  .sc-stage { height: 250px !important; }
  .sc-stage .sb2 { font-size: 26px !important; }
  .sc-stage .sb6 { gap: 12px !important; }
}

/* Telemóveis baixos (ex.: 320×568): menos ar no hero para as ações caberem no primeiro ecrã */
@media (max-width: 600px) and (max-height: 680px) {
  .home #topo .clica-hero-out { padding-top: 18px !important; padding-bottom: 100px !important; }
  .home #topo .clica-hero-out > div { padding-top: 20px; gap: 16px !important; }
  .home #topo .clica-hero-out > div p { font-size: 16px !important; line-height: 1.45 !important; }
  .home #topo .clica-btn { min-height: 50px !important; }
}

/* ---------- Até 600px: espaçamentos, tipografia e botões da homepage ---------- */
@media (max-width: 600px) {
  /* Margens laterais de 20px em vez de 32px */
  .clica-root [style*="max-width: 1320px"] { padding-left: 20px !important; padding-right: 20px !important; }

  /* Hero: preenche o primeiro ecrã, com título em cima e ações ao alcance do polegar */
  .home #topo .clica-hero-out { padding: 32px 20px 120px !important; min-height: calc(100svh - 66px); display: flex; flex-direction: column; }
  .home #topo .clica-hero-out > p { margin-bottom: 20px !important; font-size: 13px !important; letter-spacing: .12em !important; }
  .home #topo h1 { font-size: min(calc((100vw - 40px) / 5.4), 120px) !important; }
  .home #topo .clica-hero-out > div { margin-top: auto !important; padding-top: 36px; flex-direction: column !important; align-items: stretch !important; gap: 24px !important; }
  .home #topo .clica-hero-out > div p { font-size: 18px !important; }
  .home #topo .clica-hero-out > div > div { flex-direction: column; width: 100%; gap: 10px !important; }
  .home #topo .clica-btn { width: 100%; justify-content: center; min-height: 56px !important; }

  /* Faixa azul */
  .hm-band { padding: 14px 0 !important; margin-top: 10px !important; }
  .hm-band .clica-marquee { font-size: 22px !important; gap: 28px !important; }

  /* Frase que se acende: um pouco mais curta e sem saltos com a barra do browser */
  .home .clica-dark { height: 230vh !important; }
  .home .clica-dark > div { height: 100svh !important; }
  .home .clica-dark p:nth-of-type(1) { margin-bottom: 28px !important; font-size: 13px !important; }
  .home .clica-dark p:nth-of-type(2) { font-size: clamp(32px, 9.4vw, 44px) !important; }

  /* Compromisso */
  #empresa { padding: 44px 0 80px !important; }
  #empresa > div > p:first-child { margin-bottom: 28px !important; font-size: 13px !important; }
  #empresa .clica-word { padding: 24px 0 !important; gap: 10px 0 !important; }
  #empresa p.t { font-size: clamp(46px, 15vw, 76px) !important; }
  #empresa p.d { flex: 1 1 100% !important; font-size: 17px !important; }
  #empresa > div > p:last-child { margin-top: 44px !important; font-size: 19px !important; }

  /* Serviços */
  #servicos { padding: 72px 0 80px !important; }
  #servicos > div > h2 { margin-bottom: 32px !important; }
  #servicos > div > p { font-size: 13px !important; }
  #servicos > div > div { gap: 0 !important; }
  #servicos .svc-btn { min-height: 64px; padding: 20px 0; font-size: clamp(30px, 9vw, 44px); gap: 14px; }
  #servicos .svc-btn .arrow { font-size: 26px; opacity: .45; }
  #servicos .svc-btn.is-active .arrow { opacity: 1; }
  #servicos [data-svc-panel] { min-height: 0 !important; margin: 2px 0 22px; padding: 24px 22px !important; border-radius: 24px !important; gap: 18px !important; }
  #servicos [data-svc-panel] > p:nth-of-type(1) { font-size: 30px !important; }
  #servicos [data-svc-panel] > p:nth-of-type(2) { font-size: 17px !important; }
  #servicos [data-svc-panel] > div:nth-of-type(2) span { font-size: 13px !important; padding: 8px 12px !important; }
  #servicos [data-svc-panel] a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 !important; }

  /* Processo (deslize horizontal ligado ao scroll) */
  .clica-proc { height: 280vh !important; }
  .clica-proc-pin { height: 100svh !important; }
  /* O título fica um instante parado (legível) antes de a faixa começar a deslizar */
  .clica-proc-track, .clica-proc-fill { animation-range: contain 6% contain 100%; }
  .clica-proc-track { gap: 14px !important; padding: 0 20px !important; }
  .clica-proc-track > div:first-child { width: min(300px, 80vw) !important; padding-right: 8px !important; }
  .clica-proc-track > div:first-child h2 { font-size: 40px !important; }
  .clica-proc-track > div:not(:first-child) { width: min(300px, 80vw) !important; min-height: min(430px, 60svh) !important; padding: 26px !important; border-radius: 24px !important; gap: 12px !important; }
  .clica-proc-track > div:not(:first-child) > span { font-size: 92px !important; }
  .clica-proc-track > div:not(:first-child) > p:nth-of-type(1) { font-size: 28px !important; }
  .clica-proc-track > div:not(:first-child) > p:nth-of-type(2) { font-size: 16.5px !important; }

  /* Integrações */
  .hm-integ { padding: 32px 0 72px !important; gap: 14px !important; }
  .hm-integ > p { font-size: 16px !important; margin-bottom: 6px !important; }
  .hm-integ [class*="marquee"] { font-size: 38px !important; gap: 28px !important; }

  /* Reunião */
  #reuniao { padding-bottom: 72px !important; }
  #reuniao .clica-zoom { padding: 28px 22px !important; border-radius: 24px !important; gap: 24px !important; }
  #reuniao .clica-zoom p:nth-of-type(2) { font-size: 16px !important; }
  #reuniao .clica-btn { width: 100%; justify-content: center; min-height: 56px !important; }

  /* Contacto final ("Só falta um clique" → "Vamos falar?") */
  .clica-cta-pin { height: 100svh !important; min-height: 0 !important; }
  .clica-cta-body { padding: 84px 20px 28px !important; gap: 24px !important; }
  .clica-cta-body > p:first-child { font-size: clamp(60px, min(21vw, 17svh), 108px) !important; }
  .clica-cta-body [data-clicks-line] { font-size: 17px !important; }
  .clica-cta-body > div { flex-direction: column; align-items: stretch !important; gap: 22px !important; }
  .clica-cta-body > div > div:first-child { gap: 2px !important; }
  .clica-cta-body a[href^="mailto:"]:not(.clica-btn) { font-size: clamp(22px, 7vw, 30px) !important; padding: 6px 0; }
  .clica-cta-body a[href^="tel:"] { font-size: 22px !important; padding: 6px 0; }
  .clica-cta-body > div > div:last-child { flex-direction: column; width: 100%; gap: 10px !important; }
  .clica-cta-body .clica-btn { width: 100%; justify-content: center; min-height: 56px !important; font-size: 17px !important; }

  /* Rodapé */
  .clica-root footer { padding: 56px 0 120px !important; }
  .clica-root footer > div > div:first-child { padding-bottom: 36px !important; gap: 24px !important; }
  .clica-root footer > div > div:first-child .clica-btn { width: 100%; justify-content: center; }
  .clica-root footer > div > div:nth-child(2) { grid-template-columns: 1fr 1fr !important; gap: 32px 20px !important; padding: 36px 0 !important; }
  .clica-root footer > div > div:nth-child(2) > div:first-child,
  .clica-root footer > div > div:nth-child(2) > div:last-child { grid-column: 1 / -1; max-width: none !important; }
  .clica-root footer > div > div:nth-child(2) > div { gap: 0 !important; }
  .clica-root footer > div > div:nth-child(2) > div:first-child { gap: 16px !important; }
  .clica-root footer .clica-link { display: inline-flex !important; align-items: center; min-height: 44px; padding: 0 !important; }
  .clica-root footer .clica-link::after { bottom: 8px; }
  .clica-root footer > div > div:last-child { flex-direction: column; align-items: flex-start !important; gap: 8px !important; padding-top: 24px !important; }
  .clica-root footer > div > div:last-child > div { gap: 0 24px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-menu, .hb-menu-list a, .hb-menu-foot, .hb-burger span { transition: none !important; }
  .hb-menu-list a, .hb-menu-foot { transform: none !important; opacity: 1 !important; }
}

@keyframes q-sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes clica-fab-orbit { to { transform: rotate(360deg); } }
@keyframes clica-fab-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 74, 255, .55); }
  70% { box-shadow: 0 0 0 14px rgba(0, 74, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 74, 255, 0); }
}
@media (prefers-reduced-motion: reduce) { .q-dlg { animation: none !important; } }

/* Em mobile o hero é mais alto do que o ecrã: o efeito de saída (esbater ao fazer scroll)
   apagava o texto e os botões ainda a meio do ecrã. Fica desligado em ecrãs pequenos. */
@media (max-width: 600px) {
  .home #topo .clica-hero-out, .pg-hero-out { animation: none !important; }
}
