/* Holding Digital Presentación 1.0.8 — Responsive Contract v1 */

body.hdp-presentation-enabled,
.editor-styles-wrapper {
	--hdp-contract-site-max: 1120px;
	--hdp-contract-reading-max: 760px;
	--hdp-contract-toc-width: 240px;
	--hdp-contract-layout-gap: 64px;
	--hdp-contract-content-pad-x: 58px;
	--hdp-contract-content-pad-y: 50px;
	--hdp-contract-page-gutter: 32px;
	--hdp-contract-hero-min: 560px;
	--hdp-contract-hero-card-max: 920px;
	--hdp-contract-wide-bleed: 72px;
	--hdp-contract-body-size: clamp(16px, calc(15.6px + .15vw), 18px);
	--hdp-contract-h1-size: clamp(32px, calc(22px + 1.4vw), 44px);
	--hdp-contract-h2-size: clamp(25px, calc(21px + .8vw), 32px);
	--hdp-contract-h3-size: clamp(21px, calc(19px + .45vw), 24px);
	--hdp-contract-dek-size: clamp(17px, calc(16px + .35vw), 20px);
}

body.hdp-presentation-enabled {
	font-size: var(--hdp-contract-body-size);
}

body.hdp-presentation-enabled.hdp-template-editorial-a .site-content {
	box-sizing: border-box;
	max-width: var(--hdp-contract-site-max);
	padding-left: var(--hdp-contract-page-gutter);
	padding-right: var(--hdp-contract-page-gutter);
}

body.hdp-presentation-enabled.hdp-template-editorial-a .entry-content {
	container-name: hdp-layout;
	container-type: inline-size;
	max-width: 100%;
	min-width: 0;
}

body.hdp-presentation-enabled .hdp-editorial-hero {
	min-height: var(--hdp-contract-hero-min);
}

body.hdp-presentation-enabled .hdp-editorial-hero__card {
	max-width: var(--hdp-contract-hero-card-max);
}

body.hdp-presentation-enabled .hdp-editorial-hero__card h1 {
	font-size: var(--hdp-contract-h1-size);
	overflow-wrap: break-word;
}

body.hdp-presentation-enabled .hdp-editorial-hero__dek {
	font-size: var(--hdp-contract-dek-size);
}

body.hdp-presentation-enabled .hdp-article-layout {
	align-items: start;
	display: grid;
	gap: var(--hdp-contract-layout-gap);
	grid-template-columns: minmax(0, var(--hdp-contract-reading-max)) minmax(0, var(--hdp-contract-toc-width));
	max-width: 100%;
	min-width: 0;
}

body.hdp-presentation-enabled .hdp-article-main {
	box-sizing: border-box;
	container-name: hdp-reading;
	container-type: inline-size;
	max-width: 100%;
	min-width: 0;
	padding: var(--hdp-contract-content-pad-y) var(--hdp-contract-content-pad-x);
}

body.hdp-presentation-enabled .hdp-article-main h2 {
	font-size: var(--hdp-contract-h2-size);
}

body.hdp-presentation-enabled .hdp-article-main h3 {
	font-size: var(--hdp-contract-h3-size);
}

body.hdp-presentation-enabled .hdp-article-main :where(h2, h3, h4, h5, h6, p, li, blockquote, summary, figcaption) {
	max-width: 100%;
	overflow-wrap: break-word;
}

body.hdp-presentation-enabled .hdp-article-main :where(a, code) {
	overflow-wrap: anywhere;
}

body.hdp-presentation-enabled .hdp-article-main :where(figure, .wp-block-image, .wp-block-gallery, .wp-block-group, .wp-block-details, .wp-block-buttons, .wp-block-table, .hdb-editorial-callout, [class*="is-style-hdb-callout-"]) {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
}

/* Normalize browser figure margins so media/table containers align with the reading box. */
body.hdp-presentation-enabled .hdp-article-main figure {
	margin-left: 0;
	margin-right: 0;
}

body.hdp-presentation-enabled .hdp-article-main :where(img, video, svg, canvas, iframe) {
	height: auto;
	max-width: 100%;
}

