/* ============ базовое ============ */
:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --muted: #8f8f8f;
  --line: #e4e4e4;
  --display: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--bg); }

[hidden] { display: none !important; }

/* ============ навигация ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.3rem 2.5rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
}

.nav a { text-decoration: none; color: var(--ink); }

.nav__logo {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.nav__links { display: flex; gap: 2rem; }

.nav__links a {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  position: relative;
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s ease;
}

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

/* ============ hero ============ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 5.5rem;
  overflow: hidden;
}

.hero__top {
  position: relative;
  /* без flex:1 — иначе этот блок съедает всё свободное место на высоких экранах,
     и получается большой отступ до «hero__services», а после имени внизу — почти никакого */
  min-height: 46vh;
  padding: 6vh 2.5rem 0;
  overflow: hidden; /* подстраховка: ни одна плитка коллажа не вылезет на полосу с разделами ниже */
}

.hero__eyebrow {
  position: relative;
  z-index: 2;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.4rem;
  opacity: 0;
  animation: fade-up 0.9s ease 0.1s forwards;
}

.hero__intro {
  position: relative;
  z-index: 2;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.2vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 21ch;
  opacity: 0;
  animation: fade-up 1s ease 0.25s forwards;
}

.hero__portrait {
  position: relative;
  z-index: 2;
  width: clamp(7.5rem, 11vw, 10.5rem);
  aspect-ratio: 3 / 4;
  margin-top: 2rem;
  overflow: hidden;
  background: linear-gradient(160deg, #f1f1f1, #e0e0e0);
  opacity: 0;
  animation: fade-up 1s ease 0.4s forwards;
}

.hero__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- коллаж работ: всплывают одна за другой и медленно дрейфуют --- */
.hero__collage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero__tile {
  position: absolute;
  pointer-events: auto;   /* коллаж сам не ловит клики, а плитки — да: открывают работу крупно */
  cursor: pointer;
  opacity: 0;
  animation: tile-in 1.1s cubic-bezier(0.2, 0.6, 0.2, 1) forwards, drift 12s ease-in-out infinite alternate;
}

.hero__tile-inner {
  display: inline-block;
  height: 100%;
  overflow: hidden;
  transition: transform 0.6s ease-out;
  will-change: transform;
}

.hero__tile img,
.hero__tile video {
  height: 100%;
  width: auto;    /* ширина считается из реальных пропорций файла — ничего не обрезается и не тянется */
  display: block;
}

/* у каждой плитки задана только высота (см. ниже) — ширина сама подстраивается
   под пропорции конкретного фото/видео. Высота не даёт плитке вылезти вниз
   и перекрыть полосу с разделами под коллажем, какими бы ни были пропорции файла. */
.hero__tile:nth-child(1) { height: 38vh; left: 35%; top: 2%;  animation-delay: 0.5s, 0s; }
.hero__tile:nth-child(2) { height: 25vh; left: 49%; top: 32%; animation-delay: 0.8s, 2s; }
.hero__tile:nth-child(3) { height: 41vh; left: 57%; top: 0%;  animation-delay: 1.1s, 4s; }
.hero__tile:nth-child(4) { height: 24vh; left: 73%; top: 36%; animation-delay: 1.4s, 1s; }
.hero__tile:nth-child(5) { height: 35vh; left: 81%; top: 2%;  animation-delay: 1.7s, 3s; }
.hero__tile:nth-child(6) { height: 23vh; left: 41%; top: 54%; animation-delay: 2.0s, 5s; }
.hero__tile:nth-child(7) { height: 26vh; left: 91%; top: 42%; animation-delay: 2.3s, 2.5s; }
.hero__tile:nth-child(8) { height: 28vh; left: 62%; top: 52%; animation-delay: 2.6s, 4.5s; }

@keyframes tile-in {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes drift {
  from { translate: 0 0; }
  to   { translate: 0 -16px; }
}

/* --- разделы под интро: кликабельные, ведут в фильтр работ --- */
.hero__services {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 5vh 2.5rem 0;
  padding: 0.65rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  opacity: 0;
  animation: fade-up 1s ease 0.45s forwards;
}

.hero__services a {
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding-right: 1.1em;
  transition: color 0.3s ease;
}

.hero__services a::after {
  content: "↓";
  position: absolute;
  right: 0;
  top: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hero__services a:hover { color: var(--muted); }
.hero__services a:hover::after { opacity: 1; transform: translateY(0); }

.hero__name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 11vw;
  line-height: 0.9;
  letter-spacing: -0.05em;
  white-space: nowrap;
  text-align: center;
  padding-bottom: 0.06em;
  margin-bottom: 4vh;   /* воздух перед линией следующей секции — раньше текст почти упирался в неё */
  opacity: 0;
  animation: fade-up 1.1s ease 0.6s forwards;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ обо мне ============ */
.about {
  border-top: 1px solid var(--line);
  padding: 20vh 8vw;
  display: flex;
  justify-content: center;
}

.about__inner { max-width: 820px; }

.about__statement {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.8rem, 3.8vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 2.4rem;
}

.about__text {
  color: var(--muted);
  max-width: 560px;
  font-size: 0.95rem;
}

/* ============ работы ============ */
.works {
  border-top: 1px solid var(--line);
  padding: 10vh 2.5rem 14vh;
}

.works__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: 4rem;
}

.works__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  letter-spacing: -0.03em;
}

.works__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
}

