/*
Theme Name: Erdbau
Theme URI: https://www.erdbau.it/
Description: Tema classico che riproduce il layout di erdbau.it (hero a tutto schermo, sidebar obliqua, sezioni con barra rossa, carosello macchine). Compatibile con Polylang per DE/IT.
Version: 1.0.1
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: erdbau
*/

/* ---------- Font (self-hosted, niente Google Fonts per GDPR) ---------- */
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url("assets/fonts/open-sans-v40-latin-300.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/open-sans-v40-latin-regular.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("assets/fonts/open-sans-v40-latin-italic.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/open-sans-v40-latin-700.woff2") format("woff2"); }

:root {
	--erd-red: #e12614;
	--erd-red-dark: #71130a;
	--erd-black: #000;
	--erd-dark: #2b2e34;
	--erd-gray: #8a8a8a;
	--erd-light-gray: #f2f2f2;
	--erd-border: #cacaca;
	--erd-aside-w: 30rem;
	--erd-container: 75rem;
	--erd-gutter: 1.25rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	overflow-x: clip; /* gli elementi alignfull (100vw) includono la scrollbar */
	background: #fff;
	color: #000;
	font-family: "Open Sans", Helvetica, Arial, sans-serif;
	font-weight: 400;
	font-size: 1rem;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
a:hover { color: var(--erd-red); }
p, li { font-size: 1.125rem; line-height: 1.4; }
h1, h2, h3, h4, h5, h6 { font-family: inherit; font-weight: 700; line-height: 1.2; margin: 0 0 .75rem; word-break: break-word; }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; font-weight: 400; line-height: 1.4; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 1rem; left: 1rem; z-index: 9999; background: #fff; padding: .5rem 1rem; clip: auto; width: auto; height: auto; }

.container { max-width: var(--erd-container); margin: 0 auto; padding: 0 var(--erd-gutter); }
.section { margin: 5rem 0; }
.section--pad { padding: 5rem 0; margin: 0; }
.section--gray { background: var(--erd-light-gray); }

/* ---------- Titoli con barra rossa (firma visiva del sito) ---------- */
.heading-bar,
.is-style-erdbau-heading {
	position: relative;
	padding-top: 2.5rem;
	margin-bottom: 2.5rem;
}
.heading-bar::before,
.is-style-erdbau-heading::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 3.125rem;
	height: .625rem;
	background: var(--erd-red);
}
.heading-large, .is-style-erdbau-heading h1, .is-style-erdbau-heading h2:first-child { font-size: 1.875rem; font-weight: 700; line-height: 1.2; margin-bottom: .5rem; }
.heading-medium, .is-style-erdbau-heading h2:not(:first-child), .is-style-erdbau-heading h3 { font-size: 1.25rem; font-weight: 700; color: var(--erd-gray); text-transform: uppercase; }
@media (min-width: 64em) {
	.heading-large, .is-style-erdbau-heading h1, .is-style-erdbau-heading h2:first-child { font-size: 3rem; }
	.heading-bar, .is-style-erdbau-heading { padding-right: 10%; }
}

.link-more { display: inline-block; font-weight: 700; text-decoration: underline; margin-top: 1rem; }
.button, .wp-block-button__link, button[type="submit"], input[type="submit"] {
	display: inline-block;
	padding: .85em 1.5em;
	border: 0;
	border-radius: 0;
	background: var(--erd-red);
	color: #fff;
	font: inherit;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .25s ease-out;
}
.button:hover, .wp-block-button__link:hover, button[type="submit"]:hover, input[type="submit"]:hover { background: var(--erd-red-dark); color: #fff; }

/* ---------- Sidebar di navigazione (aside) ---------- */
.site-aside {
	position: fixed;
	inset: 0 auto 0 0;
	z-index: 8000;
	width: 100%;
	background: rgba(255, 255, 255, .95);
	transition: all .3s ease;
}
.site-aside.is-closed { opacity: 0; visibility: hidden; transform: translateX(-100%); }
.aside-inner {
	position: absolute;
	inset: 0;
	z-index: 10;
	width: 100%;
	padding: 2.5rem 1.25rem;
	overflow: auto;
	scrollbar-width: none;
}
.aside-inner::-webkit-scrollbar { display: none; }
.admin-bar .site-aside { top: 32px; }
.admin-bar .navigation-toggle { top: calc(2.5rem + 32px); }
@media (max-width: 782px) {
	.admin-bar .site-aside { top: 46px; }
	.admin-bar .navigation-toggle { top: calc(2.5rem + 46px); }
}
.aside-inner .main-link { display: inline-block; margin-bottom: .625rem; text-transform: uppercase; text-decoration: none; }
.site-aside .logo { display: block; width: 75%; margin-bottom: 2.5rem; position: relative; z-index: 1; }
.site-aside .logo img { width: 100%; }
.site-aside .background-dots {
	position: absolute;
	bottom: 10%;
	left: 0;
	width: 18.75rem;
	height: 15.625rem;
	background: url("assets/img/dots-texture-red.svg") center / cover no-repeat;
	pointer-events: none;
}

.main-menu, .main-menu ul { list-style: none; margin: 0; padding: 0; }
.main-menu > li { position: relative; z-index: 1; }
.main-menu > li > a,
.main-menu > li > .submenu-toggle {
	display: block;
	padding: .35rem 0;
	background: none;
	border: 0;
	font: inherit;
	font-size: 1.375rem;
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none;
	text-align: left;
	color: #000;
	cursor: pointer;
}
.main-menu > li > a:hover, .main-menu > li > .submenu-toggle:hover,
.main-menu > li.current-menu-item > a, .main-menu > li.current-menu-ancestor > .submenu-toggle { color: var(--erd-red); }
.main-menu > li.blink > a { animation: erd-blink 1.4s ease-in-out infinite; }
@keyframes erd-blink { 50% { color: var(--erd-red); } }

/* Pannello sottomenu "Leistungen" */
.main-menu > li > .sub-menu { display: none; padding: .5rem 0 1rem 1rem; }
.main-menu > li.expanded > .sub-menu { display: block; }
.main-menu .sub-menu > li > a,
.main-menu .sub-menu > li > span { display: block; font-weight: 700; text-transform: uppercase; text-decoration: none; margin-top: .75rem; }
.main-menu .sub-menu .sub-menu { padding: .25rem 0 0; }
.main-menu .sub-menu .sub-menu a { font-weight: 400; text-transform: none; margin-top: .25rem; }
.main-menu .sub-menu .sub-menu a:hover { color: var(--erd-red); }

.site-aside .languages { display: inline-flex; gap: .75rem; list-style: none; margin: 2.5rem 0 0; padding: 0 3.75rem 0 0; position: relative; text-transform: uppercase; }
.site-aside .languages::after { content: ""; position: absolute; top: .55em; right: 0; width: 3.125rem; height: .625rem; background: #000; }
.site-aside .languages a { text-decoration: none; }
.site-aside .languages .current-lang a { color: var(--erd-red); font-weight: 700; }

.aside-contact { display: flex; gap: 1.25rem; margin-top: 1.5rem; position: relative; z-index: 1; }
.aside-contact a { text-decoration: none; font-weight: 700; }

.navigation-toggle {
	position: fixed;
	top: 2.5rem;
	right: 0;
	z-index: 8001;
	width: 3.125rem;
	height: 6.25rem;
	border: 0;
	background: #000;
	color: #fff;
	cursor: pointer;
	transition: all .3s ease .3s;
}
.navigation-toggle .label {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) rotate(-90deg);
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
}
.navigation-toggle:hover { background: var(--erd-red); }

@media (min-width: 64em) {
	.site-aside { width: 23.75rem; background: transparent; }
	.site-aside::before {
		content: "";
		position: absolute;
		inset: 0 -1.875rem 0 0;
		background: rgba(255, 255, 255, .92);
		transform: skewX(-2deg);
		transform-origin: 100% 0;
	}
	.aside-inner { width: 23.75rem; padding: 3.125rem; }
	.site-aside .logo { width: 100%; }
	.navigation-toggle { right: auto; left: 0; }
	.site-aside.submenu-open { width: 100%; }
	.site-aside.submenu-open::before { background: #fff; }
	.site-aside.submenu-open .main-menu > li.expanded > .sub-menu {
		position: fixed;
		top: 0;
		bottom: 0;
		left: var(--erd-aside-w);
		right: 0;
		padding: 6.25rem 5rem;
		background: rgba(255, 255, 255, .97);
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
		align-content: start;
		gap: 2.5rem;
		overflow: auto;
	}
	.site-aside.submenu-open .sub-menu > li > a,
	.site-aside.submenu-open .sub-menu > li > span { position: relative; padding-top: 1.25rem; margin-top: 0; }
	.site-aside.submenu-open .sub-menu > li > a::before,
	.site-aside.submenu-open .sub-menu > li > span::before { content: ""; position: absolute; top: 0; left: 0; width: 2rem; height: .4rem; background: var(--erd-red); }
}
@media (min-width: 90em) {
	.site-aside { width: var(--erd-aside-w); }
	.site-aside::before { right: 0; transform: skewX(-5deg); }
	.aside-inner { width: var(--erd-aside-w); padding: 6.25rem; }
}

/* ---------- Hero slider ---------- */
.hero { position: relative; height: 20rem; overflow: hidden; background: var(--erd-dark); }
.hero-slide {
	position: absolute;
	inset: 0;
	background: center / cover no-repeat;
	opacity: 0;
	transition: opacity 1.2s ease;
}
.hero-slide.is-active { opacity: 1; }
.hero-badge { position: absolute; right: .9375rem; bottom: .9375rem; z-index: 2; height: 60px; }
.hero-badge img { height: 100%; width: auto; }
.hero-dots { position: absolute; left: 50%; bottom: 1rem; z-index: 2; display: flex; gap: .5rem; transform: translateX(-50%); }
.hero-dots button { width: .75rem; height: .75rem; padding: 0; border: 2px solid #fff; border-radius: 50%; background: transparent; cursor: pointer; }
.hero-dots button.is-active { background: #fff; }
@media (min-width: 40em) {
	.hero { height: 100vh; }
	.hero-badge { width: 240px; height: auto; right: 2.5rem; bottom: 2.5rem; }
	.hero-badge img { width: 100%; height: auto; }
}

/* Header pagine interne */
.page-hero { position: relative; height: 22rem; background: var(--erd-dark) center / cover no-repeat; }
@media (min-width: 64em) { .page-hero { height: 32rem; } }

/* ---------- Blocchi testo (titolo a sinistra, testo a destra) ---------- */
.text-section .grid { display: grid; gap: 1rem; }
@media (min-width: 64em) { .text-section .grid { grid-template-columns: 1fr 1fr; gap: 2.5rem; } }
.text-section .text > :first-child { margin-top: 0; }

/* Sezione Download / Zertifizierungen con righe oblique */
.stripes-section { position: relative; overflow: hidden; text-align: center; }
.stripes-section::before {
	content: "";
	position: absolute;
	left: -10%;
	right: -10%;
	bottom: 0;
	height: 60%;
	background: url("assets/img/stripes.svg") center / cover no-repeat;
}
.stripes-section > * { position: relative; z-index: 1; }
.stripes-section a { text-decoration: none; }

/* ---------- Carosello macchine ---------- */
.machines { position: relative; }
.machines-track {
	display: flex;
	gap: 2.5rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-bottom: 1rem;
}
.machines-track::-webkit-scrollbar { display: none; }
.machine { flex: 0 0 75%; scroll-snap-align: start; text-align: center; text-decoration: none; }
.machine img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; margin-bottom: .75rem; }
.machine .title { font-weight: 700; }
.machine .meta { color: var(--erd-gray); font-size: .875rem; }
@media (min-width: 40em) { .machine { flex-basis: calc(50% - 1.25rem); } }
@media (min-width: 64em) { .machine { flex-basis: calc(25% - 1.875rem); } }
.machines-nav { display: flex; justify-content: center; gap: .5rem; margin-top: 1rem; }
.machines-nav button { width: 2.75rem; height: 2.75rem; border: 0; background: #000; color: #fff; font-size: 1.25rem; cursor: pointer; }
.machines-nav button:hover { background: var(--erd-red); }

/* ---------- Griglie (referenze, news, archivi) ---------- */
.card-grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 40em) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64em) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
.card { text-decoration: none; display: block; }
.card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; margin-bottom: 1rem; transition: opacity .3s; }
.card:hover img { opacity: .85; }
.card h2 { font-size: 1.25rem; }
.card .date { color: var(--erd-gray); font-size: .875rem; }

/* ---------- Contenuti editor ---------- */
.entry-content > * + * { margin-top: 1.25rem; }
.entry-content a { color: var(--erd-red); }
.entry-content .alignwide { max-width: calc(var(--erd-container) + 10rem); margin-left: auto; margin-right: auto; }
.entry-content .alignfull { width: 100vw; position: relative; left: 50%; margin-left: -50vw; }
.has-erd-red-color { color: var(--erd-red); }
.has-erd-red-background-color { background-color: var(--erd-red); }
.has-erd-gray-color { color: var(--erd-gray); }
.has-erd-light-gray-background-color { background-color: var(--erd-light-gray); }

/* Form (Contact Form 7 / WPForms / core) */
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="search"], textarea, select {
	width: 100%;
	padding: .75rem;
	border: 1px solid var(--erd-border);
	border-radius: 0;
	font: inherit;
	background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--erd-red); outline-offset: -1px; border-color: var(--erd-red); }
