/* ==========================================================================
   Projetos Solidários – Alunos  |  Frontend
   Paleta: Primary #0D1033 · Secondary #71B4BE · Accent #FBCB3B
           Accent 2 #CF271E · Accent 3 #C52A74 · Background #FFFDF9
   ========================================================================== */

.pal-scope {
	--pal-primary: #0D1033;
	--pal-secondary: #71B4BE;
	--pal-accent: #FBCB3B;
	--pal-accent-2: #CF271E;
	--pal-accent-3: #C52A74;
	--pal-bg: #FFFDF9;
	--pal-surface: #FFFFFF;
	--pal-surface-alt: #F1F7F8;
	--pal-text: #0D1033;
	--pal-text-2: #555A70;
	--pal-border: #D9DEE2;
	--pal-hover: #20264F;
	--pal-active: #080A25;
	--pal-disabled: #A8ACB8;

	color: var(--pal-text);
	box-sizing: border-box;
}
.pal-scope *,
.pal-scope *::before,
.pal-scope *::after {
	box-sizing: inherit;
}

.pal-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------------------------
   Botão
   -------------------------------------------------------------------------- */
.pal-scope .pal-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .55em;
	padding: .8em 1.5em;
	border: 2px solid var(--pal-accent);
	border-radius: 999px;
	background: var(--pal-accent);
	color: var(--pal-primary);
	font: inherit;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}
.pal-scope .pal-btn__icon {
	flex: none;
	color: var(--pal-accent-2);
	transition: color .2s ease, transform .2s ease;
}
.pal-scope .pal-btn:hover,
.pal-scope .pal-btn:focus-visible {
	background: var(--pal-hover);
	border-color: var(--pal-hover);
	color: #fff;
}
.pal-scope .pal-btn:hover .pal-btn__icon,
.pal-scope .pal-btn:focus-visible .pal-btn__icon {
	color: var(--pal-accent);
	transform: scale(1.15);
}
.pal-scope .pal-btn:active {
	background: var(--pal-active);
	border-color: var(--pal-active);
	color: #fff;
}
.pal-scope .pal-btn:focus-visible {
	outline: 3px solid var(--pal-accent-3);
	outline-offset: 3px;
}
.pal-scope .pal-btn[aria-disabled="true"],
.pal-scope .pal-btn.is-disabled {
	background: var(--pal-disabled);
	border-color: var(--pal-disabled);
	color: #fff;
	pointer-events: none;
}
.pal-scope .pal-btn--lg {
	padding: 1em 1.9em;
	font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   Friso (página inicial)
   -------------------------------------------------------------------------- */
.pal-frieze {
	--pal-gap: var(--pal-gap-d, 24px);
	--pal-cols: var(--pal-cols-d, 4);
	position: relative;
	width: 100%;
	container-type: inline-size;
}
@media (max-width: 1023px) {
	.pal-frieze { --pal-cols: var(--pal-cols-t, 2); }
}
@media (max-width: 767px) {
	.pal-frieze { --pal-gap: 16px; }
}

.pal-frieze__viewport {
	padding: 16px 0 28px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x proximity;
	overscroll-behavior-x: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--pal-secondary) transparent;
}