.works__filters button {
  background: none;
  border: 0;
  padding: 0 0 3px;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.works__filters button:hover { color: var(--ink); }

.works__filters button.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.works__grid {
  columns: 3;
  column-gap: 2rem;
}

.work {
  break-inside: avoid;
  margin-bottom: 2rem;
  cursor: pointer;
}

.work__media {
  position: relative;
  overflow: hidden;
  background: #f2f2f2;
}

.work__media img,
.work__media video {
  width: 100%;
  display: block;
  transition: transform 0.8s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.work:hover .work__media img,
.work:hover .work__media video {
  transform: scale(1.04);
}

.work__caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-top: 0.65rem;
}

.work__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.work__tag {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

/* плейсхолдеры, пока нет работ — нейтральный серый */
.ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.1rem;
  color: #c4c4c4;
}

.ph--1 { background: linear-gradient(160deg, #f4f4f4, #e6e6e6); }
.ph--2 { background: linear-gradient(160deg, #ededed, #dcdcdc); }
.ph--3 { background: linear-gradient(160deg, #f1f1f1, #e0e0e0); }
.ph--4 { background: linear-gradient(160deg, #e9e9e9, #d8d8d8); }
.ph--5 { background: linear-gradient(160deg, #f5f5f5, #e3e3e3); }
.ph--6 { background: linear-gradient(160deg, #eeeeee, #dddddd); }

.work__media .ph { aspect-ratio: 3 / 4; }
.work--wide .work__media .ph { aspect-ratio: 4 / 3; }

/* ============ контакты ============ */
.contact {
  border-top: 1px solid var(--line);
  padding: 18vh 8vw 16vh;
  text-align: center;
}

.contact__lead {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.contact__links {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
}

.contact__links a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(10, 10, 10, 0.3);
  padding-bottom: 3px;
  transition: border-color 0.3s ease, opacity 0.3s ease;
}

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

/* ============ лайтбокс (крупный просмотр работы) ============ */
body.lightbox-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5vh 5vw;
  background: rgba(10, 10, 10, 0.94);
  cursor: zoom-out;
  animation: lightbox-in 0.25s ease;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox__media {
  max-width: 100%;
  max-height: 82vh;
  cursor: default;
}

.lightbox__media img,
.lightbox__media video {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox__caption {
  color: #f2f2f2;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-align: center;
  min-height: 1em;
}

.lightbox__close {
  position: fixed;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: 0;
  color: #f2f2f2;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.lightbox__close:hover { opacity: 1; }

.lightbox__arrow {
  appearance: none;
  -webkit-appearance: none;
  position: fixed;
  z-index: 5;
  top: 50%;
  transform: translateY(-50%);
  width: 3.2rem;
  height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #f2f2f2;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.lightbox__arrow:hover { opacity: 1; background: rgba(255, 255, 255, 0.18); }
.lightbox__arrow--prev { left: 1.2rem; }
.lightbox__arrow--next { right: 1.2rem; }

@media (max-width: 600px) {
  .lightbox { padding: 4vh 4vw; }
  .lightbox__close { top: 1rem; right: 1rem; }
  .lightbox__arrow { width: 2.6rem; height: 2.6rem; font-size: 1.5rem; }
  .lightbox__arrow--prev { left: 0.5rem; }
  .lightbox__arrow--next { right: 0.5rem; }
}

/* ============ футер ============ */
.footer {
  padding: 2rem;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ============ появление при скролле ============ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ страница коммерческих работ ============ */
.page {
  padding: 20vh 2.5rem 10vh;
  max-width: 1200px;
  margin: 0 auto;
}

.page__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.page__note {
  color: var(--muted);
  max-width: 540px;
  margin-bottom: 5rem;
  font-size: 0.95rem;
}

/* ============ мобильные ============ */
@media (max-width: 900px) {
  .works__grid { columns: 2; column-gap: 1.1rem; }
  .work { margin-bottom: 1.1rem; }
  .hero__tile:nth-child(n+6) { display: none; }
  .hero__tile:nth-child(1) { height: 26vh; left: 44%; top: 0%; }
  .hero__tile:nth-child(2) { height: 17vh; left: 58%; top: 40%; }
  .hero__tile:nth-child(3) { height: 25vh; left: 72%; top: 2%; }
  .hero__tile:nth-child(4) { height: 17vh; left: 87%; top: 42%; }
  .hero__tile:nth-child(5) { height: 14vh; left: 49%; top: 62%; }
}

@media (max-width: 600px) {
  .nav { padding: 1rem 1.3rem; }
  .nav__links { gap: 1.2rem; }
  .works__grid { columns: 1; }
  .about { padding: 14vh 8vw; }
  .hero { min-height: auto; }
  .hero__top { padding: 4vh 1.3rem 0; min-height: 0; }
  .hero__intro { max-width: 16ch; }
  /* на телефоне оставляем две плитки справа от текста */
  .hero__tile:nth-child(n+3) { display: none; }
  .hero__tile:nth-child(1) { height: 30vh; left: 58%; top: 0; }
  .hero__tile:nth-child(2) { height: 20vh; left: 52%; top: 48%; }
  .hero__services {
    margin: 5vh 1.3rem 0;
    flex-direction: column;
    gap: 0.2rem;
  }
  .hero__name { margin-top: 6vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
