/*
  Cinematic Dark — стили страницы.
  Шапка/секции/услуги/цифры/контакты/подвал/зерно — перенесены из
  styles/style-1-cinematic.html. Сетка работ, слот и карточка — из
  styles/work-grid-demo.html, раскладка A. Классы карточки/фильтров/
  плеера зашиты в assets/js/*.js — их имена менять нельзя.
*/

:root {
  --bg: #0A0A0A;
  --bg-2: #111111;
  --slot: #080808;
  --line: #1F1F1F;
  --fg: #F2F0EC;
  --fg-2: #8C8880;
  --accent: #E0A653;
  --font: 'Inter', -apple-system, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Боковые поля по ТЗ раздел 13: 40px от 1200px, 22px в диапазоне
   620-899px, между ними (900-1199px) — плавное сжатие. clamp() один
   формулой покрывает все точки таблицы: при vw=1200 даёт ровно 40px,
   при vw=900 — ровно 22px, ниже 900 упирается в минимум и держит 22px
   (для диапазона до 619px отдельного значения в ТЗ не задано). */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(22px, 6vw - 32px, 40px); }

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

/* nav */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 10, 10, .6);
  border-bottom: 1px solid var(--line);
}
nav .wrap { display: flex; justify-content: space-between; align-items: center; height: 72px; }
.brand { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; font-weight: 500; }
nav ul { display: flex; gap: 36px; list-style: none; }
nav a { color: var(--fg-2); text-decoration: none; font-size: 13px; letter-spacing: .08em; transition: color .3s; }
nav a:hover { color: var(--fg); }

/* hero */
.hero { position: relative; height: 100vh; min-height: 640px; display: flex; align-items: flex-end; overflow: hidden; }
.hero-media {
  position: absolute; inset: 0;
  background: linear-gradient(115deg, #1a1614 0%, #2b2119 30%, #0e1418 62%, #000 100%);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: scale(1.14) translate(-3%, -2%); } }
.hero-media::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 45%, transparent 0%, rgba(10, 10, 10, .55) 55%, var(--bg) 100%),
    linear-gradient(to top, var(--bg) 2%, transparent 45%);
}
/* Само видео — прозрачный слой поверх градиента. Пока файла нет,
   video ничего не рисует, и посетитель видит только фон .hero-media. */
