/* maschenerina Adventskalender – eigenständig, passt sich dem Theme an (Farben und Schriften, falls vorhanden). */

.mak {
	--mak-nacht: #1D2B24;
	--mak-tanne: #2F5F48;
	--mak-salbei: #8FA998;
	--mak-rost: #A54A33;
	--mak-terra: #C9684D;
	--mak-sand: #E9DFD0;
	--mak-creme: #F7F3EE;
	--mak-gold: #F1C59B;
	--mak-karte: var(--wp--preset--color--weiss-warm, #FFFDF9);
	--mak-tinte: var(--wp--preset--color--tinte, #241F1A);
	--mak-hand: var(--wp--preset--font-family--caveat, "Caveat", "Segoe Script", cursive);
	--mak-kopf: var(--wp--preset--font-family--quicksand, "Quicksand", inherit);

	position: relative; isolation: isolate; overflow: hidden; box-sizing: border-box;
	width: min(100%, 1240px); margin: 1.5rem auto 3rem; padding: clamp(1.4rem, 0.6rem + 3.4vw, 3.4rem) clamp(0.9rem, 0.2rem + 3vw, 3rem) clamp(1.2rem, 0.6rem + 3vw, 3rem);
	border-radius: clamp(24px, 3vw, 40px); color: var(--mak-creme);
	background:
		radial-gradient(120% 70% at 85% -10%, rgba(143, 169, 152, 0.28), transparent 60%),
		radial-gradient(90% 60% at 0% 110%, rgba(201, 104, 77, 0.26), transparent 60%),
		var(--mak-nacht);
	box-shadow: 0 24px 60px rgba(29, 43, 36, 0.22);
}
.mak *, .mak *::before, .mak *::after { box-sizing: border-box; }

/* Strickbordüre oben und unten */
.mak::before, .mak::after {
	content: ""; position: absolute; left: 0; right: 0; height: 12px; z-index: -1; opacity: 0.85;
	background: conic-gradient(from 135deg at 50% 0, var(--mak-terra) 90deg, transparent 0) 0 0 / 16px 12px repeat-x;
}
.mak::before { top: 0; }
.mak::after { bottom: 0; rotate: 180deg; }

/* Schnee */
.mak-schnee { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.mak-schnee i {
	position: absolute; top: -4%; left: calc(var(--x, 50) * 1%); width: var(--g, 6px); height: var(--g, 6px); border-radius: 50%;
	background: #fff; opacity: var(--o, 0.5);
}
.mak-schnee i:nth-child(1) { --x: 4; --g: 5px; --d: 15s; --v: -3s; }
.mak-schnee i:nth-child(2) { --x: 12; --g: 8px; --d: 21s; --v: -11s; --o: 0.35; }
.mak-schnee i:nth-child(3) { --x: 21; --g: 4px; --d: 13s; --v: -7s; }
.mak-schnee i:nth-child(4) { --x: 29; --g: 6px; --d: 18s; --v: -1s; --o: 0.4; }
.mak-schnee i:nth-child(5) { --x: 37; --g: 9px; --d: 24s; --v: -15s; --o: 0.3; }
.mak-schnee i:nth-child(6) { --x: 46; --g: 4px; --d: 14s; --v: -9s; }
.mak-schnee i:nth-child(7) { --x: 54; --g: 6px; --d: 19s; --v: -4s; --o: 0.45; }
.mak-schnee i:nth-child(8) { --x: 62; --g: 5px; --d: 16s; --v: -12s; }
.mak-schnee i:nth-child(9) { --x: 70; --g: 8px; --d: 22s; --v: -6s; --o: 0.3; }
.mak-schnee i:nth-child(10) { --x: 78; --g: 4px; --d: 12s; --v: -2s; }
.mak-schnee i:nth-child(11) { --x: 85; --g: 6px; --d: 20s; --v: -14s; --o: 0.4; }
.mak-schnee i:nth-child(12) { --x: 91; --g: 5px; --d: 17s; --v: -8s; }
.mak-schnee i:nth-child(13) { --x: 96; --g: 7px; --d: 23s; --v: -18s; --o: 0.35; }
.mak-schnee i:nth-child(14) { --x: 50; --g: 5px; --d: 26s; --v: -20s; --o: 0.3; }
@keyframes mak-schnee { to { top: 104%; translate: 18px 0; } }
@keyframes mak-rein { from { opacity: 0; translate: 0 18px; scale: 0.94; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes mak-ruetteln { 20% { rotate: -4deg; } 45% { rotate: 3.5deg; } 70% { rotate: -2deg; } 100% { rotate: 0deg; } }
@keyframes mak-wackeln { 25% { translate: -5px 0; } 60% { translate: 4px 0; } 100% { translate: 0 0; } }
@keyframes mak-dialog { from { opacity: 0; translate: 0 22px; scale: 0.96; } to { opacity: 1; translate: 0 0; scale: 1; } }

/* Kopf */
.mak-kopf { text-align: center; max-width: 44rem; margin: 0 auto clamp(1.3rem, 0.8rem + 2vw, 2.4rem); }
.mak-kopf > * { margin: 0; }
.mak .mak-hand { font-family: var(--mak-hand); font-weight: 700; font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); line-height: 1; color: var(--mak-gold); text-transform: none; }
.mak .mak-kopf h2 {
	margin: 0.2rem 0 0; font-family: var(--mak-kopf); font-weight: 700; color: var(--mak-creme); text-transform: none;
	font-size: clamp(2rem, 1.3rem + 3.2vw, 3.6rem); line-height: 1.05; letter-spacing: -0.03em; text-wrap: balance; overflow-wrap: break-word;
}
.mak .mak-text { margin: 0.9rem auto 0; max-width: 34rem; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem); line-height: 1.55; color: rgba(247, 243, 238, 0.82); }
.mak .mak-stand {
	display: inline-block; margin: 1.1rem 0 0; padding: 0.5rem 1.1rem; border-radius: 999px; min-height: 2.4rem;
	font-family: var(--mak-kopf); font-weight: 700; font-size: 0.92rem; line-height: 1.4;
	color: var(--mak-nacht); background: var(--mak-gold);
}
.mak .mak-verlosung { margin: 0.9rem auto 0; max-width: 34rem; padding: 0.6rem 1rem; border-radius: 16px; border: 1.5px dashed rgba(241, 197, 155, 0.6); font-family: var(--mak-kopf); font-weight: 600; font-size: 0.92rem; line-height: 1.45; color: var(--mak-gold); }
.mak .mak-verlosung a { color: var(--mak-creme); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.mak .mak-test { margin: 0.8rem 0 0; font-size: 0.82rem; color: var(--mak-gold); }

/* Türchen */
.mak .mak-tueren {
	list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: clamp(0.5rem, 0.25rem + 1vw, 1rem);
}
.mak .mak-tuer { position: relative; margin: 0; padding: 0; min-width: 0; list-style: none; }
.mak .mak-tuer::before, .mak .mak-tuer::marker { content: none; }
.mak .mak-tuer-knopf {
	all: unset; box-sizing: border-box; position: relative; display: block; width: 100%; aspect-ratio: 1; cursor: pointer;
	border-radius: clamp(14px, 1.6vw, 22px); perspective: 700px; background: rgba(0, 0, 0, 0.28);
	-webkit-tap-highlight-color: transparent; transition: translate 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), scale 0.15s ease;
}
.mak .mak-tuer-knopf:focus-visible { outline: 3px solid var(--mak-gold); outline-offset: 3px; }
.mak .mak-tuer-knopf:active { scale: 0.96; }
.mak-f0 { --f: var(--mak-tanne); --z: var(--mak-creme); }
.mak-f1 { --f: var(--mak-rost); --z: var(--mak-creme); }
.mak-f2 { --f: var(--mak-sand); --z: var(--mak-nacht); }
.mak-f3 { --f: var(--mak-terra); --z: var(--mak-nacht); }
.mak-f4 { --f: var(--mak-salbei); --z: var(--mak-nacht); }
.mak-f5 { --f: #3B4F45; --z: var(--mak-gold); }

.mak-tuer-innen { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; background: var(--mak-sand); }
.mak-tuer-innen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; border-radius: 0; }
.mak-marke {
	position: absolute; left: 6px; bottom: 6px; padding: 0.12rem 0.55rem; border-radius: 999px;
	font-family: var(--mak-kopf); font-weight: 700; font-size: 0.68rem; letter-spacing: 0.04em; line-height: 1.5;
	background: rgba(29, 43, 36, 0.82); color: var(--mak-creme);
}
.ist-heute .mak-marke, .ist-aktiv .mak-marke { background: var(--mak-gold); color: var(--mak-nacht); }
.ist-vorbei .mak-tuer-innen img { filter: grayscale(0.45) brightness(0.9); }

.mak-tuer-blatt {
	position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit;
	background: var(--f, var(--mak-tanne)); color: var(--z, var(--mak-creme));
	transform-origin: left center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
	transition: transform 0.95s cubic-bezier(0.45, 0, 0.15, 1), filter 0.95s ease;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
/* Maschen-Naht */
.mak-tuer-blatt::before {
	content: ""; position: absolute; inset: clamp(5px, 0.7vw, 9px); border-radius: clamp(9px, 1.1vw, 15px);
	border: 2px dashed currentColor; opacity: 0.32;
}
.mak-zahl { font-family: var(--mak-kopf); font-weight: 700; font-size: clamp(1.5rem, 0.9rem + 2.6vw, 3.1rem); line-height: 1; letter-spacing: -0.03em; }
.mak-tuer.ist-offen .mak-tuer-blatt { transform: rotateY(-104deg); filter: brightness(0.75); }
.mak-tuer.ohne-animation .mak-tuer-blatt { transition: none; }

/* Alle geschlossenen Türchen sehen gleich aus – das heutige muss man suchen. */
/* Ohne JavaScript sind erreichte Türchen einfach offen (Link zum Produkt) */
.mak:not(.mak-js) .mak-tuer:not(.ist-zu) .mak-tuer-blatt { transform: rotateY(-104deg); }

@media (hover: hover) {
	.mak .mak-tuer .mak-tuer-knopf:hover { translate: 0 -4px; }
}

/* Funken beim Öffnen des heutigen Türchens */
.mak-funken { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 3; pointer-events: none; }
.mak-funken i {
	position: absolute; left: 0; top: 0; width: var(--g, 8px); height: var(--g, 8px); margin: calc(var(--g, 8px) / -2); border-radius: 50%;
	background: var(--mak-gold); box-shadow: 0 0 10px rgba(241, 197, 155, 0.9); opacity: 0;
	animation: mak-funke 1s var(--v, 200ms) cubic-bezier(0.15, 0.7, 0.3, 1) forwards;
}
.mak-funken .mak-funke-stern { border-radius: 0; background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); width: calc(var(--g, 8px) * 2); height: calc(var(--g, 8px) * 2); margin: calc(var(--g, 8px) * -1); box-shadow: none; }
@keyframes mak-funke {
	0% { opacity: 0; translate: 0 0; scale: 0.3; }
	18% { opacity: 1; }
	100% { opacity: 0; translate: var(--dx, 60px) calc(var(--dy, -60px) + 26px); scale: 1; rotate: 120deg; }
}
/* Foto wächst vom Türchen ins Fenster */
::view-transition-group(mak-foto) { animation-duration: 0.6s; animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1); }
::view-transition-old(mak-foto), ::view-transition-new(mak-foto) { width: 100%; height: 100%; object-fit: cover; border-radius: 20px; overflow: clip; }
.mak-dialog.mak-ohne-einblenden[open] { animation: none; }

/* Inhalt im Dialog */
.mak-dialog {
	width: min(26rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0; border: 0; border-radius: 28px; overflow: auto;
	background: var(--mak-karte); color: var(--mak-tinte); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.mak-dialog::backdrop { background: rgba(20, 28, 24, 0.66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.mak-dialog-inhalt { padding: 1.3rem 1.3rem 1.4rem; text-align: center; }
.mak-dialog-inhalt > * { margin: 0; }
.mak .mak-dialog-zu {
	all: unset; box-sizing: border-box; position: absolute; top: 0.7rem; right: 0.7rem; z-index: 2; width: 2.6rem; height: 2.6rem; border-radius: 50%; cursor: pointer;
	display: grid; place-items: center; font-size: 1.6rem; line-height: 1; color: var(--mak-tinte); background: var(--mak-karte);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.mak .mak-dialog-zu:focus-visible { outline: 3px solid var(--mak-rost); outline-offset: 2px; }
.mak-dialog .mak-inhalt-tag { font-family: var(--mak-hand); font-weight: 700; font-size: 1.55rem; line-height: 1.1; color: var(--mak-terra); padding-inline: 2.6rem; }
.mak-dialog .mak-inhalt-bild { display: block; margin: 0.8rem 0 0; border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--mak-sand); }
.mak-dialog .mak-inhalt-bild img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.mak-dialog h3 { margin: 0.95rem 0 0; font-family: var(--mak-kopf); font-weight: 700; font-size: 1.3rem; line-height: 1.25; color: inherit; text-transform: none; overflow-wrap: anywhere; }
.mak-dialog .mak-inhalt-text { margin: 0.4rem 0 0; font-size: 0.95rem; line-height: 1.5; opacity: 0.85; }
.mak-dialog .mak-inhalt-preis { margin: 0.75rem 0 0; font-family: var(--mak-kopf); font-weight: 700; font-size: 1.5rem; line-height: 1.2; color: var(--mak-tanne); }
.mak-dialog .mak-inhalt-preis del { font-size: 0.68em; font-weight: 500; opacity: 0.6; color: var(--mak-tinte); margin-right: 0.3em; }
.mak-dialog .mak-inhalt-preis ins { text-decoration: none; background: none; }
.mak-dialog .mak-inhalt-preis small { display: none; }
.mak-spar { display: inline-block; vertical-align: middle; margin-left: 0.35em; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; background: var(--mak-rost); color: #fff; }
.mak-dialog .mak-inhalt-rest { margin: 0.75rem 0 0; font-family: var(--mak-kopf); font-weight: 700; font-size: 0.88rem; line-height: 1.4; }
.mak-rest-balken { display: block; height: 8px; margin: 0 auto 0.4rem; max-width: 15rem; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--mak-tinte) 12%, transparent); }
.mak-rest-balken i { display: block; height: 100%; min-width: 8px; border-radius: inherit; background: linear-gradient(90deg, var(--mak-terra), var(--mak-rost)); }
.mak-dialog .mak-inhalt-frist { margin: 0.6rem 0 0; font-size: 0.9rem; font-weight: 600; color: var(--mak-rost); }
.mak-dialog .mak-inhalt-frist--vorbei { color: inherit; opacity: 0.7; font-weight: 500; }
.mak-dialog .mak-inhalt-los { margin: 0.7rem 0 0; padding: 0.5rem 0.8rem; border-radius: 14px; font-size: 0.86rem; font-weight: 600; line-height: 1.4; background: color-mix(in srgb, var(--mak-gold) 34%, transparent); }
.mak-dialog .mak-knopf {
	display: block; margin: 1.1rem 0 0; padding: 0.9rem 1.4rem; border-radius: 999px; text-decoration: none; text-transform: none;
	font-family: var(--mak-kopf); font-weight: 700; font-size: 1rem; line-height: 1.3; color: #fff; background: var(--mak-rost);
	box-shadow: 0 8px 20px rgba(165, 74, 51, 0.32); transition: translate 0.2s ease, background-color 0.2s ease;
}
.mak-dialog .mak-knopf:hover { background: var(--mak-nacht); color: #fff; translate: 0 -2px; }

/* Nachtmodus des Themes */
:root[data-modus="dunkel"] .mak-dialog { --mak-tanne: #9CC7AE; --mak-rost: #C9684D; }
:root[data-modus="dunkel"] .mak-dialog .mak-knopf { color: #fff; }

@media (prefers-reduced-motion: no-preference) {
	.mak-schnee i { animation: mak-schnee var(--d, 18s) linear var(--v, 0s) infinite; }
	.mak-tuer { animation: mak-rein 0.6s calc(var(--i, 0) * 28ms) cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
	.mak-tuer.mak-ruettelt .mak-tuer-knopf { animation: mak-ruetteln 0.5s ease; }
	.mak-stand.mak-wackelt { animation: mak-wackeln 0.4s ease; }
	.mak-dialog[open] { animation: mak-dialog 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
}

@media (max-width: 900px) {
	.mak .mak-tueren { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
	.mak { margin-block: 0.75rem 2rem; border-radius: 24px; }
	.mak .mak-tueren { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; }
	.mak-zahl { font-size: 2rem; }
	.mak-marke { font-size: 0.62rem; left: 5px; bottom: 5px; }
}
