/*
 * template-fullwidth.css — strips GeneratePress default wrappers when
 * the page uses the "Full Width" template (templates/page-fullwidth.php).
 *
 * Why: GP wraps the page in <div class="site grid-container container hfeed">
 * with a max-width ~1200px and auto-injects a right sidebar widget area.
 * For TDN brand pages we own the entire viewport — no GP layout chrome.
 *
 * Loaded conditionally via wp_enqueue_scripts when is_page_template().
 */

/* --- Break out of GP's centered container ----------------------- */
/* We target via TWO mechanisms for robustness:
 *   1. body.page-template-page-fullwidth — WP standard body class
 *   2. body:has(.tdn-fullwidth-main) — modern :has() selector based on
 *      the unique <main> class our template emits. Bulletproof fallback. */

body.page-template-page-fullwidth #page,
body.page-template-page-fullwidth .site.grid-container,
body.page-template-page-fullwidth .site.container,
body.page-template-page-fullwidth .site-content,
body.page-template-page-fullwidth .content-area,
body.page-template-page-fullwidth .tdn-fullwidth-main,
body:has(.tdn-fullwidth-main) #page,
body:has(.tdn-fullwidth-main) .site.grid-container,
body:has(.tdn-fullwidth-main) .site.container,
body:has(.tdn-fullwidth-main) .site-content,
body:has(.tdn-fullwidth-main) .content-area,
body:has(.tdn-fullwidth-main) .tdn-fullwidth-main {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0;
}

/* --- Hide GP's auto-injected sidebar widget area --------------- */

body.page-template-page-fullwidth .widget-area,
body.page-template-page-fullwidth #right-sidebar,
body.page-template-page-fullwidth #left-sidebar,
body.page-template-page-fullwidth .sidebar,
body:has(.tdn-fullwidth-main) .widget-area,
body:has(.tdn-fullwidth-main) #right-sidebar,
body:has(.tdn-fullwidth-main) #left-sidebar,
body:has(.tdn-fullwidth-main) .sidebar {
	display: none !important;
}

/* --- Hide GP's default header + main navigation ---------------- */
/* TDN brand pages provide their own nav via the tdn-nav pattern (fixed top). */

body.page-template-page-fullwidth .site-header,
body.page-template-page-fullwidth #site-navigation,
body.page-template-page-fullwidth #masthead,
body.page-template-page-fullwidth .main-navigation,
body:has(.tdn-fullwidth-main) .site-header,
body:has(.tdn-fullwidth-main) #site-navigation,
body:has(.tdn-fullwidth-main) #masthead,
body:has(.tdn-fullwidth-main) .main-navigation {
	display: none !important;
}

/* --- Hide GP's default footer (we use tdn-footer pattern) ----- */

body.page-template-page-fullwidth .site-footer,
body:has(.tdn-fullwidth-main) .site-footer {
	display: none !important;
}

/* --- Reset article/inside wrappers ------------------------------ */
/* IMPORTANT : narrow selectors to GP/WP outer wrappers ONLY.
 * Previous broad `article` selector was matching INNER pattern cards
 * (e.g. <article class="tdn-values-grid__card">) and overriding their
 * padding/margin to 0. We now target only:
 *   - article.hentry (WP standard class for posts/pages outer article)
 *   - .inside-article (GP wrapper)
 *   - .entry-content (WP/GP standard content wrapper)
 * Pattern markups using <article> for cards are NOT affected.
 */

body.page-template-page-fullwidth .inside-article,
body.page-template-page-fullwidth .entry-content,
body.page-template-page-fullwidth article.hentry,
body:has(.tdn-fullwidth-main) .inside-article,
body:has(.tdn-fullwidth-main) .entry-content,
body:has(.tdn-fullwidth-main) article.hentry {
	padding: 0;
	margin: 0;
}

/* --- Page-level horizontal clip ---------------------------------- */
/* `overflow-x: clip` (modern, supported Chrome 90+, FF 81+, Safari 16+):
 * - Clips any element that would extend past the viewport horizontally
 * - Does NOT create a scroll container (unlike overflow-x: hidden)
 * - Does NOT break position: sticky for descendants (unlike body overflow:hidden)
 * - Allows decorative absolutely-positioned children of inner sections
 *   (e.g. hero cool shapes, photos watermark) to bleed slightly past
 *   their own section bounds without triggering horizontal page scroll.
 *
 * Applied to body only (not html) so the html element stays clean for
 * any future viewport-sticky behaviour. */

body.page-template-page-fullwidth,
body:has(.tdn-fullwidth-main) {
	overflow-x: clip;
	/* Round 13 : bg midnight (vs ancien #fff) — toutes les pages fullwidth TDN
	 * se terminent sur le footer pill qui est sur fond midnight (avec
	 * `.tdn-footer { background: transparent }` round 12 pour permettre le
	 * glass blur sur le watermark). Le bg body midnight assure la continuité
	 * visuelle dans la zone "sous-footer" (fin de page), évitant la bande
	 * blanche parasite. Les sections au bg propre (form contact, photos pink)
	 * couvrent leur surface intégralement, donc cette teinte body n'est jamais
	 * visible entre les sections. */
	background: var(--tdn-color-midnight, #1a1a2e);
}
