/*
Theme Name: Adventkalender
Description: Privater Adventkalender für Sofia.
Version: 1.0.0
Requires PHP: 8.2
Text Domain: adventkalender
*/

@font-face {
	font-family: "Vollkorn";
	src: url("assets/fonts/Vollkorn-VariableFont_wght.woff2") format("woff2");
	font-weight: 400 900;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "Vollkorn";
	src: url("assets/fonts/Vollkorn-Italic-VariableFont_wght.woff2") format("woff2");
	font-weight: 400 900;
	font-style: italic;
	font-display: swap;
}

:root {
	--night: #0d2019;
	--night-soft: #16332a;
	--pine: #1f4a3b;
	--berry: #8e2436;
	--berry-deep: #6d1a2a;
	--cream: #f8efdf;
	--paper: #fffaf0;
	--ink: #2a211c;
	--muted: #6b5d52;
	--gold: #e3b866;
	--gold-soft: #f4d9a0;
	--glow: #ffcf7a;
	--focus: #ffe2a8;
}

* {
	box-sizing: border-box;
}

html {
	background: var(--night);
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	color: var(--cream);
	font-family: "Vollkorn", Georgia, "Times New Roman", serif;
	font-size: 1.0625rem;
	line-height: 1.55;
	font-variant-numeric: lining-nums;
	background:
		radial-gradient(90% 60% at 50% -10%, #2c5f4c 0%, transparent 70%),
		linear-gradient(180deg, var(--night-soft) 0%, var(--night) 70%);
	background-attachment: fixed;
	overflow-x: hidden;
}

body.is-dialog-open {
	overflow: hidden;
}

#snow {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 0;
}

.santa-sky {
	position: fixed;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

.santa-flight {
	position: absolute;
	top: clamp(6px, 7vh, 80px);
	left: 0;
	width: clamp(150px, 26vw, 320px);
	transform: translateX(-110%);
	animation: santa-fly 30s linear 2s infinite;
}

.santa {
	display: block;
	width: 100%;
	height: auto;
	animation: santa-bob 2.6s ease-in-out infinite alternate;
}

.calendar-page {
	position: relative;
	z-index: 1;
	width: min(100%, 980px);
	margin: 0 auto;
	padding: 28px 16px 40px;
}

@media (max-width: 719px) {
	.santa-flight {
		top: 10px;
	}

	.calendar-page {
		padding-top: 72px;
	}
}

@keyframes santa-fly {
	0% {
		transform: translateX(-110%);
	}
	55%, 100% {
		transform: translateX(100vw);
	}
}

@keyframes santa-bob {
	from {
		transform: translateY(-5px) rotate(-1.5deg);
	}
	to {
		transform: translateY(7px) rotate(1.5deg);
	}
}

.santa-big {
	position: fixed;
	right: 16px;
	bottom: 0;
	z-index: 0;
	width: clamp(150px, 16vw, 240px);
	pointer-events: none;
}

.santa-big svg {
	display: block;
	width: 100%;
	height: auto;
}

.santa-wave {
	transform-origin: 172px 162px;
	animation: santa-wave 0.9s ease-in-out infinite alternate;
}

@keyframes santa-wave {
	from {
		transform: rotate(-9deg);
	}
	to {
		transform: rotate(9deg);
	}
}

/* Auf dem Handy liegt er kurz über den Türchen und macht dann Platz. */
@media (max-width: 719px) {
	.santa-big {
		z-index: 3;
		width: 128px;
		animation: santa-leave 0.6s ease-in 5s forwards;
	}
}

@keyframes santa-leave {
	to {
		visibility: hidden;
		opacity: 0;
		transform: translateY(30px);
	}
}

:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 3px;
}

/* Login */

.login-page {
	position: relative;
	z-index: 1;
	display: grid;
	place-items: center;
	min-height: 100vh;
	min-height: 100dvh;
	padding: 24px 16px;
}

