/*
Theme Name: Météo Centre
Theme URI: https://www.meteo-centre.fr/
Author: LRob
Author URI: https://www.lrob.fr/
Description: Child theme of Twenty Twenty-Five for the Météo Centre - Val de Loire website.
Template: twentytwentyfive
Requires at least: 6.7
Requires PHP: 8.4
Version: 0.1.0-dev.17
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: meteo-centre
*/

.wp-block-site-logo {
	z-index: 10;
}

/*
 * Header: two blue bars; from 840px the logo is larger and rises over the association bar.
 * Below, the association bar links reach the left edge, so the logo stays in the main bar.
 */
.mc-main-bar .mc-main-bar__logo img {
	width: 72px;
}

@media (min-width: 840px) {
	.mc-main-bar .mc-main-bar__logo {
		position: relative;
		margin-top: -30px;
	}

	.mc-main-bar .mc-main-bar__logo img {
		width: 130px;
	}
}

/*
 * Association bar: a slim utility bar under the main one's weight.
 * Below tablet width it keeps a single line, without the social icons (they are in the footer).
 */
.mc-association-bar .wp-block-navigation,
.mc-association-bar .wp-block-navigation__container {
	row-gap: .25rem;
}

.mc-association-bar .wp-block-navigation-item {
	white-space: nowrap;
}

.mc-association-bar .wp-social-link svg {
	width: 1.125rem;
	height: 1.125rem;
}

@media (max-width: 781px) {
	.mc-association-bar .wp-block-navigation,
	.mc-association-bar .wp-block-navigation__container {
		flex-wrap: nowrap;
		column-gap: .75rem;
	}

	.mc-association-bar .wp-block-navigation__container {
		overflow-x: auto;
		scrollbar-width: none;
	}

	.mc-association-bar .wp-block-navigation-item:has(.wp-block-social-links) {
		display: none;
	}
}

/*
 * Main menu: the menu button up to 1079px. WordPress switches at 600px, but the six
 * sections only fit beside the logo from about 1060px.
 */
@media (max-width: 1079px) {
	/* The menu button stays at the far right, the light / dark toggle before it. */
	.mc-main-bar__end .lrob-dm-toggle {
		order: -1;
	}
}

@media (min-width: 600px) and (max-width: 1079px) {
	.mc-main-bar .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.mc-main-bar .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

@media (max-width: 599px) {
	.mc-association-bar.mc-association-bar {
		padding-top: 4px !important;
		padding-bottom: 4px !important;
	}

	.mc-association-bar .wp-block-navigation.has-small-font-size,
	.mc-association-bar .wp-block-navigation__container.has-small-font-size {
		font-size: .75rem !important;
		column-gap: .5rem;
		justify-content: space-between;
	}

	.mc-association-bar .wp-block-navigation__container {
		width: 100%;
	}
}

@media (max-width: 380px) {
	.mc-association-bar .wp-block-navigation.has-small-font-size,
	.mc-association-bar .wp-block-navigation__container.has-small-font-size {
		font-size: .6875rem !important;
	}
}

/*
 * Main menu: an orange underline (the association's color) marks hover and the current section;
 * drop-down panels with rounded corners, a shadow and highlighted rows.
 */
@media (min-width: 1080px) {
	.mc-main-bar .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
		position: relative;
		padding-top: .5rem;
		padding-bottom: .5rem;
	}

	.mc-main-bar .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content::after {
		content: "";
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		height: 3px;
		border-radius: 3px;
		background: var(--wp--preset--color--custom-orange-logo);
		opacity: .7;
		transform: scaleX(0);
		transition: transform .2s ease;
	}

	.mc-main-bar .wp-block-navigation__container > .wp-block-navigation-item:hover > .wp-block-navigation-item__content::after,
	.mc-main-bar .wp-block-navigation__container > .wp-block-navigation-item:focus-within > .wp-block-navigation-item__content::after {
		transform: scaleX(1);
	}

	.mc-main-bar .wp-block-navigation__container > .current-menu-item > .wp-block-navigation-item__content::after,
	.mc-main-bar .wp-block-navigation__container > .current-menu-ancestor > .wp-block-navigation-item__content::after {
		opacity: 1;
		transform: scaleX(1);
	}

	/* Drop-down panels centered under their section (WordPress aligns them on its right edge). */
	.mc-main-bar .wp-block-navigation .wp-block-navigation__container > .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container {
		right: auto;
		left: 50%;
		transform: translateX(-50%);
	}

	.mc-main-bar .wp-block-navigation .has-child .wp-block-navigation__submenu-container {
		min-width: 15rem;
		padding: .375rem;
		border: 0;
		border-radius: 10px;
		box-shadow: var(--wp--preset--shadow--natural);
	}

	.mc-main-bar .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
		padding: .5rem .75rem;
		border-radius: 6px;
	}

	.mc-main-bar .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
	.mc-main-bar .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content:focus-visible {
		background: color-mix(in srgb, currentColor 14%, transparent);
	}

	.mc-main-bar .wp-block-navigation .has-child .wp-block-navigation__submenu-container .current-menu-item > .wp-block-navigation-item__content {
		background: color-mix(in srgb, currentColor 20%, transparent);
		box-shadow: inset 3px 0 0 var(--wp--preset--color--custom-orange-logo);
	}
}

