/**
 * The directory — browse cards + search results.
 */

.mp-aod-dir {
	--mp-berry: var(--wp--preset--color--berry, #8E2C4E);
	--mp-berry-hover: #7A2542;
	--mp-ink: #1A1A1A;
	--mp-muted: #645A60;
	--mp-line: #F1E0E6;
	--mp-wash: #FBF1F3;
	--mp-ivory: #FCF8F5;
	--mp-shadow-md: 0 6px 22px rgba(142, 44, 78, .09);
	max-width: 860px;
	margin: 0 auto;
}

/* ---------- search bar ---------- */

.mp-aod-dir-searchwrap {
	position: relative;
	max-width: 680px;
	margin: 0 auto 32px;
}

.mp-aod-dir-searchbar {
	position: relative;
	display: flex;
	align-items: center;
}

.mp-aod-dir-icon {
	position: absolute;
	left: 20px;
	color: var(--mp-muted);
	display: flex;
	pointer-events: none;
}

.mp-aod-dir-input {
	width: 100%;
	box-sizing: border-box; /* padding (incl. icon + button room) stays inside */
	font-size: 16px; /* >=16px: no iOS zoom on focus */
	font-family: inherit;
	color: var(--mp-ink);
	background: #fff;
	border: 1.5px solid var(--mp-line);
	border-radius: 100px;
	/* right padding leaves room for the clear × and the Search button */
	padding: 19px 150px 19px 52px;
	outline: none;
	box-shadow: var(--mp-shadow-md);
	transition: border-color .18s;
}

.mp-aod-dir-input:focus {
	border-color: var(--mp-berry);
}

.mp-aod-dir-input::placeholder {
	color: #9a9198;
}

/* Hide the browser's own clear × inside type=search inputs. */
.mp-aod-dir-input::-webkit-search-cancel-button,
.mp-aod-dir-input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.mp-aod-dir-input::-ms-clear {
	display: none;
}


/* The Search button, inside the pill on the right — the design's centrepiece
   action. type=button; it fires the same live search immediately. */
.mp-aod-dir-go {
	position: absolute;
	right: 7px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	background: var(--mp-berry);
	border: none;
	border-radius: 100px;
	padding: 12px 26px;
	cursor: pointer;
	transition: background .18s;
	box-sizing: border-box;
}

.mp-aod-dir-go:hover {
	background: var(--mp-berry-hover);
}

/* Popular topics — the chips row under the search bar. */
.mp-aod-dir-popular {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin: 16px auto 32px;
	max-width: 680px;
	font-size: .82rem;
	color: var(--mp-muted);
}

.mp-aod-dir-popular a {
	font-size: .8rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--mp-berry);
	background: var(--mp-wash);
	border: 1px solid var(--mp-line);
	border-radius: 100px;
	padding: 5px 14px;
	transition: background .18s, border-color .18s;
}

.mp-aod-dir-popular a:hover {
	background: #FDEEF2;
	border-color: var(--mp-berry);
}
/* ---------- section heads (topics + fresh) ---------- */

.mp-aod-dir-sechead {
	text-align: center;
	margin: 64px 0 34px;
}

.mp-aod-dir-sechead h2 {
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 800;
	letter-spacing: -.02em;
	color: var(--mp-ink);
	margin: 0 0 10px;
}

.mp-aod-dir-sechead p {
	margin: 0;
	color: #000;
	font-size: inherit; /* the theme's own body size */
	line-height: 1.6;
}

.mp-aod-dir-sechead--fresh {
	margin-top: 96px;
}

/* ---------- browse cards ---------- */

.mp-aod-dir-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 16px;
}

.mp-aod-dir-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	height: 100%; /* every card in a row is the same height */
	box-sizing: border-box; /* padding+border inside the 100% — without this
	                           row one outgrows its track and paints over
	                           row two */
	padding: 24px 24px 10px;
	background: #fff;
	border: 1px solid var(--mp-line);
	border-radius: 18px;
	text-decoration: none;
	transition: border-color .18s, transform .18s, box-shadow .18s;
}

.mp-aod-dir-card:hover {
	border-color: var(--mp-berry);
	transform: translateY(-3px);
	box-shadow: var(--mp-shadow-md);
}

.mp-aod-dir-card-title {
	font-size: 1.08rem;
	font-weight: 800;
	color: var(--mp-ink);
	letter-spacing: -.01em;
	transition: color .18s;
}

.mp-aod-dir-card:hover .mp-aod-dir-card-title {
	color: var(--mp-berry);
}

