/* ======================================================
   DROP CAP SYSTEM
   Decorative glyphs, corruption states, sigils, book themes
   ====================================================== */

:root {
	--dropcap-bg: #8B1E2D;
	--dropcap-color: #E5E7EB;
}

/* ===============================
   MANUAL H1 DROP CAP
   =============================== */

.dropcap-h1 {
	float: left;
	background: #8B1E2D;
	color: #E5E7EB;
	font-family: "Cinzel Decorative", serif;
	font-size: clamp(3.5rem, 4vw, 4.25rem);
	font-weight: 700;
	line-height: 1;
	padding: 0.55em 0.6em;
	margin: 0.1em 0.6em 0 0;
	border-radius: 4px;
	text-transform: uppercase;
	box-shadow:
		inset 0 0 0 1px rgba(255,255,255,0.08),
		0 0 0 1px rgba(198,169,107,0.25);
}

/* ===============================
   AUTO DROP CAP
   =============================== */

.has-dropcap {
	position: relative;
}

.has-dropcap::first-letter {
	float: left;
	font-family: "Cinzel Decorative", serif;
	font-weight: 700;
	text-transform: uppercase;
	font-size: clamp(2.6rem, 2.8vw, 3.05rem);
	line-height: 0.95;
	padding: 0.35em 0.45em;
	margin: 0.08em 0.45em 0 0;
	border-radius: 4px;
	background: var(--dropcap-bg);
	color: var(--dropcap-color);
	box-shadow:
		inset 0 0 0 1px rgba(255,255,255,0.08),
		0 0 0 1px rgba(0,0,0,0.25);
	opacity: 0;
	transform: translateY(6px);
	transition:
		opacity 0.6s ease,
		transform 0.6s ease,
		filter 0.6s ease,
		text-shadow 0.6s ease,
		box-shadow 0.35s ease;
}

.has-dropcap.is-visible::first-letter {
	opacity: 1;
	transform: translateY(0);
}

/* ===============================
   BOOK COLOR THEMES
   =============================== */

.book-awakening {
	--dropcap-bg: #1C1F26;
	--dropcap-color: #C7D2FE;
}

.book-descent {
	--dropcap-bg: #4B1D1D;
	--dropcap-color: #E6E1D8;
}