/* Mobile menu: the current page is underlined in the association's orange. */
.mc-main-bar .wp-block-navigation__responsive-container.is-menu-open .current-menu-item > .wp-block-navigation-item__content {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--custom-orange-logo);
	text-decoration-thickness: 3px;
	text-underline-offset: .35em;
}

/*
 * Buttons on an orange or yellow background chosen in the editor, without a text color of
 * their own: dark text, as light text on these colors stays below 3:1.
 */
.wp-block-button__link:is(.has-accent-1-background-color, .has-accent-3-background-color, .has-custom-jaune-mc-background-color, .has-custom-orange-lien-background-color, .has-custom-orange-alt-background-color, .has-custom-orange-logo-background-color):not(.has-text-color) {
	color: var(--wp--preset--color--custom-texte-orange);
}

/*
 * Block style "Fond clair fixe" (styles/blocks/fond-clair.json): a light card that keeps its
 * colors in every mode, for images with a transparent background and dark text or lines.
 * On an image, the card is the image itself (some images, like SVG maps, have no size of their
 * own and would collapse in a card sized to its content); the caption stays on the page.
 */
.wp-block-image.is-style-fond-clair {
	padding: 0;
	border-radius: 0;
	background-color: transparent;
	color: inherit;
}

.wp-block-image.is-style-fond-clair img {
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--20);
	border-radius: 8px;
	background-color: var(--wp--preset--color--custom-fond-logo);
}

/*
 * Emoji saved as images in older content (<img class="emoji">): the size WordPress gives them
 * when its emoji script runs, which this site does not load.
 */
img.emoji,
img.wp-smiley {
	display: inline !important;
	width: 1em !important;
	height: 1em !important;
	margin: 0 .07em !important;
	padding: 0 !important;
	border: none !important;
	box-shadow: none !important;
	background: none !important;
	vertical-align: -.1em !important;
}

/* Home hero: the seasonal image is set as the cover's background by the seasons plugin. */
.mc-home-hero {
	background-position: center 70%;
	background-repeat: no-repeat;
	background-size: cover;
}

.mc-home-hero__actions {
	margin-top: var(--wp--preset--spacing--40);
}

/* Home tiles: the whole tile is the link. */
.mc-tile {
	position: relative;
	padding: var(--wp--preset--spacing--30);
	border: 1px solid var(--wp--preset--color--accent-6);
	border-radius: 12px;
	transition: box-shadow .2s ease, transform .2s ease;
}

.mc-tile:hover,
.mc-tile:focus-within {
	box-shadow: var(--wp--preset--shadow--natural);
	transform: translateY(-2px);
}

.mc-tile .mc-tile__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
}

/*
 * Text colors written here (not chosen on a block) use the "as text" value of a dark mode
 * plugin when it defines one (--lrob-dm-text--<slug>), the palette color otherwise.
 */
