/**
 * Responsive CSS — Ader-al Theme
 * Breakpoints: Mobile (<768px), Tablet (768–1024px), Desktop (>1024px)
 *
 * Abordagem: Desktop-first com media queries de max-width.
 *
 * @package ader-al
 */

/* ═══════════════════════════════════════════════════
   TABLET — até 1024px
═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {

	/* Tipografia */
	:root {
		--ader-font-h1:    36px;
		--ader-font-h2:    28px;
		--ader-font-h3:    22px;
		--ader-hero-height: 70vh;
	}

	/* Container */
	.container {
		--ader-container-pad: 1.5rem;
	}

	/* Header — tablet */
	.header-info-item + .header-info-item {
		padding-left: var(--ader-space-lg);
		margin-left: var(--ader-space-lg);
	}

	.header-info-icon {
		width: 36px;
		height: 36px;
	}

	.header-info-icon svg {
		width: 18px;
		height: 18px;
	}

	/* Hero vídeo — tablet */
	.hero-section--video {
		height: 100vh;
		height: 100dvh;
	}

	/* Agenda */
	.agenda-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Notícias */
	.noticias-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.noticias-slider-track .noticia-card,
	.avisos-slider-track .noticia-card {
		flex: 0 0 calc(50% - var(--ader-space-md));
	}

	/* Números — mantém 3 colunas no tablet */

	/* Contactos */
	.contactos-grid {
		grid-template-columns: 1fr;
		gap: var(--ader-space-2xl);
	}

	/* Footer */
	.footer-cols {
		grid-template-columns: 1fr 1fr;
		gap: var(--ader-space-xl);
	}

	/* Interior */
	.interior-layout {
		--ader-sidebar-width: 25%;
		--ader-content-width: 75%;
		grid-template-columns: 25% 1fr;
		gap: var(--ader-space-2xl);
	}
}

