/*!
 * Helio child theme — dark palette, theme toggle, header tools.
 *
 * How it works: TT4/WP emit every palette color as a live CSS custom
 * property (var(--wp--preset--color--…)) on :root, and body/blocks
 * reference those variables. Overriding the variables under
 * html[data-theme="dark"] therefore re-skins the entire site without
 * touching a single block style.
 *
 * base-2 (#ffffff) is deliberately NOT overridden: in this design it is
 * the text/link color on the dark-red header & footer bands, and it must
 * stay white there in both modes.
 */

/* ------------------------------------------------------------------ *
 * Dark palette
 * ------------------------------------------------------------------ */
html[data-theme="dark"] {
	color-scheme: dark;
	--wp--preset--color--base: #14141a;        /* was #f9f9f9 — page background   */
	--wp--preset--color--contrast: #eceef2;    /* was #111111 — primary text      */
	--wp--preset--color--contrast-2: #aab0ba;  /* was #636363 — secondary text    */
	--wp--preset--color--contrast-3: #4e525c;  /* was #a4a4a4 — rules / separators */
	--wp--preset--color--accent: #b9b2a4;      /* was #cfcabe                      */
	--wp--preset--color--accent-2: #aa9682;    /* was #c2a990                      */
	--wp--preset--color--accent-3: #e0764f;    /* was #d8613c                      */
	--wp--preset--color--accent-4: #9cb08f;    /* was #b1c5a4                      */
	--wp--preset--color--accent-5: #a3b5b4;    /* was #b5bdbc                      */
}

/* Smooth color switch (no-op on first paint — values don't change). */
body,
.wp-block-group,
.wp-block-column,
.wp-block-navigation,
.wp-block-search__inside-wrapper,
.wp-block-post-terms,
.wp-block-separator {
	transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

/* ------------------------------------------------------------------ *
 * The dark-red brand bands (#7c0c0c, inline-styled) go deeper in dark
 * ------------------------------------------------------------------ */
html[data-theme="dark"] .wp-block-group[style*="7c0c0c"] {
	background-color: #3f080b !important;
}

/* Third-party sidebar widgets keep their own light background (as on the
 * old site) — we only frame them so they look intentional on dark. */
html[data-theme="dark"] .wp-dark-mode-ignore,
html[data-theme="dark"] .sidebar-weather-frame {
	border-radius: 8px;
}

/* ------------------------------------------------------------------ *
 * Header tools group (GTranslate flags + theme toggle)
 * ------------------------------------------------------------------ */
.helio-header-tools {
	gap: 0.6rem;
}

/* GTranslate switcher: keep flags tight and vertically centered in the band */
header .gtranslate_wrapper {
	display: inline-flex !important;
	align-items: center;
	line-height: 1;
}
header .gtranslate_wrapper img,
header .gtranslate_wrapper svg {
	display: block;
}

/* ------------------------------------------------------------------ *
 * Theme toggle button
 * ------------------------------------------------------------------ */
.helio-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 2.1rem;
	height: 2.1rem;
	padding: 0;
	margin: 0 0 0 0.4rem;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	line-height: 1;
}
.helio-theme-toggle:hover,
.helio-theme-toggle:focus-visible {
	background: rgba(255, 255, 255, 0.16);
	border-color: rgba(255, 255, 255, 0.85);
}
.helio-theme-toggle:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}
.helio-theme-toggle svg {
	display: block;
	width: 1.1rem;
	height: 1.1rem;
	fill: currentColor;
}

/* moon = “switch to dark” (shown in light mode); sun = back to light */
.helio-theme-toggle .helio-icon-sun { display: none; }
html[data-theme="dark"] .helio-theme-toggle .helio-icon-sun { display: block; }
html[data-theme="dark"] .helio-theme-toggle .helio-icon-moon { display: none; }

/* ------------------------------------------------------------------ *
 * Small dark-mode polish
 * ------------------------------------------------------------------ */
/* Post featured images sometimes carry white edges; soften them slightly. */
html[data-theme="dark"] .wp-block-post-featured-image img {
	border-radius: 6px;
}

/* Native form controls (search input, etc.) follow the color scheme via
 * `color-scheme: dark`; make the search block match the palette. */
html[data-theme="dark"] .wp-block-search__inside-wrapper {
	border-color: var(--wp--preset--color--contrast-3);
}

/* Respect users who prefer no motion — kill the color transition. */
@media (prefers-reduced-motion: reduce) {
	body,
	.wp-block-group,
	.wp-block-column,
	.wp-block-navigation,
	.wp-block-search__inside-wrapper,
	.wp-block-post-terms,
	.wp-block-separator {
		transition: none;
	}
}
