/* Components: cards, grid, archive heads, pagination. */

.czr-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
}

.czr-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--bg);
}

.czr-card__media {
	display: block;
	overflow: hidden;
	aspect-ratio: 3 / 2;
	background: var(--bg-soft);
}

/* Source photos carry a baked-in watermark in the bottom-left corner; scale from the top-right to crop it out. */
.czr-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform: scale(1.3);
	transform-origin: 90% 8%;
	transition: transform 0.3s ease;
}

.czr-card:hover .czr-card__media img {
	transform: scale(1.34);
}

.czr-card__body {
	padding: 12px 0 0;
}

.czr-card__label {
	display: inline-block;
	margin-bottom: 4px;
	font-size: 11px;
	font-weight: 700;
	color: var(--amber-text);
	letter-spacing: 0.06em;
	text-decoration: none;
	text-transform: uppercase;
}

.czr-card__title {
	display: -webkit-box;
	margin: 0 0 4px;
	overflow: hidden;
	font-size: 18px;
	line-height: 1.3;
	overflow-wrap: anywhere;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
}

.czr-card__title a {
	color: var(--text);
	text-decoration: none;
}

.czr-card__title a:hover {
	color: var(--cz-blue);
	text-decoration: underline;
	text-decoration-color: var(--amber);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.czr-card__date {
	color: var(--muted);
	font-size: 13px;
}

.czr-archive-head {
	margin-bottom: 32px;
}

.czr-archive-head__title {
	margin: 0 0 8px;
	font-size: 28px;
	line-height: 1.2;
}

.czr-archive-head__desc,
.czr-empty {
	color: var(--muted);
}

.czr-pagination ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 40px 0 0;
	padding: 0;
	list-style: none;
}

.czr-pagination a,
.czr-pagination span {
	display: block;
	min-width: 40px;
	padding: 8px 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	color: var(--text);
	text-align: center;
	text-decoration: none;
}

.czr-pagination .current {
	border-color: var(--red);
	background: var(--red);
	color: #fff;
}

/* "Zobacz wszystkie" is shortened to "Wszystkie" on phones so the heading keeps its line. */
.czr-more-short {
	display: none;
}

@media (max-width: 599px) {
	.czr-more-long {
		display: none;
	}

	.czr-more-short {
		display: inline;
	}
}

/* Phones, card lists (front page, archives, search): narrow cards with the photo on the left. */
@media (max-width: 599px) {
	.czr-grid--compact {
		gap: 16px;
	}

	.czr-grid--compact .czr-card {
		flex-direction: row;
		gap: 12px;
		align-items: flex-start;
	}

	.czr-grid--compact .czr-card__media {
		flex: 0 0 38%;
		aspect-ratio: 4 / 3;
	}

	.czr-grid--compact .czr-card__body {
		padding: 0;
	}

	.czr-grid--compact .czr-card__title {
		font-size: 16px;
	}
}