/* ═══════════════════════════════════════════════════
   MOBILE — até 768px
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {

	/* Espaço para a barra de apoio em 2 linhas no mobile */
	body {
		padding-bottom: 110px;
	}

	/* Tipografia */
	:root {
		--ader-font-h1:    28px;
		--ader-font-h2:    22px;
		--ader-font-h3:    18px;
		--ader-font-h4:    16px;
		--ader-hero-height: var(--ader-hero-height-sm);
		--ader-section-padding: 3rem 0;
		--ader-apoio-height: var(--ader-apoio-height-mobile);
	}

	/* ── TOP BAR ──────────────────────────────── */
	.site-topbar {
		height: auto;
		padding: var(--ader-space-sm) 0;
	}

	.site-topbar .container {
		flex-wrap: wrap;
		gap: var(--ader-space-sm);
	}

	/* ── HEADER — mobile ───────────────────────── */
	.header-body {
		padding: var(--ader-space-sm) 0;
	}

	.header-body-inner {
		justify-content: center;
	}

	.header-info {
		display: none; /* Oculto no mobile */
	}

	.header-logo img,
	.site-logo {
		height: 70px;
	}

	/* Mostrar hamburger */
	.menu-toggle {
		display: flex;
		margin-left: auto;
	}

	/* Botão fechar (X) do drawer mobile */
	.mobile-nav-close {
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		top: var(--ader-space-md);
		right: var(--ader-space-md);
		width: 40px;
		height: 40px;
		background: transparent;
		border: none;
		cursor: pointer;
		color: var(--ader-text);
		border-radius: 50%;
		transition: background var(--ader-transition);
		z-index: calc(var(--ader-z-header) + 20);
	}

	.main-navigation:not(.is-open) .mobile-nav-close {
		display: none;
	}

	.mobile-nav-close:hover,
	.mobile-nav-close:focus-visible {
		background: var(--ader-bg-alt);
		outline: none;
	}

	/* Logo dentro do drawer mobile */
	.mobile-nav-logo {
		display: block;
		margin-bottom: var(--ader-space-xl);
		padding-bottom: var(--ader-space-lg);
		border-bottom: 1px solid var(--ader-border-light);
	}

	.mobile-nav-logo img {
		height: 50px;
		width: auto;
	}

	/* Menu mobile — drawer */
	.main-navigation {
		position: fixed;
		top: 0;
		right: -100%;
		width: min(320px, 85vw);
		height: 100vh;
		background: var(--ader-bg);
		box-shadow: var(--ader-shadow-xl);
		z-index: calc(var(--ader-z-header) + 10);
		transition: right var(--ader-transition);
		overflow-y: auto;
		padding: var(--ader-space-3xl) var(--ader-space-lg) var(--ader-space-lg);
	}

	.main-navigation.is-open {
		right: 0;
	}

	.main-navigation ul {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.main-navigation a {
		padding: var(--ader-space-md);
		border-bottom: 1px solid var(--ader-border-light);
		border-radius: 0;
		font-size: 1rem;
		white-space: normal;
		word-break: break-word;
		overflow-wrap: break-word;
	}

	/* Dropdown no mobile */
	.main-navigation ul ul {
		display: flex !important;
		position: static;
		box-shadow: none;
		border: none;
		border-radius: 0;
		padding-left: var(--ader-space-md);
		flex-direction: column;
		background: var(--ader-bg-alt);
	}

	.main-navigation ul ul ul {
		padding-left: var(--ader-space-md);
	}

	/* Nível 3+ — fonte ligeiramente menor para caber */
	.main-navigation ul ul ul a {
		font-size: 0.9rem;
	}

	/* Overlay para fechar menu */
	.nav-overlay {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0,0,0,0.5);
		z-index: calc(var(--ader-z-header) + 9);
	}

	.nav-overlay.is-visible {
		display: block;
	}

	/* ── HERO ─────────────────────────────────── */
	.hero-section--video {
		height: 100vh;
		height: 100dvh;
	}

	.hero-section--video .hero-video-wrapper iframe {
		width: 177.78vh; /* 16:9 mínimo para cobrir altura total */
		min-width: 100%;
		min-height: 56.25vw;
	}

	.hero-slide-title {
		font-size: 1.75rem;
	}

	.hero-slide-text {
		font-size: 1rem;
	}

	.hero-slide-buttons {
		flex-direction: column;
		align-items: flex-start;
	}

	.hero-arrow {
		width: 36px;
		height: 36px;
		font-size: 1rem;
	}

	.hero-arrow--prev { left: var(--ader-space-md); }
	.hero-arrow--next { right: var(--ader-space-md); }

	/* ── AGENDA ───────────────────────────────── */
	.agenda-grid {
		grid-template-columns: 1fr;
	}

	/* ── NOTÍCIAS ─────────────────────────────── */
	.noticias-grid {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		gap: var(--ader-space-md);
		padding-bottom: var(--ader-space-sm);
		justify-content: flex-start;
		scrollbar-width: none; /* Firefox */
		-ms-overflow-style: none; /* IE/Edge */
	}

	.noticias-grid::-webkit-scrollbar {
		display: none; /* Chrome/Safari */
	}

	.noticias-grid .noticia-card {
		flex: 0 0 90%;
		scroll-snap-align: start;
	}

	.noticias-slider-track .noticia-card,
	.avisos-slider-track .noticia-card {
		flex: 0 0 calc(100% - var(--ader-space-md));
	}

	/* ── LOGÓTIPOS ────────────────────────────── */
	.logotipo-item img {
		height: 52px;
	}

	/* ── NÚMEROS ──────────────────────────────── */
	.numeros-grid {
		grid-template-columns: 1fr;
	}

	.numero-item + .numero-item {
		border-left: none;
		border-top: 1px solid rgba(255, 255, 255, 0.25);
	}

	.numero-item {
		padding: var(--ader-space-lg) var(--ader-space-md);
	}

	/* ── CONTACTOS ────────────────────────────── */
	.contactos-grid {
		grid-template-columns: 1fr;
	}

	.contactos-mapa {
		aspect-ratio: 4/3;
	}

	/* ── FOOTER ───────────────────────────────── */
	.footer-cols {
		grid-template-columns: 1fr;
		gap: var(--ader-space-lg);
	}

	.footer-brand img,
	.footer-brand .custom-logo {
		margin-inline: auto;
	}

	/* ── BARRA DE APOIO (2 LINHAS NO MOBILE) ──── */
	.apoio-bar {
		padding: 8px 0;
	}

	.apoio-bar .container {
		flex-direction: column;
		gap: 8px;
	}

	.apoio-bar-left,
	.apoio-bar-right {
		width: 100%;
		grid-template-columns: 1fr 1fr;
		gap: 6px;
	}

	.apoio-bar img {
		max-height: 32px;
	}

	/* ── LAYOUT INTERIOR ──────────────────────── */
	.interior-layout {
		grid-template-columns: 1fr;
		gap: var(--ader-space-xl);
		padding-top: var(--ader-space-xl);
		padding-bottom: var(--ader-space-xl);
	}

	/* Sidebar vai para baixo do conteúdo no mobile */
	.interior-sidebar {
		order: 2;
		position: static;
	}

	.interior-content {
		order: 1;
	}

	/* ── HEADER INTERIOR ──────────────────────── */
	.interior-page-header {
		min-height: 140px;
	}

	.interior-page-header h1 {
		font-size: var(--ader-font-h3);
	}

	/* ── SECÇÃO TÍTULO ────────────────────────── */
	.ader-section-title {
		margin-bottom: var(--ader-space-xl);
	}

	/* ── BOTÕES ───────────────────────────────── */
	.btn {
		padding: 0.7rem 1.25rem;
		font-size: 0.9rem;
	}

	/* ── EQUIPA CONTACTOS ─────────────────────── */
	.contactos-equipa {
		flex-direction: column;
	}

	.contactos-equipa-item {
		flex: 1 1 auto;
	}

	/* ── AVISOS GRID ──────────────────────────── */
	.avisos-grid {
		grid-template-columns: 1fr;
	}

	/* ── ORGANOGRAMA ──────────────────────────── */
	.org-chart {
		padding: 1rem 0 2rem;
	}

	/* ── POST THUMBNAIL ───────────────────────── */
	.post-thumbnail {
		max-width: 100%;
	}

	/* ── ÍCONE PDF ────────────────────────────── */
	.interior-content a[href$=".pdf"]:not(:has(img)),
	.entry-content a[href$=".pdf"]:not(:has(img)) {
		word-break: break-all;
	}
}

