/* MGC — post-QA polish fixes (additive; loaded after mgc.css) */

/* ============================================================
   Font-size preset repair (added 2026-07-13)
   ============================================================
   WordPress silently refuses to emit CSS custom properties (and the
   matching has-*-font-size utility classes) for theme.json preset slugs
   that START WITH A DIGIT. Our scale uses 2xl…6xl, so
   --wp--preset--font-size--2xl … --6xl were never defined. Every element
   style that references them — h1 (5xl), h2 (4xl), h3 (2xl) — was falling
   back to the inherited 16px, collapsing headings site-wide.
   We can't rename the slugs without breaking the "fontSize":"3xl" refs
   already saved in page content, so we supply the missing variables and
   utility classes here. Values mirror theme.json exactly. */
:root {
	--wp--preset--font-size--2xl: 1.5rem;
	--wp--preset--font-size--3xl: 1.875rem;
	--wp--preset--font-size--4xl: 2.25rem;
	--wp--preset--font-size--5xl: 3rem;
	--wp--preset--font-size--6xl: 3.75rem;
}
.has-2xl-font-size { font-size: var(--wp--preset--font-size--2xl) !important; }
.has-3xl-font-size { font-size: var(--wp--preset--font-size--3xl) !important; }
.has-4xl-font-size { font-size: var(--wp--preset--font-size--4xl) !important; }
.has-5xl-font-size { font-size: var(--wp--preset--font-size--5xl) !important; }
.has-6xl-font-size { font-size: var(--wp--preset--font-size--6xl) !important; }

/* Widen the header inner container to match the widened content sections (1320). */
.mgc-header__inner { max-width: 1320px; }

/* Long emails/URLs must wrap inside cards, footer and form fields
   instead of breaking mid-word (e.g. "gmail.c\nom"). */
.mgc-card p,
.mgc-card a,
.mgc-footer p,
.mgc-footer a,
.wpcf7 .mgc-field a {
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* ============================================================
   Photography (added 2026-07-13)
   ============================================================ */

/* On-brand content photo: rounded, cover-cropped, subtle shadow.
   Class sits on the core Image block <figure> (mgc-photo + a ratio modifier);
   the <img> inside is sized by width + aspect-ratio and cropped with object-fit. */
.wp-block-image.mgc-photo { margin: 0; }
.mgc-photo img,
img.mgc-photo {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
	object-fit: cover;
}
/* Fixed aspect ratios so card imagery stays consistent regardless of source. */
.mgc-photo--wide img   { aspect-ratio: 16 / 10; }
.mgc-photo--card img   { aspect-ratio: 4 / 3; }
.mgc-photo--pillar img { aspect-ratio: 3 / 2; }
.mgc-photo--portrait img { aspect-ratio: 3 / 4; }

/* Immersive cover headers: the WP Cover block supplies the ink-tinted scrim
   (overlay color + dim). This is a deliberate, header-only override of the
   build-kit "flat background / no photo wash" rule. These rules only make the
   MGC utility classes legible on the dark scrim. */
.mgc-cover :is(h1, h2, h3) { color: #fff; }
.mgc-cover .mgc-lead { color: var(--ink-200); }
.mgc-cover p:not(.mgc-eyebrow):not(.mgc-lead) { color: var(--ink-200); }
.mgc-cover .mgc-eyebrow { color: var(--gold-500); }
.mgc-cover .mgc-stat__n { color: #fff; }
.mgc-cover .mgc-stat__l { color: var(--ink-200); }
.mgc-cover a:not(.mgc-btn) { color: #fff; text-decoration: underline; }

/* White-outline button variant for use over photos / dark scrims. */
.mgc-cover .mgc-btn--outline {
	background: transparent;
	color: #fff;
	border-color: rgba(255, 255, 255, 0.6);
}
.mgc-cover .mgc-btn--outline:hover {
	background: rgba(255, 255, 255, 0.14);
	border-color: #fff;
	color: #fff;
}

/* Cover headers keep the tricolor rule crisp above the photo. */
.mgc-cover .mgc-tricolor { position: relative; z-index: 1; }

/* `.mgc-section--dark` colours its headings but leaves the lead paragraph to
   `.mgc-lead`, which pins colour to `--text-body` (#3D3A36) — 1.3:1 on the ink
   ground, and unreadable. The cover already makes exactly this correction for
   the same class; it is stated here for the dark section too. */
.mgc-section--dark .mgc-lead { color: var(--ink-200); }

/* ---- Hero tile labels (2026-09-04) ------------------------------------
   The tiles carry the association's four programme areas, whose Macedonian
   labels contain single words far longer than the old one-word ones
   ("Алтернативен" measures 156px at the label's 20px/700). A `1fr` grid track
   never shrinks below its content's min-content width, so at 20px each tile
   floored at 180px and the 2-up grid ran 14px past a 345px viewport — a
   horizontal scrollbar on a 360px phone. The label may not simply be shrunk:
   white on the blue tile is 3.36:1, so 20px/700 is what qualifies it as large
   text under AA (see the build kit). Instead the track is allowed to shrink
   and the label breaks the word when it genuinely cannot fit. */
.mgc-tile { min-width: 0; }
.mgc-tile__label { hyphens: auto; overflow-wrap: break-word; }

/* ============================================================
   Mobile navigation overlay (added 2026-08-12)
   ============================================================
   `.mgc-header` carries `backdrop-filter: blur(8px)` (mgc.css). Any
   backdrop-filter other than `none` establishes a containing block for
   `position: fixed` descendants, so WordPress's full-screen navigation
   overlay sized itself against the ~112px header instead of the viewport:
   the menu opened into a 111px band with an internal scrollbar and only the
   first link was reachable. Neutralising the filter while — and only while —
   the menu is open frees the overlay without changing the header's normal
   appearance. (Verified empirically: removing `position: sticky` while
   keeping the blur does NOT fix it; removing the blur does.) */
.mgc-header:has(.wp-block-navigation__responsive-container.is-menu-open) {
	backdrop-filter: none;
}

/* Initials avatar for people without a portrait (inc/person-avatar.php). */
.mgc-avatar-wrap { margin: 0; }
.mgc-avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	border-radius: 10px;
	background: var(--ink-100);
	color: var(--red-700);
	font-family: var(--font-heading, 'Montserrat', sans-serif);
	font-weight: 700;
	font-size: clamp(1.75rem, 4vw, 2.75rem);
	letter-spacing: 0.04em;
}
.mgc-avatar--round { border-radius: 9999px; font-size: 3rem; }
