/* ============================================================
   Ривер — основа: токены, сброс, типографика, кнопки, формы
   ============================================================ */

:root {
  --paper: #efeadf;
  --paper-2: #e6e0d1;
  --paper-3: #dad3c0;
  --ink: #14120e;
  --ink-2: #3a362d;
  --muted: #6b6558;
  --line: rgba(20, 18, 14, 0.16);
  --line-2: rgba(20, 18, 14, 0.08);
  --accent: #d8401f;
  --accent-deep: #b3300f;
  --felt: #14352a;
  --felt-2: #1d4636;
  --felt-line: rgba(239, 234, 223, 0.18);
  --brass: #c9a455;
  --ok: #2f6b4a;

  --f-display: 'Cormorant', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --f-body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --gut: clamp(20px, 4.4vw, 64px);
  --maxw: 1360px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 76px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* бумажное зерно поверх всего — едва заметное, но делает фон «живым» */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .3  0 0 0 0 .22  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

main { flex: 1; min-width: 0; }
html, body { overflow-x: clip; }

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 300;
  background: var(--ink); color: var(--paper); padding: 10px 16px; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ---------- раскладка ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gut);
}

.section { padding-block: clamp(72px, 10vw, 148px); position: relative; }
.section--tight { padding-block: clamp(48px, 7vw, 96px); }
.section--felt { background: var(--felt); color: var(--paper); }
.section--paper2 { background: var(--paper-2); }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- типографика ---------- */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(54px, 9.4vw, 148px); letter-spacing: -0.03em; }
h2 { font-size: clamp(40px, 6vw, 88px); letter-spacing: -0.025em; }
h3 { font-size: clamp(26px, 3vw, 40px); line-height: 1.05; }
h4 { font-size: 24px; line-height: 1.1; }

em, .it { font-style: italic; font-weight: 400; }
h1 em, h2 em, h3 em { color: var(--accent); }
.section--felt h2 em { color: #f08a6c; }

p { margin: 0 0 1em; text-wrap: pretty; }
.lead { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.5; color: var(--ink-2); max-width: 36em; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before { content: ''; width: 28px; height: 1px; background: currentColor; }
.section--felt .eyebrow { color: rgba(239, 234, 223, 0.65); }

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.num { font-family: var(--f-display); font-variant-numeric: lining-nums tabular-nums; font-weight: 500; }

/* ---------- ссылки и кнопки ---------- */
.link {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  transition: background-size 0.35s var(--ease);
  padding-bottom: 2px;
}
.link:hover { background-size: 0 1px; background-position: 100% 100%; }

.arrow-link {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 500; text-decoration: none; font-size: 15px;
  border-bottom: 1px solid currentColor; padding-bottom: 4px;
}
.arrow-link svg { transition: transform 0.3s var(--ease); }
.arrow-link:hover svg { transform: translateX(5px); }

.btn {
  --b-bg: var(--ink);
  --b-fg: var(--paper);
  --b-bd: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 24px;
  background: var(--b-bg);
  color: var(--b-fg);
  border: 1px solid var(--b-bd);
  border-radius: 2px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.2s;
}
.btn::before {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform 0.45s var(--ease);
}
.btn:hover::before { transform: translateY(0); }
.btn:hover { --b-fg: #fff; --b-bd: var(--accent); }
.btn:active { transform: scale(0.98); }
.btn svg { transition: transform 0.3s var(--ease); flex: none; }
.btn:hover svg { transform: translateX(4px); }

.btn--ghost { --b-bg: transparent; --b-fg: var(--ink); }
.btn--ghost:hover { --b-fg: #fff; }
.btn--accent { --b-bg: var(--accent); --b-bd: var(--accent); --b-fg: #fff; }
.btn--accent::before { background: var(--ink); }
.btn--accent:hover { --b-bd: var(--ink); }
.btn--paper { --b-bg: var(--paper); --b-fg: var(--ink); --b-bd: var(--paper); }
.btn--paper::before { background: var(--accent); }
.btn--small { padding: 10px 16px; font-size: 14px; }
.btn--danger { --b-bg: transparent; --b-fg: var(--accent-deep); --b-bd: var(--accent-deep); }
.btn--danger::before { background: var(--accent-deep); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.45; pointer-events: none; }

/* ---------- формы ---------- */
.field { display: block; margin-bottom: 26px; position: relative; }
.field > span.label {
  display: block;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.input, .textarea, .select {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 10px 0 11px;
  font-size: 19px;
  transition: border-color 0.25s, box-shadow 0.25s;
  appearance: none;
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.45; }
.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2314120e' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat; background-position: right 4px center; padding-right: 26px;
}
.input::placeholder, .textarea::placeholder { color: rgba(20, 18, 14, 0.35); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 1px 0 var(--accent);
}
.field.is-invalid .input { border-color: var(--accent); }
.field .hint { display: block; font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.field .error { display: block; font-size: 13.5px; color: var(--accent-deep); margin-top: 6px; min-height: 0; }
.field .error:empty { display: none; }

.input--box {
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.4);
  padding: 10px 12px; font-size: 16px; border-radius: 2px;
}
.input--box:focus { box-shadow: none; }

.check { display: flex; gap: 14px; align-items: flex-start; font-size: 15px; line-height: 1.45; cursor: pointer; }
.check input {
  appearance: none; flex: none; width: 22px; height: 22px; margin: 1px 0 0;
  border: 1px solid var(--ink); border-radius: 2px; background: transparent;
  display: grid; place-content: center; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.check input::after {
  content: ''; width: 11px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0); margin-top: -3px; transition: transform 0.2s var(--ease);
}
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }

/* ---------- анимация появления ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
}
