/*
 * Responsive Anpassungen der Website
 * Ab 1000px Breite gilt unverändert das Desktop-Layout aus layout.css / navi.css.
 *  - bis 999px: fließendes Layout (Tablet)
 *  - bis 800px: einspaltiges Layout mit aufklappbarer Navigation (Smartphone)
 */

/* Button für die mobile Navigation und Footer-Links, auf dem Desktop ausgeblendet */
#navi_toggle,
#navi_footer{
	display: none;
}

/* Spalten der Startseite (vorher Inline-Styles in index.php) */
.spalte_links{
	float: left;
	width: 300px;
}

.spalte_rechts{
	float: left;
	width: 580px;
}

/* Textblock Anlagenbau (vorher Inline-Style in anlagenbau.php) */
.textblock_schmal{
	max-width: 560px;
}

/* ===== Artikellisten (Karten werden von javascript/artikelliste.js aus der Tabelle erzeugt) ===== */
.artikel_karten{
	display: none;
}

/* Desktop-Tabelle: Kopf hervorheben, Bilder begrenzen, damit die Tabelle in den Inhaltsbereich passt */
table.artikel_tabelle tr.artikel_kopfzeile td{
	background-color: #f2f2f2;
	white-space: normal !important;
}

table.artikel_tabelle img{
	max-width: 120px;
	height: auto;
}

table.artikel_tabelle tr:not(.artikel_kopfzeile):hover td{
	background-color: #fafafa;
}

.artikel_karte{
	border: 1px solid #dddddd;
	border-radius: 4px;
	margin-bottom: 20px;
	background-color: #ffffff;
	overflow: hidden;
}

.artikel_karte_bild{
	background-color: #f7f7f7;
	border-bottom: 1px solid #eeeeee;
	padding: 15px;
	text-align: center;
}

.artikel_karte_bild img{
	max-width: 100%;
	max-height: 160px;
	height: auto;
}

.artikel_karte_inhalt{
	padding: 15px;
}

h3.artikel_produkt{
	font-style: normal;
	font-size: 17px;
	line-height: 22px;
	margin: 0 0 12px 0;
	padding-left: 10px;
	border-left: 4px solid #e20014;
}

.artikel_karte_inhalt h3.artikel_produkt ~ h3.artikel_produkt{
	margin-top: 22px;
}

.artikel_variante{
	margin-bottom: 14px;
}

.artikel_variante:last-child{
	margin-bottom: 0;
}

.artikel_masse{
	background-color: #f2f2f2;
	padding: 7px 10px;
	font-weight: bold;
}

.artikel_masse span{
	display: block;
	font-weight: normal;
	font-size: 11px;
	line-height: 14px;
	color: #777777;
}

dl.artikel_daten{
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 8px 15px;
	margin: 10px 0;
	padding: 0 10px;
}

dl.artikel_daten_breit{
	grid-template-columns: 1fr;
	padding: 0;
}

dl.artikel_daten dt{
	font-size: 11px;
	line-height: 14px;
	color: #777777;
}

dl.artikel_daten dd{
	margin: 0;
	font-weight: bold;
}

.artikel_merkmal{
	display: inline-block;
	font-weight: normal;
	background-color: #f2f2f2;
	border-radius: 3px;
	padding: 1px 8px;
	margin: 3px 5px 0 0;
}

table.artikel_nummern{
	width: 100%;
	border-collapse: collapse;
	margin-top: 6px;
}

table.artikel_nummern th{
	font-size: 11px;
	font-weight: normal;
	color: #777777;
	text-align: left;
	padding: 4px 10px;
	border-bottom: 1px solid #dddddd;
}

table.artikel_nummern td{
	padding: 5px 10px;
	border-bottom: 1px solid #eeeeee;
	white-space: nowrap;
}

table.artikel_nummern tr:last-child td{
	border-bottom: none;
}

.artikel_farbpunkt{
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-right: 6px;
	vertical-align: -1px;
	border: 1px solid rgba(0, 0, 0, 0.15);
}


