/*
 * Одна светлая тема. Автопереключения на тёмную нет намеренно.
 * Двигаем только transform и opacity, чтобы браузер не пересчитывал раскладку.
 *
 * Стили лежат одним листом: в Yew разметка собирается в Rust, разносить её
 * оформление по крейтам смысла нет.
 */

/* Акцидентный шрифт только для заголовков. Текст набирается системным,
   поэтому в загрузку уходит один вес, а не гарнитура целиком.
   swap: до загрузки заголовки видны системным начертанием. */
@font-face {
	font-family: 'Unbounded';
	font-style: normal;
	font-weight: 800;
	font-display: swap;
	src: url('/fonts/unbounded-800-cyrillic.woff2') format('woff2');
	unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
	font-family: 'Unbounded';
	font-style: normal;
	font-weight: 800;
	font-display: swap;
	src: url('/fonts/unbounded-800-latin.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2212;
}

:root {
	--paper: #f6f3ec;
	--card: #fffdf9;
	--sunk: #efeade;
	--ink: #15120d;
	--muted: #5b5346;
	--faint: #948b7a;
	--rule: #ddd5c4;
	--rule-2: #c9bfa9;
	--guide: #9fc3bd;

	--accent: #d63a12;
	--accent-deep: #a92c0c;
	--accent-wash: #fbe7e0;

	--display: 'Unbounded', 'Segoe UI Variable Display', system-ui, -apple-system, 'Helvetica Neue',
		Arial, sans-serif;
	--ui: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--mono: 'Cascadia Mono', 'JetBrains Mono', ui-monospace, Consolas, monospace;

	--pad: clamp(16px, 3.5vw, 40px);
	--max: 1240px;
	--ease: cubic-bezier(0.22, 0.68, 0.32, 1);
}

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

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--ui);
	font-size: 15px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	overflow-x: clip;
}

a {
	color: inherit;
	text-decoration: none;
}

h1,
h2,
h3 {
	margin: 0;
	font-family: var(--display);
	font-weight: 800;
	letter-spacing: -0.035em;
	line-height: 1.02;
	/* Крупный набор без этого выглядит рыхло. */
	font-feature-settings: 'kern' 1, 'liga' 1;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

.wrap {
	max-width: var(--max);
	margin: 0 auto;
	padding: 0 var(--pad);
}

/* Выделение и полоса прокрутки: мелочь, но без неё страница выглядит чужой. */
::selection {
	background: var(--accent);
	color: #fff;
}

* {
	scrollbar-width: thin;
	scrollbar-color: var(--rule-2) transparent;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 22px;
	border: 2px solid var(--ink);
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition:
		background-color 0.22s var(--ease),
		color 0.22s var(--ease),
		transform 0.22s var(--ease);
}

.btn:hover {
	transform: translateY(-2px);
	background: var(--ink);
	color: var(--paper);
}

.btn--primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}

.btn--primary:hover {
	background: var(--ink);
	border-color: var(--ink);
	color: #fff;
}

/* ---- появление при прокрутке -------------------------------------------
 * Прячем блоки только там, где их будет кому показать: метку `js` ставит
 * страница, и она же снимает её, если наблюдатель не отозвался.
 *
 * Появление это анимация, а не переход. Переход пришлось бы задерживать
 * через transition-delay, а он действует на ВСЕ переходы элемента: строка
 * каталога начинала подсвечиваться через четверть секунды после наведения.
 *
 * Сдвиг идёт по `translate`, а не по `transform`: transform занят наведением,
 * и заливка от анимации перебила бы его по приоритету.
 */
.js .reveal {
	opacity: 0;
	translate: 0 20px;
}

.js .reveal.shown {
	animation: reveal 0.6s var(--ease) var(--delay, 0ms) both;
}

@keyframes reveal {
	from {
		opacity: 0;
		translate: 0 20px;
	}
	to {
		opacity: 1;
		translate: none;
	}
}

