/* ============================================================
   БлагоДарим v3 — «Наборная мастерская» (letterpress)
   Светлый картон, чернильная краска, киноварь, тиснение.
   ============================================================ */
:root {
  --paper: #F3EDE1;      /* картон светлый */
  --paper-2: #EFE8D9;    /* ступень глубины */
  --paper-3: #EAE2CF;
  --paper-4: #E3DAC3;    /* финальный CTA */
  --plate: #FCFAF4;      /* плашка-паспарту */
  --ink: #17161A;
  --ink-soft: #44413B;
  --ink-dim: #5F5B52;
  --line: rgba(23, 22, 26, 0.32);
  --vermilion: #A82C10;  /* киноварная краска */
  --vermilion-deep: #87220B;
  --paper-on-ink: #F4F2EC;

  --r: 12px;
  --gold: #B98A3E;
  --edge: 0 3px 0 rgba(23, 22, 26, 0.32);
  --press: inset 0 2px 5px rgba(23, 22, 26, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

::selection { background: var(--vermilion); color: var(--paper-on-ink); }

/* зерно картона: тонкий шум поверх страницы */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Bitter', Georgia, serif;
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: 0.02em;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 1px rgba(23, 22, 26, 0.14);
}
h1 { font-size: clamp(40px, 4.6vw, 64px); }
h2 {
  font-size: clamp(38px, 3.9vw, 58px);
  text-align: center;
  margin-bottom: 8px;
}
h3 { font-size: clamp(24px, 2vw, 30px); line-height: 1.05; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
section { padding: 92px 0; }

.kicker {
  font-family: 'Bitter', Georgia, serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--vermilion);
  text-align: center;
  margin-bottom: 56px;
}

img { display: block; }

/* ======= ЛИНЕЙКА (верхняя) ======= */
.rule-bar {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.rule-bar-in {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.rule-bar-in span { white-space: nowrap; }
@media (max-width: 560px) {
  .rule-bar-in {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
  .rule-bar-in span:first-child { white-space: normal; }
}
.rule-item { color: var(--vermilion); }

/* ======= 1. ОФФЕР + ПРОБНЫЙ ОТТИСК ======= */
.hero { padding: 72px 0 96px; position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: 0.7fr minmax(0, 1.95fr) 0.7fr;
  grid-template-areas:
    "l head r"
    "l body r";
  grid-template-rows: auto 1fr;
  gap: 36px;
  align-items: center;
}
.collage-l { grid-area: l; }
.collage-r { grid-area: r; }
.hero-head { grid-area: head; text-align: center; position: relative; }
.hero-copy {
  grid-area: body;
  text-align: center;
  justify-self: center;
}
@media (min-width: 1021px) {
  .hero .ch {
    font-size: 13.5px;
    padding: 12px 14px;
    white-space: nowrap;
  }
  .hero .channels { flex-wrap: nowrap; gap: 8px; }
}
.hero-copy .lead {
  font-size: 17.5px;
  color: var(--ink-soft);
  max-width: 500px;
  margin: 24px auto 0;
}

/* удар пресса: строки заголовка впечатываются по одной */
.stamp span { display: block; }
.stamp .accent { color: var(--vermilion); }
.js .stamp span {
  opacity: 0;
  transform: translateY(10px) scale(1.015);
  animation: press 0.24s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}
.js .stamp span:nth-child(1) { animation-delay: 0.05s; }
.js .stamp span:nth-child(2) { animation-delay: 0.16s; }
.js .stamp span:nth-child(3) { animation-delay: 0.27s; }
@keyframes press {
  0%   { opacity: 0; transform: translateY(10px) scale(1.015); }
  60%  { opacity: 1; transform: translateY(-1px) scale(0.998); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.assure {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 24px;
  margin-top: 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
}
.assure li { position: relative; padding-left: 24px; }
.assure li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 7px;
  border-left: 2.5px solid var(--vermilion);
  border-bottom: 2.5px solid var(--vermilion);
  transform: rotate(-45deg);
}

/* кнопки-клише */
.channels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}
.channels.center { justify-content: center; }
.ch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--plate);
  color: var(--ink);
  font-weight: 600;
  font-size: 15.5px;
  text-decoration: none;
  box-shadow: var(--edge);
  transition: transform 0.15s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.15s cubic-bezier(0.23, 1, 0.32, 1);
}
.ch svg { width: 19px; height: 19px; flex: none; }
.ch:hover {
  transform: translateY(1px);
  box-shadow: var(--press);
}
.ch:active { transform: translateY(2px); }
.ch:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* кнопки в цветах мессенджеров (по просьбе владельца; оттенки затемнены до WCAG AA) */
.ch-tg {
  background: #15799F;
  border-color: #106B8C;
  color: #FFFFFF;
  box-shadow: 0 2px 0 #0D5E7B;
}
.ch-vk {
  background: #3A6B98;
  border-color: #2E5273;
  color: #FFFFFF;
  box-shadow: 0 2px 0 #274561;
}
.ch-max {
  background: #6A4BC4;
  border-color: #53349C;
  color: #FFFFFF;
  box-shadow: 0 2px 0 #472C85;
}
.ch-tg:hover, .ch-vk:hover, .ch-max:hover { box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3); }

.fine {
  margin: 22px auto 0;
  font-size: 13px;
  color: var(--ink-dim);
  max-width: 480px;
}
.fine a { color: var(--ink-soft); }

/* коллажи по бокам: 2 плашки в каждой стороне */
.collage {
  position: relative;
  min-height: 500px;
}
.c-plate {
  position: absolute;
  background: var(--plate);
  border: 1px solid rgba(23, 22, 26, 0.5);
  border-radius: var(--r);
  box-shadow: var(--edge);
  padding: 9px;
  margin: 0;
  width: 88%;
}
.c-plate img {
  width: 100%;
  aspect-ratio: 3 / 3.7;
  object-fit: cover;
  object-position: 50% 58%;
  filter: saturate(0.92) contrast(1.02);
}
.collage-l .p1 { top: 6%; left: -4%; transform: rotate(-4deg); }
.collage-l .p2 { bottom: 4%; right: -2%; transform: rotate(3deg); }
.collage-r .p3 { top: 8%; right: -4%; transform: rotate(3.5deg); }
.collage-r .p4 { bottom: 2%; left: -2%; transform: rotate(-2.5deg); }

/* плашка-паспарту (пары «фото → статуэтка») */
.plate {
  background: var(--plate);
  border: 1px solid rgba(23, 22, 26, 0.5);
  border-radius: var(--r);
  box-shadow: var(--edge);
  padding: 10px;
  margin: 0;
}
.plate .ph {
  display: block;
  overflow: hidden;
}
.plate img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  transform: scale(var(--z, 1));
  transform-origin: center;
  filter: saturate(0.92) contrast(1.02);
}
.plate figcaption {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: center;
}
.arrow {
  color: var(--vermilion);
  width: 34px;
  text-align: center;
}
.arrow svg { width: 30px; height: 30px; }

