/* ============================================================== fonts === */

@font-face {
	font-family: 'Geist';
	src: url('../assets/fonts/Geist-Variable.woff2') format('woff2');
	font-weight: 100 700;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Geist Mono';
	src: url('../assets/fonts/GeistMono-Variable.woff2') format('woff2');
	font-weight: 100 700;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Instrument Serif';
	src: url('../assets/fonts/InstrumentSerif-Regular.woff2') format('woff2');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	/* Latin/digits/punct only — Georgian must always fall through
	   to Noto Serif Georgian so mkhedruli glyphs keep full height */
	unicode-range: U+0000-10FF, U+2000-206F, U+20AC, U+2013-2014, U+2018-201E;
}

@font-face {
	font-family: 'Instrument Serif';
	src: url('../assets/fonts/InstrumentSerif-Italic.woff2') format('woff2');
	font-weight: 400;
	font-style: italic;
	font-display: swap;
	unicode-range: U+0000-10FF, U+2000-206F, U+20AC, U+2013-2014, U+2018-201E;
}

/* ============================================================== tokens === */

:root {
	--ink: #f6f3ec;
	--ink-soft: rgba(246, 243, 236, 0.66);
	--ink-faint: rgba(246, 243, 236, 0.38);
	--accent: #e8c37a;
	--line: rgba(246, 243, 236, 0.14);

	--gutter: clamp(1.4rem, 4.6vw, 6.5rem);
	--chapter-height: 185vh;

	--sans: 'Geist', 'Noto Sans Georgian', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--mono: 'Geist Mono', 'Noto Sans Georgian', ui-monospace, 'SF Mono', Menlo, monospace;
	--display: 'Instrument Serif', 'Noto Serif Georgian', 'Times New Roman', serif;

	--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================== base ==== */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: #0b0d12;
	color: var(--ink);
	font-family: var(--sans);
	font-weight: 300;
	font-size: 16px;
	line-height: 1.6;
	letter-spacing: -0.004em;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #0a0906; }

a { color: inherit; text-decoration: none; }
h1, h2, p, dl, dd, figure { margin: 0; }
code { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
em { font-style: italic; }

/* ============================================================== films == */
/* one film per chapter, full bleed under the copy */
.films {
	position: fixed;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}

.films video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	will-change: opacity, transform, filter;
	transform-origin: 50% 50%;
	/* the same grade as the stills: warm, a touch desaturated, lifted blacks */
	filter: saturate(0.82) contrast(0.94) sepia(0.12) brightness(1.02);
}

/* one warm breath of light on every cut */
.films__flash {
	position: fixed;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	opacity: 0;
	background: radial-gradient(90% 70% at 50% 45%, rgba(255, 226, 190, 0.9), rgba(255, 210, 170, 0.35) 55%, transparent 100%);
	mix-blend-mode: screen;
}

/* film grain over everything below the copy — animated so it never reads
   as a static texture */
.grain {
	position: fixed;
	inset: -40%;
	z-index: 3;
	pointer-events: none;
	opacity: 0.16;
	mix-blend-mode: overlay;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
	background-size: 300px 300px;
	animation: grain 0.5s steps(6) infinite;
}

@keyframes grain {
	0% { transform: translate(0, 0); }
	17% { transform: translate(-6%, 3%); }
	34% { transform: translate(4%, -5%); }
	51% { transform: translate(-3%, 6%); }
	68% { transform: translate(6%, 2%); }
	85% { transform: translate(-5%, -4%); }
	100% { transform: translate(0, 0); }
}

/* a whisper of extra depth on top of the films */
.atmosphere {
	position: fixed;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background:
		radial-gradient(120% 78% at 50% 8%, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.36) 100%),
		linear-gradient(to bottom, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.5));
	opacity: 0;
	transition: opacity 2s var(--ease-out);
}

body.is-live .atmosphere { opacity: 1; }

/* ============================================================== chrome == */

.chrome {
	position: fixed;
	z-index: 20;
	opacity: 0;
	pointer-events: none;
}

body.is-live .chrome { opacity: 1; transition: opacity 1.2s var(--ease-out) 0.5s; }

.nav {
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: clamp(1.1rem, 2.4vw, 2.1rem) var(--gutter);
	mix-blend-mode: normal;
}

.nav__brand {
	pointer-events: auto;
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	font-family: var(--mono);
	font-weight: 400;
	font-size: 0.78rem;
	letter-spacing: 0.34em;
	text-transform: uppercase;
}

.nav__mark {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 14px 2px color-mix(in srgb, var(--accent) 70%, transparent);
	transition: background 0.8s linear, box-shadow 0.8s linear;
}

