/* =====================================================================
   mobile.css — ajuste de escala para telemóvel
   ---------------------------------------------------------------------
   Só vale até 640px de largura. Acima disso (tablet e computador) este
   ficheiro não faz nada, por isso o desktop fica exactamente como estava.

   Deve ser a ÚLTIMA folha de estilo de cada página (depois de style.css
   e do <style> de cada página), para vencer o CSS que algumas páginas
   têm lá dentro.

   Ideia: no telemóvel o ecrã tem ~390px, não 1440px. Por isso reduzimos
   a escala (texto, ícones, botões, campos, espaços) em vez de só
   empilhar colunas.
   ===================================================================== */

@media (max-width: 640px) {

  /* ---------- escala base ----------
     Quase tudo no site está em rem; baixar a base de 16 para 15px
     encolhe texto, espaços e ícones em ~6% de uma só vez. */
  html { font-size: 15px; }
  :root { --pad: 16px; --gutter: 16px; }

  /* O texto justificado cria "buracos" enormes em colunas estreitas */
  p { text-align: left; text-align-last: auto; hyphens: manual; }

  /* ---------- títulos ---------- */
  h1, .h-xl, .hero-content h1,
  section.pub.section.hero .h-xl { font-size: clamp(1.55rem, 7.2vw, 1.85rem) !important; line-height: 1.12; letter-spacing: -.025em; }
  .page-header h1, .pais-hero h1,
  .acompanhar-hero h1 { font-size: 1.5rem !important; }
  h2, .h-lg, .section-title, .login-card h2 { font-size: clamp(1.3rem, 6vw, 1.5rem) !important; line-height: 1.15; }
  .login-card h2 { font-size: 1.2rem !important; line-height: 1.2; }
  h3, .h-md, .cx-title, .admin-cx .cx-title { font-size: 1.2rem !important; }
  .h-sm { font-size: 1.1rem !important; }
  .lead, .section-sub { font-size: .98rem !important; line-height: 1.5; }
  .hero-content p { font-size: .98rem !important; }
  main h1:not(.h-xl) { margin-bottom: 10px; }
  .section-title { margin-bottom: 10px; }
  .section-sub { margin-bottom: 24px; }

  /* Hero da página inicial no telemóvel:
     1) o título grande fica oculto (continua no código para leitores de ecrã e motores de busca);
     2) a metade de cima fica livre (só a foto);
     3) o resto — texto, botões e destaques — ocupa a metade de baixo;
     4) INSCREVA-SE e Entrar ficam lado a lado, com o ícone do WhatsApp à direita. */
  section.pub.section.hero .h-xl {
    position: absolute !important; width: 1px !important; height: 1px !important;
    margin: -1px !important; padding: 0 !important; overflow: hidden !important;
    clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important;
  }
  section.pub.section.hero {
    padding-top: 46vh !important;
    padding-top: 46svh !important;
    align-items: flex-end !important;
  }
  section.pub.section.hero > .wrap {
    display: grid; grid-template-columns: auto auto 1fr; column-gap: 10px; row-gap: 16px;
    align-items: center; justify-items: start;
  }
  section.pub.section.hero > .wrap > .measure,
  section.pub.section.hero > .wrap > .hero-destaques { grid-column: 1 / -1; margin-top: 0; }
  section.pub.section.hero .measure .lead { margin: 0; }
  /* a linha de acções deixa de ser um bloco: os seus filhos entram na mesma linha que o Entrar */
  section.pub.section.hero > .wrap > .hero-acoes { display: contents; }
  section.pub.section.hero .hero-acoes > .pill-group { grid-column: 1; grid-row: 2; margin: 0; }
  section.pub.section.hero > .wrap > .hero-entrar-mobile { display: flex; grid-column: 2; grid-row: 2; margin: 0; }
  section.pub.section.hero .hero-acoes > .hero-wa { grid-column: 3; grid-row: 2; justify-self: end; margin: 0; }
  section.pub.section.hero .btn-pill { padding-inline: 14px; font-size: .85rem; }

  /* Destaques (Formação / Empoderamento / Oportunidades): os três na MESMA linha.
     Ícone e texto encolhem para caberem em 360–390px; o texto quebra sozinho. */
  section.pub.section.hero .hero-destaques {
    display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    flex-wrap: nowrap !important; gap: 4px !important; width: 100%;
  }
  section.pub.section.hero .hero-destaques > li {
    display: flex !important; align-items: center; gap: 6px !important;
    min-width: 0; flex: none !important; padding: 0 4px !important; margin: 0 !important;
  }
  section.pub.section.hero .hd-ico { width: 24px !important; height: 24px !important; flex: 0 0 24px; }
  section.pub.section.hero .hd-ico svg { width: 13px !important; height: 13px !important; }
  section.pub.section.hero .hd-txt {
    font-size: clamp(9.5px, 2.8vw, 11.5px) !important; line-height: 1.2 !important;
    min-width: 0; overflow-wrap: anywhere;
  }
  section.pub.section.hero .hd-txt br { display: none; }

  /* ---------- espaçamento vertical das secções ---------- */
  .section { padding-block: 44px; }
  .section--tight { padding-block: 30px; }
  .mt-l { margin-top: 36px; }
  .mt-m { margin-top: 24px; }
  .page-header { padding-top: 14px; }
  .breadcrumb { font-size: .8rem; margin-bottom: 4px; }

  /* ---------- barra do topo ---------- */
  .top-brand-text { font-size: .76rem; }

  /* ---------- botões ---------- */
  .btn .label { font-size: .88rem; }
  .btn .cap { width: 44px; height: 32px; }
  .btn .cap .ico { width: 13px; height: 13px; }
  .btn--lg .cap { width: 54px; height: 39px; }
  .btn--lg .label { font-size: .98rem; }
  .btn-primary, .btn-azul, .btn-outline, .btn-outline-azul {
    min-height: 40px; padding: 10px 16px; font-size: .85rem;
  }
  .btn-login { min-height: 42px; font-size: .92rem; }
  .hero-actions { gap: 10px; }

  /* ---------- campos de formulário ----------
     16px é o mínimo para o iPhone não fazer zoom ao tocar no campo. */
  :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=button]):not([type=submit]):not([type=reset]):not([type=image]), textarea, select) {
    padding: 10px 12px; font-size: 16px;
  }
  label { font-size: .8rem; }
  .form-group { margin-bottom: 14px; }
  #insc-geral #btn-enviar-inscricao { padding: 13px 22px; font-size: .98rem; }

  /* ---------- ícones ---------- */
  .icon, .tag-icon { width: 30px; height: 30px; }
  .section-tag { font-size: 11px; padding: 5px 12px 5px 10px; margin-bottom: 12px; }
  .section-tag[data-icon]::before { width: 22px; height: 22px; font-size: 16px; }
  .hero-badge[data-icon]::before { width: 20px; height: 20px; font-size: 14px; }
  .hero-badge { font-size: .74rem; padding: 6px 12px 6px 9px; margin-bottom: 14px; }
  .hd-ico { width: 36px; height: 36px; }
  .hd-ico svg { width: 18px; height: 18px; }
  .hd-txt { font-size: 13px; }
  section.pub.section.hero .hero-wa { width: 50px; height: 50px; padding: 12px; }
  .ie-ico { font-size: 28px !important; }
  .cx-num { min-width: 34px; height: 34px; }
  .cx-num .material-symbols-outlined { font-size: 20px; }
  .contato-mapa-secao .mapa-wrapper > .material-symbols-outlined { font-size: 36px !important; }
  .acs-btn-mostrar-senha .material-symbols-outlined { font-size: 20px; }

  /* ---------- cartões e blocos ---------- */
  .ie-card { padding: 18px !important; gap: 8px; }
  .ie-card strong { font-size: 1.2rem; }
  .ie-card > span:not(.ie-ico):not(.ie-go) { font-size: .92rem; }
  .ie-h { font-size: 1.08rem; margin-top: 26px; }
  .ie-passos li, .ie-prov, .ie-caixa { padding: 14px; }
  .inscricao-form, .inscricao-camera { padding: 18px !important; }
  .login-card { padding: 22px 18px 18px !important; }
  .login-header { margin-bottom: 16px; }
  .login-logo { width: 50px; height: 50px; padding: 8px; }
  .login-wrapper { min-height: 0; padding: 22px 14px; }
  .login-form { gap: 12px; }

  /* números grandes da página "Sobre" */
  .sobre-fundacao strong { font-size: 2.1rem !important; }
  .sobre-stat strong { font-size: 1.7rem !important; }
  .stat-num { font-size: 1.5rem; }
  .stat-label { font-size: .75rem; }

  /* ---------- blocos da página inicial ---------- */
  .path { padding: 22px 20px; gap: 16px; }
  .path svg.glyph { width: 30px; height: 30px; }
  .cta-band { padding: 28px 20px; }
  .cta-band .row { gap: 18px; }
  .cta-band .form { margin-top: 18px; gap: 10px; }
  .cta-band .form input { padding: 12px 14px; }

  /* ---------- rodapé ---------- */
  .footer { padding: 28px 20px; margin-bottom: 16px; }
  .fgrid { gap: 28px; }
  .flist { font-size: .92rem; gap: 10px; }
  .footer .legal { margin-top: 28px; padding-top: 18px; font-size: .82rem; }
}

/* ecrãs muito estreitos (telemóveis pequenos, 360px ou menos) */
@media (max-width: 380px) {
  html { font-size: 14.5px; }
  .top-brand-text { font-size: .7rem; }
}