/* ======= 2. ПАРЫ ======= */
.pairs-sec { background: var(--paper-2); }
.pairs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px 36px;
}
/* каждый проект — своя плашка с номером */
.pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  background: var(--plate);
  border: 1px solid rgba(23, 22, 26, 0.5);
  border-radius: var(--r);
  box-shadow: var(--edge);
  padding: 18px 18px 14px;
}
.pair-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--vermilion);
  margin-bottom: 4px;
}
.pair-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.pair-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 1px solid var(--vermilion);
  transform: rotate(45deg);
}
.tile img { aspect-ratio: 3 / 4; }
.tile { cursor: zoom-in; }

/* ======= 3. ЛЕНТА-ДОРОЖНАЯ КАРТА ======= */
.road-sec { background: var(--paper-3); }
.rail {
  height: 14px;
  margin: 0 0 30px;
  background-image:
    radial-gradient(circle, rgba(23, 22, 26, 0.42) 2.2px, transparent 3px),
    linear-gradient(to bottom, transparent 11px, rgba(23, 22, 26, 0.42) 11px, rgba(23, 22, 26, 0.42) 12px, transparent 12px);
  background-size: 26px 14px, 100% 14px;
  background-repeat: repeat-x;
}
.road {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  counter-reset: step;
}
.step {
  background: var(--plate);
  border: 1px solid rgba(23, 22, 26, 0.5);
  border-radius: var(--r);
  box-shadow: var(--edge);
  padding: 24px 24px 26px;
  position: relative;
}
.step .num {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 40px;
  line-height: 1;
  color: var(--vermilion);
  display: inline-block;
  border: 1px solid var(--line);
  padding: 6px 14px 4px;
  margin-bottom: 18px;
  background: var(--paper);
}
.step .ic {
  position: absolute;
  top: 26px;
  right: 24px;
  width: 30px;
  height: 30px;
  color: var(--ink-soft);
}
.step h3 { margin-bottom: 10px; }
.step p { color: var(--ink-soft); font-size: 15px; }
.step-final {
  background: var(--vermilion);
  border-color: var(--vermilion-deep);
  box-shadow: 0 2px 0 var(--vermilion-deep);
}
.step-final .num { background: transparent; border-color: rgba(244, 242, 236, 0.5); color: var(--paper-on-ink); }
.step-final .ic { color: rgba(244, 242, 236, 0.85); }
.step-final h3 { color: var(--paper-on-ink); }
.step-final p { color: rgba(244, 242, 236, 0.92); }

