/* Портфолио: первый экран — фото у светло-серой стены, фон всего сайта взят с этой стены.
   Работы — карточки на плашках фирменного цвета (--plate приходит из /works.css), финал — заявка на тёмном. */
:root {
  --bg: #e8e1d4; /* тёплый светло-бежевый: на нём видны снег и белый ствол берёзы */
  --ink: #111;
  --soft: rgba(17, 17, 17, .64);
  --faint: rgba(17, 17, 17, .5);
  --line: rgba(17, 17, 17, .14);
  --dark: #121212;
  --on-dark: #f1f1ef;
  --on-dark-soft: rgba(241, 241, 239, .6);
  --error: #c8361b;
  --pad: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --text: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .55s; animation-timing-function: var(--ease); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip; /* деревья у краёв выходят за экран — без горизонтальной прокрутки */
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
img { height: auto; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ── Шапка ── */
.nav {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: baseline; gap: 24px;
  max-width: 1600px; margin: 0 auto;
  padding: 26px var(--pad);
  font-size: 16px;
}
.home .nav { position: absolute; inset: 0 0 auto; max-width: none; }
.nav-home { font-weight: 500; }
.nav-links { display: flex; gap: clamp(16px, 2.4vw, 36px); }
.nav a { transition: opacity 160ms ease; }
.nav a:hover { opacity: .6; }

/* ── Первый экран: фото на всю ширину, текст на стене слева ── */
.hero {
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 560px; max-height: 1200px;
  overflow: hidden;
}
.hero-photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 30%;
}
/* Пол кадра растворяется в фоне страницы — работы начинаются там, где стоит человек. */
.hero::after {
  content: '';
  position: absolute; inset: auto 0 0;
  height: 20%;
  background: linear-gradient(to bottom, rgba(232, 225, 212, 0), var(--bg) 90%);
}
.hero-text {
  position: absolute; z-index: 1;
  left: var(--pad); top: 31%;
}
.hero-name {
  margin: 0;
  font-size: clamp(72px, 12vw, 190px);
  font-weight: 500;
  line-height: .86;
  letter-spacing: -.055em;
  margin-left: -.06em; /* оптически выровнять «И» по краю подписи */
}
.hero-offer {
  margin: clamp(18px, 2.2vw, 30px) 0 0;
  max-width: 17em; /* текст стоит на стене слева и не заходит на человека */
  font-size: clamp(19px, 1.85vw, 28px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -.015em;
  white-space: pre-line;
}
.hero-text .cta { margin-top: clamp(18px, 2vw, 28px); }

/* Главный шаг: ведёт к заявке внизу страницы. */
.cta {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 6px;
  background: var(--ink); color: var(--on-dark);
  font-size: 17px; font-weight: 500;
  transition: opacity 160ms ease;
}
.cta:hover { opacity: .82; }
.cta:active { opacity: .7; }
.case-cta { margin: clamp(48px, 6vw, 80px) 0 0; text-align: right; }

/* Узкий или вертикальный экран: фото кадрируется по человеку, имя — под ним. */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  .hero { height: auto; min-height: 0; max-height: none; }
  .hero::after { display: none; }
  .hero-text { position: relative; left: auto; top: auto; margin-top: -8px; padding: 0 var(--pad); }
  .hero-name { font-size: clamp(72px, 22vw, 150px); }
  .hero-photo {
    position: relative;
    height: auto; aspect-ratio: 4 / 5; max-height: 82svh;
    object-position: 50% 0;
    -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent);
    mask-image: linear-gradient(to bottom, #000 80%, transparent);
  }
}

/* Вертикальный планшет: фото ниже, чтобы кнопка осталась на первом экране. */
@media (max-aspect-ratio: 1/1) and (min-width: 600px) {
  .hero-photo { max-height: 60svh; }
}

/* ── Деревья: у каждой работы своё дерево — осенние, яблоня, ель и рябина в снегу ──
   Дерево стоит в своей половине ряда, земля — на линии подписи карточки. Проведёшь мышью —
   качается вокруг земли (site.js, skewX: земля и сугроб остаются на месте) и стряхивает
   листья, яблоки, ягоды или снег; часть падает и сама. */
.tree-spot { position: relative; z-index: 0; align-self: end; display: flex; justify-content: center; }
.tree-spot--right { grid-column: 8 / 13; margin-right: calc(var(--pad) * -1); }
.tree-spot--left { grid-column: 1 / 6; margin-left: calc(var(--pad) * -1); }
/* Рамка = рисунок: по ней считаются крона и земля для падающего. Высокие деревья — уже, чтобы не перерастали работу. */
.tree-frame { position: relative; width: 100%; }
.tree-spot[data-tree="spruce"] .tree-frame { width: 62%; }
.tree-spot[data-tree="birch"] .tree-frame { width: 88%; }
.tree-frame picture { display: block; }
.tree-img { width: 100%; transform-origin: 50% 97%; will-change: transform; }
.tree-fall { position: absolute; inset: 0; container-type: size; pointer-events: none; }
.fall-leaf {
  /* --yn — высота рождения в % дерева; лист падает до земли (cqh — доля высоты дерева). */
  --drop: calc((97.5 - var(--yn)) * 1cqh);
  position: absolute; left: var(--x); top: calc(var(--yn) * 1%);
  width: var(--size); height: var(--size); margin: calc(var(--size) / -2);
  color: var(--leaf);
  opacity: 0;
  animation: leaf-drop var(--fall) linear var(--delay) infinite;
}
/* Стряхнутое падает один раз, потом site.js его убирает. */
.fall-leaf--once { animation-iteration-count: 1; animation-fill-mode: forwards; }
/* Яблоко и ягода падают быстро, с ускорением, подпрыгивают на земле и немного лежат. */
.fall-leaf--heavy { animation-name: fruit-drop; }
.fall-leaf--heavy .leaf-sway, .fall-leaf--heavy svg { animation: none; }
/* Снег плывёт медленно и не переворачивается. */
.fall-leaf--snow svg { animation: none; }
.leaf-sway { display: block; width: 100%; height: 100%; animation: leaf-sway var(--sway-t) ease-in-out var(--delay) infinite alternate; }
.fall-leaf svg { display: block; width: 100%; height: 100%; animation: leaf-flip var(--flip-t) ease-in-out var(--delay) infinite alternate; }
/* Лист отрывается, падает до земли, немного лежит и тает — следующий круг начинается с другой ветки. */
@keyframes leaf-drop {
  0% { transform: translateY(0); opacity: 0; }
  6% { opacity: 1; }
  84% { transform: translateY(var(--drop)); opacity: 1; }
  100% { transform: translateY(var(--drop)); opacity: 0; }
}
@keyframes fruit-drop {
  0% { transform: translateY(0) rotate(0); opacity: 0; animation-timing-function: cubic-bezier(.45, 0, 1, .6); }
  4% { opacity: 1; }
  32% { transform: translateY(var(--drop)) rotate(25deg); animation-timing-function: ease-out; }
  38% { transform: translateY(calc(var(--drop) - 9px)) rotate(40deg); animation-timing-function: ease-in; }
  44% { transform: translateY(var(--drop)) rotate(50deg); }
  86% { transform: translateY(var(--drop)) rotate(50deg); opacity: 1; }
  100% { transform: translateY(var(--drop)) rotate(50deg); opacity: 0; }
}
@keyframes leaf-sway {
  from { transform: translateX(calc(var(--sway) * -1)) rotate(calc(var(--spin) * -1)); }
  to { transform: translateX(var(--sway)) rotate(var(--spin)); }
}
@keyframes leaf-flip { from { transform: rotate3d(1, .3, 0, -20deg); } to { transform: rotate3d(1, .3, 0, 40deg); } }

/* ── Работы ── */
.works { position: relative; z-index: 2; max-width: 1600px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) var(--pad) 0; }
.works-head, .grid { position: relative; z-index: 1; }
.works-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 18px; margin-bottom: clamp(28px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  color: var(--soft); font-size: 15px;
}
.works-head h2 { margin: 0; font: inherit; color: var(--ink); }

