/*
Theme Name: S55 Shop
Description: Shop-Theme für 3D-gedruckte Abdeckungen für System-55-Schalter.
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: s55
*/

/* ---------- Grundlagen ---------- */
:root {
	--s55-radius: 4px;
	--s55-plate-radius: 14%;
	--s55-ease: cubic-bezier(.2, .7, .2, 1);
}

body {
	font-stretch: 100%;
	-webkit-font-smoothing: antialiased;
}

h1, h2, .wp-block-site-title {
	font-stretch: 125%;
}

h1 { text-wrap: balance; }
p { text-wrap: pretty; }

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--licht);
	outline-offset: 2px;
}

/* ---------- Licht aus: der Schalter im Hero dunkelt die Seite ab ---------- */
html.lights-off {
	--wp--preset--color--wand: #17191C;
	--wp--preset--color--platte: #22252A;
	--wp--preset--color--graphit: #ECEDEA;
	--wp--preset--color--schatten: #A3A8AE;
	--wp--preset--color--linie: #34383E;
	color-scheme: dark;
}
html.lights-off .wp-element-button,
html.lights-off .wp-block-button__link {
	color: #17191C;
}
@media (prefers-reduced-motion: no-preference) {
	body, .s55-header, .s55-footer, .s55-plate, .s55-products li.product {
		transition: background-color .5s var(--s55-ease), color .5s var(--s55-ease);
	}
}

/* ---------- Kopfzeile ---------- */
.s55-header {
	border-bottom: 1px solid var(--wp--preset--color--linie);
}
.s55-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--wand);
	color: var(--wp--preset--color--graphit);
}

/* ---------- Hero ---------- */
.s55-hero {
	min-height: min(82vh, 760px);
	align-items: center !important;
}
.s55-hero h1 {
	max-width: 13ch;
	margin-bottom: 0;
}
.s55-hero .s55-lead {
	max-width: 36ch;
	color: var(--wp--preset--color--schatten);
	font-size: var(--wp--preset--font-size--gross);
	line-height: 1.45;
}

/* Der Schalter: Rahmen mit Druckschicht-Linien, 55-mm-Einsatz, Wippe */
.s55-switch {
	--size: min(78vw, 400px);
	position: relative;
	width: var(--size);
	aspect-ratio: 1;
	margin-inline: auto;
	border-radius: var(--s55-plate-radius);
	background:
		repeating-linear-gradient(0deg, rgba(0,0,0,.045) 0 1px, transparent 1px 4px),
		var(--wp--preset--color--platte);
	box-shadow:
		0 1px 0 rgba(255,255,255,.7) inset,
		0 30px 60px -30px rgba(20, 22, 26, .45),
		0 8px 16px -8px rgba(20, 22, 26, .25);
	display: grid;
	place-items: center;
}
.s55-switch::after {
	/* Lichtkegel, der beim Einschalten an der Wand erscheint */
	content: "";
	position: absolute;
	inset: -40%;
	z-index: -1;
	border-radius: 50%;
	background: radial-gradient(closest-side, rgba(245, 196, 0, .28), transparent);
	opacity: 1;
	transition: opacity .6s var(--s55-ease);
	pointer-events: none;
}
html.lights-off .s55-switch::after { opacity: 0; }
html.lights-off .s55-switch {
	box-shadow: 0 30px 60px -30px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.06) inset;
}

.s55-switch__insert {
	width: 68.75%; /* 55 von 80 mm */
	aspect-ratio: 1;
	border-radius: 6%;
	background: var(--wp--preset--color--wand);
	box-shadow: inset 0 2px 6px rgba(0,0,0,.18);
	display: grid;
	place-items: center;
	padding: 4%;
}