/* ======= 4. ФИНАЛЬНЫЙ CTA ======= */
.cta-sec { background: var(--paper-4); padding-bottom: 104px; position: relative; }
.cta-plate {
  border: 1px solid var(--ink);
  outline: 1px solid var(--line);
  outline-offset: 5px;
  border-radius: var(--r);
  background: var(--plate);
  box-shadow: var(--press);
  text-align: center;
  padding: 64px 32px 60px;
  max-width: 780px;
  margin: 0 auto;
}
.cta-plate h2 { margin-bottom: 14px; }
.cta-plate p { color: var(--ink-soft); max-width: 460px; margin: 0 auto; }
.cta-plate .channels { margin-top: 30px; }

/* ======= 5. 3D-ВИТРИНА ======= */
.model-sec { background: var(--paper-4); padding-top: 88px; }
.vitrine {
  max-width: 560px;
  margin: 0 auto;
  border: 1px solid rgba(23, 22, 26, 0.5);
  border-radius: var(--r);
  background: var(--plate);
  box-shadow: var(--press);
  padding: 18px;
}
#figurine-canvas {
  display: block;
  width: 100%;
  height: 420px;
  touch-action: pan-y;
  cursor: grab;
}
#figurine-canvas:active { cursor: grabbing; }
.vitrine-error {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ======= ПОДВАЛ ======= */
.footer {
  background: var(--paper-4);
  border-top: 1px solid var(--line);
  padding: 44px 0 56px;
  text-align: center;
}
.f-brand {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 14px;
}
.f-docs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 26px;
  margin-bottom: 16px;
  font-size: 13.5px;
}
.f-docs a { padding: 9px 2px; display: inline-block; }
.f-docs a { color: var(--ink-soft); }
.f-meta { font-size: 12.5px; color: var(--ink-dim); }
.f-meta.dim { margin-top: 6px; }
.footer a:hover, .fine a:hover { color: var(--vermilion); }
.f-docs a:focus-visible, .fine a:focus-visible, .rule-bar a:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 3px;
}

/* ======= ПОЯВЛЕНИЕ СЕКЦИЙ ======= */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s cubic-bezier(0.23, 1, 0.32, 1), transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}
.js .reveal.visible { opacity: 1; transform: none; }
/* оттиски-плиты садятся «прессом», шаги ленты — каскадом */
.js .pairs .pair {
  transform: translateY(14px) scale(0.998);
}
.js .road .step { transition-delay: 0s; }
.js .road .step:nth-child(3n + 2) { transition-delay: 0.07s; }
.js .road .step:nth-child(3n + 3) { transition-delay: 0.14s; }

/* ======= ЛАЙТБОКС ======= */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(23, 22, 26, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.lb-overlay img {
  max-width: min(880px, 92vw);
  max-height: 78vh;
  border: 6px solid var(--plate);
}
.lb-caption {
  margin-top: 14px;
  color: var(--paper-on-ink);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.lb-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--paper-on-ink);
  background: transparent;
  color: var(--paper-on-ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--r);
}