/* Ряды зигзагом на 12 колонках: работа на 7, дерево на 5, стороны чередуются.
   В разметке дерево идёт после своей работы; dense ставит его в свободную половину того же ряда. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: clamp(72px, 9vw, 140px) clamp(20px, 3vw, 48px);
  align-items: start;
}
.card { position: relative; z-index: 1; display: block; }
.card--left { grid-column: 1 / 8; }
.card--right { grid-column: 6 / 13; }
.plate {
  --plate: #d3d3d0;
  position: relative;
  display: grid; place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--plate);
  border-radius: 6px;
  overflow: hidden;
}
.screen {
  position: relative;
  width: 82%;
  aspect-ratio: 1440 / 900;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, .14); /* пока кадр грузится — без белой вспышки */
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 24px 60px -24px rgba(0, 0, 0, .45);
  transition: transform 700ms var(--ease);
}
.screen img, .screen-video { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.screen-video {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 400ms ease;
}
.screen-video.is-on { opacity: 1; }
.screen-empty { display: grid; place-items: center; height: 100%; color: var(--faint); font-size: 15px; }
.card:hover .screen { transform: scale(1.025); }

.card-title {
  margin: 22px 0 0;
  font-size: clamp(26px, 2.6vw, 40px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -.035em;
}
.card-meta {
  display: flex; justify-content: space-between; gap: 16px;
  margin: 14px 0 0; padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--soft); font-size: 15px;
}

/* ── Страница работы ── */
.case { position: relative; z-index: 2; max-width: 1600px; margin: 0 auto; padding: 0 var(--pad); }
.case-head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px clamp(32px, 6vw, 96px);
  align-items: end;
  padding: clamp(40px, 9vh, 120px) 0 clamp(32px, 5vw, 64px);
}
.case-head h1 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: clamp(56px, 9vw, 150px);
  font-weight: 500;
  line-height: .9;
  letter-spacing: -.05em;
}
.case-lead { margin: 0; max-width: 40ch; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; color: var(--soft); }
.case-facts { display: grid; gap: 0; margin: 0; }
.case-facts div {
  display: grid; grid-template-columns: 7em 1fr; gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.case-facts div:last-child { border-bottom: 1px solid var(--line); }
.case-facts dt { color: var(--faint); font-size: 15px; padding-top: 2px; }
.case-facts dd { margin: 0; }
.case-facts a { font-weight: 500; border-bottom: 1px solid currentColor; }
.case-facts a:hover { opacity: .65; }

.plate--wide { aspect-ratio: 16 / 9; }
.plate--wide .screen { width: 76%; }
.phones-fig { margin: clamp(16px, 2vw, 24px) 0 0; }
.phones-fig figcaption { margin-top: 12px; color: var(--faint); font-size: 15px; }
.plate--phones { aspect-ratio: auto; padding: clamp(40px, 7vw, 110px) 0; }
.phones { display: flex; justify-content: center; gap: clamp(12px, 3vw, 48px); width: 84%; }
.phones img {
  width: min(22%, 300px);
  border-radius: clamp(10px, 1.6vw, 26px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 24px 60px -24px rgba(0, 0, 0, .45);
}

.case-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px clamp(32px, 5vw, 80px);
  max-width: 1180px;
  margin: clamp(64px, 9vw, 128px) 0 0 auto;
}
.note h2 { margin: 0 0 12px; font-size: 15px; font-weight: 400; color: var(--faint); }
.note--tech { grid-column: 1 / -1; }
.note--tech p { margin: 0; font-size: clamp(20px, 2vw, 28px); line-height: 1.35; letter-spacing: -.02em; }
.note--tech span { white-space: nowrap; }
.note ul { margin: 0; padding: 0; list-style: none; }
.note li { padding: 12px 0; border-top: 1px solid var(--line); line-height: 1.45; }
.note li:last-child { border-bottom: 1px solid var(--line); }

.next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 8px clamp(24px, 4vw, 64px);
  margin-top: clamp(96px, 12vw, 180px);
  padding-top: 24px;
  border-top: 1px solid var(--ink);
}
.next-label { color: var(--faint); font-size: 15px; }
.next-title {
  grid-row: 2;
  font-size: clamp(40px, 6vw, 96px);
  font-weight: 500; line-height: .95; letter-spacing: -.045em;
}
.next .plate { grid-column: 2; grid-row: 1 / 3; aspect-ratio: 16 / 10; }
.next:hover .screen { transform: scale(1.025); }

