/*
 Theme Name: Santagostino LocalSites – Dyadea
 Theme URI: https://www.centrimedicidyadea.it/
 Description: Minimal child theme for Dyadea sites in the Santagostino Local Sites network. Includes Dyadea header logo and utilities; structural overrides when needed.
 Author: FpS
 Author URI: https://www.fps.agency/
 Template: santagostino-localsites
 Version: 0.1.0
 Tested up to: 6.2
 Requires PHP: 7.4
 License: This theme is unpublished internal software, not meant to be licensed
 License URI: N/A
 Text Domain: santagostino-localsites-child-dyadea
 Tags:
*/

/* Visually hidden utility for nav/skip headings (see M5.3a spec).
   Keep content in DOM and for screen readers, hide visually. */
.visually-hidden {
	position: absolute !important;
	clip: rect(1px, 1px, 1px, 1px);
	overflow: hidden;
	height: 1px;
	width: 1px;
	word-wrap: normal;
}

/**
 * Dyadea `content-excerpt` cards: extra top padding on the title when there is no featured image **and**
 * encyclopedia taxonomy pills are present (see `content-excerpt.php`). Parent Tailwind does not emit this `pt-*`;
 * use `--spacing`.
 */
.dyadea-content-excerpt__header--no-thumb {
	padding-top: calc(var(--spacing) * 10);
}

/**
 * Related posts (single template): excerpt text matches archive cards. Parent `components.css` applies
 * `.single .entry-content a { text-primary }`, which would color excerpt links like main article links.
 */
.single .related-posts article > a {
	color: inherit;
}

.single .related-posts .entry-content a {
	color: inherit;
}

/**
 * @section Dyadea header logo
 * @description Downward shift for the logo link. Matches parent header breakpoints (`portrait` / `orientation: landscape`),
 *              same idea as Tailwind `landscape:` in `header-content.php`. On desktop scroll, parent adds `body.header-scrolled`
 *              (see parent `script.js`); tighten logo offset and add bottom margin in that state only.
 */
#masthead .dyadea-header-logo-link {
	margin-top: 0.75dvh;
}

@media (orientation: landscape) {
	#masthead .dyadea-header-logo-link {
		margin-top: 1rem;
		margin-bottom: 0;
	}

	.header-scrolled #masthead .dyadea-header-logo-link {
		margin-top: 0.75dvh;
		margin-bottom: 1rem;
	}
}

/* Dyadea-specific: make specialities inline list without bullets/checked icons. */
.list-specialita.is-style-inline-centered-checked-list {
	display: flex;
	justify-content: space-evenly;
	flex-wrap: wrap;
	list-style: none;
	padding-left: 0;
	margin-left: 0;
}

.list-specialita.is-style-inline-centered-checked-list li {
	list-style: none;
}

.list-specialita.is-style-inline-centered-checked-list li::marker {
	content: '' !important;
}

/* Parent theme injects a checked icon via ::before; disable it for Dyadea. */
.list-specialita.is-style-inline-centered-checked-list li::before {
	content: '' !important;
	display: none !important;
	background: none !important;
	background-image: none !important;
}

