/*
 * BodyBook design tokens & shared styles.
 *
 * Brand palette — the liturgical colors (owner's direction, 2026-06-10):
 *   white  = purity     → text and highlights on dark ground
 *   red    = passion    → emphasis, alerts, calls to courage
 *   blue   = trust      → the base ground of the whole interface
 *   purple = authority  → structural accents, headers, rules
 *   gold   = the glory  → metallic gradients, used sparingly so it stays precious
 *
 * Dark-first: the dark theme IS the brand. A light theme can be added later
 * by swapping these custom properties under a [data-theme="light"] selector.
 */

:root {
	/* ground (deepened again 2026-06-16 per owner: "a bit more dark").
	   Kept a desaturated navy rather than pure black — pure #000 makes off-white
	   text halate and fatigues the eye; this stays very dark but legible. */
	--night: #05070e;          /* near-black navy — the page itself (BRAND.md §6) */
	--surface: #0f1424;        /* cards */
	--surface-raised: #161e36; /* hover / focus surfaces */

	/* the four colors, kept deep for contrast */
	--purity: #f5f3ec;         /* primary text */
	--purity-dim: #b8bdc9;     /* secondary text */
	--passion: #8e2030;        /* deep red */
	--passion-bright: #c0392b; /* errors, urgent accents */
	--trust: #24406e;          /* deep blue */
	--trust-bright: #4f74b3;   /* links, focus rings */
	--authority: #43306b;      /* deep purple */
	--authority-soft: #6b5494; /* secondary accents */

	/* metallic gold — light edge, body, shadow edge */
	--gold-hi: #f9e8a0;
	--gold: #d4af37;
	--gold-lo: #8a6d1f;
	--gold-sheen: linear-gradient(105deg, var(--gold-lo) 0%, var(--gold) 28%, var(--gold-hi) 50%, var(--gold) 72%, var(--gold-lo) 100%);

	--radius: 10px;
	--font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-mark: Georgia, "Times New Roman", serif;
}

/* ---------- light theme (owner request 2026-07-04) ----------
 * Same liturgical language, inverted ground: warm parchment instead of night.
 * Only the tokens change; every component reads them, so the whole UI follows.
 * Gold is darkened so the metallic sheen stays legible on a light ground, and
 * the decorative cross-field / beam layers are toned for parchment below.
 */
[data-theme="light"] {
	--night: #f4efe3;          /* warm parchment — the page itself */
	--surface: #ffffff;        /* cards */
	--surface-raised: #ece5d5; /* hover / focus surfaces */

	--purity: #1b2030;         /* primary text — ink on light */
	--purity-dim: #55607a;     /* secondary text */
	--passion: #9b2634;        /* deep red */
	--passion-bright: #b3271b; /* errors, urgent accents */
	--trust: #c2ccdd;          /* borders (soft blue-grey on light) */
	--trust-bright: #2b5aa0;   /* links, focus rings — dark enough to read */
	--authority: #d0c4e6;      /* structural rules (soft purple on light) */
	--authority-soft: #6b5494; /* secondary accents */

	/* darker metallic gold ramp so the sheen reads on a light ground */
	--gold-hi: #caa53a;
	--gold: #9c7a1e;
	--gold-lo: #6f5410;
}

/* Lighter corner glows + a warmer, darker cross-shine so the flourishes read on parchment. */
[data-theme="light"] body {
	background:
		radial-gradient(1100px 500px at 50% -10%, rgba(107, 84, 148, 0.13), transparent 60%),
		radial-gradient(900px 420px at 85% 110%, rgba(79, 116, 179, 0.11), transparent 60%),
		var(--night);
}
[data-theme="light"] body::before {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M24 14L40 14L36 28L50 24L50 40L36 36L40 50L24 50L28 36L14 40L14 24L28 28Z' fill='%239c7a1e' fill-opacity='0.05'/%3E%3C/svg%3E");
}
[data-theme="light"] body::after {
	background: linear-gradient(118deg,
		transparent 40%,
		rgba(156, 122, 30, 0.16) 50%,
		transparent 60%);
}