body.hdp-presentation-enabled .hdp-article-main :where(pre, .wp-block-code) {
	box-sizing: border-box;
	max-width: 100%;
	overflow-x: auto;
}

/* Tables: the runtime emits the exact container thresholds from the contract. */
body.hdp-presentation-enabled .hdp-article-main .wp-block-table {
	box-sizing: border-box;
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
	width: 100%;
}

body.hdp-presentation-enabled .hdp-article-main .wp-block-table table {
	border-collapse: collapse;
	box-sizing: border-box;
	max-width: none;
}

body.hdp-presentation-enabled .hdp-article-main .wp-block-table :where(th, td) {
	min-width: 0;
	overflow-wrap: anywhere;
	word-break: normal;
}

/* Media and galleries may never create page-level horizontal overflow. */
body.hdp-presentation-enabled .hdp-article-main :where(.wp-block-image, .wp-block-gallery) {
	width: 100%;
}

body.hdp-presentation-enabled .hdp-article-main .wp-block-gallery {
	box-sizing: border-box;
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.hdp-presentation-enabled .hdp-article-main .wp-block-gallery > * {
	margin: 0;
	min-width: 0;
	width: auto !important;
}

/* Wide content is capped to the viewport instead of bleeding outside the page. */
body.hdp-presentation-enabled .hdp-article-main :where(.alignwide, .alignfull) {
	box-sizing: border-box;
	max-width: min(calc(100% + (2 * var(--hdp-contract-wide-bleed))), calc(100vw - (2 * var(--hdp-contract-page-gutter))));
}

/* Buttons wrap before they can force the reading column wider. */
body.hdp-presentation-enabled .hdp-article-main .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	max-width: 100%;
}

body.hdp-presentation-enabled .hdp-article-main .wp-block-button,
body.hdp-presentation-enabled .hdp-article-main .wp-block-button__link {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
	white-space: normal;
}

body.hdp-presentation-enabled .hdp-article-toc {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
}

body.hdp-presentation-enabled .hdp-article-toc a {
	overflow-wrap: anywhere;
}

/* Template-specific visual character remains expressed through shared tokens. */
body.hdp-presentation-enabled.hdp-contract-template-revista-destino .hdp-editorial-hero,
body.hdp-presentation-enabled.hdp-contract-template-revista-destino .hdp-editorial-hero__image {
	height: min(76vh, 860px);
	max-height: 860px;
}

body.hdp-presentation-enabled.hdp-contract-template-guia-atelier .hdp-editorial-hero {
	min-height: 0;
}

/*
 * Revista de destino uses a lower container threshold than the legacy 1024px
 * media query in presentation.css. Once the real editorial container reaches
 * 760px, Responsive Contract restores the intended two-column layout and TOC
 * sidebar. Below 760px the runtime's generated max-width rule keeps the TOC in
 * flow before the article.
 */
@container hdp-layout (min-width: 760px) {
	body.hdp-presentation-enabled.hdp-contract-template-revista-destino .hdp-article-layout {
		gap: var(--hdp-contract-layout-gap) !important;
		grid-template-columns: minmax(0, var(--hdp-contract-reading-max)) minmax(0, var(--hdp-contract-toc-width)) !important;
	}

	body.hdp-presentation-enabled.hdp-contract-template-revista-destino .hdp-article-toc {
		order: 0 !important;
		position: sticky !important;
	}

	body.hdp-presentation-enabled.hdp-contract-template-revista-destino .hdp-article-toc ol {
		columns: 1 !important;
	}
}

@media (max-width: 1024px) {
	body.hdp-presentation-enabled .hdp-article-main .wp-block-gallery {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 768px) {
	body.hdp-presentation-enabled.hdp-contract-template-revista-destino .hdp-editorial-hero,
	body.hdp-presentation-enabled.hdp-contract-template-revista-destino .hdp-editorial-hero__image {
		height: auto;
		max-height: none;
		min-height: 0;
	}

	body.hdp-presentation-enabled .hdp-article-main .wp-block-gallery {
		grid-template-columns: minmax(0, 1fr);
	}

	body.hdp-presentation-enabled .hdp-article-main .wp-block-buttons > .wp-block-button {
		width: 100%;
	}
}