/* Лесенка: шаг задаёт контейнер, номер — сам блок. */
.d1 {
	--delay: calc(var(--step, 40ms) * 1);
}
.d2 {
	--delay: calc(var(--step, 40ms) * 2);
}
.d3 {
	--delay: calc(var(--step, 40ms) * 3);
}
.d4 {
	--delay: calc(var(--step, 40ms) * 4);
}
.d5 {
	--delay: calc(var(--step, 40ms) * 5);
}
.d6 {
	--delay: calc(var(--step, 40ms) * 6);
}
.d7 {
	--delay: calc(var(--step, 40ms) * 7);
}
.d8 {
	--delay: calc(var(--step, 40ms) * 8);
}

/* ---- шапка ------------------------------------------------------------- */
.top {
	position: sticky;
	top: 0;
	z-index: 20;
	background: color-mix(in srgb, var(--paper) 86%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--rule);
}

.top__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding-top: 14px;
	padding-bottom: 14px;
}

.top__logo {
	font-family: var(--display);
	font-size: 21px;
	font-weight: 800;
	letter-spacing: -0.03em;
	white-space: nowrap;
}

.top__logo span {
	display: block;
	font-family: var(--ui);
	font-size: 10.5px;
	font-weight: 400;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--faint);
}

.top__nav {
	display: flex;
	flex-wrap: wrap;
	gap: clamp(14px, 2.4vw, 30px);
	font-size: 14px;
}

.top__nav a {
	position: relative;
	padding: 2px 0;
	color: var(--muted);
	transition: color 0.25s var(--ease);
}

.top__nav a::after {
	content: '';
	position: absolute;
	inset: auto 0 -2px 0;
	height: 1.5px;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 0.3s var(--ease);
}

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

.top__nav a:hover::after {
	transform: scaleX(1);
	transform-origin: left;
}

.top__nav a.on {
	color: var(--accent);
}

.top__nav a.on::after {
	transform: scaleX(1);
}

@media (max-width: 720px) {
	.top__bar {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
}

/* ---- заголовок раздела -------------------------------------------------
 * Крупный номер, название, линейка на остаток строки.
 */
.shead {
	display: flex;
	align-items: baseline;
	gap: clamp(12px, 2vw, 22px);
	margin: clamp(56px, 8vw, 116px) 0 clamp(22px, 3vw, 34px);
}

.shead--first {
	margin-top: clamp(28px, 4vw, 48px);
}

.shead__no {
	font-family: var(--display);
	font-size: clamp(30px, 5vw, 62px);
	font-weight: 800;
	letter-spacing: -0.05em;
	line-height: 1;
	color: transparent;
	-webkit-text-stroke: 1.5px var(--accent);
	flex: 0 0 auto;
}

.shead h2 {
	font-size: clamp(26px, 4.2vw, 48px);
	white-space: nowrap;
}

.shead__ln {
	flex: 1;
	height: 2px;
	background: var(--ink);
	transform: scaleX(0);
	transform-origin: left;
	animation: rule-in 0.9s var(--ease) 0.1s both;
}

.shead__side {
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.1em;
	color: var(--faint);
	white-space: nowrap;
}

a.shead__side:hover {
	color: var(--accent);
}

@keyframes rule-in {
	to {
		transform: scaleX(1);
	}
}

.lead {
	max-width: 56ch;
	margin: 0 0 26px;
	color: var(--muted);
	font-size: 14px;
}

/* ---- первый экран ------------------------------------------------------ */
.hero {
	position: relative;
	display: flex;
	align-items: center;
	min-height: min(92vh, 860px);
	border-bottom: 2px solid var(--ink);
	overflow: hidden;
}

.hero__field {
	position: absolute;
	inset: 0;
}

/* Чтобы текст читался поверх изолиний, кладём мягкую подложку. */
.hero__field::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		100deg,
		var(--paper) 0%,
		color-mix(in srgb, var(--paper) 88%, transparent) 42%,
		color-mix(in srgb, var(--paper) 30%, transparent) 72%,
		transparent 100%
	);
}

.relief {
	display: block;
	width: 100%;
	height: 100%;
	/* До того как поле посчитается, на месте холста ровная бумага. */
	background: var(--paper);
}

.hero__over {
	position: relative;
	width: 100%;
	padding: clamp(46px, 8vw, 104px) 0;
}

.hero__kick {
	margin: 0 0 clamp(16px, 3vw, 26px);
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.26em;
	color: var(--accent);
	animation: hero-in 0.7s var(--ease) both;
}