.login-card {
	position: relative;
	width: min(100%, 400px);
	padding: 44px 28px 32px;
	color: var(--ink);
	text-align: center;
	background: var(--paper);
	border-radius: 18px;
	box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
}

.login-card::before {
	content: "";
	position: absolute;
	inset: 8px;
	border: 1px solid var(--gold);
	border-radius: 12px;
	pointer-events: none;
}

.login-star {
	display: block;
	width: 44px;
	height: 44px;
	margin: 0 auto 12px;
	fill: var(--gold);
}

.login-card h1 {
	margin: 0;
	color: var(--berry);
	font-size: 2.5rem;
	font-style: italic;
	font-weight: 500;
	line-height: 1.1;
}

.login-intro {
	margin: 8px 0 24px;
	color: var(--muted);
}

.login-error {
	margin: 0 0 16px;
	padding: 10px 12px;
	color: var(--berry-deep);
	background: #fbe8e6;
	border-radius: 8px;
}

.login-card form {
	position: relative;
	text-align: left;
}

.login-card form p {
	margin: 0 0 14px;
}

.login-card label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.95rem;
}

.login-card input[type="text"],
.login-card input[type="password"] {
	width: 100%;
	min-height: 48px;
	padding: 10px 12px;
	color: var(--ink);
	font: inherit;
	font-size: 1.0625rem;
	background: #fff;
	border: 1px solid #c9b9a3;
	border-radius: 10px;
}

.login-card .login-remember label {
	display: flex;
	align-items: center;
	gap: 8px;
}

.login-card .login-remember input {
	width: 20px;
	height: 20px;
	accent-color: var(--berry);
}

.login-card input[type="submit"] {
	width: 100%;
	min-height: 50px;
	color: var(--paper);
	font: inherit;
	font-size: 1.125rem;
	font-weight: 600;
	background: var(--berry);
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.2s;
}

.login-card input[type="submit"]:hover {
	background: var(--berry-deep);
}

/* Kalender */

.preview-note {
	margin: 0 0 20px;
	padding: 8px 14px;
	color: var(--ink);
	text-align: center;
	background: var(--gold-soft);
	border-radius: 8px;
}

.preview-note a {
	color: var(--berry-deep);
}

.calendar-head {
	margin-bottom: 26px;
	text-align: center;
}

.calendar-head h1 {
	margin: 0;
	color: var(--gold-soft);
	font-size: clamp(2.5rem, 9vw, 4rem);
	font-style: italic;
	font-weight: 500;
	line-height: 1.1;
}

.calendar-status {
	margin: 8px 0 0;
	font-size: 1.15rem;
}

.lights {
	height: 18px;
	margin-bottom: 10px;
	background:
		radial-gradient(circle, var(--glow) 0 3px, rgb(255 207 122 / 0.25) 4px, transparent 8px) 0 50% / 56px 18px repeat-x,
		radial-gradient(circle, #ff8d7a 0 3px, rgb(255 141 122 / 0.25) 4px, transparent 8px) 28px 50% / 56px 18px repeat-x;
	animation: lights-twinkle 3s ease-in-out infinite;
}

@keyframes lights-twinkle {
	50% {
		opacity: 0.6;
	}
}

.door-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-auto-flow: dense;
	gap: 10px;
	padding: 12px;
	background: rgb(255 255 255 / 0.05);
	border: 1px solid rgb(227 184 102 / 0.45);
	border-radius: 16px;
}

@media (min-width: 720px) {
	.door-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
		gap: 14px;
		padding: 18px;
	}
}

.door {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 4 / 5;
	padding: 0;
	color: inherit;
	font: inherit;
	background: none;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	perspective: 700px;
	-webkit-tap-highlight-color: transparent;
}

.door-inside {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: radial-gradient(circle at 50% 45%, var(--glow) 0%, #c9782e 62%, #5e2d14 100%);
	border-radius: 10px;
	box-shadow: inset 0 0 12px rgb(0 0 0 / 0.55);
}

.door-inside svg {
	width: 42%;
	fill: var(--berry-deep);
}

.door-leaf {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	border: 1px solid rgb(244 217 160 / 0.5);
	border-radius: 10px;
	box-shadow: 0 4px 10px rgb(0 0 0 / 0.35);
	transform-origin: left center;
	transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.3, 1);
	backface-visibility: hidden;
}

