:root {
    --topnav-h: 40px;
    --navbar-h: 90px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    padding-top: calc(var(--topnav-h) + var(--navbar-h));
    transition: padding-top 0.3s ease;
}

body.topnav-hidden {
    padding-top: var(--navbar-h) !important;
}

body.topnav-hidden #mainNavbar {
    top: 0 !important;
}

.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.mobile-submenu.show {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
}

/*
 * Permite que um bloco inserido dentro do conteúdo de uma Página (que normalmente
 * fica limitado à largura da coluna de texto) ocupe a largura total do ecrã,
 * tal como uma barra de atalhos ou secção de destaque. Uso no editor de texto
 * (botão "</>" código-fonte): envolver o bloco em <div class="full-bleed">...</div>.
 * Funciona em qualquer largura de ecrã (responsivo).
 */
.full-bleed {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Conteúdo publicado pelo editor: o reset do Tailwind remove os estilos dos
   títulos HTML. Repor a hierarquia sem depender das classes do WordPress/Elementor. */
.prose-content :is(h1, h2, h3, h4, h5, h6) {
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: .6em;
}
.prose-content h1 { font-size: var(--font-size-h1); }
.prose-content h2 { font-size: var(--font-size-h2); }
.prose-content h3 { font-size: var(--font-size-h3); }
.prose-content h4 { font-size: var(--font-size-h4); }
.prose-content h5 { font-size: var(--font-size-h5); }
.prose-content h6 { font-size: var(--font-size-h6); }
.prose-content :is(strong, b) { font-weight: 700; }
.prose-content :is(em, i) { font-style: italic; }
.prose-content ul { list-style: disc; padding-left: 1.5em; }
.prose-content ol { list-style: decimal; padding-left: 1.5em; }
.prose-content :is(ul, ol) { margin-top: .75em; margin-bottom: 1em; }
.prose-content li { margin-bottom: .35em; }

/* Links inseridos no editor (Admin → Páginas): o reset do Tailwind deixa-os com a cor do texto */
.prose-content a { color: #1d4ed8; text-decoration: underline; text-underline-offset: 2px; }
.prose-content a:hover { color: #1e3a8a; }

/* Vídeos inseridos no editor (botão "Inserir vídeo" ou "Media"): ocupam a largura do texto e ajustam-se ao telemóvel */
:is(.prose-content, .standard-page-body, .fac-texto, .centro-texto) video { display: block; width: 100%; max-width: 100%; height: auto; margin: 1rem 0; border-radius: .5rem; background: #000; }
:is(.prose-content, .standard-page-body, .fac-texto, .centro-texto) iframe { width: 100%; max-width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }

/* Tabelas de dados vindas de documentos (ex.: Linhas de Investigação): grelha legível e, no telemóvel, deslizam na horizontal */
.prose-content table.tabela-dados { border-collapse: collapse; width: 100%; margin: .75rem 0 2rem; font-size: .92rem; }
.prose-content table.tabela-dados th { background: #1e3a8a; color: #fff; font-weight: 600; text-align: left; }
.prose-content table.tabela-dados th, .prose-content table.tabela-dados td { border: 1px solid #d1d5db; padding: .45rem .7rem; vertical-align: top; min-width: 9rem; text-align: left !important; }
.prose-content table.tabela-dados tbody tr:nth-child(even) td { background: #f9fafb; }

/* Estilo partilhado das tabelas de Produção Científica e Eventos Participados. */
/* Tabela com as cores da UniZambeze (igual a Regulamentos e Normas) */
    .uz-tabela { --uz-azul: #1e4096; --uz-azul-escuro: #172f6e; --uz-vermelho: #c8102e; --uz-linha: #eef2fb; }
    .uz-tabela table { width: 100%; border-collapse: collapse; font-size: .875rem; }
    .uz-tabela thead th { background: var(--uz-azul); color: #fff; font-weight: 600; text-align: left; padding: .8rem 1rem; white-space: nowrap; }
    .uz-tabela thead th.ordenavel { cursor: pointer; user-select: none; }
    .uz-tabela thead th.ordenavel:hover { background: var(--uz-azul-escuro); }
    .uz-tabela thead th .seta { opacity: .5; margin-left: .35rem; font-size: .7rem; }
    .uz-tabela thead th[aria-sort="ascending"] .seta, .uz-tabela thead th[aria-sort="descending"] .seta { opacity: 1; }
    .uz-tabela tbody td { padding: .85rem 1rem; vertical-align: top; border-bottom: 1px solid #e5e7eb; color: #1f2937; line-height: 1.6; }
    .uz-tabela tbody tr:nth-child(even) td { background: var(--uz-linha); }
    .uz-tabela tbody tr:hover td { background: #e2e9f8; }
    .uz-tabela .prod-num { color: #6b7280; font-weight: 600; white-space: nowrap; }
    .uz-tabela .prod-nome { color: var(--uz-azul); font-weight: 600; }
    .uz-tabela .prod-orc { font-weight: 500; }
    .uz-tabela tbody td { overflow-wrap: anywhere; white-space: pre-line; }
    .uz-tabela .ordenavel:focus-visible { outline: 3px solid #c8102e; outline-offset: -3px; }
    .uz-tabela .prod-orc.em-curso { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: #fde8eb; color: var(--uz-vermelho); }
    .uz-tabela .vazio { color: #9ca3af; }
    .uz-tabela .rotulo { display: none; }
    .uz-tabela .controlo { border: 1px solid #d1d5db; border-radius: .375rem; padding: .45rem .75rem; font-size: .875rem; color: #374151; background: #fff; outline: none; }
    .uz-tabela .controlo:focus { border-color: var(--uz-azul); box-shadow: 0 0 0 3px rgba(30, 64, 150, .15); }
    .uz-tabela .pag-btn { min-width: 2.1rem; height: 2.1rem; padding: 0 .5rem; border-radius: .375rem; font-size: .8rem; font-weight: 600; color: #374151; border: 1px solid #e5e7eb; background: #fff; }
    .uz-tabela .pag-btn:hover:not(:disabled) { border-color: var(--uz-azul); color: var(--uz-azul); }
    .uz-tabela .pag-btn.activo { background: var(--uz-azul); border-color: var(--uz-azul); color: #fff; }
    .uz-tabela .pag-btn:disabled { color: #d1d5db; cursor: not-allowed; }
    /* Telemóvel: cada publicação é um cartão com os campos rotulados */
    @media (max-width: 767px) {
        .uz-tabela table, .uz-tabela tbody, .uz-tabela tr, .uz-tabela td { display: block; width: 100%; }
        .uz-tabela thead { display: none; }
        .uz-tabela tbody tr { border-bottom: 1px solid #e5e7eb; padding: .75rem 0; }
        .uz-tabela tbody td { border-bottom: 0; padding: .2rem 1rem; }
        .uz-tabela tbody td[colspan] { padding: 2.5rem 1rem; }
        .uz-tabela .rotulo { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; }
        .uz-tabela .prod-num { font-size: .75rem; }
        .uz-tabela .barra-pesquisa label { width: 100%; }
    }

/* Vídeos ao alto (gravados no telemóvel) não ocupam mais de 80% da altura do ecrã */
:is(.prose-content, .standard-page-body, .fac-texto, .centro-texto) video { max-height: 80vh; }

/* Conteúdo editorial: URLs extensos e tabelas importadas não alargam a página. */
main :is(h1, h2, h3, h4, p, a, li) { overflow-wrap: anywhere; }
:is(.prose-content, .standard-page-body, .fac-texto, .centro-texto) { min-width: 0; }
:is(.prose-content, .standard-page-body, .fac-texto, .centro-texto) img { height: auto; }
main :is(img, video, iframe, object, embed) { max-width: 100%; }
.uz-table-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; margin-block: 1rem; }
.uz-table-scroll:focus-visible { outline: 2px solid #1e4096; outline-offset: 3px; }
.uz-table-scroll > table { margin-block: 0; }
.uz-table-scroll :is(table.MsoTableGrid, table.MsoTableGrid tr, table.MsoTableGrid td) { height: auto !important; }
.uz-content-filters { flex-wrap: wrap; }
.uz-filter-fields { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.uz-filter-fields > div { min-width: 0; }
.uz-filter-fields :is(input, select) { max-width: 100%; min-height: 44px; }
main #pagination { flex-wrap: wrap; }
@media (max-width: 639px) {
    main :is(input, select, textarea) { max-width: 100%; min-width: 0; font-size: 16px; }
    .uz-content-filters { align-items: stretch; flex-direction: column; }
    .uz-filter-fields { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
    .uz-filter-fields :is(input, select) { width: 100%; font-size: 16px; }
    .uz-content-filters > button { align-self: flex-start; min-height: 44px; }
}

/* Cartazes de eventos: mais área útil, proporções preservadas e original nítido. */
.img-inteira.event-poster { width: 100%; height: auto; background: #edf1f7; }
.event-poster .img-inteira-fundo { opacity: .24; filter: blur(22px); }
.event-poster .img-inteira-frente { position: relative; width: 100%; height: auto; max-height: 560px; object-fit: contain; padding: .5rem; }
.event-poster-placeholder { aspect-ratio: 16 / 10; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; color: #60718d; background: linear-gradient(145deg, #eef2fa, #dde5f3); }
.event-poster-placeholder i { font-size: 3rem; }
.event-poster-placeholder span { font-size: .875rem; }

#eventosCarouselMobile { align-items: flex-start; overflow-y: hidden; }
#eventosCarouselMobile article { height: auto; }
