/* ==========================================================================
   Single Post — musician-style two-column body layout
   Linnea spec 2026-05-06, build Holt 2026-05-06.
   Loaded via functions.php on is_singular('post').

   Mirrors the structural CSS contract of tec/musician-biography:
     - Body band is a two-column wp:columns (prose 66.66% / image 33.33%).
     - Mobile (≤766px) stacks image first, prose second (order: -1) —
       programme-book convention.
     - Empty featured image → image column hides via :has(); prose column
       expands to full content tier (1200px).
     - Reading-line cap (--tec-width-prose, 680px) applied to direct
       paragraph children of wp:post-content inside the prose column.

   Header is single-column (eyebrow + H1 + meta only, no image, no columns)
   per spec §2a. Meta line uses ink-low-emphasis preset (no raw hex).

   Surface chrome (background, gutter, vertical rhythm, hairline) all come
   from tec-band / tec-band--white / tec-band--editorial-sheet via
   bands.css. Nothing duplicated here.
   ========================================================================== */

/* --- Body band — column gap (mirrors .tec-musician-bio__columns) --------- */
.tec-single-post-body__columns {
	gap: var(--wp--preset--spacing--50, 2rem);
}

/* --- Featured image fallback (no thumbnail / empty) --------------------- *
 * Three fallback shapes to cover all "no image" cases:
 *   1. wp:post-featured-image renders nothing when the post has no thumbnail
 *      — the .tec-single-post-body__image column ends up containing only
 *      whitespace (no .wp-block-post-featured-image element at all).
 *   2. .wp-block-post-featured-image present but empty (rare; defensive).
 *   3. .wp-block-post-featured-image present but no <img> child (rare;
 *      defensive — also catches lazy-rendered failure modes).
 * The column-level :not(:has(img)) is the load-bearing one for case 1. */
.tec-single-post-body__image .wp-block-post-featured-image:empty,
.tec-single-post-body__image .wp-block-post-featured-image:not(:has(img)) {
	display: none;
}

/* When the image column has no <img> descendant at all, hide it entirely
 * so the prose column expands to the full content-tier (1200px). */
.tec-single-post-body__columns:has(.tec-single-post-body__image:not(:has(img))) .tec-single-post-body__image {
	display: none;
}

/* If the surviving prose column refuses to expand (core/column emits an
 * inline flex-basis:66.66% from the JSON `width` attribute), force it to
 * full width. !important is load-bearing — pure CSS specificity loses to
 * the inline declaration. Mirrors the musician-bio approach. */
.tec-single-post-body__columns:not(:has(.tec-single-post-body__image img)) .tec-single-post-body__prose {
	flex-basis: 100% !important;
}

/* --- Featured image rendering — native ratio, contained in column ------- *
 * Tombstone (Holt 2026-05-06): dropped 4:3 aspect-ratio + object-fit:cover
 * crop. Image now renders at its native intrinsic ratio, capped to the
 * column width (33.33% of the 1200px content tier). */
.tec-single-post-portrait img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* --- Reading-line cap inside the prose column --------------------------- *
 * Sits ALONGSIDE the musician-bio rule (different selector); does not
 * overwrite. Pins paragraph reading width to the prose tier (680px) inside
 * the ~800px prose column at the 1200px content cap. Mirrors style.css
 * L195–198 for musician-bio. */
.tec-single-post-body__prose .wp-block-post-content > p {
	max-width: var(--tec-width-prose);
}

/* --- Mobile stack (≤766px) — image first, prose second ------------------ *
 * Mirror of style.css L169–179 for .tec-musician-bio__columns. Tab order
 * (DOM) stays prose → image; the reorder is purely visual. */
@media (max-width: 766px) {
	.tec-single-post-body__columns {
		flex-wrap: wrap;
	}
	.tec-single-post-body__columns .wp-block-column {
		flex-basis: 100% !important;
	}
	.tec-single-post-body__image {
		order: -1;
	}
}

/* --- Header meta line --------------------------------------------------- *
 * Date · separator · author. Soft ink colour (no raw hex; uses the
 * ink-low-emphasis preset, which is the semantic "soft ink" tone in the
 * current TEC token set). Replaces the legacy charcoal #31393C styling. */
.tec-single-post-header__meta {
	gap: 0.5rem;
}
.tec-single-post-header__meta .wp-block-post-date,
.tec-single-post-header__meta .wp-block-post-author-name,
.tec-single-post-header__meta-sep {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink-low-emphasis);
}

/* --- Eyebrow link: no underline ---------------------------------------- *
 * Post categories rendered via wp:post-terms in the single-post header are
 * links; suppress the default underline across all states while keeping
 * the link clickable (browser default cursor: pointer is preserved). Scoped
 * to the single-post header so card eyebrows and other consumers are
 * unaffected. */
.tec-single-post-header .tec-eyebrow a,
.tec-single-post-header .tec-eyebrow a:hover,
.tec-single-post-header .tec-eyebrow a:focus,
.tec-single-post-header .tec-eyebrow a:active {
	text-decoration: none;
}
