/* Carolina Pinta · Lotes */

@font-face {
	font-family: "Plex Mono";
	src: url("../fonts/plex-mono-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Plex Mono";
	src: url("../fonts/plex-mono-400-italic.woff2") format("woff2");
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}
@font-face {
	font-family: "Plex Mono";
	src: url("../fonts/plex-mono-500.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
}

:root {
	--cp-cols: 6;
	--cp-row: 150px;
	--cp-gap: 16px;
	--cp-pad: 24px;
	--cp-ratio: 0.5;
	--cp-pos: center bottom;
	--cp-fit: contain;
	--cp-ink: #111;
	--cp-mute: #8a8a8a;
	--cp-bg: #fff;
	--cp-font: "Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
	margin: 0;
	background: var(--cp-bg);
	color: var(--cp-ink);
	font-family: var(--cp-font);
	font-size: 12px;
	line-height: 1.5;
	letter-spacing: .02em;
	-webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 1px solid var(--cp-ink); outline-offset: 2px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}
.skip-link:focus {
	clip: auto; width: auto; height: auto; margin: 0;
	padding: 8px 12px; top: 8px; left: 8px;
	background: var(--cp-bg); z-index: 1000;
}

/* ---------- Cabeçalho ---------- */

.site-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 24px;
	padding: var(--cp-pad);
	padding-bottom: 0;
	text-transform: uppercase;
	letter-spacing: .08em;
}
.site-title { font-weight: 500; }
.custom-logo { max-height: 40px; width: auto; }
.site-nav__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 4px 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.site-nav__list a { color: var(--cp-mute); }
.site-nav__list a:hover,
.site-nav__list a:focus-visible,
.site-nav__list a.is-active { color: var(--cp-ink); text-decoration: none; }

/* ---------- Lote ---------- */

.lote {
	container-type: inline-size;
	padding: 0 var(--cp-pad);
	margin-top: calc(var(--cp-gap) * 4);
}
.lote:first-child { margin-top: calc(var(--cp-gap) * 2); }

.lote__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 16px;
	margin-bottom: calc(var(--cp-gap) * 1);
	text-transform: uppercase;
	letter-spacing: .08em;
}
.lote__title { margin: 0; font: inherit; font-weight: 500; display: flex; gap: 16px; }
.lote__num { color: var(--cp-mute); font-weight: 400; }
.lote__count { color: var(--cp-mute); margin-left: auto; }
.lote__desc { flex-basis: 100%; order: 3; max-width: 60ch; text-transform: none; letter-spacing: .02em; color: var(--cp-mute); }
.lote__desc p { margin: 0; }

/*
 * A grelha: N colunas full-width, rows de 150px.
 * As rows escalam com a largura para manter a proporção do ecrã de referência
 * (150px de altura numa largura de 1920px). Desligável no Personalizador.
 */
.lote__grid {
	--cp-colw: calc((100cqw - (var(--cp-cols) - 1) * var(--cp-gap)) / var(--cp-cols));
	--cp-row-h: calc(var(--cp-colw) * var(--cp-ratio));
	display: grid;
	grid-template-columns: repeat(var(--cp-cols), minmax(0, 1fr));
	grid-auto-rows: var(--cp-row-h);
	gap: var(--cp-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}
@supports not (width: 1cqw) {
	.lote__grid { grid-auto-rows: var(--cp-row); }
}

.obra {
	grid-column: span min(var(--c, 1), var(--cp-cols));
	grid-row: span var(--r, 3);
	min-width: 0;
	min-height: 0;
}
.obra__link {
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
}
.obra__img {
	width: 100%;
	height: 100%;
	object-fit: var(--cp-fit);
	object-position: var(--cp-pos);
	transition: opacity .2s ease;
}
.obra__link:hover .obra__img { opacity: .88; }
.obra__link:focus-visible { outline-offset: 4px; }

/* Telemóvel: 2 colunas, imagens na proporção natural */
@media (max-width: 700px) {
	body { --cp-pad: 14px; --cp-gap: 10px; }
	.site-header { flex-direction: column; gap: 8px; }
	.site-nav__list { justify-content: flex-start; }
	.lote__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-rows: auto;
		grid-auto-flow: row dense;
		align-items: end;
	}
	.obra { grid-column: span 1; grid-row: auto; }
	.obra.is-wide { grid-column: span 2; }
	.obra__img { height: auto; }
}

/* ---------- Páginas de texto ---------- */

.texto { padding: calc(var(--cp-gap) * 4) var(--cp-pad); max-width: 72ch; font-size: 13px; }
.texto__title { font: inherit; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 24px; }
.texto__body img { margin: 24px 0; }
.vazio { padding: 25vh var(--cp-pad); text-align: center; color: var(--cp-mute); }

/* ---------- Rodapé ---------- */

.site-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 24px;
	padding: calc(var(--cp-gap) * 5) var(--cp-pad) var(--cp-pad);
	color: var(--cp-mute);
	text-transform: uppercase;
	letter-spacing: .08em;
}
.site-footer__links { display: flex; gap: 16px; }
.site-footer a:hover { color: var(--cp-ink); }

/* ---------- Lightbox ---------- */

.lb {
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: #fff;
	color: var(--cp-ink);
	overflow: hidden;
}
.lb::backdrop { background: transparent; }
.lb[open] { display: grid; animation: cp-fade .18s ease; }
@keyframes cp-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lb[open] { animation: none; } }

.lb__fig {
	margin: 0;
	padding: 56px 72px 24px;
	height: 100%;
	min-height: 0;
	overflow: hidden;
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
	justify-items: center;
}
.lb__img {
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	object-fit: contain;
	transition: opacity .15s ease;
}
.lb__img.is-loading { opacity: .25; }
.lb__cap {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 20px;
	text-align: center;
}
.lb__title { font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.lb__ficha { color: var(--cp-mute); }
.lb__ficha:empty { display: none; }
.lb__count { color: var(--cp-mute); }

.lb__btn {
	position: absolute;
	border: 0;
	background: none;
	color: var(--cp-ink);
	font: inherit;
	font-size: 20px;
	line-height: 1;
	width: 56px;
	height: 56px;
	cursor: pointer;
}
.lb__btn:hover { opacity: .5; }
.lb__close { top: 4px; right: 4px; font-size: 26px; }
.lb__prev, .lb__next { top: 50%; transform: translateY(-50%); }
.lb__prev { left: 8px; }
.lb__next { right: 8px; }
.lb.is-single .lb__prev,
.lb.is-single .lb__next { display: none; }

@media (max-width: 700px) {
	.lb__fig { padding: 56px 12px 64px; }
	.lb__prev, .lb__next { top: auto; bottom: 4px; transform: none; }
}

body.lb-open { overflow: hidden; }