.pal-frieze .pal-frieze__track {
	display: flex;
	align-items: stretch;
	gap: var(--pal-gap);
	width: max-content;
	min-width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pal-frieze .pal-frieze__item {
	display: flex;
	flex: 0 0 280px; /* alternativa para navegadores sem unidades cqw */
	flex: 0 0 calc((100cqw - (var(--pal-cols) - 1) * var(--pal-gap)) / var(--pal-cols));
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

/* Telemóvel: 1 vinheta + ~15 % da seguinte, deslize tátil, sem rotação */
@media (max-width: 767px) {
	.pal-frieze .pal-frieze__item {
		flex-basis: calc((100cqw - var(--pal-gap)) / 1.15);
		scroll-snap-align: start;
	}
	.pal-frieze__viewport {
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
	}
	.pal-frieze__viewport::-webkit-scrollbar { display: none; }
}

.pal-frieze .pal-frieze__item::before,
.pal-frieze .pal-frieze__item::marker { content: none; }

/* Sem rotação e a caber no ecrã: vinhetas centradas */
.pal-frieze.is-static .pal-frieze__track { justify-content: center; }

/* Rotação: a animação é criada em JavaScript (ver frontend.js); aqui só o essencial. */
.pal-frieze.is-marquee .pal-frieze__viewport {
	overflow: hidden;
	scroll-snap-type: none;
}

/* Botão de pausa/retoma (WCAG 2.2.2) */
.pal-frieze__controls {
	display: flex;
	justify-content: flex-end;
	margin-top: -8px;
}
.pal-frieze__controls[hidden] { display: none; }
.pal-scope .pal-frieze__toggle {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 2px solid var(--pal-border);
	border-radius: 50%;
	background: var(--pal-surface);
	color: var(--pal-primary);
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.pal-scope .pal-frieze__toggle:hover {
	background: var(--pal-hover);
	border-color: var(--pal-hover);
	color: #fff;
}
.pal-scope .pal-frieze__toggle:active {
	background: var(--pal-active);
	border-color: var(--pal-active);
	color: #fff;
}
.pal-scope .pal-frieze__toggle:focus-visible {
	outline: 3px solid var(--pal-accent-3);
	outline-offset: 2px;
}
.pal-frieze__toggle [hidden] { display: none; }
.pal-frieze__toggle span { display: inline-grid; place-items: center; }

.pal-empty {
	padding: 1rem 1.25rem;
	border: 1px dashed var(--pal-border, #D9DEE2);
	border-radius: 12px;
	color: #555A70;
}

/* --------------------------------------------------------------------------
   Vinheta
   -------------------------------------------------------------------------- */
.pal-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	overflow: hidden;
	border: 1px solid var(--pal-border);
	border-radius: 18px;
	background: var(--pal-surface);
	box-shadow: 0 1px 2px rgba(13, 16, 51, .05);
	transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.pal-card:hover,
.pal-card:focus-within {
	transform: translateY(-4px);
	border-color: var(--pal-secondary);
	box-shadow: 0 14px 32px rgba(13, 16, 51, .14);
}

.pal-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--pal-surface-alt);
}
.pal-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: 50% 25%;
	transition: transform .5s ease;
}
.pal-card:hover .pal-card__media img { transform: scale(1.04); }

.pal-card__placeholder {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, var(--pal-surface-alt), var(--pal-surface));
	color: var(--pal-secondary);
	font-size: 3.5rem;
	font-weight: 700;
}

.pal-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: .5rem;
	padding: 1rem 1.1rem 1.2rem;
}
.pal-card__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: .6rem;
}
.pal-card__name {
	margin: 0;
	color: var(--pal-primary);
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.25;
}
.pal-card__link,
.pal-card__link:hover,
.pal-card__link:focus {
	color: inherit;
	text-decoration: none;
}
/* Toda a vinheta é clicável (o botão «Apoiar» fica por cima) */
.pal-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
}
.pal-card__link:focus-visible { outline: none; }
.pal-card__link:focus-visible::after {
	outline: 3px solid var(--pal-accent-3);
	outline-offset: -3px;
}

.pal-card__age {
	flex: none;
	padding: .25em .75em;
	border: 1px solid var(--pal-border);
	border-radius: 999px;
	background: var(--pal-surface-alt);
	color: var(--pal-primary);
	font-size: .8rem;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}
.pal-card__project {
	margin: 0;
	color: var(--pal-accent-3);
	font-size: .95rem;
	font-weight: 600;
	line-height: 1.35;
}
.pal-card__excerpt {
	flex: 1;
	margin: 0;
	color: var(--pal-text-2);
	font-size: .9rem;
	line-height: 1.5;
}
.pal-card__actions {
	display: flex;
	flex-direction: column;
	gap: .55rem;
	margin-top: .6rem;
}
.pal-scope .pal-card .pal-btn {
	position: relative;
	z-index: 2;
	width: 100%;
	padding: .7em 1em;
	font-size: .95rem;
}

/* Botão secundário (contorno) */
.pal-scope .pal-btn--outline {
	background: transparent;
	border-color: var(--pal-primary);
	color: var(--pal-primary);
}
.pal-scope .pal-btn--outline:hover,
.pal-scope .pal-btn--outline:focus-visible {
	background: var(--pal-hover);
	border-color: var(--pal-hover);
	color: #fff;
}
.pal-scope .pal-btn--outline:active {
	background: var(--pal-active);
	border-color: var(--pal-active);
	color: #fff;
}

/* --------------------------------------------------------------------------
   Perfil
   -------------------------------------------------------------------------- */