/* ---------- theme toggle button (injected by theme.js on every page) ---------- */
.theme-toggle {
	position: fixed;
	top: 0.85rem;
	right: 0.85rem;
	z-index: 50;
	width: 2.4rem;
	height: 2.4rem;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.15rem;
	line-height: 1;
	color: var(--gold);
	background: var(--surface);
	border: 1px solid var(--authority);
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
	cursor: pointer;
	transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.theme-toggle:hover {
	color: var(--gold-hi);
	border-color: var(--gold);
	transform: translateY(-1px);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}
.theme-toggle:focus-visible {
	outline: 2px solid var(--trust-bright);
	outline-offset: 2px;
}

/* language toggle (injected by i18n.js) — sits just left of the theme toggle */
.lang-toggle {
	position: fixed;
	top: 0.85rem;
	right: 3.55rem;
	z-index: 50;
	width: 2.4rem;
	height: 2.4rem;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1;
	color: var(--gold);
	background: var(--surface);
	border: 1px solid var(--authority);
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
	cursor: pointer;
	transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.lang-toggle:hover {
	color: var(--gold-hi);
	border-color: var(--gold);
	transform: translateY(-1px);
}
.lang-toggle:focus-visible {
	outline: 2px solid var(--trust-bright);
	outline-offset: 2px;
}

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

body {
	font-family: var(--font-ui);
	/* colour wash only: purple glow → blue glow → night ground.
	   The gold cross field + its travelling shine wave live on the fixed
	   ::before / ::after layers below, so they stay put while the page scrolls. */
	background:
		radial-gradient(1100px 500px at 50% -10%, rgba(67, 48, 107, 0.30), transparent 60%),
		radial-gradient(900px 420px at 85% 110%, rgba(36, 64, 110, 0.24), transparent 60%),
		var(--night);
	color: var(--purity);
	line-height: 1.6;
	min-height: 100vh;
}

/* ---------- the gold cross field + slow shine wave ----------
 * Two fixed, full-viewport layers sitting just behind the page content:
 *   ::before — the faint, always-present gold cross-pattée field (the texture).
 *   ::after  — the SAME cross shape used as a mask, lit by a single diagonal
 *              gold highlight that drifts slowly corner-to-corner, so a wave of
 *              shine appears to roll across the crosses. "Present, not preachy."
 * Identical geometry + 64px tile on both layers keeps the shine in register.
 */
body::before,
body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
}
body::before {
	/* faint gold cross pattée — battle-worn, "felt more than seen" (BRAND.md §6) */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M24 14L40 14L36 28L50 24L50 40L36 36L40 50L24 50L28 36L14 40L14 24L28 28Z' fill='%23d4af37' fill-opacity='0.05'/%3E%3C/svg%3E");
	background-size: 64px 64px;
}
body::after {
	/* the shine: a bright gold band, revealed only where the crosses are */
	background: linear-gradient(118deg,
		transparent 40%,
		rgba(249, 232, 160, 0.22) 50%,
		transparent 60%);
	background-size: 260% 260%;
	background-repeat: no-repeat;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M24 14L40 14L36 28L50 24L50 40L36 36L40 50L24 50L28 36L14 40L14 24L28 28Z' fill='%23ffffff'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cpath d='M24 14L40 14L36 28L50 24L50 40L36 36L40 50L24 50L28 36L14 40L14 24L28 28Z' fill='%23ffffff'/%3E%3C/svg%3E");
	-webkit-mask-size: 64px 64px;
	mask-size: 64px 64px;
	-webkit-mask-repeat: repeat;
	mask-repeat: repeat;
	animation: cross-wave 26s linear infinite;
}
@keyframes cross-wave {
	0%   { background-position: 0% 0%; }
	100% { background-position: 100% 100%; }
}
@media (prefers-reduced-motion: reduce) {
	body::after { animation: none; opacity: 0; }
}

/* ---------- header / wordmark ---------- */

header.site {
	text-align: center;
	padding: 3.2rem 1rem 2.2rem;
	border-bottom: 1px solid var(--authority);
	position: relative;
}
header.site::after {
	/* thin gold thread under the purple rule */
	content: "";
	position: absolute;
	left: 50%;
	bottom: -2px;
	transform: translateX(-50%);
	width: min(420px, 70%);
	height: 2px;
	background: var(--gold-sheen);
	background-size: 200% 100%;
	animation: sheen 6s linear infinite;
}

.wordmark {
	font-family: var(--font-mark);
	font-size: clamp(2.4rem, 6vw, 3.4rem);
	letter-spacing: 0.02em;
	color: var(--purity);
}
.wordmark .gold {
	/* actual shiny gold: a moving metallic gradient clipped to the letters */
	background: var(--gold-sheen);
	background-size: 200% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	animation: sheen 6s linear infinite;
}
@keyframes sheen {
	from { background-position: 200% 0; }
	to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
	.wordmark .gold, header.site::after { animation: none; }
}

/* New Roman-caps brand wordmark (BodyBook index + personal pages) */
.wordmark-caps {
	font-family: "Cinzel", Georgia, "Times New Roman", serif;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	background: var(--gold-sheen);
	background-size: 200% auto;
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	animation: sheen 6s linear infinite;
}
.wordmark-caps .initial { font-size: 1.35em; }
@media (prefers-reduced-motion: reduce) { .wordmark-caps { animation: none; } }

.tagline {
	margin-top: 0.5rem;
	font-style: italic;
	color: var(--purity-dim);
}

/* ---------- layout ---------- */

main { max-width: 720px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
main.narrow { max-width: 440px; }

section h2, .card h2 {
	font-size: 0.95rem;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	color: var(--purity-dim);
	border-bottom: 1px solid var(--authority);
	padding-bottom: 0.45rem;
	margin: 2rem 0 1rem;
}

/* ---------- cards & news ---------- */

.card {
	background: var(--surface);
	border: 1px solid var(--trust);
	border-radius: var(--radius);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
}

ul.news { list-style: none; }
ul.news li {
	background: var(--surface);
	border: 1px solid var(--trust);
	border-left: 3px solid var(--passion);
	border-radius: var(--radius);
	padding: 0.9rem 1.1rem;
	margin-bottom: 0.7rem;
	transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
ul.news li:hover {
	background: var(--surface-raised);
	border-color: var(--gold);
	transform: translateY(-1px);
}
ul.news a { color: var(--purity); text-decoration: none; font-weight: 600; }
ul.news a:hover { color: var(--gold-hi); }
ul.news .meta { display: block; font-size: 0.85rem; color: var(--purity-dim); margin-top: 0.25rem; }

p.note { color: var(--purity-dim); font-size: 0.9rem; }

/* ---------- "level ground": the Areopagus house frame ----------
 * Whispered, per BRAND.md ("never megaphones"): it sets the culture — fierce on
 * ideas, gentle on people — without shouting. Cultural copy only; no feature is
 * implied, no privacy is promised.
 */
.level-frame { margin: -0.3rem 0 1.2rem; }
.level-line {
	font-family: "Cormorant Garamond", Georgia, serif;
	font-style: italic;
	font-size: 1.12rem;
	line-height: 1.45;
	color: var(--purity-dim);
}
.house-rule {
	display: inline-block;
	margin-top: 0.55rem;
	padding: 0.18rem 0.7rem;
	font-size: 0.7rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--purity-dim);
	border: 1px solid var(--authority);
	border-radius: 999px;
}

/* the steel-man nudge inside a story's reply box — guidance, not a feature */
.steelman {
	margin: 0 0 0.55rem;
	padding-left: 0.7rem;
	border-left: 2px solid var(--trust);
	font-style: italic;
	font-size: 0.85rem;
	line-height: 1.4;
	color: var(--purity-dim);
}

/* ---------- links, buttons, forms ---------- */

a { color: var(--trust-bright); }
a:hover { color: var(--gold-hi); }
a.quiet { color: var(--purity-dim); text-decoration: none; font-size: 0.9rem; }
a.quiet:hover { color: var(--gold-hi); }
a.gold-link { color: var(--gold); text-decoration: none; }
a.gold-link:hover { color: var(--gold-hi); }

button, .btn {
	display: inline-block;
	width: 100%;
	margin-top: 1.2rem;
	padding: 0.7rem 1rem;
	font: inherit;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: #221a04;
	background: var(--gold-sheen);
	background-size: 200% 100%;
	border: none;
	border-radius: var(--radius);
	cursor: pointer;
	transition: background-position 400ms ease, box-shadow 160ms ease;
}
button:hover, .btn:hover {
	background-position: 100% 0;
	box-shadow: 0 0 18px rgba(212, 175, 55, 0.35);
}
button:focus-visible, input:focus-visible, a:focus-visible {
	outline: 2px solid var(--trust-bright);
	outline-offset: 2px;
}

label { display: block; font-size: 0.9rem; color: var(--purity-dim); margin-top: 0.8rem; }
input {
	width: 100%;
	padding: 0.6rem 0.75rem;
	margin-top: 0.25rem;
	border: 1px solid var(--trust);
	border-radius: 6px;
	font: inherit;
	background: var(--night);
	color: var(--purity);
}
input:focus { border-color: var(--authority-soft); }

.error { color: var(--passion-bright); font-size: 0.9rem; margin-top: 0.8rem; min-height: 1.2em; }
.hint { font-size: 0.8rem; color: var(--purity-dim); margin-top: 0.3rem; }
.hidden { display: none; }

/* ---------- feed: composer, posts, comments ---------- */

textarea {
	width: 100%;
	min-height: 5.5rem;
	padding: 0.7rem 0.8rem;
	margin-top: 0.25rem;
	border: 1px solid var(--trust);
	border-radius: 6px;
	font: inherit;
	background: var(--night);
	color: var(--purity);
	resize: vertical;
}
textarea:focus { border-color: var(--authority-soft); outline: none; }

.post { border-left: 3px solid var(--authority); }
.post .author { font-weight: 700; }
.post .author .handle { color: var(--purity-dim); font-weight: 400; font-size: 0.85rem; }
.post .when { color: var(--purity-dim); font-size: 0.8rem; }
.post .body { margin: 0.6rem 0 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.post .actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* reaction buttons override the global gold button */
button.react-btn, button.subtle-btn, a.subtle-btn {
	width: auto;
	margin: 0;
	padding: 0.35rem 0.85rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--purity-dim);
	background: var(--night);
	border: 1px solid var(--trust);
	border-radius: 999px;
	position: relative;
	transition: border-color 150ms ease, color 150ms ease;
}
button.react-btn:hover, button.subtle-btn:hover, a.subtle-btn:hover { border-color: var(--gold); color: var(--purity); box-shadow: none; }
button.react-btn.active-amen, button.subtle-btn.active-amen { border-color: var(--gold); color: var(--gold-hi); }
button.react-btn.active-boo { border-color: var(--passion-bright); color: var(--passion-bright); }
.react-btn .face { display: inline-block; }

/* BOO: the face shakes, fumes, mutters "boo!", then composes itself */
.react-btn.booing .face { animation: boo-shake 0.9s ease; }
@keyframes boo-shake {
	0%, 100% { transform: translateX(0) rotate(0); }
	15% { transform: translateX(-3px) rotate(-8deg); }
	30% { transform: translateX(3px) rotate(8deg); }
	45% { transform: translateX(-3px) rotate(-6deg); }
	60% { transform: translateX(2px) rotate(5deg); }
	75% { transform: translateX(-1px) rotate(-2deg); }
}
.boo-bubble {
	position: absolute;
	top: -1.1rem;
	left: 50%;
	transform: translateX(-50%);
	font-size: 0.65rem;
	font-style: italic;
	color: var(--passion-bright);
	pointer-events: none;
	animation: bubble-up 0.9s ease forwards;
}

/* AMEN: a couple of claps rise and the hands disappear */
.clap-float {
	position: absolute;
	left: 50%;
	top: -0.4rem;
	pointer-events: none;
	animation: bubble-up 0.8s ease forwards;
}
.clap-float:nth-child(odd) { animation-duration: 1s; }
@keyframes bubble-up {
	from { opacity: 1; transform: translate(-50%, 0) scale(1); }
	to { opacity: 0; transform: translate(-50%, -1.4rem) scale(1.25); }
}
@media (prefers-reduced-motion: reduce) {
	.react-btn.booing .face, .boo-bubble, .clap-float { animation: none; }
	.boo-bubble, .clap-float { opacity: 0; }
}

/* allowlisted video embeds (YouTube/Vimeo) */
iframe.embed {
	width: 100%;
	aspect-ratio: 16 / 9;
	border: 1px solid var(--trust);
	border-radius: var(--radius);
	margin-bottom: 0.9rem;
	background: #000;
}

a.subtle-btn { display: inline-block; }

.comments { margin-top: 0.9rem; border-top: 1px solid var(--trust); padding-top: 0.7rem; }
.comment { padding: 0.45rem 0; font-size: 0.95rem; }
.comment .author { font-weight: 600; }
.comment .body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--purity-dim); }

