/* ==================== Шрифты ==================== */
@font-face {
  font-family: 'Involve';
  src: url('fonts/Involve-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Involve';
  src: url('fonts/Involve-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Involve';
  src: url('fonts/Involve-SemiBold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==================== Переменные ==================== */
:root {
  --paper: #ffffff;
  --ink: #191718;
  --ink-soft: rgba(25, 23, 24, 0.6);
  --ink-card: rgba(39, 38, 42, 0.6);
  --wine: #4e0000;
  --graphite: #2a292e;
  --cream: #f6f5f1;
  --slot: #e8e5e0;
  --shadow: rgba(42, 41, 46, 0.15);
  --h: 40px;
  --font-text: 'Involve', sans-serif;
  --gap: 20px;
  --section: 100px;
  color-scheme: light;
}

/* ==================== Сброс ==================== */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 17px;
  letter-spacing: 0;
  font-synthesis: none;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }
p, h1, h2, h3, ul { margin: 0; padding: 0; }
ul { list-style: none; }

/* ==================== Обёртка страницы ==================== */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: 50px;
  padding-block: 50px;
  display: flex;
  flex-direction: column;
  gap: var(--section);
  min-height: 100vh;
}
.page > .foot,
.page > footer {
  margin-top: auto;
  padding-top: 100px;
}
.page { zoom: var(--zoom, 1); }

@media (min-width: 1440px) { :root { --zoom: 1.05; } }
@media (min-width: 1680px) { :root { --zoom: 1.15; } }
@media (min-width: 1920px) { :root { --zoom: 1.2;  } }
@media (min-width: 2160px) { :root { --zoom: 1.3;  } }
@media (min-width: 2560px) { :root { --zoom: 1.4;  } }
@media (min-width: 3200px) { :root { --zoom: 1.55; } }

/* ==================== Общие элементы ==================== */
.h {
  font-weight: 400;
  font-size: var(--h);
  line-height: 53px;
  text-transform: uppercase;
}
.h--right { text-align: right; }

.lead {
  color: var(--ink-soft);
  letter-spacing: 0.5px;
  text-align: justify;
  hyphens: manual;
  text-wrap: balance;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 260px;
  max-width: 100%;
  padding: 15px 20px;
  border: 0;
  font: inherit;
  font-size: 16px;
  line-height: 20px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--cream);
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn--wine { background: var(--wine); }
.btn--dark { background: var(--graphite); }
.btn--sm { font-size: 14px; line-height: 18px; width: 100%; }

.font-sample .involve {
  font-family: 'Involve', sans-serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 1.1;
}

/* ==================== Место под фотографию ==================== */
.ph {
  position: relative;
  overflow: hidden;
  background: var(--slot);
  max-width: 100%;
  cursor: zoom-in;
}
.ph::before {
  content: attr(data-file);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  font-size: 11px;
  line-height: 14px;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  text-align: center;
}
.ph img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ph video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ph--sq { aspect-ratio: 1; }
.ph--hero { width: 633px; height: 332px; }

/* ==================== Шапка ==================== */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-text);
  font-weight: 400;
  position: relative;
}
.top > a { font-size: 15px; line-height: 18px; }
.nav { display: flex; gap: 100px; }
.nav a, .foot-links a { transition: color 0.2s; }
.nav a:hover, .foot-links a:hover {
  color: var(--wine);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.burger {
  display: none;
  width: 44px;
  height: 44px;
  margin: -13px -12px -13px 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.burger span, .burger span::after {
  display: block;
  width: 20px;
  height: 1px;
  background: var(--ink);
}
.burger span { position: relative; top: -2.5px; }
.burger span::after { content: ""; position: absolute; top: 5px; left: 0; }

/* ==================== Hero ==================== */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-top: 0;
}
.hero--services {
  grid-template-columns: minmax(0, 633px) minmax(0, 1fr);
}
.hero-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  min-width: 0;
}
.hero-copy { display: flex; flex-direction: column; gap: 20px; }
.pair { display: flex; gap: var(--gap); flex-wrap: wrap; }
.pair .btn { flex: 1 1 200px; }

/* ==================== Hero портфолио ==================== */
.hero-pf {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.hero-pf .h { text-align: right; }
.hero-pf .ph { width: 100%; height: 332px; }
.hero-pf .btn { align-self: flex-end; }

/* ==================== Секция-колонка ==================== */
.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 50px;
}

/* ==================== Фильтры ==================== */
.filters {
  display: flex;
  gap: 100px;
  flex-wrap: wrap;
  justify-content: center;
}
.filters button {
  border: 0;
  background: none;
  padding: 4px 0;
  font: inherit;
  line-height: 17px;
  letter-spacing: 0;
  color: var(--ink-soft);
  cursor: pointer;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 4px; }

