/* TETIS — стили сайта. Сетка и типографика сняты с эталона: контейнер 1320, поля 60. */
@import url('/css/fonts.css');

:root {
  --ink: #1c1b1e;
  --paper: #fffefc;
  --muted: #a39e96;
  --line: #dcdcdd;
  --tint: #f7f7f7;
  --container: 1320px;
  --gutter: 60px;
  --gap: 20px;
}

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

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

body {
  margin: 0;
  font-family: Manrope, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 21px;
  color: var(--ink);
  background: var(--paper);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

/* ---------------- прелоадер ---------------- */
/* Играет на каждой загрузке страницы: линии логотипа проявляются по очереди снизу вверх,
   затем весь оверлей гаснет. Тайминги сняты с донора (i*200+500мс задержка на линию). */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--ink);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.preloader.is-hidden { opacity: 0; pointer-events: none; }
.preloader__mark { width: 189px; height: 189px; }
.preloader__line {
  opacity: 0;
  transform: translateY(190px);
  transform-box: fill-box;
  transform-origin: center;
  animation: preloader-line 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
/* порядок задержек — по возрастанию y1 линии (сверху вниз), как у донора: i*200+500мс */
.preloader__line--1 { animation-delay: .5s; }
.preloader__line--2 { animation-delay: .7s; }
.preloader__line--3 { animation-delay: .9s; }
.preloader__line--4 { animation-delay: 1.1s; }
.preloader__line--5 { animation-delay: 1.3s; }
@keyframes preloader-line { to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .preloader { transition: none; }
  .preloader__line { animation: none; opacity: 1; transform: none; }
}

/* ---------------- шапка ---------------- */
.header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  padding: 22px 0;
  color: var(--paper);
  transition: transform .35s ease, background-color .35s ease, color .35s ease, border-color .35s ease;
  border-bottom: 1px solid transparent;
}
/* уехала вверх при прокрутке вниз */
.header.is-hidden { transform: translateY(-100%); }
/* вернулась при прокрутке вверх — уже на светлом фоне */
.header.is-solid {
  background: var(--paper); color: var(--ink); border-bottom-color: var(--line);
}

.header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 40px;
}

.header__logo img { height: 42px; width: auto; }
.header.is-solid .header__logo img { filter: invert(1); }

.header__nav { display: flex; justify-content: center; gap: 56px; }
.header__link {
  font-size: 14px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  opacity: .95;
}
.header__link:hover { opacity: .65; }

.header__right { display: flex; align-items: center; gap: 26px; }
.header__socials { display: flex; gap: 12px; }
.header__socials a { display: grid; place-items: center; width: 20px; height: 20px; }
.header__socials svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.header__phone { font-size: 16px; font-weight: 500; white-space: nowrap; }

.burger { display: none; width: 28px; height: 20px; border: 0; background: none; padding: 0; position: relative; }
.burger span { position: absolute; left: 0; right: 0; height: 1px; background: currentColor; transition: .3s; }
.burger span:nth-child(1) { top: 2px; }
.burger span:nth-child(2) { top: 9px; }
.burger span:nth-child(3) { top: 16px; }
body.is-menu-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.is-menu-open .burger span:nth-child(2) { opacity: 0; }
body.is-menu-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* выдвижная панель меню */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(380px, 86vw); z-index: 49;
  background: var(--ink); color: var(--paper);
  transform: translateX(100%); transition: transform .4s ease;
  padding: 110px 40px 40px; display: flex; flex-direction: column; gap: 26px;
}
body.is-menu-open .drawer { transform: translateX(0); }
.drawer a { font-size: 18px; }
.drawer__phone { margin-top: auto; font-size: 16px; }
.drawer__backdrop {
  position: fixed; inset: 0; z-index: 48; background: rgba(28, 27, 30, .5);
  opacity: 0; pointer-events: none; transition: opacity .35s ease;
}
body.is-menu-open .drawer__backdrop { opacity: 1; pointer-events: auto; }