.mc-tile .mc-tile__title a {
	color: var(--lrob-dm-text--custom-bleu-fonc-mc, var(--wp--preset--color--custom-bleu-fonc-mc));
	text-decoration: none;
}

.mc-tile .mc-tile__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

/* The page's text color, slightly softened: clearly readable in both color modes. */
.mc-tile .mc-tile__text {
	margin: .25rem 0 0;
	color: color-mix(in srgb, currentColor 80%, transparent);
}

/* Partners (synced pattern "partenaires"): logos at one height. A carousel can replace the row. */
.mc-partners__logos {
	gap: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
}

.mc-partners__logos .wp-block-image {
	margin: 0;
}

.mc-partners__logos img {
	width: auto !important;
	max-width: 140px;
	height: 56px !important;
	object-fit: contain;
}

@media (max-width: 599px) {
	/* Hero buttons two by two. */
	.mc-home-hero__actions .wp-block-button__link {
		padding-right: 1rem;
		padding-left: 1rem;
	}

	/* Tiles two by two. */
	.mc-tiles.mc-tiles {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.mc-tile {
		padding: var(--wp--preset--spacing--20);
	}

	.mc-tile .mc-tile__title {
		font-size: var(--wp--preset--font-size--medium);
	}

	.mc-partners__logos img {
		max-width: 96px;
		height: 40px !important;
	}
}

/* Footer */
.mc-footer-badge {
	display: inline-block;
	padding: .75rem;
	border-radius: 8px;
}

.mc-footer-badge .wp-block-image {
	margin: 0;
}

.mc-footer-menu .wp-block-navigation__container {
	row-gap: .5rem;
}

.mc-footer-bottom {
	border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent);
}

.mc-footer-bottom p {
	margin: 0;
}

/*
 * Weather risk block (.risques-meteo-block).
 * Moved as is from the site's global styles; belongs to the plugin that renders the block.
 */

/* Light theme: frosted glass */
.risques-meteo-block {
	--fg: #1f2937;
	--muted: #4b5563;
	--border: rgba(255,255,255,.45);
	--shadow: 0 10px 30px rgba(0,0,0,.08);

	/* Risk levels 0 to 5 */
	--risk-0: #9ca3af;
	--risk-1: #eab308;
	--risk-2: #f59e0b;
	--risk-3: #ef4444;
	--risk-4: #8b5cf6;
	--risk-5: #0f172a;

	/* Frosted glass (tint #3284ae at 22%) */
	background: rgba(50,132,174,0.22);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);

	color: var(--fg);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: var(--shadow);
	padding: 14px;
	max-width: 720px;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

/* Compact header: icon on the left, title and date stacked */
.risques-meteo-block .title-box {
	display: grid;
	grid-template-columns: 56px 1fr;
	grid-template-rows: auto auto;
	column-gap: 12px;
	row-gap: 2px;
	align-items: center;
	padding: 4px 2px 10px;
	border-bottom: 1px solid rgba(255,255,255,.35);
	margin-bottom: 6px;
}

.risques-meteo-block .title-box_icon {
	grid-column: 1;
	grid-row: 1 / span 2;
	width: 56px;
	height: 56px;
	border-radius: 14px;
	display: grid;
	place-items: center;
	background: rgba(255,255,255,.35);
}
.risques-meteo-block .title-box_icon img {
	width: 28px;
	height: 28px;
	object-fit: contain;
}