.hero-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.hero .wrap { position: relative; z-index: 2; padding-bottom: 88px; width: 100%; }
.eyebrow { color: var(--accent); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; margin-bottom: 26px; }
h1 { font-size: clamp(48px, 7.4vw, 108px); font-weight: 200; line-height: .95; letter-spacing: -.035em; }
h1 em { font-style: normal; color: var(--fg-2); }
.hero-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 44px; gap: 40px; flex-wrap: wrap; }
.hero-foot p { color: var(--fg-2); max-width: 390px; font-size: 15px; line-height: 1.75; }
.play { display: inline-flex; align-items: center; gap: 16px; color: var(--fg); text-decoration: none; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
.play[hidden] { display: none; }
.play span.circ { width: 60px; height: 60px; border: 1px solid rgba(242, 240, 236, .28); border-radius: 50%; display: grid; place-items: center; transition: .4s; }
.play:hover span.circ { border-color: var(--accent); background: var(--accent); color: #0A0A0A; }

/* sections */
section { padding: 140px 0; }
.sec-head { display: flex; align-items: baseline; gap: 24px; margin-bottom: 56px; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.sec-num { color: var(--accent); font-size: 12px; letter-spacing: .2em; }
.sec-head h2 { font-size: 13px; letter-spacing: .24em; text-transform: uppercase; font-weight: 500; }
.sec-head .count { margin-left: auto; color: var(--fg-2); font-size: 12px; letter-spacing: .1em; }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 0 46px; }
.filter {
  background: transparent; border: 1px solid var(--line); color: var(--fg-2);
  font-family: inherit; font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  padding: 10px 20px; border-radius: 999px; cursor: pointer; transition: .3s;
  display: inline-flex; align-items: center; gap: 8px;
}
.filter:hover { border-color: #3A3A3A; color: var(--fg); }
.filter.is-active { background: var(--accent); border-color: var(--accent); color: #0A0A0A; }
.filter__count { opacity: .55; font-size: 11px; }
.filter.is-active .filter__count { opacity: .75; }

/* work grid — раскладка A: ровные квадратные слоты */
#work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px 28px; }

.card { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; display: block; width: 100%; cursor: pointer; }
.card__slot { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--slot); border: 1px solid var(--line); }
.card__slot.is-empty { background: var(--bg-2); }

.card__blur {
  position: absolute; inset: -14%;
  background-size: cover; background-position: center;
  filter: blur(34px) brightness(.32) saturate(.7);
  transition: filter .6s;
  z-index: 0;
}
.card__media {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  transition: transform .9s cubic-bezier(.2, .7, .2, 1), filter .6s;
  filter: saturate(.72) brightness(.86);
  z-index: 1;
  display: block;
  /* Явно сбрасываем width/height: у <img> заданы атрибуты width/height
     (для intrinsic-size из card.js), браузер трактует их как
     презентационные хинты и, если конкретное измерение не переопределено
     автору-CSS, использует пиксельное значение атрибута вместо auto —
     тогда aspect-ratio ниже применить не к чему (оба измерения уже
     "заданы"), и картинка растягивается на реальный размер кадра поверх
     квадратного слота. auto здесь возвращает вычисление размера по
     aspect-ratio + единственному заданному измерению (width/height: 100%
     у модификаторов ниже). */
  width: auto;
  height: auto;
}
.card__media.is-horizontal { width: 100%; aspect-ratio: 16 / 9; }
.card__media.is-vertical { height: 100%; aspect-ratio: 9 / 16; }
.card:hover .card__media,
.card:focus-visible .card__media { transform: translate(-50%, -50%) scale(1.05); filter: saturate(1) brightness(1); }

.card__play {
  position: absolute; z-index: 3; left: 50%; top: 50%; translate: -50% -50%;
  width: 60px; height: 60px; border-radius: 50%;
  border: 1px solid rgba(242, 240, 236, .42);
  display: grid; place-items: center;
  color: var(--fg);
  opacity: 0; transition: .45s;
  backdrop-filter: blur(3px);
}
.card:hover .card__play,
.card:focus-visible .card__play { opacity: 1; }

.card__time {
  position: absolute; right: 12px; bottom: 11px; z-index: 3;
  font-size: 11px; letter-spacing: .1em; color: rgba(242, 240, 236, .8);
  background: rgba(0, 0, 0, .5); padding: 4px 9px; backdrop-filter: blur(4px);
}

/* формат слева сверху слота (ТЗ раздел 8, слой 03), эталон styles/work-grid-demo.html */
.card__fmt {
  position: absolute; left: 12px; top: 11px; z-index: 3;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(242, 240, 236, .7); background: rgba(0, 0, 0, .45);
  padding: 4px 8px; backdrop-filter: blur(4px);
}

.card__meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; gap: 16px; }
.card__title { display: block; font-size: 19px; font-weight: 400; letter-spacing: -.015em; transition: color .3s; }
.card:hover .card__title,
.card:focus-visible .card__title { color: var(--accent); }
.card__tag { color: var(--fg-2); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }

.grid__empty { color: var(--fg-2); padding: 60px 0; font-size: 14px; }

/* Луп поверх обложки. Появляется только когда готов играть. */
.card__loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s ease;
  z-index: 2;
}
.card__loop.is-ready { opacity: 1; }

/* services */
.svc { border-top: 1px solid var(--line); }
.svc-row { display: grid; grid-template-columns: 70px 1fr 1.15fr; gap: 32px; padding: 36px 0; border-bottom: 1px solid var(--line); align-items: baseline; transition: .4s; }
.svc-row:hover { padding-left: 16px; background: linear-gradient(90deg, rgba(224, 166, 83, .05), transparent 60%); }
.svc-row .n { color: var(--accent); font-size: 12px; letter-spacing: .16em; }
.svc-row h4 { font-size: 30px; font-weight: 200; letter-spacing: -.02em; }
.svc-row p { color: var(--fg-2); font-size: 14px; line-height: 1.8; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; padding: 80px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat b { display: block; font-size: 64px; font-weight: 200; letter-spacing: -.04em; line-height: 1; }
.stat span { display: block; margin-top: 14px; color: var(--fg-2); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; }

/* contact */
.contact { text-align: center; padding: 170px 0 150px; }
.contact .eyebrow { margin-bottom: 32px; }
/* Почта — одно длинное слово без пробелов, переносить браузеру негде,
   поэтому нижняя граница clamp() уменьшена, чтобы адрес помещался в 375px
   без горизонтальной прокрутки; overflow-wrap: anywhere — страховка на
   случай экрана уже 375px или более длинного адреса в будущем. */
.contact a.mail { display: inline-block; font-size: clamp(24px, 5.6vw, 76px); font-weight: 200; letter-spacing: -.035em; color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 12px; transition: .4s; overflow-wrap: anywhere; }
.contact a.mail:hover { color: var(--accent); border-color: var(--accent); }
.socials { display: flex; gap: 36px; justify-content: center; margin-top: 56px; }
.socials a { color: var(--fg-2); text-decoration: none; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; transition: color .3s; }
.socials a:hover { color: var(--fg); }

footer { border-top: 1px solid var(--line); padding: 34px 0; color: #5A5751; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }

/* lightbox — плеер поверх страницы */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: rgba(0, 0, 0, .9);
  backdrop-filter: blur(8px);
}
.lightbox[hidden] { display: none; }
.lightbox__stage { width: min(1100px, 100%); aspect-ratio: 16 / 9; }
.lightbox.is-vertical .lightbox__stage {
  /* высота ограничена высотой окна, ширина — шириной окна с учётом отступов лайтбокса;
     побеждает меньшее ограничение, чтобы сцена не вылезала за край на телефоне */
  width: min(100%, calc(85vh * 9 / 16));
  height: auto;
  aspect-ratio: 9 / 16;
}
.lightbox__stage iframe { width: 100%; height: 100%; border: 0; }
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: 1px solid var(--line);
  color: var(--fg);
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 16px;
}
body.is-locked { overflow: hidden; }

/* Фокус виден всегда — требование доступности из ТЗ */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Границы сведены к таблице ТЗ раздел 13: 900-1199px — 3 колонки (поля
   уже сжимаются через clamp() в .wrap выше, здесь трогать нечего);
   620-899px — 2 колонки, поля 22px, якоря навигации скрыты; до 619px —
   1 колонка. */
@media (max-width: 899px) {
  #work-grid { grid-template-columns: repeat(2, 1fr); }
  nav ul { display: none; }
  .svc-row { grid-template-columns: 1fr; gap: 10px; }
  .stats { grid-template-columns: 1fr; gap: 48px; }
  section { padding: 90px 0; }
}
@media (max-width: 619px) {
  #work-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .hero-media { animation: none; }
  /* ТЗ раздел 14: движение отключается полностью, а не ускоряется.
     Цвет и прозрачность (filter, background) — не движение, их не трогаем. */
  .card:hover .card__media,
  .card:focus-visible .card__media { transform: translate(-50%, -50%); }
  .svc-row:hover { padding-left: 0; }
}