.mp-aod-dir-card-dek {
	font-size: .9rem;
	color: var(--mp-muted);
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mp-aod-dir-card-count {
	margin-top: 5px;
	font-size: .78rem;
	font-weight: 700;
	color: var(--mp-berry);
}

.mp-aod-dir-empty,
.mp-aod-dir-noresult {
	text-align: center;
	padding: 48px 20px;
	color: var(--mp-muted);
	line-height: 1.6;
}

/* ---------- results ---------- */

/* Group headings in the search results ("Questions from other women",
   "From our articles") — styled like the page's own headings: bold, ink,
   tight tracking. The first sits flush under the bar; later groups get air. */
.mp-aod-dir-subhead {
	position: relative;
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--mp-ink);
	letter-spacing: -.01em;
	margin: 38px 0 18px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--mp-line);
}

/* A berry dot opens each heading, so the two result groups read as marked
   sections of the same family. */
.mp-aod-dir-subhead::before {
	content: "";
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--mp-berry);
	margin-right: 10px;
	vertical-align: 2px;
}

/* A short berry dash sitting on the rule — the brand's eyebrow motif, so
   each group announces itself at a glance. */
.mp-aod-dir-subhead::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -1px;
	width: 34px;
	height: 3px;
	border-radius: 3px;
	background: var(--mp-berry);
}

/* Inside the panel the close button comes first, so the flush-top rule
   targets the heading that directly follows it. */
.mp-aod-dir-results .mp-aod-dir-subhead:first-child,
.mp-aod-dir-close + .mp-aod-dir-subhead {
	margin-top: 0;
}

/* Results beyond the first four in a group wait behind "View all". A class,
   not the hidden attribute — an explicit display elsewhere would override
   [hidden], and this cannot be overridden by accident. */
.mp-aod-dir-hit.mp-aod-dir-more {
	display: none;
}

.mp-aod-dir-viewall {
	display: block;
	margin: 20px auto 6px; /* centred under its group */
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	color: var(--mp-berry);
	background: none;
	border: 1.5px solid var(--mp-berry);
	border-radius: 100px;
	padding: 11px 28px;
	cursor: pointer;
	transition: background .18s, color .18s;
	box-sizing: border-box;
}

.mp-aod-dir-viewall:hover {
	background: var(--mp-berry);
	color: #fff;
}

