@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Tibetan:wght@300;400&family=Crimson+Pro:ital,wght@0,300;0,400;1,300&display=swap');

:root {
	--bg:       #0f0e17;
	--bg-nav:   #12111c;
	--gold:     #c9a227;
	--gold-dim: rgba(201, 162, 39, 0.25);
	--text:     #fffffe;
	--muted:    #a7a9be;
	--nav-h:    100px;
}

html.light {
	--bg:       #faf7f0;
	--bg-nav:   #ede8df;
	--gold:     #8b6510;
	--gold-dim: rgba(139, 101, 16, 0.2);
	--text:     #1a1714;
	--muted:    #6b6055;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
	background: var(--bg);
	color: var(--text);
	overflow: hidden;
	height: 100vh;
}

/* ── CONTENT AREA ── */

#body_div {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: calc(100vh - var(--nav-h));
	padding: 1.5rem 0.25rem;
	text-align: center;
	animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ── TARA IMAGE ── */

#tara_image { margin-bottom: 1.5rem; }

#tara_image img {
	max-height: min(28vh, 200px);
	width: auto;
	max-width: 160px;
	border-radius: 10px;
	box-shadow: 0 0 40px var(--gold-dim), 0 8px 24px rgba(0,0,0,0.6);
}

#tara_image.edit img {
	max-height: 100px;
	max-width: 100px;
}

/* ── TEXT ── */

#text_paragraph {
	transition: opacity 0.28s ease-out;
	will-change: opacity;
	max-width: 640px;
	width: 100%;
}

#text_paragraph.fading { opacity: 0; }

p.tibetan, p.edit {
	font-family: 'Noto Serif Tibetan', serif;
	font-weight: 300;
	font-size: clamp(1rem, 4.5vw, 1.65rem);
	line-height: 2;
	padding: 0;
}

p.phonetic {
	font-family: 'Crimson Pro', Georgia, serif;
	font-style: italic;
	font-size: clamp(1.1rem, 4vw, 1.8rem);
	line-height: 1.9;
	padding: 0 1rem;
}

p.french {
	font-family: 'Crimson Pro', Georgia, serif;
	font-size: clamp(0.95rem, 2.8vw, 1.25rem);
	line-height: 1.8;
	padding: 0 1rem;
}

p.w4w {
	font-family: 'Noto Serif Tibetan', serif;
	font-weight: 300;
	font-size: clamp(1.1rem, 4.5vw, 1.8rem);
	line-height: 2.5;
	padding: 0 0.5rem;
}

p.phonetic_w4w {
	font-family: 'Crimson Pro', Georgia, serif;
	font-style: italic;
	font-size: clamp(1rem, 3.5vw, 1.5rem);
	line-height: 2.7;
	padding: 0 1rem;
}

/* ── ABBR / TOOLTIP ── */

abbr {
	text-decoration: none;
	border: none;
	border-bottom: 1px dotted rgba(201, 162, 39, 0.35);
	color: #e8c96a;
	cursor: help;
	transition: color 0.15s;
}

abbr:hover { color: #fff; }

html.light abbr {
	color: var(--gold);
	border-bottom-color: rgba(139, 101, 16, 0.4);
}

html.light abbr:hover { color: var(--text); }

.tooltip {
	position: absolute;
	background: var(--bg-nav);
	border: 1px solid var(--gold);
	border-radius: 6px;
	color: var(--text);
	font-family: 'Crimson Pro', Georgia, serif;
	font-size: 0.95rem;
	padding: 4px 12px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.5);
	pointer-events: none;
	z-index: 200;
	white-space: nowrap;
}

/* ── BOTTOM NAV ── */

#bottom-nav {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	height: var(--nav-h);
	background: var(--bg-nav);
	border-top: 1px solid var(--gold-dim);
	display: flex;
	flex-direction: column;
	z-index: 100;
}

#nav-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.5rem;
	padding: 6px 0;
	border-bottom: 1px solid rgba(255,255,255,0.04);
}

.nav-arrow {
	background: none;
	border: 1px solid var(--gold-dim);
	border-radius: 50%;
	width: 30px;
	height: 30px;
	color: var(--gold);
	font-size: 1rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 0.2s, background 0.2s;
	line-height: 1;
}

.nav-arrow:hover {
	border-color: var(--gold);
	background: var(--gold-dim);
}

#page_number {
	font-family: 'Crimson Pro', Georgia, serif;
	font-size: 0.85rem;
	color: var(--muted);
	min-width: 55px;
	text-align: center;
	letter-spacing: 0.05em;
}

#nav-modes {
	display: flex;
	justify-content: space-around;
	align-items: center;
	flex: 1;
	padding: 0 4px;
}

.mode-btn {
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 4px 6px;
	border-radius: 8px;
	transition: color 0.2s, background 0.2s;
	font-family: 'Crimson Pro', Georgia, serif;
	font-size: 0.8rem;
	letter-spacing: 0.03em;
	min-width: 46px;
}

.mode-btn img {
	width: 20px;
	height: 20px;
	filter: brightness(0) invert(1);
	opacity: 0.4;
	transition: opacity 0.2s, filter 0.2s;
}

.mode-btn.active {
	color: var(--gold);
}

.mode-btn.active img {
	opacity: 1;
	filter: brightness(0) invert(1) sepia(1) saturate(4) hue-rotate(5deg);
}

.mode-btn:hover:not(.active) {
	background: rgba(255,255,255,0.04);
	color: var(--text);
}

.mode-btn:hover:not(.active) img {
	opacity: 0.65;
	filter: grayscale(0.4) brightness(1.3);
}

/* ── LIGHT MODE ICON ADJUSTMENTS ── */

html.light .mode-btn img {
	filter: brightness(0);
	opacity: 0.35;
}

html.light .mode-btn.active img {
	opacity: 1;
	filter: brightness(0) sepia(1) saturate(3) hue-rotate(5deg);
}

html.light .mode-btn:hover:not(.active) img {
	opacity: 0.6;
	filter: brightness(0) opacity(0.6);
}

/* ── THEME TOGGLE ── */

#theme-toggle {
	position: fixed;
	top: 10px;
	right: 12px;
	width: 28px;
	height: 28px;
	background: none;
	border: none;
	cursor: pointer;
	opacity: 0.22;
	transition: opacity 0.2s;
	z-index: 200;
	font-size: 1.1rem;
	line-height: 1;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

#theme-toggle::before {
	content: '☾';
	color: var(--text);
}

html.light #theme-toggle::before {
	content: '☀';
}

#theme-toggle:hover {
	opacity: 0.75;
}

/* ── SPLASH SCREEN ── */

#splash {
	position: fixed;
	inset: 0;
	background: var(--bg);
	z-index: 500;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 1.8rem;
	transition: opacity 0.7s ease;
}

#splash.out {
	opacity: 0;
	pointer-events: none;
}

#splash-lotus {
	width: 110px;
	height: 110px;
	animation: lotus-breathe 3s ease-in-out infinite;
}

@keyframes lotus-breathe {
	0%, 100% { transform: scale(1);    opacity: 0.75; }
	50%       { transform: scale(1.07); opacity: 1;    }
}

#splash-title {
	font-family: 'Crimson Pro', Georgia, serif;
	font-style: italic;
	font-weight: 300;
	font-size: clamp(1.6rem, 6vw, 2.2rem);
	color: var(--text);
	letter-spacing: 0.04em;
}

#splash-sub {
	font-family: 'Crimson Pro', Georgia, serif;
	font-size: clamp(0.75rem, 3vw, 0.9rem);
	color: var(--muted);
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
