/* STAGE 2: MAIN CHRISTMAS TREE */
.tree-stage {
	position: relative;
	z-index: 10;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 18px 16px 24px;
	opacity: 0;
	transform: scale(0.97);
	transition: opacity 1s var(--ease-cinematic), transform 1.1s var(--ease-cinematic);
}

.tree-stage.is-revealed {
	opacity: 1;
	transform: scale(1);
}

/* Header */
.main-header {
	position: relative;
	z-index: 20;
	width: min(1120px, 100%);
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 12px;
	padding-top: 12px;
}

.main-header__left {
	display: flex;
	align-items: center;
}

.main-header__center {
	text-align: center;
}

.main-header__right {
	display: flex;
	justify-content: flex-end;
}

.site-title {
	margin: 0;
	font-family: var(--font-serif);
	font-size: clamp(1.35rem, 3.2vw, 2.15rem);
	font-weight: 700;
	letter-spacing: 0.03em;
	color: var(--snow-white);
	text-shadow: 0 2px 18px rgba(214, 173, 85, 0.35);
}

.kst-clock {
	margin: 4px 0 0;
	font-size: 0.82rem;
	color: var(--xmas-gold-light);
	letter-spacing: 0.05em;
}

/* Gift Box Icon Button */
.gift-box-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px 8px 10px;
	border-radius: 999px;
	border: 1.5px solid rgba(214, 173, 85, 0.72);
	background: linear-gradient(145deg, rgba(20, 62, 44, 0.92), rgba(10, 34, 24, 0.95));
	color: var(--snow-white);
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36);
	transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s ease;
}

.gift-box-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45), 0 0 18px rgba(214, 173, 85, 0.35);
}

.gift-box-btn__label {
	font-size: 0.88rem;
	font-weight: 600;
}

.gift-box-btn__count {
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--xmas-gold);
	color: #2c1c07;
	font-family: var(--font-cute);
	font-size: 0.82rem;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* Legend */
.status-legend {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.legend-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px;
	border-radius: 999px;
	background: rgba(11, 38, 27, 0.72);
	border: 1px solid rgba(255, 253, 247, 0.16);
	font-size: 0.76rem;
	color: rgba(255, 253, 247, 0.85);
}

.legend-chip::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

.legend-chip--available::before {
	background: var(--xmas-gold-light);
	box-shadow: 0 0 8px var(--xmas-gold-light);
}

.legend-chip--expired::before {
	background: var(--xmas-red-soft);
	box-shadow: 0 0 6px rgba(184, 32, 37, 0.8);
}

/* Tree Viewport */
.tree-viewport {
	flex: 1;
	display: grid;
	place-items: center;
	padding: 12px 0;
}

.tree-wrapper {
	position: relative;
	width: min(96vw, 680px);
	aspect-ratio: 680 / 820;
	margin: 0 auto;
	user-select: none;
}

.tree-svg {
	width: 100%;
	height: 100%;
	display: block;
	filter: drop-shadow(0 28px 45px rgba(4, 14, 10, 0.7));
}

/* Ornament / Envelope Layer */
.ornaments-layer {
	position: absolute;
	inset: 0;
}

.tree-node {
	position: absolute;
	transform: translate(-50%, -50%);
	background: transparent;
	border: 0;
	padding: 0;
	display: grid;
	place-items: center;
	transition: transform 0.28s var(--ease-bounce), filter 0.28s ease;
}

.tree-node:hover {
	z-index: 25;
	transform: translate(-50%, -50%) scale(1.12);
}

.tree-node:active {
	transform: translate(-50%, -50%) scale(0.97);
}

/* Kraft Gift Envelope on Tree */
.mini-envelope {
	position: relative;
	width: clamp(44px, 7.2vw, 60px);
	height: clamp(34px, 5.6vw, 46px);
	border-radius: 6px;
	background: linear-gradient(155deg, var(--kraft-light) 0%, var(--kraft-base) 58%, var(--kraft-dark) 100%);
	border: 1.5px solid rgba(114, 78, 35, 0.75);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 253, 247, 0.45);
	display: grid;
	place-items: center;
	overflow: visible;
}