.hero h1 {
	max-width: 14ch;
	margin: 0 0 22px;
	font-size: clamp(38px, 8.4vw, 108px);
	animation: hero-in 0.9s var(--ease) both;
}

.hero h1 span {
	position: relative;
	white-space: nowrap;
}

.hero h1 span::after {
	content: '';
	position: absolute;
	inset: auto 0 0.09em 0;
	height: 0.1em;
	background: var(--accent);
}

.hero__lede {
	max-width: 46ch;
	margin: 0 0 28px;
	font-size: clamp(14.5px, 1.5vw, 17px);
	color: var(--muted);
	animation: hero-in 0.9s var(--ease) 0.12s both;
}

.hero__cta {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	animation: hero-in 0.9s var(--ease) 0.2s both;
}

@keyframes hero-in {
	from {
		opacity: 0;
		transform: translateY(18px);
	}
}

.figs {
	display: flex;
	flex-wrap: wrap;
	gap: clamp(24px, 5vw, 64px);
	margin: clamp(28px, 4vw, 44px) 0 0;
}

.figs dt {
	font-family: var(--mono);
	font-size: 10.5px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--faint);
}

.figs dd {
	margin: 8px 0 0;
	font-family: var(--display);
	font-size: clamp(34px, 5vw, 56px);
	font-weight: 800;
	letter-spacing: -0.045em;
	line-height: 0.9;
}

.figs dd.small {
	font-size: clamp(20px, 2.6vw, 28px);
}

/* ---- что в работе ------------------------------------------------------ */
.work {
	--step: 60ms;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: clamp(18px, 3vw, 34px);
}

.work__card {
	position: relative;
	padding: 20px 20px 22px;
	border: 1px solid var(--rule);
	background: var(--card);
	/* Миллиметровка под знаком: лист построения, а не пустая карточка. */
	background-image:
		linear-gradient(var(--rule) 1px, transparent 1px),
		linear-gradient(90deg, var(--rule) 1px, transparent 1px);
	background-size: 22px 22px;
	background-position: -1px -1px;
	transition:
		transform 0.3s var(--ease),
		border-color 0.3s var(--ease);
}

.work__card::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(var(--card), color-mix(in srgb, var(--card) 78%, transparent));
	pointer-events: none;
}

.work__card > * {
	position: relative;
}

.work__card:hover {
	transform: translateY(-4px);
	border-color: var(--accent);
}

.work__card h3 {
	margin: 16px 0 0;
	font-family: var(--display);
	font-size: 18px;
	font-weight: 800;
	letter-spacing: -0.025em;
	line-height: 1.15;
}

/* ---- знак, которого не было -------------------------------------------- */
.glyph {
	margin: 0;
}

.glyph svg {
	display: block;
	width: 100%;
	height: auto;
}

.glyph__guide {
	stroke: var(--guide);
	stroke-width: 0.7;
	stroke-dasharray: 4 4;
}

.glyph__box {
	fill: none;
	stroke: var(--rule);
	stroke-width: 0.8;
}

.glyph__level {
	stroke: var(--accent);
	stroke-width: 1.1;
}

.glyph text {
	text-anchor: middle;
}

.glyph__outline {
	font-family: var(--display);
	font-size: 168px;
	font-weight: 800;
	fill: none;
	stroke: var(--faint);
	stroke-width: 1.4;
}

.glyph__ink {
	font-family: var(--display);
	font-size: 168px;
	font-weight: 800;
	fill: var(--ink);
}

.glyph__cap {
	font-family: var(--mono);
	font-size: 13px;
	fill: var(--muted);
}

/* ---- полоса выпусков --------------------------------------------------- */
.plot {
	position: relative;
	height: 210px;
}

.month {
	position: absolute;
	bottom: 0;
	display: flex;
	align-items: flex-end;
	gap: 5px;
	height: 100%;
	padding-left: 6px;
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.14em;
	color: var(--faint);
	pointer-events: none;
}

.month i {
	position: absolute;
	left: 0;
	top: 8%;
	bottom: 0;
	width: 1px;
	background: linear-gradient(to bottom, transparent, var(--rule) 30%);
}

.col {
	position: absolute;
	bottom: 0;
	display: flex;
	flex-direction: column-reverse;
	gap: 3px;
	width: 12px;
	transform: translateX(-50%);
	transform-origin: bottom;
	animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both;
	animation-delay: var(--d);
}

