/*
 * Rao Dermatology: site-wide rules outside .rd-prose (forms, header toggle).
 */

/* Gravity Forms: one look for every form (colours come from the gform_default_styles filter in raoderm-site.php). */
body .gform_wrapper.gform-theme--framework {
	--gf-ctrl-size-md: 48px;
	--gf-ctrl-btn-radius: 999px;
	--gf-ctrl-btn-text-transform: uppercase;
	--gf-ctrl-btn-letter-spacing: .18em;
	--gf-ctrl-btn-font-size-md: 13px;
	--gf-ctrl-btn-padding-x-md: 24px;
	--gf-ctrl-label-font-weight-primary: 500;
}

/* Mobile menu toggle: 44px hit area, same 32px icon and layout. */
.breakdance-menu .breakdance-menu-toggle {
	padding: 6px;
	margin: -6px;
}

/* Mobile drawer (Breakdance menu in collapsed mode): mega-panel links get a ~40px tap target. */
.breakdance-menu--dropdown-accordion .raoderm-mm-list { gap: 0; }
.breakdance-menu--dropdown-accordion .raoderm-mm-link { display: block; padding: 10px 0; }

/* Desktop Patients / About dropdowns: the same link rhythm as the Treatments and Skin Conditions panels. */
.breakdance-menu--dropdown-dropdown .breakdance-dropdown:not(.breakdance-dropdown--custom) .breakdance-dropdown-links { gap: 0; }
.breakdance-menu--dropdown-dropdown .breakdance-dropdown:not(.breakdance-dropdown--custom) .breakdance-dropdown-link {
	padding: 5px 10px;
	font-size: 15px;
	line-height: 1.35;
}

/* Sub-page hero without a featured image: on phones, drop the decorative arch so the title and actions come first. */
@media (max-width: 767px) {
	.raoderm-sub-hero-media:has(> .raoderm-sub-hero-fallback) { display: none; }
}

/* Two-column form sections: the heading and contact facts stay beside the tall form. */
@media (min-width: 1024px) {
	.raoderm-visit > .raoderm-visit-info,
	.academy-enquire-grid > .academy-enquire-copy { position: sticky; top: 120px; align-self: start; }
}

/* Card grids: a short last row (one card, or two in a three-column grid) is centred instead of left-aligned. */
@media (min-width: 1024px) {
	.bde-post-loop:is(.raoderm-post-grid, .academy-grid, .raoderm-hub-grid, .raoderm-sib-grid) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
	.bde-post-loop:is(.raoderm-post-grid, .academy-grid, .raoderm-hub-grid, .raoderm-sib-grid) > article { grid-column: span 2; }
	.bde-post-loop:is(.raoderm-post-grid, .academy-grid, .raoderm-hub-grid, .raoderm-sib-grid) > article:nth-child(3n + 1 of article):nth-last-child(1 of article) { grid-column: 3 / span 2; }
	.bde-post-loop:is(.raoderm-post-grid, .academy-grid, .raoderm-hub-grid, .raoderm-sib-grid) > article:nth-child(3n + 1 of article):nth-last-child(2 of article) { grid-column: 2 / span 2; }
}
@media (min-width: 480px) and (max-width: 1023px) {
	.bde-post-loop:is(.raoderm-post-grid, .academy-grid, .raoderm-hub-grid, .raoderm-sib-grid) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.bde-post-loop:is(.raoderm-post-grid, .academy-grid, .raoderm-hub-grid, .raoderm-sib-grid) > article { grid-column: span 2; }
	.bde-post-loop:is(.raoderm-post-grid, .academy-grid, .raoderm-hub-grid, .raoderm-sib-grid) > article:nth-child(2n + 1 of article):nth-last-child(1 of article) { grid-column: 2 / span 2; }
}
/* /treatments/ "Treat a concern": 16 tiles fill a 4 x 4 grid on wide screens. */
@media (min-width: 1200px) {
	#concerns .bde-post-loop.raoderm-hub-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	#concerns .bde-post-loop.raoderm-hub-grid > article { grid-column: auto; }
}