label { display: block; font-weight: 700; margin-bottom: .25rem; }

/* ---------- Footer ---------- */
.site-footer { background: #fff; padding: 7.5rem 0 2.5rem; font-size: .875rem; }
.site-footer p, .site-footer li { font-size: .875rem; }
.footer-logo { display: block; width: 12rem; margin-bottom: 3rem; }
.footer-grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 40em) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64em) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }
.footer-box { position: relative; padding-top: 1.875rem; }
.footer-box::before { content: ""; position: absolute; top: 0; left: 0; width: 3.125rem; height: .625rem; background: #000; }
.footer-box.primary::before { background: var(--erd-red); }
.footer-box .widget-title { font-size: .875rem; font-weight: 700; text-transform: uppercase; margin-bottom: .5rem; }
.footer-box ul { list-style: none; margin: 0 0 1rem; padding: 0; }
.footer-box a { text-decoration: none; }
.footer-menu { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; list-style: none; margin: 3rem 0 0; padding: 1.5rem 0 0; border-top: 1px solid var(--erd-border); }
.footer-menu a { text-decoration: none; }
.footer-copy { color: var(--erd-gray); margin-top: 1rem; }

/* ---------- Varie ---------- */
.pagination { display: flex; gap: .5rem; justify-content: center; margin-top: 3rem; }
.pagination .page-numbers { padding: .5rem .9rem; border: 1px solid var(--erd-border); text-decoration: none; }
.pagination .current { background: var(--erd-red); border-color: var(--erd-red); color: #fff; }
.wp-caption-text, figcaption { font-size: .875rem; color: var(--erd-gray); }
.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { margin-left: auto; margin-right: auto; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