/* ===== Tablet: fließendes Layout ===== */
@media (max-width: 999px){

	#gesamt, .layout{
		width: auto;
	}

	#gesamt{
		margin: 0 10px;
	}

	#content_wrap{
		padding: 30px 25px 0 25px;
		display: flow-root; /* Außenabstände der letzten Elemente bleiben im weißen Bereich */
	}

	#content_wrap img{
		max-width: 100%;
	}

	/* Bilder in den (scrollbaren) Artikellisten in Originalgröße lassen */
	#content_wrap table img{
		max-width: none;
	}

	#content_wrap img[align]{
		height: auto;
	}

	/* Header: Logo-Fläche und Bildwechsel im Verhältnis 412 : 587 skalieren */
	#header_left{
		width: 41.24%;
		height: auto;
		aspect-ratio: 412 / 335;
		background-size: 100% 100%;
	}

	#header_left_text{
		padding-top: 38.8%;
		padding-left: 16.3%;
		font-size: clamp(13px, 2.4vw, 24px);
		line-height: 1.85em;
	}

	/* jQuery Cycle setzt feste Pixelmaße, daher !important */
	.slideshow{
		width: 58.76% !important;
		height: auto !important;
		aspect-ratio: 587 / 335;
	}

	.slideshow img{
		width: 100% !important;
		height: 100% !important;
	}

	/* Hauptnavigation: Punkte teilen sich die verfügbare Breite */
	#navi > ul{
		display: flex;
	}

	#navi > ul > li{
		flex: 1 1 auto;
		width: auto !important;
		padding: 0 10px !important;
	}

	#navi > ul > li > a{
		white-space: nowrap;
	}

	/* Startseite */
	.spalte_links{
		width: 32%;
		padding-right: 3%;
	}

	.spalte_rechts{
		width: 65%;
	}

	/* Kontakt */
	#kontaktformular{
		float: none;
		width: 100%;
		margin-right: 0;
	}

	#adresse{
		float: none;
		width: 100%;
		margin-top: 20px;
	}

	#adresse iframe{
		max-width: 100%;
	}

	/* Breite Tabellen horizontal scrollbar machen (Rückfall, falls JavaScript fehlt) */
	#content_wrap table[style*="border-collapse"]{
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Artikellisten: statt der Tabelle die Karten-Ansicht zeigen */
	#content_wrap table.artikel_tabelle{
		display: none;
	}

	.artikel_karten{
		display: block;
	}

	/* Ab Tablet-Breite Bild links, Daten rechts */
	@media (min-width: 600px){
		.artikel_karte{
			display: flex;
			align-items: stretch;
		}

		.artikel_karte_bild{
			flex: 0 0 190px;
			border-bottom: none;
			border-right: 1px solid #eeeeee;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.artikel_karte_bild img{
			max-height: none;
		}

		.artikel_karte_inhalt{
			flex: 1 1 auto;
			min-width: 0;
		}
	}

	/* Footer: nur der Granulat-Streifen (background_bottom_mobil.png = background_bottom.png ohne
	   grauen Balken und runde Ecke, 900x125px), darunter durchgehend das Grau des Balkens */
	#footer{
		height: auto;
		padding: calc(13.89% + 12px) 25px 15px 25px;
		background: #d5d5d5 url('../img/style/background_bottom_mobil.png') no-repeat left top / 100% auto;
	}
}