.nav__meta {
	display: flex;
	gap: 0.5rem;
	font-family: var(--mono);
	font-size: 0.66rem;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.dot { opacity: 0.42; }

/* thin progress line at the very top */
.scrollbar {
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: rgba(255, 255, 255, 0.07);
}

.scrollbar i {
	display: block;
	height: 100%;
	width: 0%;
	background: var(--accent);
	box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 80%, transparent);
	transition: background 0.8s linear;
}

/* chapter rail — sits opposite the readout so it never fights the copy */
.rail {
	right: var(--gutter);
	bottom: clamp(1rem, 2.2vw, 1.9rem);
}

.rail ol {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	gap: 1.5rem;
}

.rail li {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	font-family: var(--mono);
	font-size: 0.62rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
	transition: color 0.6s var(--ease-out), opacity 0.6s var(--ease-out);
	opacity: 0.45;
}

.rail li b {
	font-weight: 400;
	font-size: 0.58rem;
	color: inherit;
}

.rail li span {
	max-width: 0;
	overflow: hidden;
	white-space: nowrap;
	transition: max-width 0.7s var(--ease-out);
}

.rail li.is-active {
	opacity: 1;
	color: var(--accent);
}

.rail li.is-active span { max-width: 8rem; }

/* live readout */
.hud {
	left: var(--gutter);
	bottom: clamp(1rem, 2.2vw, 1.9rem);
	display: flex;
	gap: 0.55rem;
	font-family: var(--mono);
	font-size: 0.62rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

/* ============================================================== layout == */

main { position: relative; z-index: 10; }

.panel {
	position: relative;
	min-height: var(--chapter-height);
}

.panel__inner {
	position: sticky;
	top: 0;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: clamp(6rem, 12vh, 10rem) var(--gutter) clamp(5rem, 10vh, 8rem);
}

.hero {
	min-height: 100svh;
}

.hero .panel__inner {
	min-height: 100svh;
	justify-content: flex-end;
	padding-bottom: clamp(6rem, 14vh, 10rem);
}

.hero .panel__inner > * { max-width: 62rem; }

.hero .display--hero { font-size: clamp(2.8rem, 6.4vw, 6.8rem); }

.chapter--right .panel__inner { align-items: flex-end; text-align: right; }

.card {
	position: relative;
	max-width: 36rem;
}

/* soft local scrim so type always reads over the render — sized to the sticky
   frame itself, so nothing ever overhangs the viewport */
.panel__inner::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: radial-gradient(70% 64% at 24% 52%, rgba(4, 6, 9, 0.84), rgba(4, 6, 9, 0) 74%);
}

.chapter--right .panel__inner::before {
	background: radial-gradient(70% 64% at 76% 52%, rgba(4, 6, 9, 0.84), rgba(4, 6, 9, 0) 74%);
}

/* the hero carries no scrim of its own — its inner is width-capped, so any
   fill here shows its own edge. The full-viewport .atmosphere gradient is
   what keeps the headline legible. */
.hero .panel__inner::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		linear-gradient(to right, rgba(4, 6, 9, 0.82) 0%, rgba(4, 6, 9, 0.62) 38%, rgba(4, 6, 9, 0.12) 72%, rgba(4, 6, 9, 0) 100%),
		linear-gradient(to top, rgba(4, 6, 9, 0.7) 0%, rgba(4, 6, 9, 0.25) 45%, rgba(4, 6, 9, 0) 100%);
}

.outro .panel__inner::before {
	background: radial-gradient(72% 62% at 26% 50%, rgba(4, 6, 9, 0.8), rgba(4, 6, 9, 0) 74%);
}

/* ============================================================== type ==== */

.eyebrow {
	font-family: var(--mono);
	font-size: 0.68rem;
	font-weight: 400;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--ink-soft);
	margin-bottom: clamp(1.1rem, 2.4vh, 2rem);
}

.eyebrow b {
	font-weight: 400;
	color: var(--accent);
	transition: color 0.8s linear;
}

.display {
	font-family: var(--display);
	font-weight: 400;
	line-height: 1.08;
	letter-spacing: -0.01em;
	font-size: clamp(2.9rem, 7.2vw, 7.4rem);
	text-wrap: balance;
}

.display--hero {
	font-size: clamp(3.1rem, 8.6vw, 9.2rem);
	line-height: 1.04;
	max-width: 15ch;
}

.display--outro {
	font-size: clamp(2.6rem, 5.6vw, 5.6rem);
	max-width: 16ch;
}

.chapter .display { margin-bottom: 0.6rem; }

.lede {
	margin-top: clamp(1.6rem, 3.4vh, 2.6rem);
	max-width: 38ch;
	font-size: clamp(1rem, 1.05vw, 1.14rem);
	line-height: 1.62;
	color: var(--ink-soft);
}

