/**
 * PHASE F2.21B — Shared Presentation Guardrails.
 *
 * This file is intentionally narrow. It protects cross-route text integrity and
 * establishes opt-in boundaries for Core-owned visible chrome without taking
 * layout, typography, spacing, borders, or card geometry away from templates.
 */

body[data-invitea-presentation-guardrails="f2.21b"] {
    /* Safe fallback for genuinely long customer values; headings are overridden below. */
    overflow-wrap: break-word;
    word-break: normal;
}

/* Canonical headings may wrap at normal word boundaries, never in the middle of a word. */
body[data-invitea-presentation-guardrails="f2.21b"] :where(
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    [role="heading"]
) {
    overflow-wrap: normal !important;
    word-break: normal !important;
    hyphens: manual;
}

/* A template may explicitly opt into emergency mid-word wrapping for a non-canonical heading. */
body[data-invitea-presentation-guardrails="f2.21b"] :where(
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    [role="heading"]
)[data-invitea-allow-midword-break="true"] {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

/* Long-value hooks remain allowed to break safely without widening the whole invitation. */
body[data-invitea-presentation-guardrails="f2.21b"] :where(
    [data-invitea-long-value="true"],
    [data-invitea-gift-part="detail-value"],
    [data-invitea-gift-part="address"],
    code,
    pre
) {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/*
 * Core may expose presentation semantics, but visible decorative chrome is
 * fail-closed unless the active template explicitly opts in. Existing runtime
 * elements are unaffected unless they adopt this shared marker.
 */
body[data-invitea-presentation-guardrails="f2.21b"]
[data-invitea-core-presentation-chrome]:not([data-invitea-template-presentation-opt-in="true"]) {
    display: none !important;
}