/* ==================== Сетка работ ====================
   Один «блок» = одна категория = 10-элементный цикл раскладки.

   Паттерн (6 колонок, gap 20px, ширина контейнера 1100px):
     1–2  : два фото 540×500              (по 3 колонки каждое)
     3–5  : широкое 727×540 + два 353×260 друг над другом
     6–7  : два фото 540×500
     8–10 : два 353×260 друг над другом + широкое 727×540 (зеркально)
   Ширины сходятся: 540+20+540 = 1100, 727+20+353 = 1100,
   а 260 + 20 + 260 = 540 — высота широкого фото.
================================================================ */
.works {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.works-cat {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gap);
  grid-auto-rows: 500px 260px 260px 500px 260px 260px;
  grid-auto-flow: dense;
}

/* Позиции 1–10 внутри каждого блока */
@media (min-width: 761px) {
  .works-cat > .ph:nth-child(10n+1)  { grid-column: 1 / span 3; }
  .works-cat > .ph:nth-child(10n+2)  { grid-column: 4 / span 3; }
  .works-cat > .ph:nth-child(10n+3)  { grid-column: 1 / span 4; grid-row: span 2; }
  .works-cat > .ph:nth-child(10n+4)  { grid-column: 5 / span 2; }
  .works-cat > .ph:nth-child(10n+5)  { grid-column: 5 / span 2; }
  .works-cat > .ph:nth-child(10n+6)  { grid-column: 1 / span 3; }
  .works-cat > .ph:nth-child(10n+7)  { grid-column: 4 / span 3; }
  .works-cat > .ph:nth-child(10n+8)  { grid-column: 3 / span 4; grid-row: span 2; }
  .works-cat > .ph:nth-child(10n+9)  { grid-column: 1 / span 2; }
  .works-cat > .ph:nth-child(10n+10) { grid-column: 1 / span 2; }
}

.works .mono img,
.works .mono video { filter: grayscale(1); }
.works .is-hidden { display: none; }
/* Если в блоке все фото скрыты фильтром — прячем и сам блок */
.works-cat:not(:has(.ph:not(.is-hidden))) { display: none; }

/* ==================== Готовые предложения ==================== */
.offers-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

/* ==================== Пакеты услуг ==================== */
.packs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  justify-content: center;
  align-items: stretch;
}
.packs .is-hidden { display: none; }

/* ==================== Карточка ==================== */
.card {
  background: var(--paper);
  box-shadow: 0 4px 43px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 20px;
  min-width: 0;
  height: 100%;
}
.card .ph { height: 280px; }
.card-body {
  flex: 1;
  width: 266px;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 100px;
}
.card-info { display: flex; flex-direction: column; gap: 20px; }
.card h3 {
  font-weight: 700;
  font-size: 20px;
  line-height: 26px;
  text-transform: uppercase;
}
.card-note {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0;
  color: var(--ink-soft);
  margin-bottom: 20px;
}
.ticks { display: flex; flex-direction: column; gap: 20px; }
.ticks li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0;
  color: var(--ink);
}
.ticks li:last-child { align-items: center; }
.tick {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  position: relative;
}
.tick::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  width: 5px;
  height: 9px;
  border: solid var(--cream);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.tick img { position: absolute; inset: 0; width: 20px; height: 20px; z-index: 1; }
.card-buy { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.price {
  font-size: 25px;
  line-height: 33px;
  text-transform: uppercase;
  color: var(--graphite);
  font-variant-numeric: tabular-nums;
}

/* ==================== Обо мне ==================== */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}
.about-red { width: 260px; justify-self: end; align-self: start; margin-top: 10px; }
.about-copy { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.about-wide { height: 260px; }
.about-end {
  display: flex;
  gap: var(--gap);
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
}
.about-end .ph { width: 260px; }

/* ==================== Контакты ==================== */
.contacts-hero {
  display: grid;
  grid-template-columns: 633px minmax(0, 1fr);
  gap: var(--gap);
  /* align-items: stretch не нужно указывать — это default у grid */
}

.contacts-hero .ph {
  width: 100%;
  height: 332px;
  /* flex: none убираем, оно больше не нужно */
}

.contacts-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 20px;
}