body.pal-hide-title.pal-single .entry-header,
body.pal-hide-title.pal-single .page-header,
body.pal-hide-title.pal-single .post-header,
body.pal-hide-title.pal-single .entry-meta,
body.pal-hide-title.pal-single .wp-block-post-title,
body.pal-hide-title.pal-single .wp-block-post-date,
body.pal-hide-title.pal-single .wp-block-post-author,
body.pal-hide-title.pal-single .wp-block-post-featured-image,
body.pal-hide-title.pal-single .post-thumbnail,
body.pal-hide-title.pal-single .post-navigation {
	display: none !important;
}

.pal-profile {
	max-width: 1100px;
	margin: 0 auto;
	padding: clamp(16px, 3vw, 32px) 16px 56px;
	font-size: 1.05rem;
	line-height: 1.7;
}

.pal-hero {
	display: grid;
	grid-template-columns: 1fr;
	gap: clamp(24px, 4vw, 56px);
	align-items: center;
	margin-bottom: clamp(36px, 6vw, 64px);
}
@media (min-width: 768px) {
	.pal-hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}

.pal-hero__media {
	position: relative;
	isolation: isolate;
}
.pal-hero__media::before {
	content: "";
	position: absolute;
	right: -12px;
	bottom: -12px;
	z-index: -1;
	width: 62%;
	height: 62%;
	border-radius: 28px;
	background: var(--pal-accent);
}
.pal-hero__photo {
	position: relative;
	aspect-ratio: 1 / 1;
	margin: 0;
	overflow: hidden;
	border-radius: 24px;
	background: var(--pal-surface-alt);
	box-shadow: 0 18px 40px rgba(13, 16, 51, .18);
}
.pal-hero__photo img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: 50% 20%;
}

.pal-eyebrow {
	margin: 0 0 .5rem;
	color: var(--pal-accent-3);
	font-size: .85rem;
	font-weight: 700;
	letter-spacing: .12em;
	line-height: 1.3;
	text-transform: uppercase;
}
.pal-hero__name {
	margin: 0 0 .75rem;
	color: var(--pal-primary);
	font-size: clamp(2rem, 4.5vw, 3.2rem);
	font-weight: 800;
	line-height: 1.1;
}

.pal-chips {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}
.pal-chip {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	margin: 0;
	padding: .3em .9em;
	border: 1px solid var(--pal-border);
	border-radius: 999px;
	background: var(--pal-surface-alt);
	color: var(--pal-primary);
	font-size: .95rem;
	font-weight: 600;
	line-height: 1.4;
}
.pal-chip svg { flex: none; color: var(--pal-accent-3); }

.pal-hero__project {
	margin: 0 0 1.5rem;
	padding-left: 1rem;
	border-left: 4px solid var(--pal-accent);
}
.pal-label {
	margin: 0 0 .15rem;
	color: var(--pal-text-2);
	font-size: .85rem;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
}
.pal-hero__project-title {
	margin: 0;
	color: var(--pal-primary);
	font-size: clamp(1.4rem, 2.8vw, 2rem);
	font-weight: 700;
	line-height: 1.25;
}
.pal-hero__cta { margin: 0; }

/* Secções */
.pal-section { margin: 0 0 clamp(32px, 5vw, 56px); }
.pal-section__title {
	position: relative;
	margin: 0 0 1.25rem;
	padding-bottom: .65rem;
	color: var(--pal-primary);
	font-size: clamp(1.4rem, 2.6vw, 1.9rem);
	font-weight: 700;
	line-height: 1.2;
}
.pal-section__title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 56px;
	height: 4px;
	border-radius: 4px;
	background: var(--pal-accent);
}

.pal-panel {
	padding: clamp(20px, 3vw, 36px);
	border: 1px solid var(--pal-border);
	border-radius: 20px;
	background: var(--pal-surface);
}
.pal-panel--alt {
	border-color: transparent;
	background: var(--pal-surface-alt);
}

.pal-richtext { color: var(--pal-text); }
.pal-richtext > :first-child { margin-top: 0; }
.pal-richtext > :last-child { margin-bottom: 0; }
.pal-richtext p { margin: 0 0 1.1em; }
.pal-richtext h3,
.pal-richtext h4 {
	margin: 1.6em 0 .5em;
	color: var(--pal-primary);
	line-height: 1.3;
}
.pal-richtext ul,
.pal-richtext ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.pal-richtext li { margin-bottom: .35em; }
.pal-richtext a { color: var(--pal-accent-3); text-decoration: underline; }
.pal-richtext a:hover { color: var(--pal-hover); }
.pal-richtext blockquote {
	margin: 1.2em 0;
	padding: .2em 0 .2em 1.1em;
	border-left: 4px solid var(--pal-secondary);
	color: var(--pal-text-2);
	font-style: italic;
}