/* Envelope flap lines */
.mini-envelope::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 55%;
	background: linear-gradient(180deg, rgba(255, 248, 232, 0.55), rgba(190, 152, 98, 0.35));
	clip-path: polygon(0 0, 100% 0, 50% 100%);
	border-bottom: 1px solid rgba(120, 82, 36, 0.45);
	transition: transform 0.35s ease;
	transform-origin: top center;
}

/* Twine ribbon */
.mini-envelope::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 5px;
	background: linear-gradient(90deg, transparent 45%, rgba(184, 32, 37, 0.75) 45%, rgba(184, 32, 37, 0.75) 55%, transparent 55%);
	pointer-events: none;
	opacity: 0.75;
}

.mini-envelope__seal {
	position: relative;
	z-index: 2;
	width: clamp(22px, 3.6vw, 28px);
	height: clamp(22px, 3.6vw, 28px);
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #d94146, #B82025 65%, #7a1114 100%);
	border: 1.5px solid var(--xmas-gold-light);
	color: var(--snow-white);
	font-family: var(--font-serif);
	font-size: clamp(0.72rem, 1.5vw, 0.92rem);
	font-weight: 700;
	display: grid;
	place-items: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* STATE: LOCKED */
.tree-node--locked .mini-envelope {
	filter: saturate(0.72) brightness(0.88);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 253, 247, 0.14);
}