@media (min-width: 600px) {
	.czr-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Tablets: two columns, so the third card of a front-page section is hidden to avoid a lone card. */
@media (min-width: 600px) and (max-width: 959px) {
	.czr-grid--trim .czr-card:nth-child(3) {
		display: none;
	}
}

@media (min-width: 960px) {
	.czr-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.czr-section {
	margin-bottom: 48px;
}

.czr-breadcrumbs {
	margin-bottom: 16px;
	color: var(--muted);
	font-size: 13px;
}

.czr-breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The separator trails the previous item, so a wrapped line never starts with a lone arrow. */
.czr-breadcrumbs li:not(:last-child)::after {
	margin-left: 8px;
	content: "›";
}

.czr-single__head {
	margin: 0 0 24px;
}

.czr-single__title {
	max-width: 1000px;
	margin: 4px 0 8px;
	text-wrap: pretty;
	font-size: 26px;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

@media (min-width: 600px) {
	.czr-single__title {
		text-wrap: balance;
		font-size: 30px;
	}
}

.czr-single__media {
	margin: 0 0 20px;
}

/* The photo is cropped to two thirds of its own height (--czr-ratio comes from single.php); the title sits below it. */
.czr-single__media img {
	width: 100%;
	aspect-ratio: var(--czr-ratio, 3);
	object-fit: cover;
	object-position: 50% 40%;
}

.czr-single__body,
.czr-prose {
	max-width: 760px;
	margin: 0 auto;
}

/* Post layout: text on the left, "W skrócie" and the map on the right; galleries run full width below. */
.czr-single__layout {
	display: grid;
	gap: 24px;
}

.czr-single__layout .czr-single__body {
	max-width: 760px;
	margin: 0;
}

/* Grid items default to min-width: auto, so a long unbreakable word (such as a URL) would widen the column past the screen. */
.czr-single__layout > * {
	min-width: 0;
}

.czr-prose {
	overflow-wrap: anywhere;
}

.czr-single__side {
	display: grid;
	gap: 20px;
	align-content: start;
}

.czr-single__side .czr-map {
	margin: 0;
}

.czr-summary {
	padding: 16px 18px;
	background: var(--bg-soft);
	border-top: 4px solid var(--amber);
}

.czr-summary__title {
	margin: 0 0 8px;
	font-size: 16px;
	font-weight: 800;
	color: var(--cz-blue);
}

.czr-summary p {
	margin: 0;
	font-size: 15px;
	line-height: 1.55;
}

/* One summary only: inside the text on phones, in the side column on desktop. */
.czr-single__side .czr-summary {
	display: none;
}

.czr-single__layout--aside .czr-summary--inline + * {
	margin-top: 1.5em;
}

@media (min-width: 1024px) {
	.czr-single__layout--aside {
		grid-template-columns: minmax(0, 1fr) 340px;
		gap: 40px;
	}

	.czr-summary--inline {
		display: none;
	}

	.czr-single__side .czr-summary {
		display: block;
	}

	/* The side column stays in view while the text scrolls past it. */
	.czr-single__layout--aside .czr-single__side {
		position: sticky;
		top: 24px;
		align-self: start;
	}
}

.czr-single > .czr-gallery:not(:has(.czr-gallery__mosaic)) {
	max-width: 760px;
}

.czr-prose img {
	max-width: 100%;
	height: auto;
}

/* Photos with a caption: WordPress sets a fixed pixel width inline, so it has to be overridden to keep them inside the text column. */
.czr-prose .wp-caption {
	width: auto !important;
	max-width: 100%;
	margin: 1.5em 0;
}

.czr-prose .wp-caption img {
	display: block;
	width: 100%;
}

.czr-prose .wp-caption-text {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 14px;
}

/* Photos that follow each other: two side by side (portrait), three as one large plus two small. The credit sits on the photo. */
.czr-photos {
	display: grid;
	gap: 6px;
	margin: 1.5em 0;
}

.czr-photos--2 {
	grid-template-columns: 1fr 1fr;
}

.czr-photos--3 {
	grid-template-columns: 3fr 2fr;
	grid-template-rows: 1fr 1fr;
	aspect-ratio: 4 / 3;
}

.czr-photos--3 > :first-child {
	grid-row: 1 / span 2;
}

.czr-photos > * {
	position: relative;
	min-width: 0;
	margin: 0 !important;
	overflow: hidden;
}

.czr-photos--2 > * {
	aspect-ratio: 3 / 4;
}

.czr-photos figure,
.czr-photos .wp-caption {
	width: 100% !important;
	max-width: none;
	margin: 0;
}

.czr-photos img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.czr-photos > figure > figure {
	height: 100%;
}

.czr-photos figcaption,
.czr-photos .wp-caption-text {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	margin: 0;
	padding: 24px 10px 6px;
	background: linear-gradient(to top, rgb(0 0 0 / 65%), rgb(0 0 0 / 0%));
	color: #fff;
	font-size: 12px;
	line-height: 1.3;
}

.czr-prose .aligncenter {
	display: block;
	margin-right: auto;
	margin-left: auto;
}

@media (min-width: 761px) {
	.czr-prose .alignleft {
		float: left;
		max-width: 50%;
		margin: 0.3em 1.5em 1em 0;
	}

	.czr-prose .alignright {
		float: right;
		max-width: 50%;
		margin: 0.3em 0 1em 1.5em;
	}
}

.czr-ad:empty {
	display: none;
}

.czr-search {
	display: flex;
	gap: 8px;
}

.czr-search__input {
	min-width: 0;
	padding: 8px 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font: inherit;
}

.czr-search__btn {
	padding: 8px 12px;
	border: 0;
	border-radius: var(--radius);
	background: var(--red);
	color: #fff;
	cursor: pointer;
}

.czr-section-head {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 0 0 16px;
}

.czr-section-head__title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: 20px;
	font-weight: 800;
	line-height: 1.2;
}

/* The blue wedge of the Czech flag, before every section title. */
.czr-section-head__title::before,
.czr-gallery__head h2::before {
	flex: none;
	width: 11px;
	height: 1.1em;
	background: var(--cz-blue);
	clip-path: polygon(0 0, 100% 50%, 0 100%);
	content: "";
}

.czr-section-head::after {
	order: 1;
	flex: 1;
	height: 1px;
	background: var(--line);
	content: "";
}

.czr-section-head__more {
	order: 2;
	flex: none;
	white-space: nowrap;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
}

/* Map embeds and galleries migrated from WPBakery. */
.czr-map {
	position: relative;
	margin: 1.5em 0;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--line);
}

/* Tablets: the map spans the text width, so a wider, lower frame. */
@media (min-width: 768px) and (max-width: 1023px) {
	.czr-single .czr-map {
		aspect-ratio: 16 / 9;
	}
}

.czr-map iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Photo gallery: a vertical stream plus a full-screen viewer (inc/gallery.php). */
.czr-gallery {
	margin: 40px 0;
	padding-top: 28px;
	border-top: 1px solid var(--line);
}

.czr-gallery__head {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 20px;
}

.czr-gallery__head h2 {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: 20px;
	font-weight: 800;
	line-height: 1.2;
}

.czr-gallery__count {
	color: var(--muted);
	font-size: 14px;
}

.czr-gallery__fullscreen {
	margin-left: auto;
	padding: 6px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: none;
	color: var(--text);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.czr-gallery__fullscreen:hover {
	border-color: var(--text);
}

.czr-gallery__stream {
	display: grid;
	gap: 22px;
}

.czr-gallery__fig {
	margin: 0;
}

.czr-gallery__open {
	display: block;
	width: 100%;
	padding: 0;
	overflow: hidden;
	border: 0;
	background: var(--bg-soft);
	cursor: zoom-in;
}

.czr-gallery__open img {
	display: block;
	width: 100%;
	height: auto;
}

.czr-gallery__fig figcaption {
	display: flex;
	gap: 12px;
	margin-top: 8px;
	color: var(--muted);
	font-size: 14px;
}

.czr-gallery__n {
	flex: none;
	color: var(--text);
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	white-space: nowrap;
}

/* Viewer: always dark, regardless of the page theme. */
.czr-lb {
	position: fixed;
	inset: 0;
	z-index: 100;
	height: 100vh;
	height: 100dvh;
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
	background: #0d0e0f;
	color: #ecedee;
}

.czr-lb[hidden] {
	display: none !important;
}

.czr-lb__top,
.czr-lb__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	font-size: 14px;
}

.czr-lb__count {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.czr-lb__close {
	width: 44px;
	height: 44px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 22px;
	cursor: pointer;
}

.czr-lb__stage {
	min-height: 0;
	padding-inline: 56px;
	touch-action: pan-y;
}

/* Fill the stage and let object-fit letterbox: percentage max-height fails inside a grid and the photo overflows the screen. */
.czr-lb__stage img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	user-select: none;
}

.czr-lb__cap {
	color: #a3a7ac;
}

.czr-lb__nav {
	position: absolute;
	top: 50%;
	width: 48px;
	height: 72px;
	translate: 0 -50%;
	border: 0;
	border-radius: 4px;
	background: rgb(255 255 255 / 8%);
	color: #fff;
	font-size: 34px;
	cursor: pointer;
}

.czr-lb__nav:hover {
	background: rgb(255 255 255 / 16%);
}

.czr-lb__nav--prev {
	left: 6px;
}

.czr-lb__nav--next {
	right: 6px;
}

.czr-lb button:focus-visible {
	outline: 3px solid #ee4d57;
	outline-offset: 2px;
}

/* Short screens (phones in landscape): the photo takes the whole height, bars float over it. */
@media (max-height: 520px) {
	.czr-lb {
		grid-template-rows: minmax(0, 1fr);
		padding: 0;
	}

	.czr-lb__top,
	.czr-lb__bottom {
		position: absolute;
		right: 0;
		left: 0;
		z-index: 1;
		padding: 6px 16px;
	}

	.czr-lb__top {
		top: 0;
		background: linear-gradient(rgb(0 0 0 / 65%), rgb(0 0 0 / 0%));
	}

	.czr-lb__bottom {
		bottom: 0;
		padding-top: 24px;
		background: linear-gradient(rgb(0 0 0 / 0%), rgb(0 0 0 / 70%));
		font-size: 13px;
	}

	.czr-lb__cap {
		color: #e4e6e8;
	}

	.czr-lb__close {
		width: 40px;
		height: 40px;
	}
}

@media (max-width: 560px) {
	.czr-lb__stage {
		padding-inline: 0;
	}

	.czr-lb__nav {
		display: none;
	}
}

/* Gallery mosaic: one large photo plus small ones, the last can say "+N" (inc/gallery.php). */
.czr-gallery__mosaic {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 6px;
}

.czr-gallery__tile {
	position: relative;
	aspect-ratio: 1;
}

.czr-gallery__tile img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.czr-gallery__tile:hover img {
	transform: scale(1.05);
}

/* Few photos: a single row of tiles. Phone: three photos are one wide photo plus two squares, 2 and 4 photos are squares. */
.czr-gallery__mosaic--3,
.czr-gallery__mosaic--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.czr-gallery__mosaic.czr-gallery__mosaic--1 {
	grid-template-columns: minmax(0, 1fr);
}

/* Phone: four photos are one wide photo plus three squares (default 3 columns). */

.czr-gallery__mosaic--2 .czr-gallery__tile:first-child {
	grid-column: auto;
	aspect-ratio: 1;
}

.czr-gallery__tile:first-child {
	grid-column: 1 / -1;
	aspect-ratio: 16 / 10;
}

.czr-gallery__plus {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgb(15 42 74 / 70%);
	color: #fff;
	font-size: 24px;
	font-weight: 800;
}

@media (min-width: 761px) {
	.czr-gallery__mosaic--7 {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.czr-gallery__mosaic--4 {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.czr-gallery__mosaic--5,
	.czr-gallery__mosaic--3 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.czr-gallery__mosaic.czr-gallery__mosaic--1 .czr-gallery__tile:first-child {
		grid-column: auto;
		grid-row: auto;
		aspect-ratio: 21 / 9;
	}

	.czr-gallery__mosaic.czr-gallery__mosaic--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.czr-gallery__mosaic.czr-gallery__mosaic--2 .czr-gallery__tile,
	.czr-gallery__mosaic.czr-gallery__mosaic--2 .czr-gallery__tile:first-child {
		grid-column: auto;
		grid-row: auto;
		aspect-ratio: 4 / 3;
	}

	/* Three or four photos: one row, the large photo is as tall as the narrow ones next to it. */
	.czr-gallery__mosaic.czr-gallery__mosaic--3 .czr-gallery__tile:not(:first-child),
	.czr-gallery__mosaic.czr-gallery__mosaic--4 .czr-gallery__tile:not(:first-child) {
		aspect-ratio: auto;
	}

	.czr-gallery__mosaic.czr-gallery__mosaic--3 .czr-gallery__tile:first-child,
	.czr-gallery__mosaic.czr-gallery__mosaic--4 .czr-gallery__tile:first-child {
		grid-row: auto;
		aspect-ratio: 1;
	}

	.czr-gallery__mosaic .czr-gallery__tile:first-child {
		grid-column: span 2;
		grid-row: span 2;
		aspect-ratio: auto;
	}

	/* Five or seven tiles: the first row of small tiles is landscape, the second is portrait; the large tile spans both. */
	.czr-gallery__mosaic--7 .czr-gallery__tile:nth-child(n + 2):nth-child(-n + 4),
	.czr-gallery__mosaic--5 .czr-gallery__tile:nth-child(n + 2):nth-child(-n + 3) {
		aspect-ratio: 3 / 2;
	}

	.czr-gallery__mosaic--7 .czr-gallery__tile:nth-child(n + 5),
	.czr-gallery__mosaic--5 .czr-gallery__tile:nth-child(n + 4) {
		aspect-ratio: 3 / 4;
	}
}

/* Video in the gallery: a play badge on the first tile, and a click-to-load gate in the viewer. */
.czr-gallery__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	translate: -50% -50%;
	border-radius: 50%;
	background: rgb(15 42 74 / 80%);
	box-shadow: 0 0 0 3px #fff;
}

.czr-gallery__play::before {
	position: absolute;
	top: 50%;
	left: 50%;
	translate: -35% -50%;
	border-top: 12px solid transparent;
	border-bottom: 12px solid transparent;
	border-left: 20px solid #fff;
	content: "";
}

.czr-gallery__tile--video:not(:first-child) .czr-gallery__play {
	width: 40px;
	height: 40px;
}

.czr-lb__video {
	position: relative;
	display: grid;
	width: 100%;
	height: 100%;
	place-items: center;
}

.czr-lb__video > img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0.45;
}

.czr-lb__video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.czr-lb__gate {
	position: relative;
	display: grid;
	gap: 16px;
	max-width: 440px;
	padding: 20px;
	justify-items: center;
	text-align: center;
}

.czr-lb__gate p {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
}

.czr-lb__load {
	padding: 12px 24px;
	border: 0;
	background: var(--amber);
	color: #1d2733;
	font: inherit;
	font-weight: 800;
	cursor: pointer;
}

.czr-lb__load:hover {
	background: #f0b93a;
}
