/* =========================================================
   Движение и медиа: заставка, зерно, курсор, видео,
   бегущая строка, манифест, галерея, подпись в подвале.
   Всё отключается при «уменьшить движение» в системе.
   ========================================================= */

/* ---------- Плавная прокрутка (Lenis) ---------- */
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto; }
.lenis.lenis-stopped { overflow: clip; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Заставка ---------- */
.intro { display: none; }
.has-intro .intro {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--bg-deep);
  transition: clip-path 1.1s cubic-bezier(.76, 0, .24, 1);
  clip-path: inset(0 0 0 0);
}
.has-intro .intro.is-out { clip-path: inset(0 0 100% 0); }
.intro__inner { display: grid; justify-items: center; gap: 18px; text-align: center; }
.intro__mark { width: 64px; height: 75px; fill: var(--accent); opacity: 0; transform: translateY(12px) scale(.94); animation: intro-mark 1.1s var(--ease-out) .15s forwards; }
.intro__mark .em-ref { opacity: .25; }
.intro__name, .intro__role { overflow: hidden; }
.intro__name span, .intro__role span { display: inline-block; transform: translateY(110%); animation: intro-up 1s var(--ease-out) forwards; }
.intro__name { font: 400 clamp(1.5rem, 3.2vw, 2.2rem)/1.2 var(--ff-display); color: var(--text); }
.intro__name span { animation-delay: .45s; }
.intro__role { font: 400 .72rem/1.4 var(--ff-label); letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.intro__role span { animation-delay: .62s; }
.intro__line { position: absolute; left: 0; bottom: 0; height: 1px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; animation: intro-line 1.5s var(--ease) .2s forwards; }
.intro.is-out .intro__inner { transform: translateY(-40px); opacity: 0; transition: transform .9s var(--ease), opacity .6s; }
@keyframes intro-mark { to { opacity: 1; transform: none; } }
@keyframes intro-up { to { transform: none; } }
@keyframes intro-line { to { transform: scaleX(1); } }

/* ---------- Плёночное зерно ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 250; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .055; mix-blend-mode: overlay;
  animation: grain 1.2s steps(6) infinite;
}
[data-theme="ivory"] .grain { opacity: .08; mix-blend-mode: multiply; }
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-6%, 4%); } 40% { transform: translate(5%, -7%); }
  60% { transform: translate(-3%, 8%); } 80% { transform: translate(7%, 2%); } 100% { transform: translate(0, 0); }
}

/* ---------- Курсор ---------- */
.cursor { display: none; }
.has-cursor .cursor { display: block; position: fixed; left: 0; top: 0; z-index: 260; pointer-events: none; }
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor summary, .has-cursor label { cursor: none; }
.has-cursor input, .has-cursor textarea { cursor: text; }
.cursor__dot, .cursor__ring { position: absolute; left: 0; top: 0; border-radius: 50%; will-change: transform; }
.cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent); transition: opacity .3s, width .3s, height .3s; }
.cursor__ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  display: grid; place-items: center;
  transition: width .45s var(--ease-out), height .45s var(--ease-out), margin .45s var(--ease-out), background-color .4s, border-color .4s, opacity .3s;
}
.cursor__label { font: 400 .62rem/1 var(--ff-label); letter-spacing: .2em; text-transform: uppercase; color: var(--on-accent); opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s var(--ease-out); white-space: nowrap; }
.cursor.is-link .cursor__ring { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: transparent; }
.cursor.is-link .cursor__dot { opacity: 0; }
.cursor.is-label .cursor__ring { width: 96px; height: 96px; margin: -48px 0 0 -48px; background: var(--accent); border-color: var(--accent); }
.cursor.is-label .cursor__label { opacity: 1; transform: none; }
.cursor.is-label .cursor__dot { opacity: 0; }
.cursor.is-text .cursor__ring { width: 4px; height: 30px; margin: -15px 0 0 -2px; border-radius: 2px; background: var(--accent); border-color: transparent; }
.cursor.is-hidden .cursor__ring, .cursor.is-hidden .cursor__dot { opacity: 0; }
.cursor.is-down .cursor__ring { transform-origin: center; }

/* ---------- Кнопка: периодический блик ---------- */
.btn--accent::before {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: -60%; width: 40%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
  transform: skewX(-20deg); animation: shine 7s var(--ease) 4s infinite;
}
@keyframes shine { 0%, 72% { transform: skewX(-20deg) translateX(0); } 100% { transform: skewX(-20deg) translateX(520%); } }

