/* ==== Layout geral do arquivo ==== */
.acs-wrap { display: flex; gap: 2rem; max-width: 1300px; margin: 2rem auto; padding: 0 1rem; align-items: flex-start; }
.acs-sidebar { flex: 0 0 240px; position: sticky; top: 20px; }
.acs-sidebar ul { list-style: none; margin: 0; padding: 0; }
.acs-sidebar ul.children,
.acs-sidebar ul ul.children { padding-left: 0 !important; margin: 0.2rem 0 0.4rem 0.7rem !important; list-style: none !important; }
.acs-sidebar ul.children > li,
.acs-sidebar ul ul.children > li { position: relative; padding-left: 1.2rem !important; }
.acs-sidebar ul.children > li::before,
.acs-sidebar ul ul.children > li::before { content: "└"; position: absolute; left: 0; top: 0; color: #aaa; }
.acs-sidebar li { margin: 0.25rem 0; }
.acs-sidebar a { text-decoration: none; color: #333; }
.acs-sidebar a:hover { text-decoration: underline; }
.acs-external-site-link { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e2e2e2; font-size: 0.9rem; }
.acs-external-site-link a { color: #2271b1; }
.acs-main { flex: 1; min-width: 0; }

.acs-breadcrumbs { font-size: 0.9rem; color: #666; margin-bottom: 1rem; }
.acs-breadcrumbs a { color: #666; }

.acs-subtemas { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 2rem; }
.acs-subtema-btn { background: #f1f1f1; border-radius: 20px; padding: 0.4rem 1rem; text-decoration: none; color: #222; font-size: 0.9rem; }
.acs-subtema-btn:hover { background: #e0e0e0; }

/* ==== Grelha de cartões ==== */
.acs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.acs-main .ct-pagination { margin-top: 3rem; }
.acs-card { border: 1px solid #e2e2e2; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; background: #fff; transition: box-shadow .2s; }
.acs-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.acs-card-thumb { display: block; aspect-ratio: 3/4; background: #f6f6f6; overflow: hidden; }
.acs-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acs-thumb-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: #999; font-size: 0.85rem; }
.acs-search-thumb-placeholder {
	width: 100%; aspect-ratio: 3/4; background: #f6f6f6; border-radius: 4px;
	min-height: 80px;
}
.acs-card-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.acs-card-title { font-size: 1.05rem; margin: 0; line-height: 1.3; }
.acs-card-title a { text-decoration: none; color: #111; }
.acs-card-tema { font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; color: #888; margin: 0; }
.acs-card-btn { align-self: flex-start; background: #2271b1; color: #fff; padding: 0.4rem 1rem; border-radius: 4px; text-decoration: none; font-size: 0.85rem; margin: 0.3rem 0; }
.acs-card-btn:hover { background: #135e96; color: #fff; }
.acs-card-desc { font-size: 0.85rem; color: #555; margin: 0; line-height: 1.4; }
.acs-card-meta { font-size: 0.8rem; color: #777; margin: 0; display: flex; align-items: baseline; gap: 0.3em; min-width: 0; }
.acs-card-autor { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.acs-card-data { flex-shrink: 0; }

/* ==== Ficha individual ==== */
.acs-single-wrap { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
.acs-back-btn { display: inline-block; margin-bottom: 1rem; text-decoration: none; color: #2271b1; font-size: 0.95rem; }
.acs-single-title { margin-bottom: 0.5rem; }
.acs-meta p { margin: 0.2rem 0; }

/* Conteúdo nativo (texto/imagens/blocos escritos diretamente no editor, quando existir) */
.acs-single-content {
	max-width: 800px;
	margin: 1.5rem auto;
	line-height: 1.7;
}
.acs-single-content img,
.acs-single-content iframe,
.acs-single-content embed,
.acs-single-content video {
	max-width: 100%;
	height: auto;
}
.acs-single-content p { margin: 0 0 1rem; }

.acs-viewer-container {
	position: relative;
	width: 95%;
	max-width: 1200px;
	margin: 1.5rem auto;
}
.acs-viewer-iframe {
	width: 100%;
	height: 850px;
	border: 1px solid #ddd;
	border-radius: 6px;
	display: block;
}
@media (max-width: 600px) {
	.acs-viewer-container { width: 100%; }
	.acs-viewer-iframe { height: 600px; }
}

.acs-external-link { text-align: center; margin-top: 1rem; }
.acs-external-link a { text-decoration: none; background: #f1f1f1; padding: 0.5rem 1.2rem; border-radius: 4px; color: #222; }
.acs-external-link a:hover { background: #e2e2e2; }
.acs-share-box { margin-top: 2rem; }

@media (max-width: 782px) {
	.acs-wrap { flex-direction: column; position: relative; }

	/* Grelha: 2 cartões lado a lado em mobile */
	.acs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
	.acs-card-body { padding: 0.65rem; gap: 0.25rem; }
	.acs-card-title { font-size: 0.88rem; }
	.acs-card-tema, .acs-card-meta, .acs-card-desc { font-size: 0.7rem; }
	.acs-card-btn { font-size: 0.75rem; padding: 0.3rem 0.7rem; }

	/* Sidebar como "drawer" deslizante */
	.acs-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: min(80%, 320px);
		background: #fff;
		z-index: 9999;
		overflow-y: auto;
		overflow-x: hidden;
		box-sizing: border-box;
		padding: 1.5rem 1.2rem;
		box-shadow: 4px 0 24px rgba(0,0,0,0.18);
		transform: translateX(-100%);
		transition: transform 0.28s ease;
	}
	.acs-sidebar.is-open { transform: translateX(0); }
	.acs-sidebar.is-dragging { transition: none; }

	/* Aba/pega - elemento INDEPENDENTE da sidebar (não é filho dela), sempre fixo ao ecrã,
	   para nunca ser cortada por overflow e estar sempre disponível para iniciar o arrasto,
	   mesmo com o painel fechado/fora de ecrã. */
	.acs-sidebar-handle {
		position: fixed;
		top: 50%;
		left: 0;
		transform: translateY(-50%);
		width: 34px;
		height: 64px;
		background: #2271b1;
		color: #fff;
		border: none;
		border-radius: 0 10px 10px 0;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 1.5rem;
		line-height: 1;
		cursor: pointer;
		box-shadow: 3px 0 10px rgba(0,0,0,0.18);
		padding: 0;
		z-index: 10000;
		transition: left 0.28s ease;
	}
	.acs-sidebar-handle.is-open { left: min(80%, 320px); }
	.acs-sidebar-handle-arrow { display: inline-block; transition: transform 0.28s ease; }
	.acs-sidebar-handle.is-open .acs-sidebar-handle-arrow { transform: rotate(180deg); }

	/* Fundo escurecido atrás do painel aberto - tocar fora fecha */
	.acs-sidebar-overlay {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0,0,0,0.4);
		z-index: 9998;
	}
	.acs-sidebar-overlay.is-visible { display: block; }
}

@media (min-width: 783px) {
	.acs-sidebar-handle,
	.acs-sidebar-overlay { display: none !important; }
}
