/* SPDX-License-Identifier: GPL-2.0-or-later */

:root {
	--de-bg: #f7f3e9;
	--de-surface: #ece9da;
	--de-field: #fffcf4;
	--de-text: #222d27;
	--de-muted: #4c5a50;
	--de-link: #305945;
	--de-visited: #70482e;
	--de-accent: #8c492d;
	--de-rule: #9b9c83;
	--de-focus: #943f25;
	--de-on-link: #fffaf0;
	--de-serif: Georgia, "Liberation Serif", serif;
	--de-sans: system-ui, sans-serif;
	--de-measure: 44rem;
	--de-chrome: 48rem;
	--de-gutter: clamp(1.125rem, 5vw, 2rem);
	color-scheme: light;
}

:root[data-appo-theme="dark"],
body[data-appo-theme="dark"] {
	--de-bg: #18221e;
	--de-surface: #26362e;
	--de-field: #202d26;
	--de-text: #f4eddb;
	--de-muted: #c5cabb;
	--de-link: #c8dfac;
	--de-visited: #e2ba98;
	--de-accent: #edb18c;
	--de-rule: #758778;
	--de-focus: #ffd3a2;
	--de-on-link: #18221e;
	color-scheme: dark;
}

/* The parent and APPO Theme Switch use these tokens in their shared controls. */
:root,
:root[data-appo-theme] {
	--appo-bg: var(--de-bg);
	--appo-surface: var(--de-surface);
	--appo-ink: var(--de-text);
	--appo-muted: var(--de-muted);
	--appo-soft: var(--de-muted);
	--appo-accent: var(--de-accent);
	--appo-accent-bg: var(--de-surface);
	--appo-border: var(--de-rule);
	--appo-focus: var(--de-focus);
	--appo-outline: var(--de-focus);
	--appo-link: var(--de-link);
	--appo-link-hover: var(--de-accent);
	--appo-hover: var(--de-surface);
	--appo-field: var(--de-field);
	--appo-field-text: var(--de-text);
	--appo-placeholder: var(--de-muted);
	--appo-button: var(--de-link);
	--appo-button-text: var(--de-on-link);
	--appo-radius: .2rem;
	--appo-width: var(--de-measure);
	--appo-maxwidth: var(--de-measure);
	--appo-wide: var(--de-chrome);
	--appo-font: var(--de-serif);
}

body.wp-theme-digireale-editoriale,
body.wp-child-theme-digireale-editoriale {
	background: var(--de-bg);
	color: var(--de-text);
	font-family: var(--de-serif);
	font-size: clamp(1.0625rem, 1rem + .28vw, 1.1875rem);
	line-height: 1.7;
}

body.wp-child-theme-digireale-editoriale .site-header,
body.wp-child-theme-digireale-editoriale .site-footer {
	background: var(--de-bg);
	color: var(--de-text);
	box-shadow: none;
	border: 0;
	position: static;
}

body.wp-child-theme-digireale-editoriale .site-header .appo-container.header-inner,
body.wp-child-theme-digireale-editoriale .site-footer .appo-container.footer-inner {
	width: min(calc(100% - 2 * var(--de-gutter)), var(--de-chrome));
	max-width: none;
	margin-inline: auto;
}

.site-header .appo-container.header-inner {
	display: grid;
	gap: .55rem;
	align-items: start;
	justify-content: stretch;
	padding: 1.3rem 0 .85rem;
	border-top: .25rem solid var(--de-accent);
	border-bottom: 1px solid var(--de-rule);
}

.site-header .site-branding {
	display: flex;
	align-items: center;
	gap: .6rem;
}

.site-header .custom-logo {
	width: 2rem;
	height: 2rem;
	object-fit: contain;
}

.site-header .site-branding a,
.site-header .site-title a {
	color: var(--de-text);
	text-decoration: none;
}
.site-header .site-title,
.site-header .site-title a {
	font-family: var(--de-serif);
	font-size: clamp(1.55rem, 3vw, 2rem);
	font-weight: 700;
	letter-spacing: -.035em;
	line-height: 1.1;
}

.site-header .primary-navigation,
.site-header .appo-navigation-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-start;
	gap: .45rem .85rem;
	width: 100%;
	margin: 0;
}