/* ---------- footer ---------- */

footer.site {
	text-align: center;
	padding: 2rem 1rem 3rem;
	border-top: 1px solid var(--authority);
	color: var(--purity-dim);
	font-size: 0.9rem;
}
footer.site .soon { color: var(--gold); font-style: italic; }

/* ---------- .social front-page hero: "The Beam" ----------
 * Scoped to header.hero (index.html only) so the shared header.site used by
 * the other pages is untouched. Cathedral light: a soft purple→blue beam
 * descends behind an oversized wordmark; gold stays scarce (the wordmark
 * sheen, one thin rule, the single primary CTA). All motion is optional.
 */
header.hero {
	position: relative;
	overflow: hidden;
	text-align: center;
	padding: clamp(3.5rem, 9vw, 6.5rem) 1rem clamp(2.4rem, 5vw, 3.4rem);
	border-bottom: 1px solid var(--authority);
}
header.hero::after {
	/* thin gold thread under the purple rule — matches header.site's footer line */
	content: "";
	position: absolute;
	left: 50%;
	bottom: -2px;
	transform: translateX(-50%);
	width: min(420px, 70%);
	height: 2px;
	background: var(--gold-sheen);
	background-size: 200% 100%;
	animation: sheen 6s linear infinite;
}

/* the descending beam: a soft cone of light fanning down from the top center */
header.hero .beam {
	position: absolute;
	top: -18%;
	left: 50%;
	width: min(560px, 90%);
	height: 130%;
	transform: translateX(-50%);
	pointer-events: none;
	z-index: 0;
	background:
		conic-gradient(from 180deg at 50% 0%,
			transparent 156deg,
			rgba(107, 84, 148, 0.30) 172deg,
			rgba(79, 116, 179, 0.24) 180deg,
			rgba(107, 84, 148, 0.30) 188deg,
			transparent 204deg);
	filter: blur(20px);
	-webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), transparent 86%);
	mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), transparent 86%);
	animation: beam-breathe 9s ease-in-out infinite;
}
@keyframes beam-breathe {
	0%, 100% { opacity: 0.72; }
	50% { opacity: 1; }
}