/* Blog and search cards: the Read / Explore button sits on the card's bottom edge, level across a row. */
.raoderm-post-card { display: flex; flex-direction: column; height: 100%; }
.raoderm-post-card > .raoderm-pill { margin-top: auto; align-self: flex-start; }
.raoderm-post-card > .raoderm-card-text { margin-bottom: 20px; }
.raoderm-hub-tile > .raoderm-pill { margin-top: auto; }
.raoderm-hub-tile > :not(.raoderm-pill):nth-last-child(2) { margin-bottom: 18px; }

/* Hub tiles on phones (/treatments/, /conditions/, /injectables/ …): two-up, 4:3 image and title only. */
@media (max-width: 767px) {
	.bde-post-loop.raoderm-hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
	.bde-post-loop.raoderm-hub-grid > article { grid-column: auto !important; }
	.raoderm-hub-grid .raoderm-hub-tile > p,
	.raoderm-hub-grid .raoderm-hub-tile > .raoderm-pill,
	.raoderm-hub-grid .raoderm-hub-tile > .raoderm-hub-tile-cta { display: none; }
	.raoderm-hub-grid .raoderm-hub-tile > :not(.raoderm-pill):nth-last-child(2) { margin-bottom: 0; }
	.raoderm-hub-grid .raoderm-hub-tile-media { margin-bottom: 0; }
	.raoderm-hub-grid .raoderm-hub-tile-media .raoderm-card-img { aspect-ratio: 4 / 3; height: auto; object-fit: cover; }
	.raoderm-hub-grid .raoderm-hub-tile-title { font-size: 19px; line-height: 1.2; margin-top: 10px; }
}

/* Header: the main nav links, submenu chevrons and search toggle get the same 2px teal ring as the utility links and logo.
 * Desktop menu links carry 30px of vertical padding, so the ring is drawn on an inner box hugging the label. */
header .breakdance-menu-link:focus-visible,
header .breakdance-menu-link-arrow:focus-visible,
header .breakdance-menu-toggle:focus-visible {
	outline: 2px solid #00756f;
	outline-offset: 2px;
	border-radius: 4px;
}
@media (min-width: 1120px) {
	header .breakdance-menu-link:focus-visible { outline: none; position: relative; }
	header .breakdance-menu-link-arrow:focus-visible { outline: none; }
	header .breakdance-menu-link:focus-visible::after,
	header .breakdance-menu-link-arrow:focus-visible::before {
		content: "";
		position: absolute;
		inset: 22px -4px 22px 6px;
		border: 2px solid #00756f;
		border-radius: 4px;
		pointer-events: none;
	}
	header .breakdance-menu-item > .breakdance-menu-link:focus-visible::after { inset: 22px 6px; }
	/* The chevron icon is the arrow's ::after, so its ring uses ::before. */
	header .breakdance-menu-link-arrow:focus-visible::before { inset: 24px 6px 24px -4px; }
}
header .bde-search-form-v2__toggle:focus-visible {
	outline: 2px solid #a6ece7;
	outline-offset: 4px;
	border-radius: 4px;
}

/* Home "Find your treatment" cards on phones: a landscape crop instead of near-square photos. */
@media (max-width: 767px) {
	.raoderm-grid-4 .raoderm-card-img { aspect-ratio: 4 / 3; height: auto; object-fit: cover; }
}

/* Long "Call …" pills wrap between words, not inside the phone number. */
a[href^="tel:"]:is(.raoderm-pill, .button-atom) { text-wrap: balance; }

/* About Dr. Rao: the hero photo is a three-panel strip (US-Rao.jpg). Frame its right panel, Dr. Rao's own
   portrait, until the commissioned portrait arrives. Page 269 = /our-team/. Phones keep the
   wide crop, which already shows him. */
@media (min-width: 768px) {
	.page-id-269 .raoderm-sub-hero-bg { background-position: 100% 30%; }
}

/* Landing header (Breakdance 694) on narrow phones: the wide Alberta DermaSurgery Centre logo shrinks so the
   "Book a consultation" pill always fits beside it. */
@media (max-width: 767px) {
	.bde-f-container-link-694-101.raoderm-brand { flex-shrink: 1; min-width: 0; }
	.bde-f-image-694-100.raoderm-logo { width: 100%; max-width: 230px; }
}