.contacts-info .h { margin-bottom: 0; }
.contacts-info a:first-of-type { margin-top: auto; }
.contacts-info a {
  font-size: 25px;
  line-height: 33px;
  font-weight: 400;
  text-transform: uppercase;
  text-align: right;
  user-select: all;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.contacts-info a:hover { color: var(--wine); }

/* ==================== Страница «в разработке» ==================== */
.stub {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 30px;
  padding-block: 60px;
}
.stub .h {
  font-size: var(--h);
  line-height: 1.15;
  text-align: center;
  max-width: 800px;
}
.stub-note {
  color: var(--ink-soft);
  letter-spacing: 0.5px;
  max-width: 460px;
}

/* ==================== Подвал ==================== */
.foot { display: flex; flex-direction: column; gap: 50px; }
.foot-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap); }
.logo { font-family: var(--font-text); font-weight: 400; font-size: 15px; line-height: 18px; }
.foot-call {
  width: 841px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-transform: uppercase;
  font-weight: 400;
}
.foot-call a {
  font-size: 35px;
  line-height: 36px;
  text-align: right;
  user-select: all;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.foot-call a:hover { color: var(--wine); }
.foot-call,
.foot-call .h,
.foot-call a { font-weight: 400; }
.foot-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap);
}
.foot-links {
  display: flex;
  gap: 100px;
  flex-wrap: wrap;
  color: var(--ink-soft);
  letter-spacing: 0;
}
.social { display: flex; gap: 30px; align-items: flex-end; }
.social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  position: relative;
  transition: opacity 0.2s;
}
.social img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: var(--paper);
}

/* ==================== Мобильные ==================== */
@media (max-width: 760px) {
  :root { --h: 16px; --section: 50px; }
  .h       { line-height: 20px; white-space: wrap; }
  .page    { padding-inline: 20px; padding-block: 32px 50px; }
  .foot-call a { font-size: 18px; line-height: 22px; }

  .burger { display: flex; }
  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 16px);
    left: -15px;
    right: -15px;
    z-index: 5;
    flex-direction: column;
    gap: 20px;
    padding: 20px 20px;
    background: var(--paper);
    border-block: 1px solid var(--slot);
  }
  .nav.open { display: flex; }
  

 .hero > .ph:has(video),
  .hero-pf > .ph:has(video),
  .contacts-hero > .ph:has(video) {
    width: 100%;
    height: auto;
    aspect-ratio: 633 / 332;
  }

  .hero { display: flex; flex-direction: column; }
  .hero-side { display: contents; }
  .hero-copy { display: contents; }
  .hero .h { order: -1; text-align: right; }
  .hero .pair { margin-top: 30px; flex-direction: column; }
  .pair .btn { flex: none; width: 100%; }
  .ph--hero { width: 100%; height: auto; aspect-ratio: 633 / 332; }

  .hero-pf .btn { align-self: stretch; width: 100%; }

  .stack { gap: 50px; }
  .stack > .btn { width: 260px; }

  .filters { width: 100%; justify-content: space-between; gap: 10px; font-size: 12px; }

  /* Мобильная раскладка блока: 2 колонки квадратов */
  .works-cat {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
    grid-auto-flow: row;
  }
  .works-cat > .ph {
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: 1;
    height: auto;
  }
  .works-cat > .ph:nth-child(10n+3),
  .works-cat > .ph:nth-child(10n+8) {
    grid-column: 1 / -1;
    aspect-ratio: 1;
    height: auto;
  }

  .cards { grid-template-columns: 1fr; }
  .packs { grid-template-columns: 1fr; }

  .card-body {
    gap: 60px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding-inline: 16px;
  }

  .about { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .about-copy, .about-end { display: contents; }
  .about .h { grid-area: 1 / 1 / 2 / 3; }
  .about-red { grid-area: 2 / 1; width: 100%; margin: 0; }
  .about-end .ph { grid-area: 2 / 2; width: 100%; }
  .about-wide { grid-area: 3 / 1 / 4 / 3; }
  .about-copy .lead { grid-area: 4 / 1 / 5 / 3; }
  .about-end .btn { grid-area: 5 / 1 / 6 / 3; width: 100%; margin-top: 30px; }

  .contacts-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-end;     /* ← прижимает всё вправо */
    gap: 20px;
  }

  .contacts-hero .ph {
    width: 100%;
    height: auto;
    aspect-ratio: 633 / 332;
    order: 2;
    align-self: stretch;       /* картинка — на всю ширину */
  }

  .contacts-info { display: contents; }

  .contacts-info .h,
  .contacts-info .h--right {
    order: 1;                  /* заголовок сверху */
    text-align: right;
    margin-bottom: 0;
    align-self: flex-end;
  }

  .contacts-info a {
    order: 3;                  /* ссылки снизу */
    font-size: 16px;
    line-height: 22px;
    text-align: right;
    align-self: flex-end;
    margin-top: 0;
  }

  .contacts-info a:first-of-type { margin-top: 0; }


  .stub .h { white-space: normal; }

  .foot-top .logo { display: none; }
  .foot-call a { text-align: right; }
  .foot-bottom { align-items: flex-end; }
  .foot-links { flex-direction: column; gap: 20px; }
  .social { flex-direction: column; align-items: center; gap: 20px; }

  .lightbox { padding: 16px; }
  .lightbox__close { top: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .lightbox { transition: none; }
}
html { scroll-behavior: smooth; }