/*
 * AGP u medijima — listing.
 *
 * Loaded AFTER services.css + news.css + gallery.css so the layout
 * primitives + lightbox styles are already available. This file owns
 * only what's specific to this surface:
 *   - overlay-header rules keyed to .page-template-page-agp-u-medijima,
 *   - .agpm-grid + .agpm-card BEM mirroring the foto-i-video-galerija
 *     visual (square 1:1 image, no card chrome) but with a date meta
 *     line above the title and no "Saznaj više" CTA. Clicking the card
 *     image opens the post's gallery in the shared lightbox (gallery.js)
 *     — there is no single-post template by design.
 *
 * Pagination reuses .news-pagination — visual treatment is identical
 * across listing surfaces.
 */

/* --------------------------------------------------------------
 * Overlay header — listing Page (template page-agp-u-medijima.php).
 * -------------------------------------------------------------- */
.page-template-page-agp-u-medijima .site-header {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 10;
}

.page-template-page-agp-u-medijima .site-main {
	margin-top: 0;
	overflow-x: clip;
}

/* --------------------------------------------------------------
 * Listing — col-8 grid + cards (mirrors .fivg-card visually).
 *
 * Layout: 2-col grid, 39px row gap / 30px col gap. Each card is
 * image (1:1, 10px radius), date meta 14px below, title 6px below.
 * No card chrome, no CTA.
 * -------------------------------------------------------------- */
.agpm-list-section {
	margin-bottom: 56px;
}

.agpm-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 39px 30px;
	margin-bottom: 40px;
}

.agpm-card {
	display: flex;
	flex-direction: column;
}

/* The .gallery wrapper exists so gallery.js auto-wires the lightbox; we
 * don't want it to introduce its own flow (extra anchors below are
 * hidden, so the grid item only takes the height of the visible cover).
 */
.agpm-card__gallery {
	display: block;
	width: 100%;
}

.agpm-card__media {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #fff;
	border: 1px solid #ececec;
	border-radius: 10px;
	position: relative;
}

/* Source images here are scanned magazine/news clippings — most are
 * portrait (e.g. 327x889). `object-fit: contain` shows the full image
 * inside the 1:1 frame instead of center-cropping the title off; the
 * white card + light hairline border frames the letterboxed sides
 * cleanly. Square images still fill the whole box. */
.agpm-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* The video card uses a real 16:9 YouTube thumbnail and a play overlay,
 * so contain would leave huge bars — switch that one card back to
 * cover so the thumb fills the square cleanly. */
.agpm-card__media--video img {
	object-fit: cover;
}

/* Additional gallery items live in the same .gallery container so
 * gallery.js wires them as lightbox slides, but they should never take
 * up flow space on the card. */
.agpm-card__media--hidden {
	display: none !important;
}

.agpm-card__media--placeholder {
	background: linear-gradient(135deg, #d8d8d8 0%, #ececec 100%);
}

/* Video card — YouTube thumbnail with a play overlay. */
.agpm-card__media--video::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.18);
	transition: background-color 0.2s ease;
}

.agpm-card__media--video:hover::after,
.agpm-card__media--video:focus::after {
	background: rgba(0, 0, 0, 0.32);
}

.agpm-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 72px;
	height: 72px;
	margin: -36px 0 0 -36px;
	border-radius: 50%;
	background: #bb2548;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	z-index: 1;
}

.agpm-card__play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 13px 0 13px 20px;
	border-color: transparent transparent transparent #fff;
	transform: translate(-50%, -50%);
}

.agpm-card__meta {
	margin: 14px 0 0;
	font-family: var(--font-heading);
	font-weight: 500;
	font-size: 12px;
	line-height: 18px;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: #6b6b6b;
}

.agpm-card__meta time {
	font: inherit;
	letter-spacing: inherit;
	color: inherit;
}

.agpm-card__title {
	margin: 6px 0 0;
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: 18px;
	line-height: 28px;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: #0a0a0a;
}

.agpm-list__empty {
	margin: 0;
	padding: 32px 30px;
	background: #fff;
	border: 1px solid #c3c3c3;
	border-radius: 10px;
	color: #565656;
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 26px;
}

@media screen and (max-width: 991px) {
	.agpm-list-section {
		margin-bottom: 48px;
	}

	.agpm-grid {
		gap: 28px 24px;
		margin-bottom: 32px;
	}

	.agpm-card__play {
		width: 60px;
		height: 60px;
		margin: -30px 0 0 -30px;
	}
}

@media screen and (max-width: 599px) {
	.agpm-grid {
		grid-template-columns: 1fr;
		gap: 22px;
		margin-bottom: 24px;
	}

	.agpm-card__meta {
		margin-top: 18px;
	}

	.agpm-card__title {
		font-size: 17px;
		line-height: 26px;
	}
}
