/*
Theme Name:     Drio Theme
Description:    Child theme for Drio's Template
Author:         Drio, LLC
Author URI:     https://drioduo.com
Template:       greyd-theme
Version:        1.0.1ak
Tags:
*/

/*
 * Critical above-the-fold layout.
 *
 * Greyd emits these block-specific rules in the footer. Duplicating the
 * essential widths here prevents the homepage hero and single-post header
 * from shifting after their first paint.
 */
.gs_kXGmqT {
	width: calc(50% - (var(--wp--preset--spacing--medium) / 1)) !important;
}

.gs_KxR7AG {
	max-width: 40% !important;
}

.gs_JBpybG,
.gs_d9gxDu {
	width: calc(50% - (var(--wp--preset--spacing--medium) / 1)) !important;
}

@media (max-width: 991.98px) {
	.gs_JBpybG {
		width: 100% !important;
	}

	.gs_d9gxDu {
		width: 70% !important;
	}
}

@media (max-width: 575.98px) {
	.gs_kXGmqT {
		width: 100% !important;
	}

	.gs_KxR7AG {
		max-width: 100% !important;
	}

	.gs_d9gxDu {
		width: 100% !important;
	}
}


/* Preserve the homepage About section's 40/60 composition.
 * Greyd currently escapes the CSS custom property in these generated widths,
 * which makes both declarations invalid after an editor save. */
.home .gs_zpRlWT {
	width: calc(40% - (var(--wp--preset--spacing--medium) / 1)) !important;
}

.home .gs_v48lEW {
	width: calc(60% - (var(--wp--preset--spacing--medium) / 1)) !important;
}

@media (max-width: 991.98px) {
	.home .gs_zpRlWT,
	.home .gs_v48lEW {
		width: 100% !important;
	}
}

@media (max-width: 575.98px) {
	.home .gs_3vNCnf {
		margin: 0 !important;
		min-width: 100% !important;
	}
}


/* Keep new-window indicators visually separated from button labels. */
.wp-block-button__link[target="_blank"]::after,
.wp-element-button[target="_blank"]::after {
	margin-left: 0.4em;
}

.wp-block-button__link[target="_blank"] > svg:last-child,
.wp-block-button__link[target="_blank"] > .dashicons:last-child,
.wp-block-button__link[target="_blank"] > [class*="icon"]:last-child,
.wp-element-button[target="_blank"] > svg:last-child,
.wp-element-button[target="_blank"] > .dashicons:last-child,
.wp-element-button[target="_blank"] > [class*="icon"]:last-child {
	margin-left: 0.4em;
}


/* Greyd buttons use the generic .button class after trigger rendering. */
a.button[target="_blank"]::after,
a[role="trigger"].button[target="_blank"]::after {
	margin-left: 0.5em !important;
}


/* Consistent, high-contrast keyboard focus across interactive controls. */
:where(a, button, input, select, textarea, summary, [role="button"], [role="tab"], [tabindex]:not([tabindex="-1"])):focus-visible {
	outline: 2px solid transparent !important;
	outline-offset: 3px;
	box-shadow: 0 0 0 3px #ffffff, 0 0 0 6px #1d2ba7 !important;
	transition: none !important;
}

/* Keep the PDF file-type suffix visually distinct without de-emphasizing it. */
.mh-pdf-label {
	white-space: nowrap;
}


/* Accessible controls for legacy carousel blocks. */
.cb-carousel-block .mh-carousel-controls {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 0.5rem;
}

.cb-carousel-block .mh-carousel-toggle {
	appearance: none;
	background: #ffffff;
	border: 2px solid #428202;
	border-radius: 4px;
	color: #234600;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	padding: 0.45rem 0.75rem;
}

.cb-carousel-block .cb-button-prev[role="button"],
.cb-carousel-block .cb-button-next[role="button"] {
	cursor: pointer;
}