.s55-switch__rocker {
	all: unset;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	border-radius: 5%;
	cursor: pointer;
	background: linear-gradient(180deg, #FFFFFF 0%, var(--wp--preset--color--platte) 50%, #E4E6E2 100%);
	box-shadow: 0 6px 0 -2px rgba(0,0,0,.12), 0 1px 0 rgba(255,255,255,.9) inset;
	transform: perspective(500px) rotateX(7deg);
	transform-origin: center;
	position: relative;
}
.s55-switch__rocker::before {
	/* Kontrollpunkt: leuchtet, wenn das Licht an ist */
	content: "";
	position: absolute;
	left: 50%;
	top: 16%;
	width: 9%;
	aspect-ratio: 1;
	translate: -50% 0;
	border-radius: 50%;
	background: var(--wp--preset--color--licht);
	box-shadow: 0 0 14px 3px rgba(245, 196, 0, .65);
	transition: background-color .3s, box-shadow .3s;
}
.s55-switch__rocker[aria-pressed="false"] {
	transform: perspective(500px) rotateX(-7deg);
	background: linear-gradient(0deg, #FFFFFF 0%, var(--wp--preset--color--platte) 50%, #D9DCD7 100%);
}
html.lights-off .s55-switch__rocker {
	background: linear-gradient(0deg, #3A3E44 0%, #2C3035 55%, #24272C 100%);
}
.s55-switch__rocker[aria-pressed="false"]::before {
	background: #5A5F66;
	box-shadow: none;
}
.s55-switch__rocker:focus-visible {
	outline: 3px solid var(--wp--preset--color--licht);
	outline-offset: 6px;
}
@media (prefers-reduced-motion: no-preference) {
	.s55-switch__rocker { transition: transform .18s var(--s55-ease), background .3s; }
}
.s55-switch__hint {
	text-align: center;
	color: var(--wp--preset--color--schatten);
	font-size: var(--wp--preset--font-size--klein);
	margin-top: 1.5rem;
}

/* ---------- Abschnitte ---------- */
.s55-section-head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
}

/* ---------- Produktraster (Shortcode und Shop-Seiten) ---------- */
.s55-products ul.products,
.woocommerce ul.products {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 2.5rem 1.5rem;
	margin: 0 !important;
	padding: 0;
	list-style: none;
}
.s55-products ul.products::before, .s55-products ul.products::after,
.woocommerce ul.products::before, .woocommerce ul.products::after {
	display: none !important;
}
.s55-products ul.products li.product,
.woocommerce ul.products li.product {
	width: auto !important;
	margin: 0 !important;
	float: none !important;
	padding: 0;
}
ul.products li.product a img {
	width: 100%;
	height: auto;
	display: block;
}
ul.products li.product a img,
.wc-block-components-product-image img,
.wc-block-grid__product-image img {
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: var(--s55-radius);
	background: var(--wp--preset--color--platte);
	margin-bottom: 1rem !important;
}
ul.products li.product .woocommerce-loop-product__title {
	font-size: 1.0625rem !important;
	font-weight: 600;
	padding: 0 !important;
	margin: 0 0 .25rem !important;
}
ul.products li.product .price {
	color: var(--wp--preset--color--schatten) !important;
	font-size: 1rem !important;
	font-variant-numeric: tabular-nums;
	display: block;
}
ul.products li.product .button {
	margin-top: .75rem;
	background: transparent;
	color: var(--wp--preset--color--graphit);
	border: 1px solid var(--wp--preset--color--graphit);
	border-radius: var(--s55-radius);
	padding: .55rem 1rem;
	font-weight: 600;
	font-size: .9375rem;
}
ul.products li.product .button:hover {
	background: var(--wp--preset--color--graphit);
	color: var(--wp--preset--color--wand);
}
.woocommerce span.onsale {
	background: var(--wp--preset--color--licht);
	color: #22252A;
	border-radius: var(--s55-radius);
	min-height: 0;
	min-width: 0;
	line-height: 1;
	padding: .4rem .6rem;
	font-weight: 600;
}

/* ---------- Maßzeichnung ---------- */
.s55-dimension {
	width: min(100%, 340px);
	margin-inline: auto;
	color: var(--wp--preset--color--graphit);
}
.s55-dimension text {
	font-family: inherit;
	font-size: 13px;
	fill: currentColor;
}

/* ---------- Schritte ---------- */
.s55-steps {
	counter-reset: step;
}
.s55-step {
	counter-increment: step;
	border-top: 2px solid var(--wp--preset--color--graphit);
	padding-top: 1rem;
}
.s55-step h3::before {
	content: counter(step);
	display: block;
	font-stretch: 125%;
	font-weight: 300;
	font-size: 3rem;
	line-height: 1;
	margin-bottom: .75rem;
}

/* ---------- FAQ ---------- */
.s55-faq .wp-block-details {
	border-top: 1px solid var(--wp--preset--color--linie);
	padding-block: 1.1rem;
}
.s55-faq .wp-block-details:last-child {
	border-bottom: 1px solid var(--wp--preset--color--linie);
}
.s55-faq summary {
	font-weight: 600;
	font-size: var(--wp--preset--font-size--gross);
	cursor: pointer;
	list-style: none;
	display: flex;
	justify-content: space-between;
	gap: 1rem;
}
.s55-faq summary::-webkit-details-marker { display: none; }
.s55-faq summary::after {
	content: "+";
	font-weight: 300;
	font-size: 1.6rem;
	line-height: 1;
}
.s55-faq details[open] summary::after { content: "–"; }
.s55-faq details > :not(summary) {
	max-width: 62ch;
	color: var(--wp--preset--color--schatten);
}

/* ---------- Fußzeile ---------- */
.s55-footer {
	border-top: 1px solid var(--wp--preset--color--linie);
	color: var(--wp--preset--color--schatten);
	font-size: var(--wp--preset--font-size--klein);
}
.s55-footer a { color: inherit; }

/* ---------- WooCommerce-Feinschliff ---------- */
.woocommerce .quantity .qty { border-radius: var(--s55-radius); }
.wc-block-components-button:not(.is-link),
.single_add_to_cart_button {
	border-radius: var(--s55-radius) !important;
}
.woocommerce-store-notice, p.demo_store {
	background: var(--wp--preset--color--graphit);
	color: var(--wp--preset--color--wand);
}

@media (max-width: 781px) {
	.s55-hero { min-height: 0; }
	.s55-switch { --size: min(72vw, 320px); }
}

ul.products li.product a { text-decoration: none; }