/* ======= ЮРИДИЧЕСКИЕ МОДАЛКИ (docs.js) ======= */
.doc-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(23, 22, 26, 0.62);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.doc-modal {
  background: var(--plate); color: var(--ink);
  width: min(760px, 100%); max-height: min(84vh, 900px);
  border: 1px solid var(--ink);
  outline: 1px solid var(--line);
  outline-offset: 4px;
  border-radius: var(--r);
  display: flex; flex-direction: column; overflow: hidden;
}
.doc-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.doc-head h3 { font-size: 24px; }
.doc-close { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--r); background: none; color: var(--ink-soft); font-size: 22px; cursor: pointer; }
.doc-close:hover { color: var(--vermilion); border-color: var(--vermilion); }
.doc-body { overflow-y: auto; padding: 24px 28px 32px; font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); }
.doc-body h4 { font-family: 'Oswald', 'Arial Narrow', sans-serif; font-weight: 500; text-transform: uppercase; letter-spacing: 0.02em; font-size: 16px; color: var(--ink); margin: 22px 0 8px; }
.doc-body p { margin-bottom: 10px; }
.doc-body a, .doc-body .doc-link-inline { color: var(--vermilion); background: none; border: none; font: inherit; cursor: pointer; border-bottom: 1px solid rgba(168, 44, 16, 0.35); padding: 0; }
.doc-body .doc-meta { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.doc-body b { color: var(--ink); }

/* ======= АДАПТИВ ======= */
@media (max-width: 1020px) {
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "l"
      "r"
      "body";
    grid-template-rows: none;
    gap: 32px;
  }
  .hero { padding-top: 32px; }
  /* заголовок → коллаж → пояснение и кнопки */
  .hero-head { order: 1; }
  .collage-l { order: 2; }
  .collage-r { order: 3; }
  .hero-copy { order: 4; }
  .collage {
    position: static;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
  }
  .c-plate { position: static; width: 100%; }
  .collage-l .p1 { transform: rotate(-2deg); }
  .collage-l .p2 { transform: rotate(1.5deg); }
  .collage-r .p3 { transform: rotate(1.5deg); }
  .collage-r .p4 { transform: rotate(-1.5deg); }
  .pairs { grid-template-columns: 1fr; }
  .road { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  section { padding: 64px 0; }
  .rule-bar-in { font-size: 11px; letter-spacing: 0.12em; }
  h1 { font-size: clamp(32px, 9vw, 42px); }
  .hero { padding: 20px 0 48px; }
  .hero-copy .lead { margin-top: 12px; font-size: 16px; }
  .assure { margin-top: 12px; gap: 6px 20px; }
  .channels { flex-direction: column; align-items: stretch; gap: 8px; margin-top: 16px; }
  .ch { justify-content: center; padding: 12px 18px; }
  .fine { margin-top: 14px; }
  /* коллаж 2×2: все четыре визуализации */
  .collage { gap: 12px; max-width: 360px; }
  .c-plate { padding: 6px; }
  .c-plate img { aspect-ratio: 1 / 1.15; }
  .road { grid-template-columns: 1fr; }
  .pair {
    grid-template-columns: 1fr;
    gap: 12px;
    justify-items: stretch;
  }
  .pair .arrow {
    grid-column: 1;
    justify-self: center;
    transform: rotate(90deg);
  }
  .tile img { aspect-ratio: 3 / 3.6; }
  .cta-plate { padding: 48px 20px 44px; }
  #figurine-canvas { height: 340px; }
}

/* ======= REDUCED MOTION ======= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .stamp span { opacity: 1; transform: none; animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .ch, .ch:hover, .ch:active { transform: none; transition: none; }
}

/* ======= ПРАЗДНИЧНАЯ РОССЫПЬ ======= */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  display: block;
  transform: rotate(var(--rot, 0deg));
}
.confetti i b {
  display: block;
  border-radius: var(--br, 2px);
}
@keyframes confetti-drop {
  from { opacity: 0; transform: translateY(-16px) rotate(0deg); }
  to { opacity: 1; transform: translateY(0) rotate(var(--spin, 0deg)); }
}

.cta-plate { position: relative; overflow: hidden; }
.gift-icon {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  color: var(--vermilion);
}

@media (max-width: 560px) {
  .hero > .confetti, #confetti-cta { display: none; }
  .confetti-m { position: absolute; inset: -16px 0; }
}