.tree-node--locked .mini-envelope__seal {
	background: radial-gradient(circle at 35% 30%, #6d7f76, #3d5248 75%);
	border-color: rgba(255, 253, 247, 0.6);
	color: var(--snow-white);
}

.node-lock-pip {
	position: absolute;
	top: -7px;
	right: -6px;
	z-index: 4;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: rgba(15, 40, 30, 0.92);
	border: 1px solid rgba(255, 253, 247, 0.55);
	font-size: 9px;
	display: grid;
	place-items: center;
}

/* STATE: AVAILABLE (TODAY!) */
.tree-node--available {
	z-index: 15;
	animation: envelope-invite 2.4s ease-in-out infinite;
}

.tree-node--available .mini-envelope {
	border-color: var(--xmas-gold-light);
	box-shadow:
		0 0 22px rgba(243, 220, 155, 0.85),
		0 0 42px rgba(214, 173, 85, 0.48),
		0 8px 18px rgba(0, 0, 0, 0.5);
}

.tree-node--available .mini-envelope__seal {
	background: radial-gradient(circle at 35% 30%, #f5df9c, #D6AD55 70%, #9b701e 100%);
	color: #362105;
	border-color: #fffdf7;
}

.node-sparkle {
	position: absolute;
	top: -10px;
	left: -8px;
	font-size: 13px;
	color: var(--xmas-gold-light);
	text-shadow: 0 0 10px #fff;
	animation: sparkle-spin 2.2s linear infinite;
	pointer-events: none;
}

@keyframes envelope-invite {
	0%, 100% { transform: translate(-50%, -50%) rotate(-3deg) scale(1.03); }
	50% { transform: translate(-50%, -56%) rotate(3.5deg) scale(1.09); }
}

@keyframes sparkle-spin {
	0%, 100% { transform: scale(0.9) rotate(0deg); opacity: 0.8; }
	50% { transform: scale(1.25) rotate(180deg); opacity: 1; }
}

/* STATE: OPENED (Today already opened) */
.tree-node--opened .mini-envelope::before {
	transform: rotateX(155deg);
}

.tree-node--opened .mini-envelope {
	border-color: var(--xmas-gold);
	box-shadow: 0 0 16px rgba(214, 173, 85, 0.42), 0 6px 14px rgba(0, 0, 0, 0.45);
}

.node-check-pip {
	position: absolute;
	bottom: -6px;
	right: -6px;
	z-index: 4;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--forest-green);
	border: 1.5px solid var(--xmas-gold-light);
	color: var(--xmas-gold-light);
	font-size: 10px;
	font-weight: 700;
	display: grid;
	place-items: center;
}

/* STATE: EXPIRED (Past date transformed into a NEW Christmas Ornament!) */
.tree-ornament {
	position: relative;
	width: clamp(38px, 6.2vw, 52px);
	height: clamp(38px, 6.2vw, 52px);
	display: grid;
	place-items: center;
	animation: ornament-sway 4.2s ease-in-out infinite;
}

.tree-ornament::before {
	content: "";
	position: absolute;
	top: -6px;
	left: 50%;
	transform: translateX(-50%);
	width: 10px;
	height: 7px;
	border-radius: 2px 2px 0 0;
	background: linear-gradient(90deg, #b2862e, #f3dc9b, #9c7524);
	box-shadow: 0 -4px 0 -3px var(--xmas-gold-light);
}

.tree-ornament__body {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-family: var(--font-serif);
	font-size: clamp(0.76rem, 1.5vw, 0.92rem);
	font-weight: 700;
	color: var(--snow-white);
	border: 1.5px solid rgba(243, 220, 155, 0.8);
	box-shadow:
		inset -6px -8px 14px rgba(0, 0, 0, 0.42),
		inset 4px 5px 10px rgba(255, 253, 247, 0.35),
		0 6px 14px rgba(0, 0, 0, 0.45);
}

.tree-ornament--red .tree-ornament__body {
	background: radial-gradient(circle at 32% 28%, #eb6064, #B82025 55%, #660d10 100%);
}

.tree-ornament--gold .tree-ornament__body {
	background: radial-gradient(circle at 32% 28%, #fff1be, #D6AD55 58%, #876015 100%);
	color: #3a2305;
}

.tree-ornament--green .tree-ornament__body {
	background: radial-gradient(circle at 32% 28%, #3fa176, #174B35 58%, #0a2419 100%);
}

.tree-ornament--bell .tree-ornament__body {
	border-radius: 45% 45% 24% 24%;
	background: radial-gradient(circle at 32% 25%, #fff0b8, #D6AD55 62%, #7d5814 100%);
	color: #3a2305;
}

@keyframes ornament-sway {
	0%, 100% { transform: rotate(-2deg); }
	50% { transform: rotate(2deg); }
}

/* DEC 25 TOP STAR ORNAMENT */
.tree-star-btn {
	position: absolute;
	top: 5.5%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: clamp(68px, 11vw, 96px);
	height: clamp(68px, 11vw, 96px);
	background: transparent;
	border: 0;
	padding: 0;
	display: grid;
	place-items: center;
	z-index: 22;
	transition: transform 0.35s var(--ease-bounce);
}

.tree-star-btn:hover {
	transform: translate(-50%, -50%) scale(1.12);
}

.tree-star-btn__halo {
	position: absolute;
	inset: -14px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(243, 220, 155, 0.55), transparent 70%);
	opacity: 0.45;
	pointer-events: none;
}

.tree-star-btn--available .tree-star-btn__halo {
	opacity: 1;
	animation: star-pulse 2s ease-in-out infinite;
}

.tree-star-btn--available svg {
	filter: drop-shadow(0 0 18px rgba(243, 220, 155, 0.95));
}

.tree-star-btn__day {
	position: absolute;
	font-family: var(--font-serif);
	font-size: clamp(0.75rem, 1.4vw, 0.92rem);
	font-weight: 700;
	color: #3f2704;
	pointer-events: none;
}

@keyframes star-pulse {
	0%, 100% { transform: scale(0.95); opacity: 0.72; }
	50% { transform: scale(1.22); opacity: 1; }
}

/* Footer */
.main-footer {
	text-align: center;
	padding-top: 8px;
}

.main-footer p {
	margin: 0;
	font-size: 0.82rem;
	color: rgba(255, 253, 247, 0.72);
}

/* Mobile adjustments */
@media (max-width: 720px) {
	.main-header {
		grid-template-columns: 1fr;
		justify-items: center;
		gap: 8px;
	}

	.main-header__left {
		order: 2;
	}

	.main-header__center {
		order: 1;
	}

	.main-header__right {
		order: 3;
		justify-content: center;
	}

	.tree-wrapper {
		width: min(98vw, 460px);
	}
}