.door-leaf::after {
	content: "";
	position: absolute;
	inset: 5px;
	border: 1px dashed rgb(244 217 160 / 0.35);
	border-radius: 6px;
}

.door:nth-child(3n + 1) .door-leaf {
	background: linear-gradient(155deg, #a92e43, var(--berry-deep));
}

.door:nth-child(3n + 2) .door-leaf {
	background: linear-gradient(155deg, #2b6650, #173c30);
}

.door:nth-child(3n) .door-leaf {
	color: var(--berry-deep);
	background: linear-gradient(155deg, #fff6e4, #ecd9b7);
}

.door-number {
	position: relative;
	color: var(--gold-soft);
	font-size: clamp(1.6rem, 6.5vw, 2.4rem);
	font-weight: 600;
	line-height: 1;
}

.door:nth-child(3n) .door-number {
	color: var(--berry-deep);
}

.door-ornament {
	position: relative;
	flex: none;
	width: 34%;
	max-width: 26px;
	aspect-ratio: 1;
	height: auto;
	color: var(--gold-soft);
	opacity: 0.9;
}

.door:nth-child(3n) .door-ornament {
	color: var(--berry);
}

.door-decor {
	display: grid;
	aspect-ratio: 4 / 5;
	place-items: center;
	color: rgb(244 217 160 / 0.55);
	border: 1px dashed rgb(244 217 160 / 0.28);
	border-radius: 10px;
}

.door-decor svg {
	width: 44%;
	height: auto;
	aspect-ratio: 1;
}

.door-decor-wide {
	display: none;
}

@media (min-width: 720px) {
	.door-decor-wide {
		display: grid;
	}
}

.door.door-24 {
	grid-column: span 2;
	grid-row: span 2;
	aspect-ratio: auto;
	height: 100%;
}

.door.door-24 .door-leaf {
	gap: 6px;
	overflow: hidden;
	background: linear-gradient(145deg, #f7dc9b 0%, #e3b866 42%, #b98a2f 100%);
	border: 2px solid var(--gold-soft);
	box-shadow: 0 0 22px 3px rgb(255 207 122 / 0.45);
}

.door.door-24 .door-leaf::after {
	border-color: rgb(109 26 42 / 0.45);
}

.door.door-24 .door-leaf::before {
	content: "";
	position: absolute;
	inset: 0 -40%;
	background: linear-gradient(105deg, transparent 42%, rgb(255 255 255 / 0.55) 50%, transparent 58%);
	animation: door-shimmer 5s ease-in-out infinite;
}

.door.door-24 .door-ornament {
	width: 36%;
	max-width: 72px;
	color: var(--berry-deep);
}

.door.door-24 .door-number {
	color: var(--berry-deep);
	font-size: clamp(3rem, 13vw, 4.5rem);
	font-weight: 700;
}

.door.door-24.is-locked .door-leaf {
	filter: none;
}

.door.door-24 .door-inside svg {
	width: 34%;
}

@keyframes door-shimmer {
	0%, 55% {
		transform: translateX(-60%);
	}
	100% {
		transform: translateX(60%);
	}
}

.door.is-locked .door-leaf {
	filter: saturate(0.75) brightness(0.82);
}

.door.is-today .door-leaf {
	animation: today-glow 2.4s ease-in-out infinite;
}

.door.is-opened .door-leaf {
	transform: rotateY(-62deg);
}

.door.is-opening .door-leaf {
	transform: rotateY(-108deg);
}

.door.is-opened .door-leaf,
.door.is-opening .door-leaf {
	animation: none;
}

.door:not(.is-locked):not(.is-opened):hover .door-leaf {
	transform: rotateY(-14deg);
}

.door.is-shaking {
	animation: door-shake 0.4s;
}

@keyframes today-glow {
	50% {
		box-shadow: 0 0 22px 5px var(--glow);
	}
}

@keyframes door-shake {
	25% { transform: translateX(-4px); }
	75% { transform: translateX(4px); }
}

.calendar-foot {
	margin-top: 26px;
	text-align: center;
}

.calendar-foot a {
	color: var(--gold-soft);
}

.toast {
	position: fixed;
	left: 50%;
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: 5;
	width: max-content;
	max-width: calc(100% - 32px);
	padding: 10px 18px;
	color: var(--ink);
	text-align: center;
	background: var(--paper);
	border-radius: 999px;
	box-shadow: 0 10px 28px rgb(0 0 0 / 0.4);
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 10px);
	transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* Türchen-Inhalt */

.door-dialog {
	width: min(100% - 24px, 640px);
	max-height: calc(100dvh - 24px);
	padding: 0;
	color: var(--ink);
	background: var(--paper);
	border: 0;
	border-radius: 18px;
	box-shadow: 0 30px 80px rgb(0 0 0 / 0.55);
	overflow: hidden;
}

.door-dialog[open] {
	display: flex;
	flex-direction: column;
	animation: dialog-in 0.35s ease-out;
}

.door-dialog::backdrop {
	background: rgb(6 16 12 / 0.75);
}

@keyframes dialog-in {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.97);
	}
}

.dialog-head {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px 14px 22px;
	color: var(--paper);
	background: var(--berry);
}

.door-dialog.is-door-24 {
	border: 3px solid var(--gold);
}

.door-dialog.is-door-24 .dialog-head {
	color: var(--ink);
	background: linear-gradient(120deg, #e9c678, #f7dc9b 50%, #d3a650);
}

.door-dialog.is-door-24 .dialog-close {
	background: rgb(109 26 42 / 0.14);
}

.spark {
	position: absolute;
	top: -24px;
	z-index: 2;
	color: var(--gold);
	line-height: 1;
	pointer-events: none;
	animation: spark-fall linear forwards;
}

@keyframes spark-fall {
	to {
		opacity: 0;
		transform: translateY(70vh) rotate(300deg);
	}
}

.dialog-head h2 {
	margin: 0;
	font-size: 1.35rem;
	font-style: italic;
	font-weight: 500;
	line-height: 1.2;
}

.dialog-close {
	flex: none;
	width: 44px;
	height: 44px;
	color: inherit;
	font: inherit;
	font-size: 1.6rem;
	line-height: 1;
	background: rgb(255 255 255 / 0.14);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.door-content {
	padding: 22px;
	overflow-y: auto;
	overscroll-behavior: contain;
	overflow-wrap: anywhere;
}

.door-content > :first-child {
	margin-top: 0;
}

.door-content > :last-child {
	margin-bottom: 0;
}

.door-content img {
	max-width: 100%;
	height: auto;
	border-radius: 10px;
}

.door-content a {
	color: var(--berry);
}

.door-content .wp-block-file {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.door-content .wp-block-file object {
	width: 100%;
	border-radius: 10px;
}

.door-content .wp-block-file__button {
	display: inline-block;
	padding: 10px 18px;
	color: var(--paper);
	background: var(--berry);
	border-radius: 10px;
	text-decoration: none;
}

.door-empty,
.door-loading {
	color: var(--muted);
	font-style: italic;
	text-align: center;
}

@media (prefers-reduced-motion: reduce) {
	.santa-wave {
		animation: none;
	}

	.santa-big {
		animation-duration: 0.01s;
	}

	.santa-sky {
		display: none;
	}

	.door-leaf {
		transition: none;
	}

	.lights,
	.door.door-24 .door-leaf::before,
	.door.is-today .door-leaf,
	.door.is-shaking,
	.door-dialog[open] {
		animation: none;
	}

	.door.is-today .door-leaf {
		box-shadow: 0 0 16px 4px var(--glow);
	}
}