.lede b {
	font-weight: 400;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
}

.body {
	max-width: 40ch;
	font-size: clamp(0.95rem, 0.98vw, 1.06rem);
	line-height: 1.68;
	color: var(--ink-soft);
}

.chapter--right .body,
.chapter--right .spec { margin-left: auto; }

/* latin name on top, georgian beneath, three short paragraphs */
.display--latin {
	letter-spacing: 0.01em;
	font-size: clamp(2.9rem, 6.6vw, 7rem);
}

.name-ka {
	font-family: var(--display);
	font-size: clamp(1.5rem, 2.6vw, 2.5rem);
	line-height: 1.2;
	color: var(--ink);
	margin-top: -0.4rem;
	margin-bottom: clamp(1.3rem, 2.8vh, 2.2rem);
}

.body + .body { margin-top: 0.9rem; }
.body--ka { color: var(--ink); }
.body--ru { color: var(--ink-soft); font-size: clamp(0.9rem, 0.94vw, 1rem); }
.body--en { color: var(--ink-faint); font-size: clamp(0.78rem, 0.82vw, 0.88rem); letter-spacing: 0.01em; }

.chapter--right .name-ka { margin-left: auto; }
.chapter--right .body { margin-left: auto; }

.lede--big {
	max-width: 46ch;
	font-size: clamp(1.15rem, 1.4vw, 1.5rem);
	line-height: 1.5;
	color: var(--ink);
}

.hero .display, .hero .lede, .hero .body, .card .display, .card .name-ka, .card .body {
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 0, 0, 0.35);
}

.hero .lede + .lede { margin-top: clamp(1rem, 2vh, 1.5rem); }
.hero__en { margin-top: clamp(1rem, 2vh, 1.5rem); max-width: 56ch; }

.lede--en {
	font-family: var(--mono);
	font-size: 0.72rem;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin-top: 1.2rem;
}

/* ============================================================== specs === */

.spec,
.colophon {
	margin-top: clamp(1.8rem, 3.6vh, 2.8rem);
	display: grid;
	gap: 0;
	border-top: 1px solid var(--line);
	max-width: 34rem;
}

.spec > div,
.colophon > div {
	display: grid;
	grid-template-columns: 9rem 1fr;
	gap: 1rem;
	padding: 0.62rem 0;
	border-bottom: 1px solid var(--line);
	font-family: var(--mono);
	font-size: 0.7rem;
	letter-spacing: 0.06em;
}

.chapter--right .spec > div { grid-template-columns: 1fr 9rem; }
.chapter--right .spec dt { order: 2; text-align: right; }
.chapter--right .spec dd { order: 1; text-align: right; }

.spec dt,
.colophon dt {
	color: var(--ink-faint);
	text-transform: uppercase;
	letter-spacing: 0.18em;
	font-size: 0.62rem;
	align-self: center;
}

.spec dd,
.colophon dd {
	margin: 0;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
}

.outro { min-height: 100svh; }

.outro .panel__inner {
	position: relative;
	max-width: 64rem;
	min-height: 100svh;
	justify-content: flex-start;
	padding-top: clamp(6rem, 14vh, 9rem);
}

.colophon { margin-top: clamp(2.4rem, 5vh, 4rem); max-width: 44rem; }
.colophon > div { grid-template-columns: 10rem 1fr; }

