/**
 * Energy Daily Card — front-end styles.
 *
 * Brand: graphite base, blue glow, gold accents, mystical/ancient feel.
 * All selectors are namespaced under .edc-* so the active theme can override.
 * Custom properties expose the palette for easy theming.
 */

.edc-card-wrap {
	--edc-graphite: #16181d;
	--edc-graphite-2: #1f232b;
	--edc-graphite-3: #2a2f3a;
	--edc-blue: #4aa3ff;
	--edc-blue-glow: rgba(74, 163, 255, 0.55);
	--edc-gold: #d8b15a;
	--edc-gold-soft: #f0d28a;
	--edc-text: #e8eaf0;
	--edc-muted: #aab0bd;

	--edc-card-w: 300px;
	--edc-card-ratio: 1.55; /* height / width */
	--edc-radius: 16px;

	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	margin: 1.5rem auto;
	max-width: 100%;
	font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- Card shell + 3D flip ---- */

.edc-card {
	width: var(--edc-card-w);
	max-width: 86vw;
	aspect-ratio: 1 / var(--edc-card-ratio);
	perspective: 1400px;
	cursor: pointer;
	outline: none;
	border: 0;
	background: transparent;
	-webkit-tap-highlight-color: transparent;
}

.edc-card:focus-visible {
	outline: 2px solid var(--edc-blue);
	outline-offset: 6px;
	border-radius: var(--edc-radius);
}

.edc-card__inner {
	position: relative;
	width: 100%;
	height: 100%;
	transition: transform 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
	transform-style: preserve-3d;
	will-change: transform;
}

.edc-card.is-flipped .edc-card__inner {
	transform: rotateY(180deg);
}

.edc-card__back,
.edc-card__face {
	position: absolute;
	inset: 0;
	border-radius: var(--edc-radius);
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	overflow: hidden;
}

.edc-card__face {
	transform: rotateY(180deg);
	background:
		radial-gradient(120% 90% at 50% 0%, var(--edc-graphite-3) 0%, var(--edc-graphite) 60%),
		var(--edc-graphite);
	border: 1px solid rgba(216, 177, 90, 0.35);
	box-shadow:
		0 18px 50px rgba(0, 0, 0, 0.55),
		0 0 0 1px rgba(74, 163, 255, 0.08) inset;
	display: flex;
	flex-direction: column;
}

/* ---- Loading hint on the card ---- */

.edc-card.is-loading {
	cursor: progress;
}

.edc-card.is-loading .edc-card__back-inner::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.25);
	animation: edc-pulse 1s ease-in-out infinite;
}

@keyframes edc-pulse {
	0%, 100% { opacity: 0.25; }
	50% { opacity: 0.6; }
}

/* ---- Card back ---- */

.edc-card__back-inner {
	position: relative;
	width: 100%;
	height: 100%;
	border-radius: var(--edc-radius);
	border: 1px solid rgba(216, 177, 90, 0.4);
	box-shadow:
		0 18px 50px rgba(0, 0, 0, 0.55),
		0 0 28px var(--edc-blue-glow);
}

.edc-card__back-inner--image .edc-card__back-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: var(--edc-radius);
}

.edc-card__back-inner--deco {
	display: flex;
	align-items: center;
	justify-content: center;
	background:
		radial-gradient(60% 60% at 50% 45%, rgba(74, 163, 255, 0.18) 0%, rgba(74, 163, 255, 0) 70%),
		repeating-linear-gradient(45deg, rgba(216, 177, 90, 0.05) 0 2px, transparent 2px 10px),
		linear-gradient(160deg, var(--edc-graphite-2) 0%, var(--edc-graphite) 100%);
	overflow: hidden;
}

/* Ornamental frame */
.edc-card__back-inner--deco::before {
	content: "";
	position: absolute;
	inset: 14px;
	border: 1px solid rgba(216, 177, 90, 0.5);
	border-radius: calc(var(--edc-radius) - 6px);
	box-shadow: 0 0 18px rgba(216, 177, 90, 0.15) inset;
}

/* Central glowing sigil */
.edc-card__sigil {
	position: relative;
	width: 96px;
	height: 96px;
	border-radius: 50%;
	background:
		radial-gradient(circle at 50% 50%, var(--edc-gold-soft) 0%, var(--edc-gold) 35%, rgba(216, 177, 90, 0) 70%);
	box-shadow: 0 0 36px var(--edc-blue-glow);
	animation: edc-breathe 4.5s ease-in-out infinite;
}

