/* ==========================================================================
   Block: Post Header (acf/post-header)

   Values come in as unitless CSS vars from post-header.php:
     --ph-base-d / --ph-base-m      base width (px): the SCREEN width the
                                    design is for; every size below is exact
                                    on screens this wide or wider. On desktop
                                    also the block's max-width when Max Width
                                    is empty (mobile is full width)
     --ph-heading-* / --ph-desc-*   heading / description font size (px)
     --ph-tags-* / --ph-meta-*      pill / author-date font size (px)
     --ph-views-*                   views count font size (px)
     --ph-avatar-*                  author photo size (px)
     --ph-icon-h-*                  share icon height (px); width is auto
     --ph-bicon-h-*                 author / date icon height (px); width auto
     --ph-gap-d / --ph-gap-m        text-image gap (px)
     --ph-img-w                     desktop image column width (%)
     --ph-radius-d / --ph-radius-m  image corner radius (with px unit)
     --ph-sp-{tags,heading,desc,divider}-*
                                    space below tags / heading / description,
                                    and between the divider and author row (px)
     --ph-mt-* / --ph-mb-*          top / bottom margin (with px unit)
     --ph-maxw-d                    desktop max width (any unit); unset =
                                    base width
     --ph-pl-* / --ph-pr-*          left / right padding (any unit), same
                                    rules as the Hero Banner: desktop padding
                                    only while the container is narrower than
                                    max width + both paddings
   On screens narrower than the base width everything scales down with the
   screen (--ph-u, viewport units) so the layout keeps the design's
   proportions. At the base width and wider, sizes are exactly as set,
   whatever width the block itself ends up (e.g. a 1200px content area on a
   1440px screen with Base Width 1440 still gets the typed sizes).
   ========================================================================== */