.seg {
	display: block;
}

.seg__hit {
	display: block;
	border-radius: 2px;
	/* Тон растёт вместе с объёмом: мелкие раздачи спокойные, крупные горячие. */
	background: color-mix(in srgb, var(--accent) var(--heat), var(--ink));
	transition:
		transform 0.2s var(--ease),
		filter 0.2s var(--ease);
}

.seg:hover .seg__hit,
.seg.on .seg__hit,
.seg:focus-visible .seg__hit {
	transform: scaleX(1.5);
	filter: brightness(1.15);
}

.col__count {
	position: absolute;
	top: -19px;
	left: 50%;
	transform: translateX(-50%);
	font-family: var(--mono);
	font-size: 10px;
	color: var(--faint);
}

.rail {
	height: 2px;
	background: var(--ink);
}

.cap {
	display: flex;
	align-items: center;
	gap: 9px;
	flex-wrap: wrap;
	margin: 14px 0 0;
	min-height: 1.5em;
	font-size: 13px;
	color: var(--muted);
}

.cap b {
	color: var(--ink);
	font-size: 15px;
}

.dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: var(--rule-2);
}

@keyframes rise {
	from {
		transform: translateX(-50%) scaleY(0);
		opacity: 0;
	}
	to {
		transform: translateX(-50%) scaleY(1);
		opacity: 1;
	}
}

@media (max-width: 700px) {
	.plot {
		height: 160px;
	}

	.col {
		width: 8px;
	}
}

/* ---- все работы -------------------------------------------------------- */
.find {
	display: block;
	margin-bottom: 18px;
}

.find input {
	width: 100%;
	max-width: 340px;
	padding: 11px 15px;
	border: 1.5px solid var(--rule-2);
	background: var(--card);
	color: var(--ink);
	font: inherit;
	font-size: 14px;
}

.find input:focus {
	outline: none;
	border-color: var(--accent);
}

.rows {
	--step: 28ms;
	border-top: 2px solid var(--ink);
}

.row {
	position: relative;
	display: grid;
	grid-template-columns: 52px 1fr 120px 116px;
	gap: 14px;
	align-items: baseline;
	padding: clamp(14px, 1.6vw, 20px) 8px;
	border-bottom: 1px solid var(--rule);
	/* Подсветка плавная, а сам сдвиг короткий: на длинном сдвиге строка
	   тянется за курсором и это читается как подтормаживание. */
	transition:
		background 0.24s var(--ease),
		padding 0.12s var(--ease);
}

/* Полоса слева выезжает из ниоткуда и держит строку взглядом. */
.row--link::before {
	content: '';
	position: absolute;
	inset: 0 auto 0 0;
	width: 3px;
	background: var(--accent);
	transform: scaleY(0);
	transform-origin: center;
	transition: transform 0.24s var(--ease);
}

.row--link:hover {
	background: var(--card);
	padding-left: 20px;
}

.row--link:hover::before {
	transform: scaleY(1);
}

.row--link:hover .row__name,
.row--link:hover .row__idx {
	color: var(--accent);
}

.rows__head {
	border-bottom: 1px solid var(--ink);
}

.rows__head span {
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--faint);
}

.row__idx {
	font-family: var(--display);
	font-size: 18px;
	font-weight: 800;
	letter-spacing: -0.04em;
	color: var(--rule-2);
	transition: color 0.24s var(--ease);
}

.row__name {
	font-family: var(--display);
	font-size: clamp(17px, 1.9vw, 22px);
	font-weight: 700;
	letter-spacing: -0.022em;
	line-height: 1.16;
	transition: color 0.24s var(--ease);
}

.row .v,
.row .d {
	font-family: var(--mono);
	font-size: 12px;
	color: var(--muted);
}

.rows__empty {
	padding: 36px 0;
	color: var(--muted);
}

@media (max-width: 860px) {
	.row {
		grid-template-columns: 34px 1fr auto;
		gap: 10px;
	}

	.row .v,
	.row .d {
		display: none;
	}
}

/* ---- разборы ----------------------------------------------------------- */
.posts {
	--step: 50ms;
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--rule);
}