header.hero .hero-inner { position: relative; z-index: 1; }

header.hero .wordmark {
	font-size: clamp(3rem, 9vw, 5rem);
	line-height: 1.05;
}

.hero-rule {
	width: min(260px, 56%);
	height: 2px;
	margin: 1.1rem auto 1.25rem;
	border-radius: 2px;
	background: var(--gold-sheen);
	background-size: 200% 100%;
	animation: sheen 6s linear infinite;
}

.hero-tagline {
	font-family: var(--font-mark);
	font-style: italic;
	font-size: clamp(1.02rem, 2.4vw, 1.25rem);
	line-height: 1.5;
	color: var(--purity-dim);
}

.hero-actions { margin-top: 1.7rem; }
.btn-enter {
	display: inline-block;
	width: auto;
	margin: 0;
	padding: 0.72rem 1.7rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: #221a04;
	background: var(--gold-sheen);
	background-size: 200% 100%;
	border-radius: var(--radius);
	text-decoration: none;
	transition: background-position 400ms ease, box-shadow 200ms ease;
}
.btn-enter:hover {
	color: #221a04;
	background-position: 100% 0;
	box-shadow: 0 0 22px rgba(212, 175, 55, 0.40);
}

.hero-links { margin-top: 1rem; font-size: 0.9rem; }
.hero-links a { color: var(--purity-dim); text-decoration: none; }
.hero-links a:hover { color: var(--gold-hi); }