/* ---------------- герой ---------------- */
.hero {
  position: relative; min-height: 100vh;
  display: grid; place-items: center; text-align: center;
  color: var(--paper); overflow: hidden;
}
.hero__media { position: absolute; inset: 0; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; }
.hero__media::after { content: ''; position: absolute; inset: 0; background: rgba(28, 27, 30, .28); }
.hero__inner { position: relative; padding: 0 var(--gutter); }
.hero__title {
  margin: 0;
  font-size: 42px; line-height: 49.14px; font-weight: 300;
  letter-spacing: 1px; text-transform: uppercase; white-space: pre-line;
}
.hero__cta { margin-top: 150px; }

/* ---------------- герой внутренней страницы ---------------- */
.phero {
  position: relative; height: 540px;
  display: grid; place-items: center; text-align: center;
  color: var(--paper); overflow: hidden;
}
.phero__media { position: absolute; inset: 0; }
.phero__media img { width: 100%; height: 100%; object-fit: cover; }
.phero__media::after { content: ''; position: absolute; inset: 0; background: rgba(28, 27, 30, .3); }
.phero__title {
  position: relative; margin: 0; padding: 0 var(--gutter);
  font-size: 42px; line-height: 49.14px; font-weight: 300;
  letter-spacing: 1px; text-transform: uppercase; white-space: pre-line;
}

/* ---------------- текст с фотографией сбоку ---------------- */
.textimg { display: grid; grid-template-columns: 460fr 740fr; gap: 60px; align-items: start; }
.textimg--right { grid-template-columns: 600fr 660fr; }
.textimg--right .textimg__media { order: 2; }
.textimg__media img { width: 100%; height: auto; }
.textimg__title { margin: 0 0 18px; font-size: 24px; line-height: 37px; font-weight: 400; }
.textimg__lead { margin: 0 0 18px; }
.textimg__body p { margin: 0 0 18px; }
.textimg__body p:last-child { margin-bottom: 0; }

/* ---------------- сетка портфолио в 4 колонки ---------------- */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); align-items: start; }
.grid4--three { grid-template-columns: repeat(3, 1fr); }
.grid4 .portfolio__media { height: 230px; }
.grid4 .portfolio__name { font-size: 20px; line-height: 30px; }
.grid4 .portfolio__body { padding: 16px 18px 20px; }
.grid4 .portfolio__item { flex: none; }

/* фильтры категорий */
.filters { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 40px; }
.filters__btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  padding: 9px 20px; font-size: 14px; transition: .25s;
}
.filters__btn:hover { border-color: var(--ink); }
.filters__btn.is-active { background: var(--tint); border-color: var(--muted); }