/* Dyadea maps-home parity refinements (M5 UI parity). */
.dyadea-maps-home .dyadea-two-column-band.wp-block-columns > .wp-block-column:first-child {
	align-self: stretch;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.dyadea-maps-home .dyadea-two-column-band.wp-block-columns > .wp-block-column:first-child > .wp-block-group.mapshome__container-left {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.dyadea-maps-home .mapshome__container-left {
	height: 100%;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

/* core/html wraps the map markup; stretch it so #map can fill the column beside the venue list */
.dyadea-maps-home .mapshome__container-left > .wp-block-html {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.dyadea-maps-home ul.venues-map__venues {
	list-style: none;
	margin-bottom: 0;
	margin-left: 0;
	margin-right: 0;
	padding: 0;
}

.dyadea-maps-home ul.venues-map__venues li.card--venue {
	display: flex;
}

.dyadea-maps-home ul.venues-map__venues li.card--venue + li.card--venue {
	margin-top: 1.5rem;
}

.dyadea-maps-home ul.venues-map__venues li.card--venue::marker {
	content: '' !important;
}

.dyadea-maps-home .venue__img {
	max-width: 25%;
	aspect-ratio: 1;
	object-fit: cover;
}

.dyadea-maps-home .venue__info {
	padding: 1rem;
}

.dyadea-maps-home .venue__address,
.dyadea-maps-home .venue__phone {
	display: block;
}

.dyadea-maps-home .venue__phone {
	font-weight: 700;
}

.dyadea-maps-home .places__button-container {
	align-self: center;
	margin-left: auto;
}

/**
 * @section My Maps embed — clip top chrome
 * @description Google My Maps `/maps/d/embed` draws a fixed header inside the iframe (title, account, “Crea la tua mappa”).
 *              Cross-origin rules prevent hiding it via parent JS/CSS inside the frame. We clip it by shifting the iframe up and
 *              using `overflow: hidden` on `.map__container`. `--dyadea-mymaps-chrome-y` is slightly oversized for subpixel remnants.
 *
 *              **maps-places (Sedi):** fixed 360px-tall viewport; iframe height = view + chrome (avoids collapse when the only
 *              child is absolutely positioned).
 *
 *              **maps-home:** `#map` fills the left column height (venue list sets row height). Flex chain: column →
 *              `.mapshome__container-left` → `.wp-block-html` → `.map__container` → iframe `height: calc(100% + chrome)`.
 */
.dyadea-maps-places .map__container {
	--dyadea-mymaps-chrome-y: 62px;
	--dyadea-mymaps-view-h: 360px;
	overflow: hidden !important;
	position: relative;
	height: var(--dyadea-mymaps-view-h) !important;
	min-height: var(--dyadea-mymaps-view-h) !important;
	max-height: var(--dyadea-mymaps-view-h) !important;
}

.dyadea-maps-home .map__container {
	--dyadea-mymaps-chrome-y: 62px;
	overflow: hidden !important;
	position: relative;
	flex: 1 1 auto;
	min-height: 360px;
	height: 100%;
	max-height: none;
}

.dyadea-maps-home .map__container iframe,
.dyadea-maps-places .map__container iframe {
	position: absolute !important;
	left: 0 !important;
	width: 100% !important;
	top: calc(-1 * var(--dyadea-mymaps-chrome-y)) !important;
	border: 0 !important;
}

.dyadea-maps-places .map__container iframe {
	height: calc(var(--dyadea-mymaps-view-h) + var(--dyadea-mymaps-chrome-y)) !important;
	min-height: calc(var(--dyadea-mymaps-view-h) + var(--dyadea-mymaps-chrome-y)) !important;
}

.dyadea-maps-home .map__container iframe {
	height: calc(100% + var(--dyadea-mymaps-chrome-y)) !important;
	min-height: calc(360px + var(--dyadea-mymaps-chrome-y)) !important;
}

/* Magazine (legacy /it/magazine/*) intro parity: tag + title + intro text spacing. */
.dyadea-magazine-header {
	margin-bottom: 1.5rem;
}

.dyadea-magazine-header .tag.tag--default {
	display: inline-block;
	margin-bottom: 0.75rem;
}

.dyadea-magazine-header .entry-title {
	margin-bottom: 0.75rem;
}

.dyadea-magazine-header .page-intro__text {
	margin-bottom: 0;
}

/* Title spacing: move vertical rhythm to the header container, not the H1 itself. */
.page-title,
h1.entry-title {
	padding-top: 0 !important;
}

/*
 * Entry / page header top padding (moved off h1.entry-title / archive titles; see reset above).
 *
 * Previous `body.singular #main article …` selectors failed when markup differed (wrappers, `#main` usage).
 * Restore a global `header.entry-header` rule, then reset list/card templates: their `<article>` uses
 * `border-gray-300` (parent + child excerpt + search). Singular pages/specialties do not, so they keep ×6.
 * Archive/search `header.page-header` uses the same top rhythm as singular entry headers.
 * `var(--spacing, 0.25rem)` matches default Tailwind scale if the token is missing in cascade.
 */
header.entry-header,
header.page-header {
	padding-top: calc(var(--spacing, 0.25rem) * 6);
}

article.border-gray-300 header.entry-header {
	padding-top: calc(var(--spacing, 0.25rem) * 4);
}

article.border-gray-300 header.entry-header.dyadea-content-excerpt__header--no-thumb {
	padding-top: calc(var(--spacing, 0.25rem) * 10);
}

/* Sedi maps-places: same venue list treatment as maps-home (M5 Cluster B parity). */
.dyadea-maps-places ul.venues-map__venues {
	list-style: none;
	margin-bottom: 0;
	margin-left: 0;
	margin-right: 0;
	padding: 0;
}

.dyadea-maps-places ul.venues-map__venues li.card--venue {
	display: flex;
}

.dyadea-maps-places ul.venues-map__venues li.card--venue + li.card--venue {
	margin-top: 1.5rem;
}

.dyadea-maps-places ul.venues-map__venues li.card--venue::marker {
	content: '' !important;
}

.dyadea-maps-places .venue__img {
	max-width: 25%;
	aspect-ratio: 1;
	object-fit: cover;
}

.dyadea-maps-places .venue__info {
	padding: 1rem;
}

.dyadea-maps-places .venue__address,
.dyadea-maps-places .venue__phone {
	display: block;
}

.dyadea-maps-places .venue__phone {
	font-weight: 700;
}

.dyadea-maps-places .places__button-container {
	align-self: center;
	margin-left: auto;
}

/* Chi siamo stats card (core/list + card__list className): grid parity with legacy “card” row. */
.entry-content ul.wp-block-list.card__list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 1rem 1.5rem;
	list-style: none;
	padding-left: 0;
	margin-left: 0;
	margin-block-start: 48px;
	margin-block-end: 48px;
}

.entry-content ul.wp-block-list.card__list .list-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.25rem;
}

.entry-content ul.wp-block-list.card__list .list-value {
	font-weight: 700;
	font-size: 1.5rem;
	line-height: 1.2;
}

/**
 * @section Dyadea two-column content bands
 * @description Vertical rhythm between stacked `core/group` + `core/columns` sections (migrator class `dyadea-two-column-band`).
 */
.entry-content .wp-block-columns.dyadea-two-column-band {
	margin-block-start: 48px;
}

.entry-content blockquote.wp-block-quote.dyadea-pill {
	display: inline-block;
	padding: 0.35rem 0.75rem;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--primary-light, #d7e9ea);
	color: var(--wp--preset--color--foreground, #404040);
}

.entry-content blockquote.wp-block-quote.dyadea-pill p {
	margin: 0;
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1.25rem;
}

/**
 * @section Dyadea Magazine archive
 * @description Make hover background cover the whole card, not individual elements.
 */
.blog .entry-content {
	/* Ensure the excerpt area doesn't override the card hover background */
	background: transparent;
}

.blog article.post:hover {
	background: var(--wp--preset--color--primary-light, #e2eff8);
	transition: background-color 150ms ease-in-out;
}

.blog article.post > a.group {
	display: block;
	height: 100%;
}

.blog article.post > a.group:hover {
	background: transparent !important; /* handled by article:hover */
}

/**
 * Section heading scale (Dyadea): parent `.entry-content h3` uses `text-medium` + `text-primary`
 * (see `santagostino-localsites-theme/tailwind/custom/components/components.css`). Imported blocks
 * use h3 for section titles; match `.entry-content h2` size/weight/leading. Exclude nested venue
 * titles in maps lists (`h3.venue__name`).
 */
.entry-content h3:not(.venue__name) {
	font-size: var(--text-large);
	--tw-leading: var(--leading-tight);
	line-height: var(--leading-tight);
	--tw-font-weight: var(--font-weight-bold);
	font-weight: var(--font-weight-bold);
	color: var(--wp--preset--color--foreground, #404040);
}

/* Chi siamo / Polo: legacy pill “tags” read as slogans, not default body copy. */
.entry-content .tag.tag--rounded {
	display: inline-block;
	margin: 1rem 0;
	padding: 0.5rem 1rem;
	border-left: 4px solid var(--wp--preset--color--primary, #0579ab);
	font-style: italic;
	font-size: 1.125rem;
	line-height: 1.4;
	color: var(--wp--preset--color--primary, #0579ab);
	background: var(--wp--preset--color--primary-light, #e2eff8);
	border-radius: 0.25rem;
}

/**
 * Pages: `post_tag` terms as pills (before H1 in `.entry-header`, child `content-page.php`).
 */
.entry-header .dyadea-page-tags--pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.entry-header .dyadea-page-tag-pill,
.entry-content .dyadea-page-tag-pill,
.wp-block-post-content .dyadea-page-tag-pill {
	display: inline-flex;
	align-items: center;
	border-radius: 999px;
	background: var(--wp--preset--color--primary, #0579ab);
	color: #fff;
	padding: 0.25rem 0.75rem;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.25rem;
}

/**
 * Polo hub: “Prenota online” two-column block — same column rhythm as home maps block, constrained width (not alignfull).
 */
.entry-content .dyadea-prenota-section--paged {
	max-width: 56rem;
	margin-left: auto;
	margin-right: auto;
	padding-left: 1rem;
	padding-right: 1rem;
}

.entry-content .dyadea-prenota-section--paged .wp-block-columns {
	gap: 1.5rem 2rem;
	align-items: stretch;
}

@media (min-width: 782px) {
	.entry-content .dyadea-prenota-section--paged .wp-block-columns {
		flex-wrap: nowrap;
	}
}

.entry-content .dyadea-prenota-section--paged .wp-block-column {
	min-width: 0;
}

/**
 * @section Specialty hub macro-area leaf grid (static HTML from migrator)
 * @description Mirrors `archive-specialty.php` + `content-excerpt-specialty.php` inside page `entry-content`.
 *              Parent `.entry-content h2` uses theme `text-large`; archive cards use `text-base`. Tailwind
 *              utilities inside `core/html` may be absent from the compiled bundle — rules below are explicit.
 */
.entry-content > .wp-block-html:has(.dyadea-specialty-hub-leaf-grid) {
	max-width: none;
	width: 100%;
}

.entry-content .dyadea-specialty-hub-leaf-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
	width: 100%;
	max-width: 56rem;
	margin-left: auto;
	margin-right: auto;
	padding-block: 1.5rem;
	padding-inline: 0;
	list-style: none;
	margin-block: 0;
}

@media (min-width: 768px) {
	.entry-content .dyadea-specialty-hub-leaf-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.entry-content .dyadea-specialty-hub-leaf-card {
	margin: 0;
	padding: 0;
	border: 1px solid #d1d5db;
	border-radius: 0.125rem;
	background: var(--wp--preset--color--background, #fff);
}

.entry-content .dyadea-specialty-hub-leaf-card > a {
	display: block;
	text-decoration: none;
	color: inherit;
}

.entry-content .dyadea-specialty-hub-leaf-card > a > .flex.flex-row {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.5rem;
	transition: background-color 150ms ease;
}

.entry-content .dyadea-specialty-hub-leaf-card > a:is(:hover, :focus-visible) > .flex.flex-row {
	background-color: var(--wp--preset--color--primary-light, #d7e9ea);
}

.entry-content .dyadea-specialty-hub-leaf-card .entry-header {
	margin: 0;
	padding: 0;
	min-width: 0;
}

/* Match archive `h2.entry-title text-base font-bold group-hover:text-primary` (not `.entry-content h2` / prose scale). */
.entry-content .dyadea-specialty-hub-leaf-grid h2.entry-title {
	margin: 0;
	padding: 0;
	font-size: 1rem;
	line-height: 1.25rem;
	font-weight: 700;
	color: var(--wp--preset--color--foreground, #404040);
	--tw-leading: 1.25rem;
}

.entry-content .dyadea-specialty-hub-leaf-card > a:is(:hover, :focus-visible) h2.entry-title {
	color: var(--wp--preset--color--primary, #0579ab);
}

.entry-content .dyadea-specialty-hub-leaf-card .flex.items-center.gap-2 .text-xs {
	font-size: 0.75rem;
	line-height: 1rem;
	color: var(--wp--preset--color--foreground, #404040);
}

.entry-content .dyadea-specialty-hub-leaf-card .flex.items-center.gap-2 svg {
	display: block;
	width: 1rem;
	height: 1rem;
	flex-shrink: 0;
}

.entry-content .dyadea-specialty-hub-leaf-card figure {
	margin: 0;
	flex-shrink: 0;
}

.entry-content .dyadea-specialty-hub-leaf-card .wp-post-image {
	width: 5rem;
	height: 5rem;
	object-fit: cover;
	border-radius: 0.125rem;
	display: block;
}
