/*
Theme Name: MendelBeats Child
Theme URI: https://www.djmendelbeats.com/
Description: Astra child theme for DJ MendelBeats. Fixes mobile layout, embed overflow, transparent-header collisions, and form usability without changing the site's look.
Author: DJ MendelBeats
Template: astra
Version: 1.2.0
Text Domain: mendelbeats-child
*/

/* ==========================================================================
   1. EMBED OVERFLOW — the homepage video   [REWRITTEN in v1.2]

   Markup on the live page is:
     figure.wp-block-embed.aligncenter.wp-embed-aspect-16-9.wp-has-aspect-ratio
       > div.wp-block-embed__wrapper
           > iframe (player.vimeo.com)

   v1.1 failed because it never neutralised .aligncenter (which core sizes
   with max-width + auto margins against the CONTENT box, not the padding
   box) and never guaranteed the wrapper was the positioning context. The
   iframe was therefore resolving its 'left: 0' against an ancestor further
   up the tree, landing it off-centre and bleeding past the right edge.
   ========================================================================== */

.entry-content figure.wp-block-embed,
.entry-content figure.wp-block-embed.aligncenter,
.entry-content figure.wp-block-embed.alignwide,
.entry-content .wp-block-embed {
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	margin-left: auto !important;
	margin-right: auto !important;
	padding-left: 0;
	padding-right: 0;
	float: none;
	box-sizing: border-box;
}

/* The wrapper IS the positioning context. No exceptions. */
.entry-content .wp-block-embed .wp-block-embed__wrapper {
	position: relative !important;
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 auto !important;
	padding: 0 !important;
	overflow: hidden;
	border-radius: 12px;
}

/* Intrinsic 16:9 box. aspect-ratio for modern Safari, ::before as fallback. */
.entry-content .wp-embed-aspect-16-9 .wp-block-embed__wrapper {
	aspect-ratio: 16 / 9;
}

@supports not (aspect-ratio: 16 / 9) {
	.entry-content .wp-embed-aspect-16-9 .wp-block-embed__wrapper::before {
		content: "";
		display: block;
		padding-top: 56.25%;
	}
}

/* Pin the player to the wrapper on all four sides. */
.entry-content .wp-block-embed .wp-block-embed__wrapper > iframe {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	margin: 0 !important;
	transform: none !important;
	border: 0;
}

/* Overflow guard for any pasted media */
.entry-content img,
.entry-content iframe,
.entry-content video,
.entry-content embed,
.entry-content object {
	max-width: 100%;
}

.entry-content img {
	height: auto;
}


/* ==========================================================================
   2. TRANSPARENT HEADER COLLISION  [NEW in v1.1]
   Astra's transparent header floats over the page and sets
   `.ast-theme-transparent-header #primary { padding: 0 }`. That works on the
   homepage, where a full-bleed cover block sits underneath it. On Contact,
   Services and Pricing there is no hero — so the logo and nav land on top of
   the page heading.

   Proper fix is per-page (see note below). This is the CSS safety net.
   Page IDs: 30 = Contact, 32 = Pricing, 281 = Services.
   ========================================================================== */

.ast-theme-transparent-header.page-id-30 #primary,
.ast-theme-transparent-header.page-id-32 #primary,
.ast-theme-transparent-header.page-id-281 #primary {
	padding-top: 150px;
}

@media (max-width: 921px) {
	.ast-theme-transparent-header.page-id-30 #primary,
	.ast-theme-transparent-header.page-id-32 #primary,
	.ast-theme-transparent-header.page-id-281 #primary {
		padding-top: 110px;
	}
}

@media (max-width: 544px) {
	.ast-theme-transparent-header.page-id-30 #primary,
	.ast-theme-transparent-header.page-id-32 #primary,
	.ast-theme-transparent-header.page-id-281 #primary {
		padding-top: 95px;
	}
}


/* ==========================================================================
   3. STARVED COLUMN PADDING + CONSISTENT MOBILE GUTTER   [WIDENED in v1.2]

   v1.1 only matched columns whose inline style contained "spacing--80".
   That is fragile: the moment a block uses --70 or a raw rem value, the
   rule misses and that section gets a different gutter than its
   neighbours — which is the "inconsistent margins" you keep seeing.

   v1.2 caps the INNER padding of every content column on small screens
   and lets the page container own the outer gutter, so every band on the
   page starts and ends on the same two vertical lines.
   ========================================================================== */

@media (max-width: 921px) {
	.entry-content .wp-block-columns > .wp-block-column[style*="padding"] {
		padding-left: var(--wp--preset--spacing--50) !important;
		padding-right: var(--wp--preset--spacing--50) !important;
	}
}

@media (max-width: 782px) {
	/* One gutter value for the whole page. Change this number and every
	   band moves together. */
	.ast-plain-container .site-content .ast-container,
	.ast-plain-container .entry-content > .wp-block-group,
	.ast-plain-container .entry-content > .wp-block-columns {
		--mb-gutter: 18px;
	}

	.entry-content .wp-block-columns > .wp-block-column[style*="padding"] {
		padding-left: 18px !important;
		padding-right: 18px !important;
	}

	/* Rounded cards should keep their corners inside the viewport. */
	.entry-content > .wp-block-columns,
	.entry-content > .wp-block-group {
		margin-left: auto;
		margin-right: auto;
		max-width: 100%;
	}
}