.edc-card__sigil::before {
	content: "✶";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 44px;
	color: var(--edc-graphite);
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.edc-card__rune {
	position: absolute;
	color: var(--edc-gold-soft);
	font-size: 20px;
	opacity: 0.75;
	text-shadow: 0 0 10px var(--edc-blue-glow);
	top: 28px;
	left: 28px;
	animation: edc-twinkle 3s ease-in-out infinite;
}

.edc-card__rune--b {
	top: auto;
	left: auto;
	right: 28px;
	bottom: 28px;
	animation-delay: 1.5s;
}

@keyframes edc-breathe {
	0%, 100% { transform: scale(1); filter: brightness(1); }
	50% { transform: scale(1.06); filter: brightness(1.15); }
}

@keyframes edc-twinkle {
	0%, 100% { opacity: 0.3; }
	50% { opacity: 0.9; }
}

/* ---- Card face content ---- */

.edc-card__face-inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 18px 18px 20px;
	overflow-y: auto;
	color: var(--edc-text);
}

.edc-card__image-wrap {
	border-radius: 10px;
	overflow: hidden;
	margin-bottom: 12px;
	box-shadow: 0 0 20px var(--edc-blue-glow);
	flex: 0 0 auto;
}

.edc-card__image {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
}

.edc-card__title {
	font-family: "Spectral", Georgia, "Times New Roman", serif;
	font-size: 1.4rem;
	line-height: 1.2;
	margin: 0 0 8px;
	color: var(--edc-gold-soft);
	text-align: center;
	letter-spacing: 0.02em;
}

.edc-card__meaning {
	font-size: 0.95rem;
	line-height: 1.6;
	color: var(--edc-muted);
	text-align: center;
	flex: 1 1 auto;
}

.edc-card__meaning p {
	margin: 0 0 0.6em;
}

.edc-card__cta {
	margin: 14px 0 0;
	text-align: center;
	flex: 0 0 auto;
}

.edc-card__button {
	display: inline-block;
	text-decoration: none;
	font-family: "Inter", system-ui, sans-serif;
	font-weight: 600;
	font-size: 0.9rem;
	letter-spacing: 0.02em;
	padding: 10px 20px;
	border-radius: 999px;
	color: var(--edc-graphite);
	background: linear-gradient(135deg, var(--edc-gold-soft), var(--edc-gold));
	box-shadow: 0 6px 18px rgba(216, 177, 90, 0.35), 0 0 18px var(--edc-blue-glow);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.edc-card__button:hover,
.edc-card__button:focus {
	transform: translateY(-1px);
	box-shadow: 0 8px 24px rgba(216, 177, 90, 0.45), 0 0 26px var(--edc-blue-glow);
	color: var(--edc-graphite);
}

.edc-card__notice {
	color: var(--edc-muted);
	text-align: center;
	margin: auto;
	font-size: 0.95rem;
	padding: 1rem;
}

/* ---- Hint + empty state ---- */

.edc-card__hint {
	margin: 0;
	font-size: 0.85rem;
	color: var(--edc-muted);
	letter-spacing: 0.03em;
}

.edc-card.is-flipped ~ .edc-card__hint,
.edc-card-wrap:has(.edc-card.is-flipped) .edc-card__hint {
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease;
}

.edc-card-wrap--empty {
	padding: 2rem 1rem;
}

/* ---- Hover lift on the closed card ---- */

@media (hover: hover) {
	.edc-card:not(.is-flipped):hover .edc-card__inner {
		transform: translateY(-4px) rotateY(0deg);
	}
}

/* ---- Responsive ---- */

@media (max-width: 480px) {
	.edc-card-wrap {
		--edc-card-w: 260px;
	}
	.edc-card__title {
		font-size: 1.25rem;
	}
}

/* ---- Reduced motion: no 3D flip, just reveal the face ---- */

@media (prefers-reduced-motion: reduce) {
	.edc-card__inner {
		transition: none;
		transform-style: flat;
	}
	.edc-card.is-flipped .edc-card__inner {
		transform: none;
	}
	.edc-card__back,
	.edc-card__face {
		-webkit-backface-visibility: visible;
		backface-visibility: visible;
	}
	.edc-card__face {
		transform: none;
		opacity: 0;
		visibility: hidden;
		position: absolute;
	}
	.edc-card.is-flipped .edc-card__face {
		position: relative;
		opacity: 1;
		visibility: visible;
	}
	.edc-card.is-flipped .edc-card__back {
		opacity: 0;
		visibility: hidden;
	}
	.edc-card__sigil,
	.edc-card__rune,
	.edc-card.is-loading .edc-card__back-inner::after {
		animation: none;
	}
}