/* ═══════════════════════════════════════════════════
   MOBILE PEQUENO — até 480px
═══════════════════════════════════════════════════ */
@media (max-width: 480px) {

	:root {
		--ader-container-pad: 1rem;
	}

	.hero-slide-buttons .btn {
		width: 100%;
		justify-content: center;
	}

	.agenda-card-body {
		padding: var(--ader-space-md);
	}

	.noticia-card-body {
		padding: var(--ader-space-md);
	}

	/* Equipa contactos — coluna única em ecrãs pequenos */
	.contactos-equipa-item {
		flex: 1 1 100%;
	}

	/* Organograma — nós mais pequenos */
	.org-node {
		width: 120px;
	}

	.org-node__photo {
		width: 70px;
		height: 70px;
	}

	/* Breadcrumb — texto mais pequeno */
	.breadcrumb-list {
		font-size: 0.75rem;
	}
}

/* ═══════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════ */
@media print {

	.site-topbar,
	.site-header,
	.apoio-bar,
	.site-footer,
	.main-navigation,
	.hero-section,
	.slider-controls,
	.hero-nav,
	.hero-arrow {
		display: none !important;
	}

	body {
		padding-bottom: 0;
		font-size: 12pt;
		color: #000;
	}

	.interior-layout {
		grid-template-columns: 1fr;
	}

	a {
		color: #000;
		text-decoration: underline;
	}

	.entry-content a::after {
		content: ' (' attr(href) ')';
		font-size: 0.8em;
		color: #555;
	}
}