.foot {
	margin-top: clamp(2.4rem, 5vh, 4rem);
	display: flex;
	gap: 0.6rem;
	font-family: var(--mono);
	font-size: 0.62rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

/* ============================================================== pick ==== */

.pick {
	list-style: none;
	margin: clamp(1.4rem, 3vh, 2.4rem) 0 0;
	padding: 0;
	display: grid;
	gap: 0;
	max-width: 40rem;
	border-top: 1px solid var(--line);
}

.pick li {
	border-bottom: 1px solid var(--line);
	transform-origin: left center;
}

.pick button {
	appearance: none;
	background: none;
	border: 0;
	width: 100%;
	display: grid;
	grid-template-columns: 3rem 1fr auto;
	align-items: baseline;
	gap: 1rem;
	padding: 0.55rem 0;
	color: var(--ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: color 0.4s var(--ease-out), padding-left 0.5s var(--ease-out);
}

.pick button b {
	font-family: var(--mono);
	font-weight: 400;
	font-size: 0.62rem;
	letter-spacing: 0.18em;
	color: var(--ink-faint);
}

.pick button span {
	font-family: var(--display);
	font-size: clamp(1.5rem, 2.5vw, 2.2rem);
	line-height: 1.15;
}

.pick button em {
	font-family: var(--display);
	font-style: normal;
	font-size: clamp(0.95rem, 1.3vw, 1.2rem);
	color: var(--ink-faint);
}

.pick button:hover:not(:disabled) { color: var(--accent); padding-left: 0.6rem; }
.pick button:disabled { cursor: default; }
.pick li.is-kept button { color: var(--accent); }
.pick li.is-kept button b { color: var(--accent); }

.pick__result { margin-top: clamp(1.4rem, 3vh, 2.2rem); max-width: 40rem; }

.pick__chosen {
	font-family: var(--display);
	font-size: clamp(1.8rem, 3.4vw, 3rem);
	line-height: 1.1;
	color: var(--accent);
}

.pick__actions {
	margin-top: 1.4rem;
	display: flex;
	gap: 1.6rem;
	align-items: center;
	font-family: var(--mono);
	font-size: 0.7rem;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.pick__send {
	color: var(--ink);
	border-bottom: 1px solid var(--accent);
	padding-bottom: 0.2rem;
}

.pick__reset {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	color: var(--ink-faint);
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	cursor: pointer;
}

.pick__reset:hover { color: var(--ink); }

/* mini credits on the pick screen */
.credits {
	margin-top: clamp(1.6rem, 3vh, 2.4rem);
	max-width: 40rem;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.35rem 2rem;
	border-top: 1px solid var(--line);
	padding-top: 0.9rem;
}

.credits > div {
	display: flex;
	gap: 0.7rem;
	align-items: baseline;
	font-family: var(--mono);
	font-size: 0.62rem;
	letter-spacing: 0.08em;
}

.credits dt { color: var(--ink); min-width: 4.5rem; }
.credits dd { margin: 0; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.14em; }

@media (max-width: 900px) { .credits { grid-template-columns: 1fr; } }

/* ============================================================== hero cue */

.hero__cue {
	position: absolute;
	left: var(--gutter);
	bottom: clamp(2.2rem, 5vh, 3.4rem);
	display: flex;
	align-items: center;
	gap: 0.9rem;
	font-family: var(--mono);
	font-size: 0.62rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.hero__cue i {
	display: block;
	width: 3.4rem;
	height: 1px;
	background: linear-gradient(to right, var(--accent), transparent);
	transform-origin: left center;
	animation: cue 2.8s var(--ease-out) infinite;
}

@keyframes cue {
	0%, 100% { transform: scaleX(0.35); opacity: 0.45; }
	45% { transform: scaleX(1); opacity: 1; }
}

/* ============================================================== reveal == */

[data-reveal],
.split-line {
	will-change: transform, opacity;
}

.split-char { display: inline-block; will-change: transform, opacity, filter; }

.split-mask {
	overflow: hidden;
	display: block;
	/* generous room for Georgian full-height glyphs — never clip them */
	padding: 0.22em 0.08em 0.16em;
	margin: -0.22em -0.08em -0.16em;
}

/* ============================================================== boot ==== */

.boot {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: grid;
	place-items: center;
	background: #0b0d12;
	transition: opacity 1.1s var(--ease-out), visibility 1.1s;
}

.boot.is-done { opacity: 0; visibility: hidden; }

.boot__inner { display: grid; justify-items: center; gap: 1.5rem; }

.boot__mark {
	font-family: var(--mono);
	font-size: 0.8rem;
	letter-spacing: 0.5em;
	text-indent: 0.5em;
	color: var(--ink);
}

.boot__bar {
	width: min(46vw, 14rem);
	height: 1px;
	background: rgba(255, 255, 255, 0.12);
	overflow: hidden;
}

.boot__bar i {
	display: block;
	height: 100%;
	width: 30%;
	background: var(--accent);
	animation: boot 1.5s ease-in-out infinite;
}

@keyframes boot {
	0% { transform: translateX(-110%); }
	100% { transform: translateX(360%); }
}

.boot__note {
	font-family: var(--mono);
	font-size: 0.6rem;
	letter-spacing: 0.26em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

/* the welcome is long; on a phone it breathes a little tighter and the cue
   follows the text instead of sitting below the fold */
@media (max-width: 700px) {
	.hero .panel__inner { padding-top: clamp(3.4rem, 9vh, 5rem); padding-bottom: 2.6rem; }
	.hero .lede--big { font-size: 1.06rem; }
	.hero .lede:not(.lede--big) { font-size: 0.94rem; }
	.hero__cue { position: static; margin-top: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
	.grain { animation: none; }
	.hero__cue i { animation: none; }
	.boot__bar i { animation: none; width: 100%; }
	.atmosphere, .chrome { transition-duration: 0.01ms; }
}