/* ---------- Видео поверх фото ---------- */
.motion-video { display: block; opacity: 0; transition: opacity 1.6s var(--ease); pointer-events: none; }
.motion-video.is-playing { opacity: 1; }
.hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; filter: var(--portrait-filter); }
.about__photo { overflow: hidden; }
.about__video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%;
  filter: brightness(.9) saturate(.92);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%), linear-gradient(180deg, transparent 0, #000 10%, #000 78%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%), linear-gradient(180deg, transparent 0, #000 10%, #000 78%, transparent 100%);
          mask-composite: intersect;
}
.about__photo img, .about__video { transform: scale(var(--zoom, 1.08)); transition: none; }

/* ---------- Бегущая строка ---------- */
.marquee { overflow: hidden; border-bottom: 1px solid var(--line); background: var(--bg); padding: clamp(22px, 3.4vw, 40px) 0; }
.marquee__track { display: flex; width: max-content; will-change: transform; }
.marquee__set { display: flex; align-items: center; flex-shrink: 0; }
.marquee span {
  font: 400 clamp(2.4rem, 6.4vw, 5.6rem)/1 var(--ff-display); letter-spacing: -.01em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--accent) 70%, transparent);
  padding: 0 .35em; transition: color .5s, -webkit-text-stroke-color .5s;
}
.marquee span:nth-of-type(2n) { font-style: italic; }
.marquee span:hover { color: var(--accent); }
.marquee i { width: 14px; height: 14px; flex-shrink: 0; background: var(--accent); transform: rotate(45deg); opacity: .8; }
[data-theme="ivory"] .marquee span { -webkit-text-stroke-color: color-mix(in srgb, var(--text) 55%, transparent); }

/* ---------- Манифест ---------- */
.manifest { padding-block: clamp(90px, 13vw, 180px); background: var(--bg); border-bottom: 1px solid var(--line); }
.manifest .label { margin-bottom: 30px; }
.manifest__text { max-width: 22em; font: 400 clamp(1.8rem, 3.9vw, 3.4rem)/1.22 var(--ff-display); letter-spacing: -.01em; color: var(--text); text-wrap: balance; }
.manifest__text .mw { opacity: .14; transition: opacity .35s linear; }
.manifest__text .mw.is-lit { opacity: 1; }
.manifest__text .mw.is-key { color: var(--accent); font-style: italic; }
[data-theme="ivory"] .manifest__text .mw.is-key { color: var(--label); }

/* ---------- Заголовки: слова поднимаются ---------- */
.js .h2.is-split[data-reveal] { opacity: 1; transform: none; }
.h2.is-split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.h2.is-split .w > span { display: inline-block; transform: translateY(105%) rotate(4deg); transform-origin: left bottom; transition: transform 1.1s var(--ease-out); transition-delay: calc(var(--i) * 55ms + 80ms); }
.h2.is-split.is-in .w > span { transform: none; }

/* ---------- Подписи разделов: линия ---------- */
.js .label[data-reveal] { position: relative; }

/* ---------- Карточки направлений: фото ---------- */
.card__media { position: absolute; inset: 0; z-index: -2; margin: 0; overflow: hidden; clip-path: inset(100% 0 0 0); transition: clip-path .9s var(--ease-out); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); transition: transform 1.4s var(--ease-out); filter: brightness(.5) saturate(.85); }
.card__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--bg-deep) 55%, transparent) 0%, color-mix(in srgb, var(--bg-deep) 82%, transparent) 70%, var(--bg-deep) 100%); }
.card:hover .card__media, .card:focus-within .card__media { clip-path: inset(0 0 0 0); }
.card:hover .card__media img, .card:focus-within .card__media img { transform: scale(1.04); }
.card:hover .card__text { color: var(--text); }
[data-theme="ivory"] .card__media img { filter: brightness(1.05) saturate(.7) contrast(.9); }
[data-theme="ivory"] .card__media::after { background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 55%, transparent) 0%, color-mix(in srgb, var(--surface-2) 86%, transparent) 70%, var(--surface-2) 100%); }
@media (hover: none) {
  .card__media { clip-path: none; }
  .card__media img { transform: none; filter: brightness(.42) saturate(.8); }
  [data-theme="ivory"] .card__media img { filter: brightness(1.1) saturate(.6) contrast(.85); opacity: .5; }
}

/* ---------- Подход: чернила ---------- */
.approach { position: relative; isolation: isolate; }
.approach__ink { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: screen; }
.approach__ink.is-playing, .approach__ink.is-still { opacity: .5; }
.approach::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--bg-deep) 30%, transparent) 34%, color-mix(in srgb, var(--bg-deep) 86%, transparent) 56%, color-mix(in srgb, var(--bg-deep) 92%, transparent) 100%),
    linear-gradient(180deg, var(--bg-deep) 0%, transparent 18%, transparent 82%, var(--bg-deep) 100%); }