.reelzappy-post-header {
	--ph-base: var(--ph-base-d);
	--ph-heading: var(--ph-heading-d);
	--ph-desc: var(--ph-desc-d);
	--ph-tags: var(--ph-tags-d);
	--ph-meta: var(--ph-meta-d);
	--ph-views: var(--ph-views-d);
	--ph-avatar: var(--ph-avatar-d);
	--ph-icon-h: var(--ph-icon-h-d);
	--ph-bicon-h: var(--ph-bicon-h-d, 13);
	--ph-radius: var(--ph-radius-d, 16px);
	--ph-gap: var(--ph-gap-d);
	--ph-sp-tags: var(--ph-sp-tags-d, 20);
	--ph-sp-heading: var(--ph-sp-heading-d, 16);
	--ph-sp-desc: var(--ph-sp-desc-d, 24);
	--ph-sp-divider: var(--ph-sp-divider-d, 24);
	--ph-accent: var(--color-link, #F8F503); /* Brand yellow: icons, author, date, views, avatar ring, pill hover. */
	--ph-border: var(--color-card-border, #F8F503); /* Image border. */
	--ph-text: var(--color-text, #F5F5FA);
	--ph-pill-bg: rgba(248, 245, 3, 0.2); /* #F8F503 at 20%. */
	--ph-divider: rgba(248, 245, 3, 0.3); /* #F8F503 at 30%. */
	--ph-pl: var(--ph-pl-d, 0px);
	--ph-pr: var(--ph-pr-d, 0px);
	--ph-maxw: var(--ph-maxw-d, calc(var(--ph-base-d) * 1px));

	/*
	 * 1 design pixel: 1px when the screen is at least the base width,
	 * proportionally less on narrower screens.
	 */
	--ph-u: min(1px, calc(100vw / var(--ph-base)));

	/* Desktop padding is "all or nothing" (see the Hero Banner block). */
	--ph-pl-eff: clamp(0px, (var(--ph-maxw) + var(--ph-pl) + var(--ph-pr) - 100%) * 1000, var(--ph-pl));
	--ph-pr-eff: clamp(0px, (var(--ph-maxw) + var(--ph-pl) + var(--ph-pr) - 100%) * 1000, var(--ph-pr));

	box-sizing: border-box;
	width: 100%;
	max-width: calc(var(--ph-maxw) + var(--ph-pl-eff) + var(--ph-pr-eff));
	padding-inline: var(--ph-pl-eff) var(--ph-pr-eff);
	margin-inline: auto;
	margin-block: var(--ph-mt-d, 0) var(--ph-mb-d, 32px);
	color: var(--ph-text);
}

.reelzappy-post-header *,
.reelzappy-post-header *::before,
.reelzappy-post-header *::after {
	box-sizing: border-box;
}

/* Layout: text | image on desktop. */
.reelzappy-post-header__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, var(--ph-img-w, 50%));
	align-items: center;
	gap: calc(var(--ph-gap) * var(--ph-u));
}

.reelzappy-post-header--image-left .reelzappy-post-header__inner {
	grid-template-columns: minmax(0, var(--ph-img-w, 50%)) minmax(0, 1fr);
}

.reelzappy-post-header--image-left .reelzappy-post-header__media {
	order: -1;
}

.reelzappy-post-header--no-image .reelzappy-post-header__inner {
	grid-template-columns: minmax(0, 1fr);
}

.reelzappy-post-header__content {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	min-width: 0;
}

/* Tag pills. */
.reelzappy-post-header .reelzappy-post-header__tags {
	display: flex;
	flex-wrap: wrap;
	gap: calc(12 * var(--ph-u));
	margin: 0 0 calc(var(--ph-sp-tags) * var(--ph-u));
	padding: 0;
	list-style: none;
}

.reelzappy-post-header .reelzappy-post-header__tags li {
	margin: 0;
	padding: 0;
}

.reelzappy-post-header .reelzappy-post-header__tag {
	display: inline-flex;
	align-items: center;
	padding: 0.5em 1.2em;
	border-radius: 999px;
	background: var(--ph-pill-bg);
	font-family: var(--font-family-subheading, 'Archivo', sans-serif);
	font-weight: 400;
	font-size: max(11px, calc(var(--ph-tags) * var(--ph-u)));
	line-height: 1.2;
	color: var(--ph-text);
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.reelzappy-post-header a.reelzappy-post-header__tag:hover,
.reelzappy-post-header a.reelzappy-post-header__tag:focus-visible {
	background: var(--ph-accent);
	color: #000;
}

/* Heading and description. */
.reelzappy-post-header .reelzappy-post-header__heading {
	margin: 0 0 calc(var(--ph-sp-heading) * var(--ph-u));
	font-family: var(--font-family-subheading, 'Archivo', sans-serif);
	font-weight: 700;
	font-size: calc(var(--ph-heading) * var(--ph-u));
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	color: var(--ph-text);
}

.reelzappy-post-header .reelzappy-post-header__description {
	margin: 0 0 calc(var(--ph-sp-desc) * var(--ph-u));
	font-family: var(--font-family-subheading, 'Archivo', sans-serif);
	font-weight: 400;
	font-size: max(11px, calc(var(--ph-desc) * var(--ph-u)));
	line-height: 1.4;
	color: var(--ph-text);
}

.reelzappy-post-header .reelzappy-post-header__heading a,
.reelzappy-post-header .reelzappy-post-header__description a {
	color: var(--ph-accent);
	text-decoration: underline;
}

.reelzappy-post-header .reelzappy-post-header__heading mark,
.reelzappy-post-header .reelzappy-post-header__description mark {
	background: none;
	color: var(--ph-accent);
}

/* No trailing space after whichever part is last (e.g. no author row). */
.reelzappy-post-header .reelzappy-post-header__content > :last-child {
	margin-bottom: 0;
}

/* Meta row: author + date | share icons + views, under a divider. */
.reelzappy-post-header__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: calc(12 * var(--ph-u)) calc(16 * var(--ph-u));
	width: 100%;
	margin: 0;
	padding-top: calc(var(--ph-sp-divider) * var(--ph-u));
	border-top: 1px solid var(--ph-divider);
	font-family: var(--font-family-subheading, 'Archivo', sans-serif);
	font-size: max(11px, calc(var(--ph-meta) * var(--ph-u)));
	line-height: 1.3;
}

.reelzappy-post-header__byline {
	display: flex;
	align-items: center;
	gap: calc(12 * var(--ph-u));
	min-width: 0;
}

.reelzappy-post-header .reelzappy-post-header__avatar {
	flex: none;
	width: max(28px, calc(var(--ph-avatar) * var(--ph-u)));
	height: max(28px, calc(var(--ph-avatar) * var(--ph-u)));
	max-width: none;
	border: 2px solid var(--ph-accent);
	border-radius: 50%;
	object-fit: cover;
}

.reelzappy-post-header__byline-text {
	display: flex;
	flex-direction: column;
	gap: calc(6 * var(--ph-u));
	min-width: 0;
}

.reelzappy-post-header__byline-item {
	display: flex;
	align-items: center;
	line-height: 1.3;
	gap: 0.45em;
	color: var(--ph-accent);
}

.reelzappy-post-header .reelzappy-post-header__date time {
	white-space: nowrap; /* Wraps as "Updated on / March 30, 2026". */
}

.reelzappy-post-header .reelzappy-post-header__byline-item a {
	color: inherit;
	text-decoration: none;
}

.reelzappy-post-header .reelzappy-post-header__byline-item a:hover {
	text-decoration: underline;
}

/* Icon box is one line tall, so it stays on the first line when the text wraps. */
/*
 * Author / date icon: set height, width from its own shape, vertically
 * centred on its text (the middle of both lines when the date wraps).
 */
.reelzappy-post-header .reelzappy-post-header__icon {
	flex: none;
	width: auto;
	height: max(8px, calc(var(--ph-bicon-h) * var(--ph-u)));
}

/* Uploaded icon: 1em tall, width from its own shape, centred on the first line. */
.reelzappy-post-header .reelzappy-post-header__icon--custom {
	max-width: none;
	object-fit: contain;
}

.reelzappy-post-header__stats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: calc(12 * var(--ph-u)) calc(16 * var(--ph-u));
	margin-left: auto;
}