.site-header .primary-navigation ul {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .15rem .95rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header .primary-navigation a,
.site-header .appo-header-search,
.site-footer .footer-inner {
	font: 500 .875rem/1.55 var(--de-sans);
}

.site-header .primary-navigation a {
	color: var(--de-link);
	text-underline-offset: .18em;
}
.site-header .primary-navigation a:hover,
.site-header .primary-navigation [aria-current="page"] {
	text-decoration: underline;
	text-decoration-color: var(--de-accent);
	text-decoration-thickness: .12em;
}

.site-header .appo-header-search {
	display: flex;
	flex: 0 1 13rem;
	max-width: 100%;
	margin: 0 0 0 auto;
}
.site-header .appo-header-search input {
	width: min(100%, 10rem);
	min-width: 0;
	flex: 1 1 auto;
}
.site-header .appo-header-search button {
	flex: 0 0 auto;
}
.site-header [role="switch"] {
	outline-offset: .2rem;
}

body.wp-child-theme-digireale-editoriale #appo-main,
body.wp-child-theme-digireale-editoriale .appo-layout,
body.wp-child-theme-digireale-editoriale .appo-hero,
body.wp-child-theme-digireale-editoriale .appo-newsletter {
	width: min(calc(100% - 2 * var(--de-gutter)), var(--de-measure));
	max-width: none;
	margin-inline: auto;
}

body.wp-child-theme-digireale-editoriale #appo-main {
	padding: clamp(1.9rem, 5vw, 3.4rem) 0 3rem;
}
body.wp-child-theme-digireale-editoriale .appo-layout #appo-main {
	width: 100%;
}
body.wp-child-theme-digireale-editoriale.home #appo-main {
	padding-top: .5rem;
}

body.wp-child-theme-digireale-editoriale :is(.appo-hero, .site-hero) {
	background: var(--de-bg);
	color: var(--de-text);
	border: 0;
	box-shadow: none;
	padding-block: clamp(2rem, 6vw, 3.75rem) 1.65rem;
	text-align: start;
}

body.wp-child-theme-digireale-editoriale :is(.appo-hero, .site-hero) :is(h1, h2, p) {
	color: var(--de-text);
	text-align: start;
}

body.wp-child-theme-digireale-editoriale :is(.appo-hero, .site-hero) :is(.appo-kicker, .appo-eyebrow, .hero-kicker, .appo-hero-kicker) {
	display: none;
}

body.wp-child-theme-digireale-editoriale :is(.appo-hero, .site-hero) h1,
body.wp-child-theme-digireale-editoriale #appo-main :is(h1, .entry-title) {
	font-family: var(--de-serif);
	font-weight: 700;
	letter-spacing: -.055em;
	font-size: clamp(2.25rem, 1.45rem + 3vw, 4rem);
	line-height: 1.06;
	color: var(--de-text);
	text-wrap: balance;
}

body.wp-child-theme-digireale-editoriale #appo-main :is(h2, h3),
body.wp-child-theme-digireale-editoriale .appo-newsletter :is(h2, h3) {
	font-family: var(--de-serif);
	line-height: 1.2;
	letter-spacing: -.025em;
	color: var(--de-text);
}
body.wp-child-theme-digireale-editoriale #appo-main h2 {
	font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem);
}

body.wp-child-theme-digireale-editoriale #appo-main a:not([class*="button"]),
body.wp-child-theme-digireale-editoriale .appo-newsletter a,
body.wp-child-theme-digireale-editoriale .site-footer a {
	color: var(--de-link);
	text-underline-offset: .17em;
	text-decoration-thickness: .075em;
	overflow-wrap: anywhere;
}

body.wp-child-theme-digireale-editoriale #appo-main :is(.entry-content, .appo-map-standalone) a:not([class*="button"]):visited {
	color: var(--de-visited);
}

body.wp-child-theme-digireale-editoriale #appo-main :is(.entry-content, .appo-composer, .appo-featured, .entry-header),
body.wp-child-theme-digireale-editoriale .appo-newsletter {
	color: var(--de-text);
}

