/*
Theme Name: Yoga With Adriene
Theme URI: https://yogawithadriene.com/
Description: Lean block theme replacing the Oxygen build. Design tokens live in theme.json.
Version: 0.9.2
Requires at least: 6.6
Requires PHP: 8.1
Text Domain: ywa
*/

/* Keep the header visible while scrolling (replaces My Sticky Menu Pro). The sticky element must be
   the template-part wrapper WordPress adds around parts/header.html, not the group inside it. */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
}

.admin-bar .wp-site-blocks > header.wp-block-template-part {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/* In-page anchors (e.g. "Jump to" on the transcripts page) land below the sticky header. */
html {
	scroll-padding-top: 8rem;
}

/* Lighter YouTube embeds: keep a 16:9 box before the iframe loads (replaces Lazy Load for Videos layout). */
.wp-block-embed-youtube .wp-block-embed__wrapper iframe,
.wp-block-post-content iframe[src*="youtube"] {
	aspect-ratio: 16 / 9;
	width: 100%;
	height: auto;
}

/* Click-to-play YouTube (ywa_youtube_facade in functions.php). */
.ywa-yt {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	padding: 0;
	border: 0;
	background: #000;
	cursor: pointer;
	overflow: hidden;
}

/* Embeds with core's aspect-ratio classes reserve 16:9 with a ::before spacer and expect the player
   positioned over it; do the same for the button so there's no empty box above it. */
.wp-has-aspect-ratio .wp-block-embed__wrapper > .ywa-yt {
	position: absolute;
	inset: 0;
	height: 100%;
	aspect-ratio: auto;
}

/* Absolutely positioned so core's img { height: auto } can't stretch it past the 16:9 box. The 4:3
   thumbnail has black bars top and bottom; cover crops them off evenly. */
.ywa-yt img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
}

.ywa-yt__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 68px;
	height: 48px;
	transform: translate(-50%, -50%);
	border-radius: 12px;
	background: rgb(33 33 33 / 80%);
	transition: background-color 0.15s;
}

.ywa-yt__play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 55%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 10px 0 10px 18px;
	border-color: transparent transparent transparent #fff;
}

.ywa-yt:hover .ywa-yt__play,
.ywa-yt:focus-visible .ywa-yt__play {
	background: #f00;
}

.ywa-yt__frame {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
}

/* Video archive grid (parts/video-grid.html): thumbnail plus centered title, like the Oxygen hub. */
.ywa-video-grid .wp-block-post-featured-image img {
	object-fit: cover;
}

.ywa-video-grid .wp-block-post-title {
	font-size: 1.375rem;
	line-height: 1.25;
}

.ywa-video-grid .wp-block-post-title a {
	text-decoration: none;
}

.ywa-video-grid .wp-block-post-title a:hover {
	text-decoration: underline;
}

.wp-block-query-pagination a,
.wp-block-query-pagination .current {
	padding: 0.25rem 0.6rem;
	border: 1px solid var(--wp--preset--color--mist);
	text-decoration: none;
}

.wp-block-query-pagination .current {
	background: var(--wp--preset--color--black);
	color: var(--wp--preset--color--paper);
}

.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--black);
	border: 1px solid currentColor;
}

/* Calendar page (templates/page-calendar.html). The monthly content is edited in the block
   editor and often has stray empty paragraphs; don't let them add gaps. */
.ywa-calendar .wp-block-post-content p:empty {
	display: none;
}

/* AWeber newsletter sign-up (patterns/newsletter-signup.php). */
.ywa-signup__form {
	display: grid;
	gap: var(--wp--preset--spacing--20);
}

.ywa-signup__label {
	font-size: var(--wp--preset--font-size--small);
}

.ywa-signup__input {
	min-height: 44px;
	padding: 0 0.75rem;
	border: 1px solid var(--wp--preset--color--muted);
	background: var(--wp--preset--color--paper);
	font: inherit;
}

.ywa-signup__input:focus-visible,
.ywa-signup__button:focus-visible {
	outline: 2px solid var(--wp--preset--color--black);
	outline-offset: 2px;
}

.ywa-signup__button {
	min-height: 44px;
	margin-top: var(--wp--preset--spacing--20);
	cursor: pointer;
}

/* Old classic posts hard-code iframe and image widths; never let them push past the column. */
.wp-block-post-content iframe,
.wp-block-post-content img {
	max-width: 100%;
}

.wp-block-post-content img {
	height: auto;
}

/* Mobile menu overlay: left-aligned, larger top-level links, sub-items indented under their parent. */
.wp-block-navigation__responsive-container.is-menu-open {
	--navigation-layout-justification-setting: flex-start;
	--navigation-layout-justify: flex-start;
	--navigation-layout-align: flex-start;
	padding: var(--wp--preset--spacing--40);
}

/* !important: the nav's "justify right" setting (items-justified-right) otherwise wins inside the overlay. */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	align-items: flex-start !important;
	justify-content: flex-start !important;
	text-align: left;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	gap: 1.1rem;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	font-size: 1.75rem;
	line-height: 1.1;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
	gap: 0.55rem;
	margin-top: 0.6rem;
	padding: 0 0 0 1rem !important;
	border-left: 1px solid var(--wp--preset--color--muted);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	font-size: 1.15rem;
	padding: 0 !important;
}

/* Home hero on phones: heading and intro, then Adriene's photo, then the sign-up form. */
@media (max-width: 781px) {
	.ywa-hero {
		flex-direction: column;
		align-items: stretch !important;
	}

	.ywa-hero > .wp-block-column {
		display: contents;
	}

	.ywa-hero .wp-block-image {
		order: 1;
		margin-block: var(--wp--preset--spacing--30);
	}

	.ywa-hero .wp-block-image img {
		max-width: min(100%, 320px);
		height: auto;
	}

	.ywa-hero .ywa-signup {
		order: 2;
	}

	.ywa-hero .wp-block-spacer {
		display: none;
	}
}

/* Media & text: keep the text's outer edge on the page column (core pads both sides by 8%). */
@media (min-width: 601px) {
	.wp-block-media-text.has-media-on-the-right > .wp-block-media-text__content {
		padding-left: 0;
	}

	.wp-block-media-text:not(.has-media-on-the-right) > .wp-block-media-text__content {
		padding-right: 0;
	}
}

/* About page: shorter top photo on phones so the heading shows without scrolling. */
@media (max-width: 600px) {
	.wp-block-cover.ywa-about-hero {
		min-height: 360px !important;
	}
}