.reelzappy-post-header .reelzappy-post-header__share {
	display: flex;
	align-items: center;
	gap: calc(12 * var(--ph-u));
	margin: 0;
	padding: 0;
	list-style: none;
}

.reelzappy-post-header .reelzappy-post-header__share li {
	margin: 0;
	padding: 0;
}

.reelzappy-post-header .reelzappy-post-header__share-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	height: max(10px, calc(var(--ph-icon-h) * var(--ph-u)));
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ph-accent);
	line-height: 0;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.reelzappy-post-header .reelzappy-post-header__share-link:hover,
.reelzappy-post-header .reelzappy-post-header__share-link:focus-visible {
	opacity: 0.75;
}

.reelzappy-post-header .reelzappy-post-header__share-link svg,
.reelzappy-post-header .reelzappy-post-header__share-link img {
	display: block;
	width: auto; /* From the icon's own shape (viewBox / image ratio). */
	height: 100%;
}

/* "Link copied" tooltip (the script adds .is-copied). */
.reelzappy-post-header .reelzappy-post-header__share-link.is-copied::after {
	content: attr(data-copied-label);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	padding: 4px 8px;
	border-radius: 6px;
	background: var(--color-tooltip-background, #2f3441);
	font-size: 12px;
	line-height: 1.3;
	color: var(--color-text-on-tooltip, #e3e3e3);
	white-space: nowrap;
	pointer-events: none;
}

.reelzappy-post-header .reelzappy-post-header__views {
	font-size: max(11px, calc(var(--ph-views) * var(--ph-u)));
	display: inline-flex;
	gap: 0.3em;
	font-weight: 500;
	color: var(--ph-accent);
	text-transform: uppercase;
	white-space: nowrap;
}

/* Image. */
.reelzappy-post-header__media {
	overflow: hidden;
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius, 16px);
	background-color: var(--color-card-background, #1A1E2B);
}

.reelzappy-post-header .reelzappy-post-header__picture {
	display: block;
}

.reelzappy-post-header .reelzappy-post-header__image {
	display: block;
	width: 100%;
	height: auto;
}

/* Editor-only stand-in when a Site Template has no post to show. */
.reelzappy-post-header .reelzappy-post-header__media--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 9;
	border-style: dashed;
	font-size: 14px;
	opacity: 0.7;
}

/* Mobile: one column, image under the text.
 *
 * Default breakpoint: mobile up to 768px, desktop from 769px. A block with a
 * custom "Desktop Starts At" value gets data-ph-bp="N", and block.php copies
 * the block between the mobile:start / mobile:end markers for it, with
 * :not([data-ph-bp]) -> [data-ph-bp="N"] and 768px -> N-1. Keep the markers,
 * the "(max-width: 768px)" query and the :not([data-ph-bp]) scopes exactly.
 * The scopes sit inside :where() so specificity is unchanged; descendant
 * rules keep two classes so they beat the desktop --image-left rules.
 */
/* mobile:start */
@media (max-width: 768px) {
	.reelzappy-post-header:where(:not([data-ph-bp])) {
		--ph-base: var(--ph-base-m);
		--ph-heading: var(--ph-heading-m);
		--ph-desc: var(--ph-desc-m);
		--ph-tags: var(--ph-tags-m);
		--ph-meta: var(--ph-meta-m);
		--ph-views: var(--ph-views-m);
		--ph-avatar: var(--ph-avatar-m);
		--ph-icon-h: var(--ph-icon-h-m);
		--ph-bicon-h: var(--ph-bicon-h-m, 11);
		--ph-radius: var(--ph-radius-m, 16px);
		--ph-gap: var(--ph-gap-m);
		--ph-sp-tags: var(--ph-sp-tags-m, 16);
		--ph-sp-heading: var(--ph-sp-heading-m, 12);
		--ph-sp-desc: var(--ph-sp-desc-m, 20);
		--ph-sp-divider: var(--ph-sp-divider-m, 20);
		--ph-pl: var(--ph-pl-m, 0px);
		--ph-pr: var(--ph-pr-m, 0px);

		max-width: 100%; /* Full width on mobile; the base width only sets scaling. */
		padding-inline: var(--ph-pl) var(--ph-pr); /* Mobile padding always applies. */
		margin-block: var(--ph-mt-m, 0) var(--ph-mb-m, 32px);
	}

	.reelzappy-post-header:where(:not([data-ph-bp])) .reelzappy-post-header__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	.reelzappy-post-header:where(:not([data-ph-bp])) .reelzappy-post-header__media {
		order: 0;
	}

	.reelzappy-post-header:where(:not([data-ph-bp])) .reelzappy-post-header__tags {
		gap: calc(8 * var(--ph-u));
	}

	/* One row, as in the design: the byline text wraps ("Updated on / date") rather than the icons dropping down. */
	.reelzappy-post-header:where(:not([data-ph-bp])) .reelzappy-post-header__meta {
		flex-wrap: nowrap;
	}

	.reelzappy-post-header:where(:not([data-ph-bp])) .reelzappy-post-header__stats {
		flex: none;
		gap: calc(12 * var(--ph-u));
	}

	.reelzappy-post-header:where(:not([data-ph-bp])) .reelzappy-post-header__share {
		gap: calc(10 * var(--ph-u));
	}

	.reelzappy-post-header:where(:not([data-ph-bp])) .reelzappy-post-header__byline {
		gap: calc(10 * var(--ph-u));
	}
}
/* mobile:end */