@media (max-width: 899px) { .approach::after { background: linear-gradient(180deg, var(--bg-deep) 0%, transparent 20%, color-mix(in srgb, var(--bg-deep) 80%, transparent) 55%, var(--bg-deep) 100%); } }
[data-theme="ivory"] .approach__ink { mix-blend-mode: multiply; filter: invert(1) hue-rotate(180deg) saturate(.6); }
[data-theme="ivory"] .approach__ink.is-playing, [data-theme="ivory"] .approach__ink.is-still { opacity: .35; }

/* ---------- Галерея принципов ---------- */
.gallery { position: relative; background: var(--bg-deep); border-top: 1px solid var(--line); }
.gallery__pin { padding-block: clamp(80px, 10vw, 120px) 56px; overflow: hidden; }
.gallery__head { margin-bottom: clamp(36px, 5vw, 56px); }
.gallery__head .h2 { max-width: 16em; }
.gallery__viewport { overflow: hidden; }
.gallery__track { display: flex; gap: clamp(16px, 2.4vw, 32px); padding-inline: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter))); width: max-content; will-change: transform; counter-reset: none; }
.gallery__item { flex: 0 0 auto; width: clamp(280px, 46vw, 640px); }
.gallery__img { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: var(--surface); }
.gallery__img img { position: absolute; inset: 0; width: 118%; max-width: none; height: 100%; object-fit: cover; left: -9%; transform: translateX(var(--shift, 0px)) scale(1.02); filter: brightness(.82) saturate(.9); transition: filter .8s; }
.gallery__item:hover .gallery__img img { filter: brightness(.95) saturate(1); }
.gallery__cap { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin-top: 22px; align-items: baseline; }
.gallery__num { grid-row: span 2; font: 400 .74rem/1 var(--ff-label); letter-spacing: .2em; color: var(--label); }
.gallery__cap h3 { font: 400 1.5rem/1.2 var(--ff-display); }
.gallery__cap p { color: var(--muted); font-size: .97rem; }
.gallery__foot { margin-top: 40px; }
.gallery__bar { display: block; height: 1px; background: var(--line); position: relative; overflow: hidden; }
.gallery__bar span { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(var(--gp, 0)); }
/* закреплённая горизонтальная прокрутка — только на широких экранах */
.gallery.is-pinned .gallery__pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-block: 40px; }
@media (max-width: 899px) {
  .gallery__viewport { overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .gallery__viewport::-webkit-scrollbar { display: none; }
  .gallery__item { width: 80vw; scroll-snap-align: center; }
  .gallery__track { padding-inline: var(--gutter); }
}

/* ---------- Контакты: шёлк ---------- */
.contacts { position: relative; isolation: isolate; overflow: hidden; }
.contacts__silk { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.contacts__silk.is-playing, .contacts__silk.is-still { opacity: .5; }
.contacts::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 30%, color-mix(in srgb, var(--bg) 78%, transparent) 70%, var(--bg) 100%); }
[data-theme="ivory"] .contacts__silk { mix-blend-mode: multiply; filter: invert(1) hue-rotate(180deg) saturate(.4) brightness(1.1); }
[data-theme="ivory"] .contacts__silk.is-playing, [data-theme="ivory"] .contacts__silk.is-still { opacity: .2; }

/* ---------- Подпись в подвале ---------- */
.footer__word { overflow: hidden; padding-bottom: 36px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.footer__word span[data-letters] { display: flex; justify-content: space-between; font: 400 clamp(2.6rem, 10.6vw, 9.4rem)/.95 var(--ff-display); letter-spacing: -.02em; color: var(--accent); white-space: nowrap; }
.footer__word .ch { display: inline-block; transform: translateY(105%); transition: transform 1.2s var(--ease-out); transition-delay: calc(var(--i) * 40ms); }
.footer__word.is-in .ch { transform: none; }
html:not(.js) .footer__word .ch { transform: none; }
[data-theme="ivory"] .footer__word span[data-letters] { color: var(--text); }

/* ---------- Без движения ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain, .cursor, .intro { display: none !important; }
  .hero__video, .about__video { display: none !important; }
  .h2.is-split .w > span, .footer__word .ch { transform: none !important; }
  .manifest__text .mw { opacity: 1 !important; }
  .btn--accent::before { display: none; }
  .gallery__viewport { overflow-x: auto; }
}