/* Preserve Greyd pagination appearance when action links are corrected to buttons. */
.wp-block-query-pagination button.page-numbers,
.wp-block-query-pagination button.wp-block-query-pagination-next,
.wp-block-query-pagination button.wp-block-query-pagination-previous {
	appearance: none;
	background: transparent;
	color: inherit;
	cursor: pointer;
	font: inherit;
}


/* Use native checkbox rendering in Gravity Forms.
 * This avoids the parent theme's transparent custom checkmark and remains
 * reliable across browsers, touch devices, and forced-colors mode. */
.gform_wrapper input[type="checkbox"] {
	-webkit-appearance: checkbox !important;
	appearance: auto !important;
	accent-color: #234600;
	inline-size: 1.125rem;
	block-size: 1.125rem;
	cursor: pointer;
}

.gform_wrapper input[type="checkbox"]::before,
.gform_wrapper input[type="checkbox"]::after {
	content: none !important;
}

.gform_wrapper .gchoice label {
	cursor: pointer;
}


/* Greyd's button variants use higher-specificity focus resets.
 * Ensure every keyboard-focused button retains the shared focus indicator. */
html body a.button[class]:focus-visible,
html body a[role="button"][aria-label]:focus-visible,
html body .wp-element-button:focus-visible,
html body .wp-block-button__link:focus-visible {
	outline: 2px solid transparent !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 3px #ffffff, 0 0 0 6px #1d2ba7 !important;
}


/* Restore core WordPress right-aligned image wrapping inside flow layouts.
 * Greyd's blocks.css resets .alignright to float:none!important. */
body .is-layout-flow > .wp-block-image.alignright,
body .is-layout-constrained > .wp-block-image.alignright {
	float: right !important;
	margin: 0 0 1.5rem 2rem !important;
}

body .is-layout-flow > .wp-block-image.alignright + .wp-block-paragraph,
body .is-layout-constrained > .wp-block-image.alignright + .wp-block-paragraph {
	clear: none !important;
}

/* Avoid an unusably narrow text column beside floated images on small screens. */
@media (max-width: 781.98px) {
	body .is-layout-flow > .wp-block-image.alignright,
	body .is-layout-constrained > .wp-block-image.alignright {
		float: none !important;
		margin: 1.5rem 0 1.5rem auto !important;
	}
}