/* ==========================================================================
   4. NEVER BREAK WORDS IN HEADINGS
   ========================================================================== */

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
	overflow-wrap: normal;
	word-break: normal;
	hyphens: none;
	text-wrap: balance;
}

.entry-content p,
.entry-content li {
	text-wrap: pretty;
}


/* ==========================================================================
   5. SPACING RHYTHM — the "weird margins" on laptop
   ========================================================================== */

@media (min-width: 922px) {
	.entry-content .wp-block-columns > .wp-block-column[style*="spacing--80"] {
		padding-left: var(--wp--preset--spacing--70) !important;
		padding-right: var(--wp--preset--spacing--70) !important;
	}
}

.entry-content .wp-block-columns.has-background .wp-block-column > p {
	max-width: 68ch;
	margin-inline: auto;
}


/* ==========================================================================
   6. FLUID HERO TYPE
   ========================================================================== */

.entry-content .wp-block-cover h1,
.entry-content .wp-block-cover h2 {
	font-size: clamp(1.75rem, 6.2vw, 3.25rem);
	line-height: 1.12;
	letter-spacing: -0.01em;
}

.entry-content .wp-block-cover p {
	font-size: clamp(1rem, 3.4vw, 1.2rem);
	line-height: 1.55;
}

@media (max-width: 544px) {
	.entry-content .wp-block-cover p.has-text-align-center {
		text-align: left;
	}
}


/* ==========================================================================
   7. FORMS — WPForms (form #395, modern markup)   [REWRITTEN in v1.2]

   Two separate bugs were producing the misaligned Name row:

   (a) The First/Last blocks are .wpforms-field-row-block.wpforms-one-half.
       v1.1 set width:100% and zeroed margin-RIGHT and padding-RIGHT only.
       WPForms' modern stylesheet puts the gutter on the LEFT of the second
       block, so "Last" kept a ~20px indent AND lost that width — exactly
       the stagger in your screenshot.

   (b) Phone/Email (.wpforms-one-half) and the three Event selects
       (.wpforms-one-third) had no mobile rule at all, so three dropdowns
       were sharing a 393pt screen.

   Everything below stacks to a single column at 782px and zeroes the
   gutter on BOTH sides.
   ========================================================================== */

.wpforms-container input[type="text"],
.wpforms-container input[type="email"],
.wpforms-container input[type="tel"],
.wpforms-container input[type="url"],
.wpforms-container input[type="number"],
.wpforms-container input[type="date"],
.wpforms-container select,
.wpforms-container textarea,
.wpforms-container .choices__inner {
	font-size: 16px !important; /* stops iOS zooming on focus */
	min-height: 44px;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.wpforms-container textarea {
	min-height: 130px;
}

@media (max-width: 782px) {

	/* Every multi-column field goes full width. */
	.wpforms-container .wpforms-field.wpforms-one-half,
	.wpforms-container .wpforms-field.wpforms-one-third,
	.wpforms-container .wpforms-field.wpforms-two-thirds,
	.wpforms-container .wpforms-field.wpforms-one-fourth,
	.wpforms-container .wpforms-field.wpforms-three-fourths,
	.wpforms-container .wpforms-field-row-block.wpforms-one-half,
	.wpforms-container .wpforms-field-row-block.wpforms-one-third {
		width: 100% !important;
		max-width: 100% !important;
		flex: 0 0 100% !important;
		float: none !important;
		clear: both !important;
		display: block !important;
		/* the fix v1.1 missed — BOTH sides */
		margin-left: 0 !important;
		margin-right: 0 !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	/* Vertical rhythm between the now-stacked blocks. */
	.wpforms-container .wpforms-field-row-block + .wpforms-field-row-block {
		margin-top: 14px !important;
	}

	.wpforms-container .wpforms-field {
		margin-bottom: 18px !important;
	}

	/* The Name row itself is a flex/float row in WPForms modern CSS. */
	.wpforms-container .wpforms-field-row {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
	}

	.wpforms-container .wpforms-field-row::after {
		content: "";
		display: table;
		clear: both;
	}

	/* Choices.js dropdowns inherit an inline width from JS. */
	.wpforms-container .choices,
	.wpforms-container .choices__inner,
	.wpforms-container .choices[data-type*="select-one"] {
		width: 100% !important;
		max-width: 100% !important;
	}

	/* Let the placeholder text breathe instead of truncating to "Choos..." */
	.wpforms-container .choices__inner,
	.wpforms-container .choices__list--single .choices__item {
		white-space: normal;
		overflow: visible;
		text-overflow: clip;
	}
}

.wpforms-container .wpforms-field-label,
.wpforms-container .wpforms-field-sublabel {
	line-height: 1.4;
}

.wpforms-container .wpforms-submit {
	min-height: 48px;
	font-size: 16px;
	cursor: pointer;
}

@media (max-width: 782px) {
	.wpforms-container .wpforms-submit {
		width: 100%;
	}
}


/* ==========================================================================
   8. TAP TARGETS — 44px minimum (Apple HIG / WCAG 2.5.5)
   ========================================================================== */

.wp-block-button__link,
.ast-button,
.main-header-menu .menu-link,
button[type="submit"] {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