/* Hero brand mark and typography styling */
.logo-container {
	margin-bottom: 1.5rem;
	display: flex;
	justify-content: center;
	align-items: center;
}

.hero-logo {
	width: clamp(80px, 15vw, 110px);
	height: clamp(80px, 15vw, 110px);
	transition: transform 400ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 300ms ease;
	filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0));
}

/* Glow and float on hover */
header.hero:hover .hero-logo,
.hero-logo:hover {
	transform: scale(1.05) rotate(5deg);
	filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.35));
}

/* Larger Roman-caps wordmark specifically for the hero */
header.hero .wordmark-caps {
	font-size: clamp(3rem, 9vw, 5rem);
	line-height: 1.05;
	display: block;
	margin: 0 auto;
}

.hero-tagline {
	font-family: "Cormorant Garamond", Georgia, serif;
	font-style: italic;
	font-size: clamp(1.2rem, 2.8vw, 1.5rem);
	line-height: 1.5;
	color: var(--gold);
	text-transform: lowercase;
	letter-spacing: 0.02em;
}

@media (prefers-reduced-motion: reduce) {
	header.hero::after, .hero-rule, header.hero .beam { animation: none; }
	.hero-logo {
		transition: none;
	}
	header.hero:hover .hero-logo {
		transform: none;
		filter: none;
	}
}