/* ── Заявка и подвал: тёмный финал ── */
.contact {
  position: relative; z-index: 2;
  margin-top: clamp(120px, 16vw, 220px);
  background: var(--dark);
  color: var(--on-dark);
}
.contact-inner, .foot { max-width: 1600px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 48px clamp(32px, 6vw, 96px);
  padding-top: clamp(72px, 10vw, 140px);
  padding-bottom: clamp(72px, 9vw, 120px);
}
.contact-lead h2 {
  margin: 0;
  font-size: clamp(44px, 6.4vw, 104px);
  font-weight: 500; line-height: .95; letter-spacing: -.045em;
  text-wrap: balance;
}
.contact-avatar {
  display: inline-block;
  width: .8em; height: .8em;
  margin: 0 .22em -.06em 0;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: baseline;
}
.contact-lead p { margin: 28px 0 0; max-width: 34ch; color: var(--on-dark-soft); font-size: 18px; }
.contact-tg {
  display: inline-block;
  margin-top: 28px;
  font-size: clamp(22px, 2vw, 30px); font-weight: 500; letter-spacing: -.02em;
  border-bottom: 2px solid currentColor;
  transition: opacity 160ms ease;
}
.contact-tg:hover { opacity: .65; }

.order-form { align-self: end; }
.order-fields { display: grid; gap: 26px; }
.order-fields[hidden], .order-done[hidden] { display: none; }
.field { display: grid; gap: 6px; }
.field span { font-size: 15px; color: var(--on-dark-soft); }
.field input, .field textarea {
  width: 100%;
  padding: 8px 0 10px;
  border: 0; border-bottom: 1px solid rgba(241, 241, 239, .28); border-radius: 0;
  background: transparent;
  font: inherit; font-size: 19px; color: var(--on-dark);
  resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: rgba(241, 241, 239, .3); }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--on-dark); box-shadow: 0 1px 0 var(--on-dark); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.order-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.order-foot button {
  padding: 16px 28px;
  border: 0; border-radius: 6px;
  background: var(--on-dark); color: var(--dark);
  font: inherit; font-weight: 500; font-size: 16px;
  cursor: pointer;
  transition: opacity 160ms ease;
}
.order-foot button:hover { opacity: .82; }
.order-foot button:disabled { opacity: .45; cursor: progress; }
.order-error { margin: 0; color: #ff8a70; font-size: 15px; }
.order-done { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: -.015em; }

.foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding-top: 22px; padding-bottom: 30px;
  border-top: 1px solid rgba(241, 241, 239, .14);
  color: var(--on-dark-soft); font-size: 15px;
}
.foot a:hover { color: var(--on-dark); }
.foot { flex-wrap: wrap; }
.legal { flex-basis: 100%; margin: 0; font-size: 13px; line-height: 1.5; }

/* ── Узкие экраны ── */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .nav { padding-top: 18px; padding-bottom: 18px; font-size: 15px; }
  .grid { grid-template-columns: 1fr; }
  .card--left, .card--right { grid-column: 1 / -1; }
  /* На телефоне дерево — под своей работой, поменьше, у левого или правого края по очереди. */
  .tree-spot--left, .tree-spot--right { grid-column: 1 / -1; width: 72%; margin: calc(clamp(72px, 9vw, 140px) * -0.6) 0 0; }
  .tree-spot--right { justify-self: end; }
  .tree-spot--left { justify-self: start; }
  .case-head, .case-notes, .contact-inner { grid-template-columns: 1fr; }
  .plate--wide { aspect-ratio: 4 / 3; }
  .plate--wide .screen { width: 86%; }
  .phones { width: 92%; }
  .phones img { width: 31%; }
  .next { grid-template-columns: 1fr; }
  .next .plate { grid-column: 1; grid-row: auto; }
  .foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  @view-transition { navigation: none; }
  .screen, .screen-video { transition: none; }
}