/* Vídeo 16:9 */
.pal-video__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 20px;
	background: var(--pal-primary);
	box-shadow: 0 14px 34px rgba(13, 16, 51, .16);
}
.pal-video__frame iframe,
.pal-video__frame video,
.pal-video__frame embed,
.pal-video__frame object {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.pal-video__frame video { object-fit: contain; }

/* Galeria 16:9 */
.pal-gallery {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}
@media (min-width: 768px) {
	.pal-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}
.pal-gallery li { margin: 0; padding: 0; list-style: none; }
.pal-gallery__link {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 14px;
	background: var(--pal-surface-alt);
	cursor: zoom-in;
}
.pal-gallery__link img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform .4s ease;
}
.pal-gallery__link:hover img { transform: scale(1.06); }
.pal-gallery__link:focus-visible {
	outline: 3px solid var(--pal-accent-3);
	outline-offset: 3px;
}

/* Apelo final */
.pal-cta {
	margin: 0 0 2rem;
	padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 48px);
	border-radius: 24px;
	background: var(--pal-primary);
	color: #fff;
	text-align: center;
}
.pal-cta__title {
	margin: 0 0 .5rem;
	color: #fff;
	font-size: clamp(1.5rem, 3vw, 2.2rem);
	font-weight: 800;
	line-height: 1.2;
}
.pal-cta__text {
	max-width: 46ch;
	margin: 0 auto 1.5rem;
	color: rgba(255, 255, 255, .85);
}
.pal-scope .pal-cta .pal-btn:hover,
.pal-scope .pal-cta .pal-btn:focus-visible {
	background: #fff;
	border-color: #fff;
	color: var(--pal-primary);
}
.pal-scope .pal-cta .pal-btn:active {
	background: var(--pal-surface-alt);
	border-color: var(--pal-surface-alt);
	color: var(--pal-primary);
}
.pal-scope .pal-cta .pal-btn:hover .pal-btn__icon,
.pal-scope .pal-cta .pal-btn:focus-visible .pal-btn__icon { color: var(--pal-accent-2); }
.pal-scope .pal-cta .pal-btn:focus-visible { outline-color: var(--pal-accent); }

.pal-back { margin: 0; }
.pal-scope .pal-back a {
	color: var(--pal-primary);
	font-weight: 600;
	text-decoration: none;
	border-bottom: 2px solid var(--pal-accent);
}
.pal-scope .pal-back a:hover { color: var(--pal-hover); border-bottom-color: var(--pal-accent-3); }

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
body.pal-lightbox-open { overflow: hidden; }
.pal-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(8, 10, 37, .94);
}
.pal-lightbox[hidden] { display: none; }
.pal-lightbox__figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: min(1200px, 100%);
	max-height: 100%;
	margin: 0;
}
.pal-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 120px);
	border-radius: 12px;
	background: #000;
	object-fit: contain;
}
.pal-lightbox__count {
	color: #fff;
	font-size: .9rem;
}
.pal-lightbox__btn {
	position: absolute;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 2px solid rgba(255, 255, 255, .45);
	border-radius: 50%;
	background: rgba(13, 16, 51, .75);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease;
}
.pal-lightbox__btn:hover { background: var(--pal-hover); border-color: #fff; }
.pal-lightbox__btn:active { background: var(--pal-active); }
.pal-lightbox__btn:focus-visible { outline: 3px solid var(--pal-accent); outline-offset: 2px; }
.pal-lightbox__btn--close { top: 16px; right: 16px; }
.pal-lightbox__btn--prev { top: 50%; left: 16px; transform: translateY(-50%); }
.pal-lightbox__btn--next { top: 50%; right: 16px; transform: translateY(-50%); }
@media (max-width: 767px) {
	.pal-lightbox { padding: 12px; }
	.pal-lightbox__btn--prev,
	.pal-lightbox__btn--next { top: auto; bottom: 16px; transform: none; }
	.pal-lightbox__btn--prev { left: 16px; }
	.pal-lightbox__btn--next { right: 16px; }
	.pal-lightbox__img { max-height: calc(100vh - 160px); }
}
