/* IACM — ajustamentos incrementais da interface.
   Este ficheiro é carregado depois de main.css. Mantém a identidade existente
   e evita substituir o CSS original, que contém várias regras legadas. */

/* Cabeçalho fixo: reservar espaço real para que o logótipo nunca se sobreponha
   aos títulos das páginas internas, mesmo durante o carregamento do CSS. */
:root {
  --iacm-header-height: 81px;
}

body {
  padding-top: var(--iacm-header-height) !important;
}

.site-header .navbar {
  min-height: var(--iacm-header-height);
  background: rgba(255, 255, 255, 0.98) !important;
  border-bottom: 1px solid rgba(0, 51, 102, 0.1);
}

.site-header .navbar-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

/* A capa institucional precisa de contraste mesmo que uma regra legada da
   página tenha prioridade sobre a cor do texto ou o fundo da secção. */
main > .page-hero-section {
  background: linear-gradient(135deg, #003366 0%, #0056b3 100%) !important;
  color: #fff;
}

main > .page-hero-section .hero-title {
  color: #fff;
  background: none;
  -webkit-text-fill-color: #fff;
  text-shadow: none;
}

main > .page-hero-section .hero-subtitle {
  color: rgba(255, 255, 255, 0.94);
  opacity: 1;
}

/* Menu: o número de ligações exige um ponto de colapso mais largo. */
.site-header .navbar {
  z-index: 1040;
}

.site-header .navbar-nav .nav-link {
  margin: 0 0.15rem;
  padding: 0.6rem 0.55rem !important;
  font-size: 0.9rem;
}

.site-header .navbar-nav .nav-link.btn-primary,
.site-header .navbar-nav .nav-link.btn-primary:hover,
.site-header .navbar-nav .nav-link.btn-primary:focus {
  color: #ffffff !important;
  background: #0056b3;
}

.site-header .navbar-brand .logo {
  display: block;
  width: clamp(140px, 15vw, 185px);
  max-width: 185px;
  height: auto;
  max-height: 52px;
  object-fit: contain;
}

@media (max-width: 1399.98px) {
  .site-header .navbar-collapse {
    max-height: calc(100dvh - 82px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    padding: 0.85rem;
    border-radius: 0 0 14px 14px;
  }

  .site-header .navbar-nav .nav-link {
    margin: 0.15rem 0;
    padding: 0.7rem 0.9rem !important;
    white-space: normal;
  }
}

/* Imagens das capas internas: limitar dimensões e preservar proporção. */
.page-hero-section .hero-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 360px);
  max-height: 420px;
  object-fit: contain;
  margin-inline: auto;
}

/* Evita que textos compridos forcem colunas para fora da janela. */
.page-hero-section .row > *,
.hero-carousel-section .hero-info-side,
.hero-carousel-section .hero-buttons-side {
  min-width: 0;
}

.page-hero-section .hero-title,
.page-hero-section .hero-subtitle {
  overflow-wrap: break-word;
}

@media (max-width: 767.98px) {
  :root {
    --iacm-header-height: 78px;
  }

  .site-header .navbar-brand .logo {
    width: clamp(135px, 37vw, 165px);
    max-height: 48px;
  }

  .page-hero-section {
    min-height: 0;
    padding: 70px 0 48px;
  }

  .page-hero-section .row {
    row-gap: 1.5rem;
  }

  .page-hero-section .hero-image img {
    max-width: min(100%, 250px);
    max-height: 270px;
  }

  .page-hero-section .hero-title {
    font-size: clamp(1.65rem, 7vw, 2.35rem);
  }
}