body.wp-child-theme-digireale-editoriale #appo-main :is(.appo-composer, .appo-featured),
body.wp-child-theme-digireale-editoriale .appo-newsletter {
	background: transparent !important;
	border: 0;
	border-top: 1px solid var(--de-rule);
	border-radius: 0;
	box-shadow: none;
	padding: 1.3rem 0 0;
	margin-block: 0 2.3rem;
}
body.wp-child-theme-digireale-editoriale .appo-newsletter {
	margin-inline: auto;
}

body.wp-child-theme-digireale-editoriale #appo-main .appo-featured-item {
	margin: 0;
	padding: .9rem 0 1rem;
	border: 0;
	border-bottom: 1px solid var(--de-rule);
	border-radius: 0;
	background: transparent;
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-featured-item h3 {
	margin: 0;
	font-size: 1.3rem;
}
body.wp-child-theme-digireale-editoriale #appo-main :is(.appo-featured-meta, .entry-meta, .appo-featured-excerpt),
body.wp-child-theme-digireale-editoriale .site-footer {
	color: var(--de-muted);
}

body.wp-child-theme-digireale-editoriale :is(.appo-composer, .appo-header-search, .appo-newsletter, #comments) :is(input:not([type="submit"]):not([type="hidden"]):not([type="checkbox"]), textarea, select) {
	background: var(--de-field);
	color: var(--de-text);
	border: 1px solid var(--de-rule);
	border-radius: .2rem;
}
body.wp-child-theme-digireale-editoriale :is(.appo-composer, .appo-header-search, .appo-newsletter, #comments) :is(input, textarea)::placeholder {
	color: var(--de-muted);
	opacity: 1;
}
body.wp-child-theme-digireale-editoriale :is(.appo-composer, .appo-header-search, .appo-newsletter, #comments) :is(button[type="submit"], input[type="submit"]) {
	background: var(--de-link);
	color: var(--de-on-link);
	border: 1px solid var(--de-link);
	border-radius: .2rem;
	font-family: var(--de-sans);
}

body.wp-child-theme-digireale-editoriale :is(.site-header, #appo-main, .site-footer, .appo-newsletter) :focus-visible {
	outline: 2px solid var(--de-focus);
	outline-offset: 3px;
}

.site-footer .appo-container.footer-inner {
	padding-block: 1rem 2rem;
	border-top: 1px solid var(--de-rule);
}

/* The map plugin sets its own pale surfaces. Give every visible level a
   matching foreground and background independent of the global body color. */
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone {
	color: var(--de-text);
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone .appo-map-page-content {
	background: var(--de-surface) !important;
	color: var(--de-text) !important;
	border: 1px solid var(--de-rule);
	border-radius: .3rem;
	padding: clamp(.5rem, 2vw, .95rem);
	box-shadow: none;
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone :is(details, .appo-section, li),
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone .appo-map-page-content ul {
	background: transparent !important;
	color: var(--de-text) !important;
	border-color: var(--de-rule);
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone summary {
	background: var(--de-field) !important;
	color: var(--de-text) !important;
	border: 1px solid var(--de-rule);
	border-radius: .2rem;
	box-shadow: none;
	overflow-wrap: anywhere;
	padding: .48rem .63rem;
	min-height: 2.75rem;
	cursor: pointer;
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone summary:hover,
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone details[open] > summary {
	border-color: var(--de-link);
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone :is(.appo-item-num, .appo-branch-count),
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone summary::before,
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone summary::marker {
	color: var(--de-muted) !important;
	opacity: 1;
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone .appo-branch-count {
	background: var(--de-surface) !important;
	border-color: var(--de-rule);
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone a {
	color: var(--de-link) !important;
	background: transparent !important;
	text-decoration: underline;
}
body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone a:visited {
	color: var(--de-visited) !important;
}

@media (max-width: 42rem) {
	.site-header .appo-header-search {
		flex: 0 1 100%;
		margin-inline: 0;
	}
	.site-header .appo-header-search input {
		width: auto;
	}
	.site-header .primary-navigation ul {
		row-gap: .45rem;
		column-gap: .7rem;
	}
	body.wp-child-theme-digireale-editoriale #appo-main .appo-map-standalone .appo-map-page-content ul ul {
		padding-inline-start: .75rem;
	}
}