/* ===== Smartphone: einspaltig, aufklappbare Navigation ===== */
@media (max-width: 800px){

	body{
		font-size: 14px;
		line-height: 21px;
	}

	#gesamt{
		margin: 0;
	}

	/* Reihenfolge: Navigation ganz oben, dann Header, Inhalt, Footer */
	.layout{
		display: flex;
		flex-direction: column;
	}

	#navi{
		order: -1;
	}

	/* Startseite | Kontakt | Impressum stehen mobil im Footer (#navi_footer) */
	#navi_top{
		display: none;
	}

	/* Header: Logo-Fläche über volle Breite in einheitlichem Hellgrau, Bildwechsel darunter.
	   logo_mobil.png ist das Logo aus background_header_links.png auf #efefef statt Verlauf mit runder Ecke */
	#header_left{
		float: none;
		width: 100%;
		aspect-ratio: auto;
		background: #efefef url('../img/style/logo_mobil.png') no-repeat 15px 20px / 240px auto;
	}

	#header_left_text{
		padding: 118px 20px 18px 20px;
		font-size: 18px;
		line-height: 28px;
	}

	#header_left_text br{
		display: none;
	}

	.slideshow{
		float: none;
		width: 100% !important;
	}

	/* Navigation */
	#navi_toggle{
		display: block;
		position: relative;
		padding: 0 20px;
		line-height: 50px;
		font-size: 16px;
		text-transform: uppercase;
		color: #ffffff;
		cursor: pointer;
		user-select: none;
	}

	#navi_toggle .navi_toggle_icon,
	#navi_toggle .navi_toggle_icon:before,
	#navi_toggle .navi_toggle_icon:after{
		display: block;
		position: absolute;
		width: 24px;
		height: 3px;
		background-color: #ffffff;
		content: '';
	}

	#navi_toggle .navi_toggle_icon{
		right: 20px;
		top: 24px;
	}

	#navi_toggle .navi_toggle_icon:before{
		top: -8px;
	}

	#navi_toggle .navi_toggle_icon:after{
		top: 8px;
	}

	#navi > ul{
		display: none;
		border-top: 1px solid #333333;
	}

	#navi.offen > ul{
		display: block;
	}

	#navi ul li,
	#navi > ul > li{
		float: none;
		width: auto !important;
		padding: 0 !important;
		text-align: left;
		border-bottom: 1px solid #333333;
	}

	#navi ul li a{
		line-height: 48px;
		padding: 0 60px 0 20px;
	}

	/* Untermenüs als Akkordeon statt absolut positionierter Flyouts (navi.js setzt Inline-Styles) */
	#navi ul li ul,
	#navi ul li ul li ul{
		display: none;
		position: static !important;
		width: auto !important;
		background-color: #2a2a2a;
	}

	#navi ul li.sub_offen > ul{
		display: block !important;
	}

	#navi ul li ul li{
		padding: 0 !important;
		border-bottom: 1px solid #3a3a3a;
		background-image: none !important;
	}

	#navi ul li ul li a{
		line-height: 44px;
		padding-left: 35px;
		color: #ffffff !important;
	}

	#navi ul li ul li ul{
		background-color: #3a3a3a;
	}

	#navi ul li ul li ul li a{
		padding-left: 50px;
	}

	/* Hover-Farben aus navi.css (dunkelgrau) gelten mobil nicht */
	#navi ul li ul li ul li a,
	#navi ul li:hover ul li:hover ul li a,
	#navi ul li:hover ul li:hover ul li:hover a{
		color: #ffffff !important;
	}

	#navi li:hover{
		background-color: transparent;
	}

	#navi li.aktiv{
		background-color: #e20014;
	}

	/* Plus-/Minus-Schalter für Untermenüs, wird von navi.js eingefügt */
	#navi .navi_sub_toggle{
		position: absolute;
		right: 0;
		top: 0;
		width: 50px;
		height: 48px;
		line-height: 48px;
		text-align: center;
		font-size: 22px;
		color: #ffffff;
		cursor: pointer;
		user-select: none;
	}

	#navi ul li ul li .navi_sub_toggle{
		height: 44px;
		line-height: 44px;
	}

	#navi .navi_sub_toggle:before{
		content: '+';
	}

	#navi li.sub_offen > .navi_sub_toggle:before{
		content: '\2212';
	}

	/* Inhalt */
	#content_wrap{
		padding: 20px 15px 0 15px;
	}

	h1{
		font-size: 22px;
		line-height: 28px;
	}

	#content_wrap img[align]{
		float: none !important;
		display: block;
		margin: 0 0 15px 0 !important;
	}

	.spalte_links,
	.spalte_rechts{
		float: none;
		width: 100%;
		padding-right: 0;
	}

	.spalte_links{
		margin-bottom: 20px;
	}

	/* Produktkategorien zweispaltig */
	a.kategoriebutton{
		width: calc(50% - 8px);
		margin-right: 16px;
		margin-bottom: 20px;
	}

	a.kategoriebutton:nth-of-type(2n){
		margin-right: 0;
	}

	a.kategoriebutton img{
		width: 100%;
		box-sizing: border-box;
		padding: 0 !important;
	}

	a.unterkategoriebutton{
		float: none;
		width: auto;
		margin-right: 8px !important;
		margin-bottom: 20px;
	}

	.downloadlink{
		float: none;
		margin-bottom: 6px;
	}

	/* Referenzbilder zweispaltig */
	.referenzbild{
		width: calc(50% - 24px);
		height: auto;
		margin-right: 0 !important;
		margin-bottom: 16px;
	}

	.referenzbild:nth-of-type(2n+1){
		margin-right: 16px !important;
	}

	.referenzbild img{
		width: 100%;
		height: auto;
		aspect-ratio: 1 / 1;
		object-fit: cover;
		display: block;
	}

	/* Partner-Logos untereinander */
	#content_wrap div[style*="margin-right: 40px"]{
		float: none !important;
		margin-right: 0 !important;
		margin-bottom: 20px;
	}

	/* Kontaktformular: Tabellenzellen untereinander */
	#kontaktformular table,
	#kontaktformular tbody,
	#kontaktformular tr,
	#kontaktformular td{
		display: block;
		width: 100% !important;
		box-sizing: border-box;
	}

	#kontaktformular .linke_spalte,
	#kontaktformular .rechte_spalte{
		padding: 6px 0 0 0 !important;
	}

	#kontaktformular .input_reparatur{
		padding-right: 0;
	}

	#kontaktformular input,
	#kontaktformular textarea,
	#kontaktformular select{
		box-sizing: border-box;
		font-size: 16px; /* verhindert Auto-Zoom auf iOS */
	}

	#kontaktformular input[type=radio]{
		width: auto;
	}

	#kontaktformular .input_reparatur[style*="float: right"]{
		float: none !important;
		width: 100% !important;
		margin-top: 10px;
	}

	#kontaktformular img{
		float: none;
		display: block;
		margin-bottom: 5px;
	}

	#kontaktformular input[type=submit]{
		width: 100%;
		padding: 10px;
	}

	#footer{
		padding-left: 15px;
		padding-right: 15px;
		font-size: 12px;
	}

	#navi_footer{
		display: block;
		margin-bottom: 10px;
		font-size: 15px;
		line-height: 24px;
	}

	#navi_footer a{
		color: #555555;
		margin-right: 18px;
	}
}
