/* 40plus Adventskalender – Frontend */

.ak40 {
	width: 100%;
	max-width: var(--ak40-max, none);
	margin: 0 auto;
	box-sizing: border-box;
}
.ak40 *,
.ak40 *::before,
.ak40 *::after {
	box-sizing: border-box;
}

.ak40-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* Jede Zelle ist quadratisch; Abstand entsteht über das Padding */
.ak40-cell {
	aspect-ratio: 1 / 1;
	padding: 7%;
	perspective: 900px;
}
/* Große 2x2-Kacheln: gleiches absolutes Padding wie kleine Kacheln */
.ak40-span-2 {
	padding: 3.5%;
}

.ak40-link {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	color: inherit;
	text-decoration: none;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}
.ak40-cell.is-active .ak40-link {
	cursor: pointer;
}

/* ---------- Flip ---------- */
.ak40-flip {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}

@media (hover: hover) {
	.ak40-cell.is-active:hover .ak40-flip {
		transform: rotateY(180deg);
	}
}
.ak40-cell.is-active .ak40-link:focus-visible .ak40-flip,
.ak40-cell.is-flipped .ak40-flip {
	transform: rotateY(180deg);
}

.ak40-face {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	container-type: inline-size;
}
.ak40-front {
	overflow: visible;
}
.ak40-back {
	transform: rotateY(180deg);
	text-align: center;
}

.ak40-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Gewinnspiel-Bilder füllen die Kachel */
.ak40-raffle .ak40-front .ak40-img {
	object-fit: cover;
}

/* ---------- Rückseiten ---------- */
.ak40-cookie .ak40-back {
	background: var(--ak40-cookie-back, #fff);
	border-radius: 10%;
	padding: 14%;
	box-shadow: 0 2px 6px rgba(80, 40, 10, 0.18);
}
.ak40-cookie .ak40-back .ak40-img {
	object-fit: contain;
}

.ak40-donut .ak40-back {
	background: var(--ak40-donut-bg, #c8102e);
	border-radius: 50%;
}
.ak40-raffle .ak40-back {
	background: var(--ak40-raffle-bg, #fff);
}
.ak40-raffle .ak40-back-img {
	object-fit: contain;
}

/* Hover-Bild bei Krapfen und Gewinnspielen: füllt die Fläche, kein Overlay */
.ak40-back-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ---------- Fallbacks, solange keine Bilder hinterlegt sind ---------- */
.ak40-cookie-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-radius: 10%;
	background:
		radial-gradient(circle at 30% 25%, #e8a266 0%, #cf7a37 55%, #b3601f 100%);
	box-shadow:
		inset 0 0 0 0.25em rgba(255, 230, 200, 0.18),
		inset 0 -0.3em 0.5em rgba(90, 40, 5, 0.3),
		0 2px 4px rgba(90, 40, 5, 0.25);
}
.ak40-num {
	font-family: Georgia, "Times New Roman", serif;
	font-weight: 700;
	font-size: 46cqi;
	line-height: 1;
	color: #d98a4b;
	text-shadow:
		-1px -1px 0 rgba(255, 225, 190, 0.5),
		2px 2px 2px rgba(80, 35, 5, 0.45);
}

.ak40-donut-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: radial-gradient(circle, #fff 0%, #fbf9f6 55%, #ede5da 75%, #d9a878 92%, #c0773a 100%);
	box-shadow: 0 2px 4px rgba(90, 40, 5, 0.2);
}
.ak40-star {
	font-size: 34cqi;
	line-height: 1;
	color: #b2621f;
}

.ak40-raffle-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: #e2ddd5;
	color: #6b6258;
	font-weight: 700;
	font-size: 9cqi;
}

/* ---------- Fokus ---------- */
.ak40-cell.is-active .ak40-link:focus-visible {
	outline: 3px solid var(--ak40-donut-bg, #c8102e);
	outline-offset: 3px;
	border-radius: 6px;
}

/* ---------- Reduzierte Bewegung: Überblenden statt Drehen ---------- */
@media (prefers-reduced-motion: reduce) {
	.ak40-flip,
	.ak40-cell.is-active .ak40-flip {
		transform: none !important;
		transition: none;
	}
	.ak40-back {
		transform: none;
		opacity: 0;
		transition: opacity 0.2s;
	}
	.ak40-cell.is-active .ak40-link:focus-visible .ak40-back,
	.ak40-cell.is-flipped .ak40-back {
		opacity: 1;
	}
}
@media (prefers-reduced-motion: reduce) and (hover: hover) {
	.ak40-cell.is-active:hover .ak40-back {
		opacity: 1;
	}
}
