/**
 * PunjabiTime News — Phase 1 FOLLOW-UP polish (additive, safe).
 *
 * Loaded via the Novamira sandbox loader AFTER punjabitime-phase1-polish.css
 * (priority 95) so these refinements win without editing main.css or any
 * template. Scope is purely visual:
 *   T2  Homepage: cap oversized images, make category sections look balanced
 *       and professional when they have only 1 or 2 posts, reduce blank space.
 *   T3  Single article: tighten featured-image height + spacing rhythm.
 *   T1  Belt-and-braces hide of any Google/GTranslate visual chrome.
 *
 * Changes NO posts, images, categories, menus, settings, AdSense, ads.txt,
 * the cream background, or the dark footer. Fully reversible: disable/delete
 * the sandbox loader (pt-phase1-followup.php) and this file.
 */

/* ================================================================== *
 * T1 — keep all Google Translate chrome out of the layout (safety net).
 * ================================================================== */
.pt-gt-hidden,
#google_translate_element,
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
.goog-te-gadget,
.gt_float_switcher,
.gtranslate_wrapper .switcher {
	display: none !important;
}
body { top: 0 !important; }

/* ================================================================== *
 * T2 — HOMEPAGE IMAGE SIZE CONTROL
 * Hard caps so no image can ever take half the page. Lead is the only
 * intentionally larger image and it stays bounded.
 * ================================================================== */
.pt-home .pt-card__image,
.pt-home .pt-video-card__image {
	overflow: hidden;
	border-radius: 3px;
}

.pt-home .pt-card--standard .pt-card__image img,
.pt-home .pt-grid-section .pt-card__image img {
	aspect-ratio: 16 / 10;
	max-height: 220px;
	width: 100%;
	object-fit: cover;
}

/* Lead images: bounded cinematic banner, never half the screen. */
.pt-home .pt-top-grid__lead .pt-card__image img,
.pt-home .pt-feature-grid__main .pt-card__image img,
.pt-home .pt-card--lead .pt-card__image img {
	aspect-ratio: 16 / 9;
	max-height: 360px;
	width: 100%;
	object-fit: cover;
}

@media (max-width: 820px) {
	.pt-home .pt-top-grid__lead .pt-card__image img,
	.pt-home .pt-feature-grid__main .pt-card__image img,
	.pt-home .pt-card--lead .pt-card__image img {
		max-height: 250px;
	}
	.pt-home .pt-card--standard .pt-card__image img,
	.pt-home .pt-grid-section .pt-card__image img {
		max-height: 240px;
	}
}

/* ================================================================== *
 * T2 — BALANCED SECTIONS WHEN A CATEGORY HAS ONLY 1 OR 2 POSTS
 * ================================================================== */

/* --- 4-up card grids (Latest News, World, Politics, Crime, Entertainment) ---
 * When the grid has only 1 or 2 cards, stop them stretching across the whole
 * row. Pack them to the left in compact, consistent widths. */
.pt-home .pt-card-grid--four {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 22px;
	align-items: stretch;
	justify-content: start;
}

/* Exactly one card -> single compact card (not a full-width giant). */
.pt-home .pt-card-grid--four:has(> .pt-card:only-child) {
	grid-template-columns: minmax(0, 320px);
}

/* Exactly two cards -> two balanced compact cards, left aligned. */
.pt-home .pt-card-grid--four:has(> .pt-card:nth-child(2):last-child) {
	grid-template-columns: repeat(2, minmax(0, 320px));
}

/* Exactly three cards -> three even columns. */
.pt-home .pt-card-grid--four:has(> .pt-card:nth-child(3):last-child) {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* --- Feature sections (Punjab, India, NRI, Sports): lead + side list ---
 * The lead and the side list are fed by the SAME query, so a 1-post category
 * fills the lead and leaves the side list empty (big blank right column).
 * When the list is empty, collapse to a single bounded lead card. */
.pt-home .pt-feature-grid:has(> .pt-feature-grid__list:empty),
.pt-home .pt-feature-grid:has(> .pt-feature-grid__list:not(:has(.pt-news-line))) {
	grid-template-columns: minmax(0, 640px);
}

.pt-home .pt-feature-grid:has(> .pt-feature-grid__list:empty) .pt-feature-grid__list,
.pt-home .pt-feature-grid:has(> .pt-feature-grid__list:not(:has(.pt-news-line))) .pt-feature-grid__list {
	display: none;
}

/* Keep the lead readable, never edge-to-edge huge, when it stands alone. */
.pt-home .pt-feature-grid:has(> .pt-feature-grid__list:empty) .pt-feature-grid__main .pt-card__image img {
	max-height: 320px;
}

/* Tablet: 4-up becomes 2-up; honour the 1/2 card caps too. */
@media (max-width: 1100px) {
	.pt-home .pt-card-grid--four {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.pt-home .pt-card-grid--four:has(> .pt-card:only-child) {
		grid-template-columns: minmax(0, 320px);
	}
}

/* Mobile: everything single column, tidy. */
@media (max-width: 820px) {
	.pt-home .pt-card-grid--four,
	.pt-home .pt-card-grid--four:has(> .pt-card:only-child),
	.pt-home .pt-card-grid--four:has(> .pt-card:nth-child(2):last-child),
	.pt-home .pt-card-grid--four:has(> .pt-card:nth-child(3):last-child),
	.pt-home .pt-feature-grid:has(> .pt-feature-grid__list:empty) {
		grid-template-columns: 1fr;
	}
}

/* Headline sizing already capped in phase1-polish; nudge feature lead down a
 * touch on very wide screens so it reads as news, not a poster. */
@media (min-width: 1400px) {
	.pt-home .pt-feature-grid__main .pt-card__title {
		font-size: clamp(24px, 2vw, 32px);
	}
}

/* ================================================================== *
 * T3 — SINGLE ARTICLE FINE-TUNE (on top of phase1-polish T4)
 * ================================================================== */
body.single .pt-single-fallback__image img {
	max-height: 420px;
	object-fit: cover;
}

/* A little more breathing room between title, meta and body. */
body.single .pt-page-header h1 {
	margin-bottom: 10px;
}

body.single .pt-entry-content > :first-child {
	margin-top: 0;
}

/* Center any standalone images/figures in the body. */
body.single .pt-entry-content img,
body.single .pt-entry-content figure {
	display: block;
	margin-left: auto;
	margin-right: auto;
}