.posts a {
	display: grid;
	grid-template-columns: 108px 1fr auto 28px;
	align-items: baseline;
	gap: 20px;
	padding: 20px 0;
	border-bottom: 1px solid var(--rule);
	transition: padding-left 0.32s var(--ease);
}

.posts a:hover {
	padding-left: 14px;
}

.posts__date {
	font-family: var(--mono);
	font-size: 11.5px;
	color: var(--faint);
}

.posts__title {
	font-family: var(--display);
	font-size: clamp(16px, 1.7vw, 19px);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.3;
	transition: color 0.25s var(--ease);
}

.posts a:hover .posts__title {
	color: var(--accent);
}

.posts__tag {
	font-family: var(--mono);
	font-size: 10.5px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--faint);
}

.posts__arrow {
	color: var(--accent);
	opacity: 0;
	transform: translateX(-6px);
	transition:
		opacity 0.3s var(--ease),
		transform 0.3s var(--ease);
}

.posts a:hover .posts__arrow {
	opacity: 1;
	transform: none;
}

@media (max-width: 700px) {
	.posts a {
		grid-template-columns: 1fr auto;
		gap: 4px 12px;
		padding: 16px 0;
	}

	.posts__title {
		grid-column: 1 / -1;
		order: 3;
	}

	.posts__arrow {
		display: none;
	}
}

/* ---- отдельная страница ------------------------------------------------ */
.sheet {
	max-width: 900px;
	padding-top: clamp(26px, 4vw, 48px);
}

.sheet--text {
	max-width: 74ch;
}

.sheet h1 {
	max-width: 18ch;
	margin: clamp(18px, 3vw, 28px) 0 clamp(22px, 3vw, 32px);
	font-size: clamp(30px, 5.4vw, 58px);
}

.sheet h2 {
	margin: 38px 0 12px;
	font-size: clamp(19px, 2.4vw, 26px);
}

.sheet p {
	color: var(--muted);
}

.sheet__lede {
	font-size: clamp(16px, 1.7vw, 19px);
}

.sheet__meta {
	margin: clamp(22px, 3vw, 32px) 0 0;
	font-family: var(--mono);
	font-size: 11.5px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--faint);
}

.back {
	font-size: 13px;
	color: var(--muted);
	transition: color 0.25s var(--ease);
}

.back:hover {
	color: var(--accent);
}

.dl__size {
	font-family: var(--mono);
	font-size: 12px;
	opacity: 0.8;
}

.hint {
	margin: 14px 0 0;
	font-size: 13px;
	color: var(--faint);
}

.facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1px;
	margin: clamp(34px, 5vw, 56px) 0 0;
	border: 1px solid var(--rule);
	background: var(--rule);
}

.facts > div {
	padding: 16px 18px;
	background: var(--card);
}

.facts dt {
	font-family: var(--mono);
	font-size: 10.5px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--faint);
}

.facts dd {
	margin: 8px 0 0;
	font-family: var(--display);
	font-size: 20px;
	font-weight: 700;
}

/* ---- подвал ------------------------------------------------------------ */
.foot {
	margin-top: clamp(72px, 10vw, 128px);
	border-top: 1px solid var(--rule);
	background: var(--sunk);
}

.foot__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: clamp(24px, 5vw, 64px);
	padding-top: clamp(36px, 5vw, 56px);
	padding-bottom: clamp(44px, 6vw, 64px);
}

.foot__sig {
	margin: 0;
	font-family: var(--display);
	font-size: clamp(20px, 2.4vw, 25px);
	font-weight: 800;
	letter-spacing: -0.03em;
}

.foot__hint {
	margin: 8px 0 20px;
	font-size: 13.5px;
	color: var(--muted);
}

.foot__links {
	display: flex;
	flex-wrap: wrap;
	gap: 22px;
	font-size: 14px;
}

.foot__links a {
	position: relative;
	color: var(--muted);
	transition: color 0.25s var(--ease);
}

.foot__links a::after {
	content: '';
	position: absolute;
	inset: auto 0 -3px 0;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 0.3s var(--ease);
}

.foot__links a:hover {
	color: var(--accent);
}

.foot__links a:hover::after {
	transform: scaleX(1);
	transform-origin: left;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.js .reveal,
	.js .reveal.shown {
		opacity: 1;
		translate: none;
		animation: none;
	}

	.col {
		animation: none;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