.book-bloodmoon {
	--dropcap-bg: linear-gradient(145deg, #6F1622, #A32035);
	--dropcap-color: #F1EAEA;
}

.book-awakening .has-dropcap::first-letter {
	letter-spacing: -0.03em;
}

.book-bloodmoon .has-dropcap::first-letter {
	background-size: 200% 200%;
	animation: bloodmoon-flow 6s ease infinite;
}

@keyframes bloodmoon-flow {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}

/* ===============================
   CODEX DROP CAP
   =============================== */

.codex-entry .has-dropcap::first-letter {
	border-radius: 0;
	padding: 0.6em 0.65em;
	font-family: "Cinzel", serif;
	box-shadow:
		inset 0 0 0 2px rgba(199,210,254,0.35),
		0 0 0 1px rgba(0,0,0,0.4);
}

/* ===============================
   LOCKED / CORRUPTED
   =============================== */

.veil-locked .has-dropcap::first-letter {
	cursor: help;
	filter: blur(2px) saturate(1.4);
	text-shadow:
		0 0 6px rgba(163,32,53,0.6),
		0 0 14px rgba(163,32,53,0.35);
	background: #2A0F14;
	animation: pulse-corruption 2.5s infinite;
}

@keyframes pulse-corruption {
	0%,100% { opacity: 0.7; }
	50% { opacity: 1; }
}

.veil-locked .has-dropcap::after {
	content: "Enter the Veil to unbind this glyph";
	position: absolute;
	left: 0;
	top: 100%;
	margin-top: 6px;
	padding: 6px 10px;
	font-size: 0.75rem;
	white-space: nowrap;
	background: rgba(15,15,20,0.95);
	color: #E5E7EB;
	border-radius: 4px;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-4px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	z-index: 20;
}

.veil-locked .has-dropcap:hover::after {
	opacity: 1;
	transform: translateY(0);
}

/* ===============================
   TIERED HEALING / CORRUPTION
   =============================== */

.veil-tier-initiate .has-dropcap::first-letter {
	filter: blur(2.5px) saturate(1.6) contrast(1.2);
	text-shadow:
		0 0 10px rgba(163,32,53,0.6),
		0 0 18px rgba(163,32,53,0.4);
}

.veil-tier-acolyte .has-dropcap::first-letter {
	filter: blur(1px) saturate(1.2);
	text-shadow:
		0 0 6px rgba(163,32,53,0.3);
}

.veil-tier-ascendant .has-dropcap::first-letter {
	filter: none;
	text-shadow: none;
	animation: glyph-stabilize 0.6s ease forwards;
}

@keyframes glyph-stabilize {
	from { opacity: 0.85; }
	to { opacity: 1; }
}

/* ===============================
   MUTATION STATES
   =============================== */

.has-dropcap.mutate-1::first-letter,
.chapter-corruption-low .has-dropcap::first-letter {
	filter: none;
}

.has-dropcap.mutate-2::first-letter,
.chapter-corruption-mid .has-dropcap::first-letter {
	filter: saturate(1.15);
	text-shadow: 0 0 4px rgba(163,32,53,0.25);
}

.has-dropcap.mutate-3::first-letter,
.chapter-corruption-high .has-dropcap::first-letter {
	filter: blur(1.2px) saturate(1.4);
	text-shadow:
		0 0 8px rgba(163,32,53,0.5),
		0 0 16px rgba(163,32,53,0.3);
}

/* ===============================
   ARTIFACT SIGILS
   =============================== */

.sigil-nocturnum .has-dropcap::first-letter {
	border-radius: 0;
	background: radial-gradient(circle at top left, #0F172A, #020617);
	box-shadow:
		inset 0 0 0 2px rgba(148,163,184,0.35),
		0 0 14px rgba(15,23,42,0.6);
}

.sigil-codex .has-dropcap::first-letter {
	background: linear-gradient(145deg, #3F2E1E, #1F140B);
	color: #F5E8C7;
	box-shadow:
		inset 0 0 0 1px rgba(245,232,199,0.45);
}

.sigil-cradle .has-dropcap::first-letter {
	background: linear-gradient(135deg, #1B4332, #081C15);
	color: #D8F3DC;
	box-shadow:
		0 0 12px rgba(64,145,108,0.45);
}

/* ===============================
   SIGIL FRACTURE
   =============================== */

.codex-entry[class*="sigil-"] .has-dropcap::first-letter {
	transition:
		transform 0.35s ease,
		box-shadow 0.35s ease,
		background-size 0.35s ease;
}

.codex-entry[class*="sigil-"] .has-dropcap:hover::first-letter {
	transform: scale(1.05) rotate(-0.8deg);
	background-size: 120% 120%;
	box-shadow:
		inset 0 0 0 2px rgba(255,255,255,0.25),
		0 0 20px rgba(163,32,53,0.45);
}

/* ===============================
   BLOOD MOON STATES
   =============================== */

.blood-moon-active .has-dropcap::first-letter {
	box-shadow:
		inset 0 0 0 1px rgba(255,255,255,0.15),
		0 0 16px rgba(163,32,53,0.5);
	animation: bloodmoon-pulse 3.5s ease-in-out infinite;
}

@keyframes bloodmoon-pulse {
	0%,100% { opacity: 0.85; }
	50% { opacity: 1; }
}

.blood-moon-active.veil-tier-ascendant .has-dropcap::first-letter {
	animation: none;
	box-shadow:
		0 0 12px rgba(199,210,254,0.55);
}

.blood-moon-active.veil-tier-initiate .has-dropcap::first-letter {
	filter: blur(2px) saturate(1.8);
}

/* ===============================
   AWAKENING / CONVERGENCE
   =============================== */

.veil-awakening {
	animation: veil-dim 1.2s ease forwards;
}

@keyframes veil-dim {
	from { filter: none; }
	to { filter: brightness(0.85) saturate(1.1); }
}

.veil-awakening .has-dropcap::first-letter {
	filter: none !important;
	text-shadow: none !important;
	background-blend-mode: normal;
	animation: glyph-heal 1.8s ease forwards;
	box-shadow:
		0 0 18px rgba(199,210,254,0.45);
}

@keyframes glyph-heal {
	0% {
		filter: blur(2px) saturate(1.6);
		text-shadow:
			0 0 12px rgba(163,32,53,0.7);
	}
	100% {
		filter: none;
		text-shadow: none;
	}
}

.veil-convergence .has-dropcap::first-letter {
	animation: convergence-pulse 4s ease-in-out infinite;
	box-shadow:
		0 0 22px rgba(163,32,53,0.7),
		0 0 40px rgba(199,210,254,0.35);
}

@keyframes convergence-pulse {
	0%,100% { opacity: 0.85; }
	50% { opacity: 1; }
}

.veil-singular .has-dropcap::first-letter {
	animation: singular-breath 7s ease-in-out infinite;
}

@keyframes singular-breath {
	0%,100% { opacity: 0.85; }
	50% {
		opacity: 1;
		text-shadow:
			0 0 24px rgba(199,210,254,0.6),
			0 0 42px rgba(163,32,53,0.45);
	}
}

/* ===============================
   SIGIL SCARS
   =============================== */

.veil-sigil-scar {
	position: relative;
}

.veil-sigil-scar::after {
	font-family: Cinzel, serif;
	position: absolute;
	top: -6px;
	right: -10px;
	font-size: 0.85rem;
	opacity: 0.35;
	filter: drop-shadow(0 0 6px rgba(199,210,254,0.35));
}

.sigil-scar-awakening::after {
	content: "⟁";
	color: #C7D2FE;
}

.sigil-scar-descent::after {
	content: "⟁⟐";
	color: #E6E1D8;
	letter-spacing: -0.2em;
}

.sigil-scar-bloodmoon::after {
	content: "⟁✶";
	color: #A32035;
	text-shadow: 0 0 8px rgba(163,32,53,0.6);
}

/* ===============================
   ACCESSIBILITY
   =============================== */

@media (prefers-reduced-motion: reduce) {
	.has-dropcap::first-letter,
	.book-bloodmoon .has-dropcap::first-letter,
	.veil-locked .has-dropcap::first-letter,
	.blood-moon-active .has-dropcap::first-letter,
	.veil-awakening,
	.veil-awakening .has-dropcap::first-letter,
	.veil-convergence .has-dropcap::first-letter,
	.veil-singular .has-dropcap::first-letter {
		animation: none !important;
		transition-duration: 0.001ms !important;
	}
}