.mp-aod-dir-hits {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mp-aod-dir-hit {
	border-bottom: 1px solid var(--mp-line);
}

.mp-aod-dir-hit a {
	display: block;
	padding: 18px 4px;
	text-decoration: none;
	transition: padding-left .18s;
}

.mp-aod-dir-hit a:hover {
	padding-left: 8px;
}

.mp-aod-dir-hit-q {
	display: block;
	font-size: 1.05rem;
	font-weight: 700;
	color: #000;
	margin-bottom: 4px;
}

.mp-aod-dir-hit a:hover .mp-aod-dir-hit-q {
	color: var(--mp-berry);
}

.mp-aod-dir-hit-topic {
	display: inline-block;
	align-self: flex-start;
	font-size: .72rem;
	font-weight: 700;
	color: #fff;
	background: var(--mp-berry);
	border-radius: 100px;
	padding: 3px 12px;
	margin-bottom: 8px;
}

.mp-aod-dir-hit-ex {
	display: block;
	font-size: .9rem;
	color: var(--mp-muted);
	line-height: 1.55;
}

@media (max-width: 600px) {
	.mp-aod-dir-input {
		padding: 16px 112px 16px 46px;
	}

	.mp-aod-dir-icon {
		left: 16px;
	}

	.mp-aod-dir-go {
		padding: 10px 18px;
		font-size: 14px;
	}

	/* Two compact topic tiles per row on phones. */
	.mp-aod-dir-grid {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}

	.mp-aod-dir-card {
		padding: 14px 14px 10px;
		gap: 4px;
		border-radius: 14px;
	}

	.mp-aod-dir-card-title {
		font-size: .98rem;
	}

	.mp-aod-dir-card-dek {
		font-size: .82rem;
	}

	.mp-aod-dir-card-count {
		font-size: .74rem;
	}

}

/* =========================================================================
 * The question stream — flagged questions drifting in two rows, edges
 * masked, paused on hover. Decorative; the content is reachable elsewhere.
 * ====================================================================== */

.mp-aod-dir-stream {
	/* Full-bleed: break out of the 860px container to span the viewport. */
	width: 100vw;
	margin: 44px calc(50% - 50vw) 0;
	padding: 26px 0 30px;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
	        mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.mp-aod-dir-stream-row {
	display: flex;
	gap: 12px;
	width: max-content;
	margin-bottom: 12px;
}

.mp-aod-dir-stream-row:last-child {
	margin-bottom: 0;
}

.mp-aod-dir-stream-row.is-a {
	animation: mp-aod-drift-l 30s linear infinite;
}

.mp-aod-dir-stream-row.is-b {
	animation: mp-aod-drift-r 36s linear infinite;
}

.mp-aod-dir-stream:hover .mp-aod-dir-stream-row {
	animation-play-state: paused;
}

@keyframes mp-aod-drift-l {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}

@keyframes mp-aod-drift-r {
	from { transform: translateX(-50%); }
	to   { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
	.mp-aod-dir-stream-row {
		animation: none !important;
		flex-wrap: wrap;
		width: auto;
		justify-content: center;
	}

	.mp-aod-dir-stream {
		mask-image: none;
		-webkit-mask-image: none;
	}
}

.mp-aod-dir-qchip {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: .86rem;
	font-weight: 600;
	color: var(--mp-ink);
	text-decoration: none;
	background: #fff;
	border: 1px solid var(--mp-line);
	border-radius: 100px;
	padding: 9px 18px;
	box-shadow: 0 2px 8px rgba(142, 44, 78, .06);
	transition: border-color .18s, color .18s;
}

.mp-aod-dir-qchip::before {
	content: "\201C";
	font-weight: 800;
	color: var(--mp-berry);
}

a.mp-aod-dir-qchip:hover {
	border-color: var(--mp-berry);
	color: var(--mp-berry);
}

/* --- trust line --- */
.mp-aod-dir-trust {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px 34px;
	border-top: 1px solid var(--mp-line);
	padding: 16px 0;
	margin: 0 0 40px;
	font-size: .82rem;
	font-weight: 600;
	color: var(--mp-muted);
}

.mp-aod-dir-trust span {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.mp-aod-dir-trust svg {
	color: var(--mp-berry);
	flex: none;
}

/* =========================================================================
 * Fresh from our doctors — the latest snippets as two-column cards.
 * ====================================================================== */

.mp-aod-dir-recent {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

/* The list item is the grid cell: zero any theme li margins, flex so the card
   fills it, and min-width:0 so long content can never force cells to overlap. */
.mp-aod-dir-recent li {
	margin: 0;
	padding: 0;
	display: flex;
	min-width: 0;
}

.mp-aod-dir-recent a {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	padding: 24px;
	background: #fff;
	border: 1px solid var(--mp-line);
	border-radius: 18px;
	text-decoration: none;
	transition: border-color .18s, transform .18s, box-shadow .18s;
}

.mp-aod-dir-recent a:hover {
	border-color: var(--mp-berry);
	transform: translateY(-3px);
	box-shadow: var(--mp-shadow-md);
}

.mp-aod-dir-rpill {
	align-self: flex-start;
	font-size: .72rem;
	font-weight: 700;
	color: var(--mp-berry);
	background: var(--mp-wash);
	border-radius: 100px;
	padding: 3px 12px;
	margin-bottom: 12px;
}

.mp-aod-dir-rq {
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: break-word;
	font-size: 1.05rem; /* matched to the consultation card question */
	font-weight: 700;
	letter-spacing: -.01em;
	color: var(--mp-ink);
	line-height: 1.4;
	margin-bottom: 8px;
	transition: color .18s;
}

.mp-aod-dir-recent a:hover .mp-aod-dir-rq {
	color: var(--mp-berry);
}

.mp-aod-dir-rex {
	margin-bottom: 14px;
	overflow-wrap: break-word;
	display: -webkit-box;
	-webkit-line-clamp: 6;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: .9rem;
	color: var(--mp-muted);
	line-height: 1.6;
}

.mp-aod-dir-rby {
	display: block;
	margin-top: auto;
	padding-top: 14px;
	border-top: 1px solid var(--mp-line);
	font-size: .78rem;
	font-weight: 600;
	color: var(--mp-muted);
}

.mp-aod-dir-rby b {
	color: var(--mp-ink);
	font-weight: 700;
}

@media (max-width: 720px) {
	.mp-aod-dir-recent {
		grid-template-columns: 1fr;
	}

	.mp-aod-dir-recent a {
		padding: 18px;
	}
}

/* The panel's close button. */
.mp-aod-dir-close {
	position: sticky;
	top: 0;
	z-index: 5; /* above the relative-positioned headings, so clicks land */
	margin-left: auto; /* right-aligned without float */
	width: 30px;
	height: 30px;
	margin-top: -4px;
	margin-right: -6px;
	border: none;
	border-radius: 50%;
	background: var(--mp-wash);
	color: var(--mp-berry);
	font-size: 19px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .18s, color .18s;
}

.mp-aod-dir-close:hover {
	background: var(--mp-berry);
	color: #fff;
}


/* Search results float as a panel under the bar, overlaying the page —
   the content beneath stays put and comes back the moment she closes. */
.mp-aod-dir-results {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	right: 0;
	z-index: 60;
	background: #fff;
	border: 1px solid var(--mp-line);
	border-radius: 20px;
	box-shadow: 0 24px 60px rgba(142, 44, 78, .16);
	padding: 22px 24px 24px;
	max-height: 65vh;
	overflow-y: auto;
}

@media (max-width: 600px) {
	.mp-aod-dir-results {
		max-height: 70vh;
		padding: 16px 16px 18px;
		border-radius: 16px;
	}
}

/* While the panel is open the whole search unit lifts to the top of the
   viewport, command-palette style, and the page behind it blurs. */
.mp-aod-dir-searchwrap.is-open {
	position: fixed;
	top: 18px;
	left: 50%;
	transform: translateX(-50%);
	width: min(680px, calc(100vw - 32px));
	margin: 0;
	z-index: 9991;

	/* The wrap itself becomes the popup card — bar and results are one unit:
	   one white background, one 1px border, rounded corners. */
	background: #fff;
	border: 1px solid var(--mp-line);
	border-radius: 26px;
	overflow: hidden; /* children clip to the rounded corners, top and bottom */
	box-shadow: 0 18px 50px rgba(46, 10, 24, .16);
	padding: 10px;
	animation: mp-aod-pop .2s ease-out;
}

@keyframes mp-aod-pop {
	from {
		opacity: 0;
		transform: translate(-50%, -8px);
	}
	to {
		opacity: 1;
		transform: translate(-50%, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.mp-aod-dir-searchwrap.is-open {
		animation: none;
	}

	.mp-aod-dir-backdrop {
		animation: none;
	}
}

/* Inside the card the input calms down: no floating shadow, resting on the
   soft ivory wash, border only waking on focus. */
.mp-aod-dir-searchwrap.is-open .mp-aod-dir-input {
	box-shadow: none;
	background: var(--mp-ivory);
	border-color: transparent;
}

.mp-aod-dir-searchwrap.is-open .mp-aod-dir-input:focus {
	border-color: var(--mp-berry);
	background: #fff;
}

/* Results join the flow of the card — no divider, no second border, no gap
   worth the name. Bar and results are one seamless white unit. */
.mp-aod-dir-searchwrap.is-open .mp-aod-dir-results {
	position: static;
	border: none;
	border-radius: 0 0 18px 18px;
	box-shadow: none;
	margin-top: 6px;
	padding: 12px 14px 10px;
	/* dvh tracks the real visible viewport (mobile URL bars), so the card's
	   bottom border always stays on screen with breathing room. */
	max-height: calc(100vh - 170px);
	max-height: calc(100dvh - 170px);
}

/* The blur sheet. Lives inside the wrap's stacking context, beneath its
   content, covering the viewport. Clicking it closes the panel. */
.mp-aod-dir-backdrop {
	position: fixed;
	inset: 0;
	z-index: 9990; /* just beneath the card; outside the transformed wrap so
	                  backdrop-filter can actually blur the page */
	background: rgba(252, 248, 245, .45); /* soft veil — the blur does the work */
	-webkit-backdrop-filter: blur(4px);
	        backdrop-filter: blur(4px);
	animation: mp-aod-fade .2s ease-out;
}

@keyframes mp-aod-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@media (max-width: 600px) {
	.mp-aod-dir-searchwrap.is-open {
		top: 12px;
		width: calc(100vw - 32px);
		padding: 8px;
		border-radius: 20px;
	}

	.mp-aod-dir-searchwrap.is-open .mp-aod-dir-results {
		max-height: calc(100vh - 140px);
		max-height: calc(100dvh - 140px);
		padding: 12px 10px 8px;
	}
}

/*
 * 16px of side breathing room for every section on phones — except the
 * question stream (deliberately full-bleed) and the open search popup
 * (it manages its own card padding). Lives at the end of the file on
 * purpose: several section bases (trust, section heads, Fresh) are defined
 * below the main media block, and an earlier rule would lose to them.
 */
@media (max-width: 600px) {
	.mp-aod-dir-searchwrap:not(.is-open),
	.mp-aod-dir-popular,
	.mp-aod-dir-trust,
	.mp-aod-dir-sechead,
	.mp-aod-dir-grid,
	.mp-aod-dir-recent {
		padding-left: 16px;
		padding-right: 16px;
	}
}

/* Mobile: the Fresh question matches the consultation card question. */
@media (max-width: 600px) {
	.mp-aod-dir-rq {
		font-size: 1rem;
	}
}

/* Topic cards beyond the first six hide behind "View more topics". */
.mp-aod-dir-card.mp-aod-dir-more {
	display: none;
}