/* WCAG reflow support at the effective viewport created by 200% zoom. */
@media (max-width: 781.98px) {
	main {
		min-width: 0;
	}

	main p,
	main li,
	main a,
	main label,
	main legend {
		overflow-wrap: anywhere;
	}

	main img,
	main video,
	main iframe {
		max-width: 100%;
		height: auto;
	}

	/* The Contact page begins with a nowrap locations/form row. */
	body.page-id-181 main .entry-content > .wp-block-group.is-layout-flex {
		flex-direction: column !important;
		flex-wrap: wrap !important;
		align-items: stretch !important;
	}

	body.page-id-181 main .entry-content > .wp-block-group.is-layout-flex > * {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	.gform_wrapper,
	.gform_wrapper form,
	.gform_wrapper .gform_body,
	.gform_wrapper .gfield,
	.gform_wrapper .ginput_container,
	.gform_wrapper .ginput_complex {
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
	}

	.gform_wrapper .gform-grid-row {
		display: block !important;
		margin-inline: 0 !important;
	}

	.gform_wrapper .gform-grid-col {
		width: 100% !important;
		max-width: 100% !important;
		padding-inline: 0 !important;
	}

	.gform_wrapper label {
		white-space: normal !important;
	}

	/* Keep calendar controls usable while preserving horizontal scrolling
	 * for the month grid, which is a two-dimensional data table. */
	.piecal-controls,
	.fc .fc-toolbar {
		flex-wrap: wrap !important;
		gap: 0.5rem;
	}

	.piecal-controls__view-chooser,
	.piecal-controls__view-chooser select {
		max-width: 100% !important;
	}

	.wp-block-piecal-calendar,
	.piecal-wrapper {
		max-width: 100%;
		min-width: 0;
	}

	.piecal-wrapper .fc-view-harness {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.piecal-popover__inner {
		width: calc(100vw - 2rem) !important;
		max-width: calc(100vw - 2rem) !important;
		max-height: calc(100vh - 2rem);
		overflow: auto;
	}
}


/* Visible hover and keyboard-focus cues for editorial text links. */
.gs_h9euLm:hover > span:first-child,
.gs_h9euLm:focus-visible > span:first-child,
.wp-block-greyd-buttons a.is-style-clear.dyn:hover > span:first-child,
.wp-block-greyd-buttons a.is-style-clear.dyn:focus-visible > span:first-child {
	text-decoration: underline !important;
	text-underline-offset: 0.15em;
}

/* Footer contact and policy links: underline text links only, never buttons or logos. */
footer .wp-block-greyd-list .list_content a.link:hover,
footer .wp-block-greyd-list .list_content a.link:focus-visible,
footer p.custom-svg-size > a:hover,
footer p.custom-svg-size > a:focus-visible {
	text-decoration: underline !important;
	text-underline-offset: 0.15em;
}

/* Standard text links on the News/Events and policy pages. */
body.page-id-171 main :is(p, li, h2, h3, h4) > a:not(.button, .wp-element-button):hover,
body.page-id-171 main :is(p, li, h2, h3, h4) > a:not(.button, .wp-element-button):focus-visible,
body:is(.page-id-709, .page-id-9940, .page-id-9941, .page-id-10325) main :is(p, li) > a:not(.button, .wp-element-button):hover,
body:is(.page-id-709, .page-id-9940, .page-id-9941, .page-id-10325) main :is(p, li) > a:not(.button, .wp-element-button):focus-visible {
	text-decoration: underline !important;
	text-underline-offset: 0.15em;
}


/* Media Coverage cards, aligned with the Blog listing design. */
.page-id-9877 .mh-media-card-grid {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--tiny);
	align-items: stretch;
}

.page-id-9877 .mh-media-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: var(--wp--preset--spacing--small);
	background: var(--wp--preset--color--foreground);
	border-radius: 20px;
}

.page-id-9877 .mh-media-card .wp-block-image {
	margin-bottom: var(--wp--preset--spacing--small);
}

.page-id-9877 .mh-media-card .wp-block-image img {
	display: block;
	width: 100%;
	height: 220px;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 12px;
}

.page-id-9877 .mh-media-card .wp-block-heading {
	margin-top: 0;
	font-family: var(--wp--preset--font-family--lora);
	font-size: var(--wp--preset--font-size--medium) !important;
	line-height: 1.35 !important;
}

.page-id-9877 .mh-media-card > p:last-child {
	margin-top: auto;
	margin-bottom: 0;
	font-size: var(--wp--preset--font-size--tiny) !important;
	color: var(--wp--preset--color--mediumdark);
}

.page-id-9877 .mh-media-card .wp-block-heading a:hover,
.page-id-9877 .mh-media-card .wp-block-heading a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

@media (max-width: 991.98px) {
	.page-id-9877 .mh-media-card-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 575.98px) {
	.page-id-9877 .mh-media-card-grid {
		grid-template-columns: 1fr;
	}
}


/* Native Query Loop link used by the homepage article cards. */
.mh-card-read-more {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
}

.mh-card-read-more::after {
	content: "→";
	margin-left: 10px;
	text-decoration: none;
}

.mh-card-read-more:hover,
.mh-card-read-more:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}


/* Keep the Donate nested navigation flyout opening to the right on desktop. */
@media (min-width: 992px) {
	.wp-block-navigation .mh-submenu-open-right > .wp-block-navigation__submenu-container {
		left: 100% !important;
		right: auto !important;
		inset-inline-start: 100% !important;
		inset-inline-end: auto !important;
		top: -1px;
		transform: none !important;
	}
}