.risques-meteo-block .title-box_primary {
	grid-column: 2;
	grid-row: 1;
	margin: 0;
	font-size: clamp(1.1rem, 1vw + 1rem, 1.5rem);
	line-height: 1.15;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.risques-meteo-block .title-box_secondary {
	grid-column: 2;
	grid-row: 2;
	margin: 0;
	font-weight: 500;
	color: var(--muted);
	font-size: 0.95rem;
}

@media (max-width: 520px) {
	.risques-meteo-block .title-box {
		grid-template-columns: 52px 1fr;
		row-gap: 0;
		padding-bottom: 8px;
	}
	.risques-meteo-block .title-box_icon {
		width: 52px; height: 52px; border-radius: 12px;
	}
	.risques-meteo-block .title-box_secondary { font-size: .9rem; }
}

/* Risk list */
.risques-meteo-block .list ul {
	list-style: none;
	margin: 6px 0 0;
	padding: 0;
}

.risques-meteo-block .list li {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 12px 10px 12px 12px;
	border-bottom: 1px dashed rgba(255,255,255,.35);
	position: relative;
	font-size: 1rem;
}
.risques-meteo-block .list li:last-child { border-bottom: none; }

/* Coloured bar on the left, by level */
.risques-meteo-block .list li::before {
	content: "";
	position: absolute;
	left: 6px;
	top: 6px;
	bottom: 6px;
	width: 5px;
	border-radius: 8px;
	background: var(--risk-0);
	opacity: .95;
}

/* Badge on the right */
.risques-meteo-block .valeur_du_risque {
	justify-self: end;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	padding: 6px 10px;
	min-width: 54px;
	text-align: center;
	border-radius: 999px;
	line-height: 1;
	border: 1px solid rgba(255,255,255,.45);
	background: rgba(255,255,255,.35);
}

/* Colours by level (row and matching badge) */
.risques-meteo-block .list li.valeur_du_risque_0::before { background: var(--risk-0); }
.risques-meteo-block .list li.valeur_du_risque_1::before { background: var(--risk-1); }
.risques-meteo-block .list li.valeur_du_risque_2::before { background: var(--risk-2); }
.risques-meteo-block .list li.valeur_du_risque_3::before { background: var(--risk-3); }
.risques-meteo-block .list li.valeur_du_risque_4::before { background: var(--risk-4); }
.risques-meteo-block .list li.valeur_du_risque_5::before { background: var(--risk-5); }

.risques-meteo-block .list li.valeur_du_risque_0 > .valeur_du_risque { color: var(--fg); border-color: var(--risk-0); }
.risques-meteo-block .list li.valeur_du_risque_1 > .valeur_du_risque { color: #3b2f00; border-color: var(--risk-1); background: color-mix(in oklab, var(--risk-1) 20%, white 80%); }
.risques-meteo-block .list li.valeur_du_risque_2 > .valeur_du_risque { color: #3a1f00; border-color: var(--risk-2); background: color-mix(in oklab, var(--risk-2) 20%, white 80%); }
.risques-meteo-block .list li.valeur_du_risque_3 > .valeur_du_risque { color: #4a0e0e; border-color: var(--risk-3); background: color-mix(in oklab, var(--risk-3) 18%, white 82%); }
.risques-meteo-block .list li.valeur_du_risque_4 > .valeur_du_risque { color: #2c0f4d; border-color: var(--risk-4); background: color-mix(in oklab, var(--risk-4) 18%, white 82%); }
.risques-meteo-block .list li.valeur_du_risque_5 > .valeur_du_risque { color: #ffffff; border-color: var(--risk-5); background: var(--risk-5); }

.risques-meteo-block .list li:hover {
	background: rgba(255,255,255,.22);
}

/* Text colour shortcuts */
.risques-meteo-block .list li.risque-color-font-0 { color: var(--risk-0); }
.risques-meteo-block .list li.risque-color-font-1 { color: var(--risk-1); }
.risques-meteo-block .list li.risque-color-font-2 { color: var(--risk-2); }
.risques-meteo-block .list li.risque-color-font-3 { color: var(--risk-3); }
.risques-meteo-block .list li.risque-color-font-4 { color: var(--risk-4); }
.risques-meteo-block .list li.risque-color-font-5 { color: var(--risk-5); }

@media (max-width: 380px) {
	.risques-meteo-block { padding: 12px; border-radius: 14px; }
	.risques-meteo-block .list li { padding: 10px 8px 10px 12px; gap: 8px; }
	.risques-meteo-block .valeur_du_risque { min-width: 48px; padding: 5px 8px; font-size: .95rem; }
}