/* ---------------- слайдер проекта ---------------- */
.slider { position: relative; max-width: 760px; margin: 0 auto; }
.slider__track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -ms-overflow-style: none;
}
.slider__track::-webkit-scrollbar { display: none; }
.slider__slide { flex: 0 0 100%; scroll-snap-align: center; }
.slider__slide img { width: 100%; height: 100%; max-height: 1010px; object-fit: cover; }
.slider__arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border: 0; background: none;
  font-size: 34px; line-height: 1; color: var(--paper); opacity: .85;
  text-shadow: 0 1px 6px rgba(28, 27, 30, .5);
}
.slider__arrow:hover { opacity: 1; }
.slider__arrow--prev { left: 4px; }
.slider__arrow--next { right: 4px; }
.slider__arrow[disabled] { opacity: .25; cursor: default; }
.slider__counter { margin-top: 10px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------------- кнопки ---------------- */
.btn {
  display: inline-block; padding: 15px 34px;
  font-size: 16px; line-height: 1; letter-spacing: .02em; text-transform: uppercase;
  border: 1px solid currentColor; background: transparent; color: inherit;
  transition: background-color .25s ease, color .25s ease;
}
/* у донора кнопка-рамка статична: заливка на hover не появляется, только курсор */
.btn--sm { padding: 12px 24px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.btn--solid { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn--solid:hover { opacity: .85; background: var(--paper); color: var(--ink); }

/* ---------------- секции ---------------- */
.section { padding: 90px 0; }
.section--tint { background: var(--tint); }
.section--dark { background: var(--ink); color: var(--paper); }
.section--flush { padding-top: 0; }

.section__head {
  display: grid; grid-template-columns: 1fr auto; align-items: start;
  gap: 24px; margin-bottom: 46px;
}
.section__title {
  margin: 0; max-width: 740px;
  font-size: 42px; line-height: 63px; font-weight: 300; white-space: pre-line;
}
.section__label { font-size: 14px; line-height: 22px; color: var(--muted); white-space: nowrap; }
.section--dark .section__label { color: var(--muted); }

/* ---------------- принципы ---------------- */
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
/* четвёртая карточка занимает две колонки — как в эталоне */
.principles > :nth-child(4) { grid-column: span 2; }

.card {
  border: 1px solid var(--line); padding: 30px 32px 34px;
  display: flex; flex-direction: column; min-height: 190px;
}
.card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.card__title { margin: 0; font-size: 24px; line-height: 37px; font-weight: 400; }
.card__num { font-size: 14px; line-height: 22px; color: var(--muted); }
.card__rule { height: 1px; background: var(--line); margin: 14px 0 18px; }
.card__text { margin: 0; color: var(--ink); max-width: 46ch; }

/* ---------------- портфолио ---------------- */
/* В эталоне ряды зеркалятся: узкая+широкая, затем широкая+узкая.
   Ширины донора 526 и 777 при контейнере 1320 и зазоре 20 — держим те же доли. */
.portfolio { display: flex; flex-wrap: wrap; gap: var(--gap); }
.portfolio__item { flex: 0 0 calc((100% - var(--gap)) * 0.4037); display: block; min-width: 0; }
.portfolio__item:nth-child(4n+2),
.portfolio__item:nth-child(4n+3) { flex-basis: calc((100% - var(--gap)) * 0.5963); }

.portfolio__media { overflow: hidden; height: 600px; background: var(--tint); }
.portfolio__media img { width: 100%; height: 100%; object-fit: cover; }
/* тень «приподнимает» карточку при наведении — без сдвига и без зума, тайминги сняты с донора */
.portfolio__item { transition: box-shadow 1s, opacity .5s; }
.portfolio__item:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.portfolio__body { border: 1px solid var(--line); border-top: 0; padding: 18px 21px 22px; }
.portfolio__name { margin: 0; font-size: 24px; line-height: 36px; font-weight: 400; }
.portfolio__meta { margin: 4px 0 0; font-size: 14px; line-height: 21px; color: var(--muted); }

/* ---------------- этапы ---------------- */
.steps-wrap { position: relative; }
.steps { display: flex; flex-direction: column; gap: var(--gap); }
.step {
  border: 1px solid var(--line); padding: 26px 32px 30px; background: var(--paper);
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start;
}
.step__num { grid-column: 1 / -1; font-size: 14px; line-height: 22px; color: var(--muted); }
.step__title { margin: 0; font-size: 24px; line-height: 36px; font-weight: 400; }
.step__text { margin: 0; color: var(--ink); }

/* на планшете и мобильном этапы становятся горизонтальной каруселью со свайпом,
   как у донора — на десктопе остаются вертикальным списком */
.steps__hint { display: none; }

@media (max-width: 960px) {
  .steps {
    flex-direction: row; overflow-x: auto; gap: var(--gap);
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .steps::-webkit-scrollbar { display: none; }
  .step { flex: 0 0 82%; scroll-snap-align: start; }

  .steps__hint {
    display: block; position: absolute; right: 8px; bottom: -30px;
    pointer-events: none; mix-blend-mode: multiply;
  }
  .steps__hint-card { animation: steps-hint-card 2s infinite; }
  .steps__hint-hand { animation: steps-hint-hand 2s infinite; }
  /* значения в единицах viewBox (320x300), не CSS-пикселях итогового рендера — сняты с донора as-is */
  @keyframes steps-hint-hand {
    0%   { transform: translateX(80px) scale(1); opacity: 0; }
    10%  { transform: translateX(80px) scale(1); opacity: 1; }
    20%, 60% { transform: translateX(175px) scale(.6); opacity: 1; }
    80%  { transform: translateX(5px) scale(.6); opacity: 1; }
    100% { transform: translateX(5px) scale(.6); opacity: 0; }
  }
  @keyframes steps-hint-card {
    0%, 60% { transform: translateX(0); }
    80%, 100% { transform: translateX(-240px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .steps__hint-card, .steps__hint-hand { animation: none; }
}

/* ---------------- партнёры ---------------- */
.marquee { overflow: hidden; position: relative; padding: 30px 0; }
.marquee__track { display: flex; align-items: center; gap: 90px; width: max-content; animation: marquee 34s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item { flex: 0 0 auto; width: 300px; display: grid; place-items: center; }
.marquee__item img { max-height: 90px; width: auto; object-fit: contain; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee__track { animation: none; flex-wrap: wrap; justify-content: center; width: 100%; }
}

/* ---------------- блок для дизайнеров ---------------- */
.designers__label { color: var(--muted); font-size: 14px; line-height: 22px; margin-bottom: 32px; }
.designers__title { margin: 0 0 44px; font-size: 42px; line-height: 63px; font-weight: 300; white-space: pre-line; }

/* ---------------- FAQ ---------------- */
.faq { display: flex; flex-direction: column; gap: var(--gap); }
.faq__item { background: var(--tint); }
.faq__trigger {
  width: 100%; border: 0; background: none; padding: 26px 30px;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  text-align: left; color: var(--ink);
  font-size: 24px; line-height: 36px; font-weight: 400;
}
.faq__icon { position: relative; flex: 0 0 auto; width: 22px; height: 22px; }
.faq__icon::before, .faq__icon::after {
  content: ''; position: absolute; background: var(--muted); transition: transform .3s ease, opacity .3s ease;
}
.faq__icon::before { left: 0; right: 0; top: 50%; height: 1px; }
.faq__icon::after { top: 0; bottom: 0; left: 50%; width: 1px; }
.faq__item.is-open .faq__icon::after { transform: rotate(90deg); opacity: 0; }
.faq__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.faq__item.is-open .faq__panel { grid-template-rows: 1fr; }
.faq__panel > div { overflow: hidden; }
.faq__answer { margin: 0; padding: 0 30px 28px; max-width: 92ch; }

/* ---------------- форма ---------------- */
.formsec { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; }
.formsec__label { color: var(--muted); font-size: 14px; line-height: 22px; margin-bottom: 30px; }
.formsec__title { margin: 0; font-size: 42px; line-height: 63px; font-weight: 300; }
.formsec__card { background: #232227; padding: 40px; }
.formsec__lead { margin: 0 0 26px; font-size: 24px; line-height: 34px; font-weight: 400; }

.field { display: block; margin-bottom: 14px; }
.field input, .field textarea {
  width: 100%; padding: 15px 18px; font: inherit; font-size: 13px; letter-spacing: .06em;
  color: var(--paper); background: transparent; border: 1px solid rgba(255, 254, 252, .35);
  text-transform: uppercase;
}
.field textarea { min-height: 90px; text-transform: none; letter-spacing: normal; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: rgba(255, 254, 252, .55); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--paper); }
.field--error input { border-color: #e08b86; }

.form__note { margin: 16px 0 0; font-size: 10px; line-height: 15px; color: rgba(255, 254, 252, .6); }
.form__note a { text-decoration: underline; }
.form__status { margin: 14px 0 0; font-size: 13px; }
.form__status--ok { color: #9fd6b6; }
.form__status--err { color: #e08b86; }

/* ---------------- подвал ---------------- */
.footer { background: var(--tint); padding: 60px 0 50px; }
.footer__nav { display: flex; gap: 66px; margin-bottom: 34px; }
.footer__nav a { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.footer__nav a:hover { color: var(--muted); }
.footer__bottom { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: end; }
/* логотип белый (рассчитан на тёмный герой) — в светлом подвале инвертируем */
.footer__logo img { height: 54px; width: auto; filter: invert(1); }
.footer__right { text-align: right; color: var(--ink); }
.footer__socials { display: flex; gap: 14px; justify-content: flex-end; margin-bottom: 14px; }
.footer__socials svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.footer__note { margin: 0 0 6px; font-size: 10px; line-height: 15px; color: var(--ink); }
.footer__privacy { font-size: 10px; text-decoration: underline; }

/* ---------------- страницы контента ---------------- */
.prose { max-width: 900px; }
.prose h2 { font-size: 24px; line-height: 37px; font-weight: 400; margin: 0 0 18px; }
.prose__lead { font-size: 14px; line-height: 21px; color: var(--muted); margin: 0 0 26px; }
.prose p { margin: 0 0 18px; }

.pagehead { padding: 190px 0 0; }
.pagehead__title { margin: 0; font-size: 42px; line-height: 63px; font-weight: 300; }

.pagehead__title--project { max-width: 760px; margin: 0 auto; }
.project__body { max-width: 760px; margin: 34px auto 0; font-size: 20px; line-height: 30px; }
.project__params { margin: 0 0 34px; padding-left: 22px; }
.project__params li { margin-bottom: 4px; }
.project__params b { font-weight: 600; }
.project__lead { margin: 0 0 18px; font-size: 24px; line-height: 34px; font-weight: 600; }
.project__body p { margin: 0 0 18px; color: var(--ink); }
.project__also { margin: 0 0 26px; font-size: 22px; line-height: 32px; font-weight: 400; }

.contacts__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 50px; }
.contacts__item { font-size: 18px; line-height: 28px; }
.contacts__icon { width: 40px; height: 40px; margin-bottom: 16px; }
.contacts__item > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.contacts__item a:hover { color: var(--muted); }

/* ---------------- адаптив ---------------- */
@media (max-width: 1200px) {
  :root { --gutter: 40px; }
  .header__nav { gap: 34px; }
  .section__title, .designers__title, .formsec__title, .pagehead__title { font-size: 36px; line-height: 52px; }
}

@media (max-width: 960px) {
  :root { --gutter: 30px; }
  .header__nav, .header__socials { display: none; }
  .burger { display: block; }
  .header__inner { grid-template-columns: auto 1fr auto; }
  .header__right { gap: 18px; }
  .principles { grid-template-columns: repeat(2, 1fr); }
  .principles > :nth-child(4) { grid-column: span 2; }
  .portfolio__media { height: 420px; }
  .step { grid-template-columns: 1fr; gap: 12px; }
  .formsec { grid-template-columns: 1fr; gap: 40px; }
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .grid4--three { grid-template-columns: repeat(2, 1fr); }
  .textimg, .textimg--right { grid-template-columns: 1fr; gap: 30px; }
  .textimg--right .textimg__media { order: 0; }
  .phero { height: 420px; }
}

@media (max-width: 640px) {
  :root { --gutter: 20px; }
  .section { padding: 60px 0; }
  .section__head { grid-template-columns: 1fr; gap: 10px; margin-bottom: 30px; }
  .section__label { order: -1; }
  .hero__title { font-size: 28px; line-height: 34px; }
  .hero__cta { margin-top: 70px; }
  .section__title, .designers__title, .formsec__title, .pagehead__title { font-size: 28px; line-height: 40px; }
  .principles, .project__gallery { grid-template-columns: 1fr; }
  .portfolio__item, .portfolio__item:nth-child(4n+2), .portfolio__item:nth-child(4n+3) { flex-basis: 100%; }
  .portfolio__media { height: auto; aspect-ratio: 4 / 3; }
  .principles > :nth-child(4) { grid-column: span 1; }
  .card__title, .portfolio__name, .faq__trigger, .step__title { font-size: 20px; line-height: 30px; }
  .faq__trigger { padding: 20px; }
  .faq__answer { padding: 0 20px 22px; }
  .formsec__card { padding: 28px 22px; }
  .footer__nav { gap: 22px; flex-wrap: wrap; margin-bottom: 26px; }
  .footer__bottom { grid-template-columns: 1fr; align-items: start; }
  .footer__right { text-align: left; }
  .footer__socials { justify-content: flex-start; }
  .pagehead { padding-top: 140px; }
  .marquee__item { width: 200px; }
  .marquee__track { gap: 50px; }
  .phero { height: 340px; }
  .phero__title { font-size: 26px; line-height: 34px; }
  .grid4, .grid4--three { grid-template-columns: 1fr; }
  .grid4 .portfolio__media { height: auto; aspect-ratio: 4 / 3; }
  .filters { justify-content: flex-start; gap: 8px; margin-bottom: 28px; }
  .filters__btn { padding: 8px 14px; font-size: 13px; }
  .project__body { font-size: 16px; line-height: 26px; }
  .project__lead { font-size: 20px; line-height: 30px; }
  .slider__arrow { width: 34px; font-size: 26px; }
}
