:root {
  --bg: #0d0d0f;
  --bg-2: #16161a;
  --line: #2a2a30;
  --text: #f2efe9;
  --muted: #8d8b93;
  --accent: #ff5b2e;
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 48px);
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Inter Tight", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font: 400 17px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #000; }

/* единые охранные поля: контент и шапка всегда на одной вертикали */
.wrap { padding-inline: var(--gutter); max-width: 1680px; margin-inline: auto; }
[id] { scroll-margin-top: 90px; }

/* header */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(var(--gutter), calc((100vw - 1680px) / 2 + var(--gutter)));
  background: rgba(13, 13, 15, .82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.top.scrolled { border-bottom-color: var(--line); }
.top > * { min-width: 0;
}
.logo { font: 600 15px/1 var(--display); letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.logo i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.nav { display: flex; gap: clamp(14px, 2.5vw, 32px); font-size: 15px; color: var(--muted); }
.nav a:hover { color: var(--text); }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 99px; background: var(--text); color: var(--bg);
  font: 500 15px/1 var(--body); transition: background .2s, color .2s;
}
.btn:hover { background: var(--accent); color: #000; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

/* hero */
.hero { padding-top: clamp(120px, 18vh, 200px); }
.eyebrow { color: var(--muted); font-size: 15px; display: flex; gap: 10px; align-items: center; margin-bottom: 28px; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 4px #3ddc8422; }
h1 {
  font: 500 clamp(40px, 8.2vw, 132px)/0.98 var(--display);
  letter-spacing: -0.035em; max-width: 14ch;
}
h1 em { font-style: normal; color: var(--accent); }
.hero-foot {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: end;
  margin-top: clamp(32px, 5vw, 64px); padding-bottom: clamp(40px, 6vw, 72px);
}
.hero-foot p { font-size: clamp(18px, 1.6vw, 22px); max-width: 38ch; color: #cfccd4; }
.stats { display: flex; gap: clamp(20px, 4vw, 56px); justify-content: flex-end; }
.stats b { display: block; font: 500 clamp(32px, 4vw, 56px)/1 var(--display); letter-spacing: -.03em; }
.stats span { color: var(--muted); font-size: 14px; }

/* marquee */
.marquee { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; }
.marquee-track { display: flex; width: max-content; animation: scroll 70s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
/* отступ через margin, а не gap — иначе на стыке двух копий лента дёргается */
.marquee img { height: clamp(160px, 22vw, 300px); width: auto; margin-right: 14px; border-radius: 10px; object-fit: cover; flex: none; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* sections */
section.block { padding-top: clamp(64px, 10vw, 140px); }
.block-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: clamp(28px, 4vw, 48px); }
h2 { font: 500 clamp(30px, 5vw, 72px)/1 var(--display); letter-spacing: -0.03em; }
h2 sup { font: 400 15px/1 var(--body); color: var(--muted); letter-spacing: 0; vertical-align: top; margin-left: 8px; }
.block-head p { color: var(--muted); max-width: 36ch; }

/* project cards */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(16px, 2vw, 28px); }
.card { display: block; }
.card-media {
  aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--bg-2);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1); }
.card:hover .card-media img { transform: scale(1.04); }
.card-info { display: flex; justify-content: space-between; gap: 16px; padding: 16px 4px 6px; align-items: baseline; }
.card-info h3 { font: 500 clamp(18px, 1.7vw, 24px)/1.2 var(--display); letter-spacing: -0.01em; }
.card-info span { color: var(--muted); font-size: 15px; text-align: right; }
.card:hover h3 { color: var(--accent); }
.card.wide { grid-column: span 2; }
.card.wide .card-media { aspect-ratio: 16 / 8; }

/* motion grid */
.reels { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(10px, 1.4vw, 20px); }
.reel { cursor: pointer; }
.reel .frame {
  position: relative; aspect-ratio: 9 / 16; border-radius: var(--radius); overflow: hidden; background: var(--bg-2);
}
.reel video, .reel .frame > img { width: 100%; height: 100%; object-fit: cover; }
.reel .play {
  position: absolute; left: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(13,13,15,.6); backdrop-filter: blur(8px); display: grid; place-items: center;
  transition: background .2s;
}
.reel:hover .play { background: var(--accent); }
.reel .play svg { width: 14px; height: 14px; margin-left: 2px; fill: var(--text); }
.reel:hover .play svg { fill: #000; }
.reel .dur { position: absolute; right: 12px; top: 12px; font-size: 13px; padding: 3px 8px; border-radius: 99px; background: rgba(13,13,15,.6); }
.reel-info { padding: 12px 2px 0; }
.reel-info b { font-weight: 500; display: block; }
.reel-info span { color: var(--muted); font-size: 14px; }

/* services */
.services { border-top: 1px solid var(--line); }
.service {
  display: grid; grid-template-columns: 80px 1.1fr 1.4fr; gap: 24px; align-items: baseline;
  padding: clamp(22px, 3vw, 36px) 0; border-bottom: 1px solid var(--line);
}
.service .n { color: var(--muted); font-size: 15px; }
.service h3 { font: 500 clamp(20px, 2.4vw, 34px)/1.1 var(--display); letter-spacing: -0.02em; }
.service p { color: #bdbac2; }

/* contact */
.contact { padding-top: clamp(80px, 12vw, 180px); padding-bottom: clamp(40px, 5vw, 64px); }
.contact h2 { font-size: clamp(40px, 9vw, 150px); line-height: .95; max-width: 12ch; }
.contact h2 a { color: var(--accent); }
.contact h2 a:hover { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 8px; }
.links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
footer { display: flex; justify-content: space-between; gap: 16px; padding: 28px 0 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

/* case page */
.case-hero { padding-top: clamp(110px, 15vh, 170px); }
.back { color: var(--muted); font-size: 15px; display: inline-flex; gap: 8px; margin-bottom: 32px; }
.back:hover { color: var(--accent); }
.case-hero .kind { color: var(--accent); font-size: 15px; margin-bottom: 16px; }
.case-hero h1 { max-width: none; font-size: clamp(40px, 8vw, 128px); }
.case-intro { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; margin: clamp(28px, 4vw, 48px) 0; }
.case-intro .lead { font-size: clamp(19px, 1.8vw, 25px); line-height: 1.45; color: #dedbe3; max-width: 44ch; }
.facts { display: grid; gap: 14px; align-content: start; }
.facts div { display: grid; grid-template-columns: 100px 1fr; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.facts dt { color: var(--muted); font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 14px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; color: #cfccd4; }
.case-cover { border-radius: var(--radius); overflow: hidden; cursor: zoom-in; }
.case-cover img { width: 100%; max-height: 88vh; object-fit: cover; }

.case-section { padding-top: clamp(56px, 8vw, 110px); }
.case-section-head { display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; margin-bottom: 28px; align-items: baseline; }
.case-section-head h2 { font-size: clamp(26px, 3.4vw, 48px); }
.case-section-head p { color: var(--muted); max-width: 52ch; }

.masonry { columns: 3; column-gap: clamp(10px, 1.4vw, 20px); }
.masonry.cols-2 { columns: 2; }
.masonry.cols-4 { columns: 4; }
.tile {
  break-inside: avoid; margin-bottom: clamp(10px, 1.4vw, 20px);
  border-radius: 10px; overflow: hidden; background: var(--bg-2); cursor: zoom-in; position: relative;
}
.tile img, .tile video { width: 100%; height: auto; }
.tile.is-video { cursor: pointer; }
.tile .play { position: absolute; left: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; background: rgba(13,13,15,.6); backdrop-filter: blur(8px); display: grid; place-items: center; }
.tile .play svg { width: 14px; height: 14px; margin-left: 2px; fill: var(--text); }
.tile:hover .play { background: var(--accent); }
.tile:hover .play svg { fill: #000; }

.next { display: block; margin-top: clamp(80px, 12vw, 160px); border-top: 1px solid var(--line); padding: 40px 0; }
.next span { color: var(--muted); font-size: 15px; }
.next b { display: block; font: 500 clamp(36px, 7vw, 110px)/1 var(--display); letter-spacing: -.03em; margin-top: 8px; transition: color .2s; }
.next:hover b { color: var(--accent); }

/* lightbox */
.lb {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,8,10,.96);
  display: none; align-items: center; justify-content: center;
}
.lb.open { display: flex; }
.lb-stage { max-width: calc(100vw - 140px); max-height: calc(100vh - 80px); display: grid; place-items: center; }
.lb-stage img, .lb-stage video { max-width: calc(100vw - 140px); max-height: calc(100vh - 80px); width: auto; height: auto; border-radius: 8px; }
.lb button {
  position: absolute; background: rgba(255,255,255,.08); color: var(--text); border: 0; cursor: pointer;
  width: 48px; height: 48px; border-radius: 50%; font-size: 22px; display: grid; place-items: center;
}
.lb button:hover { background: var(--accent); color: #000; }
.lb .x { top: 18px; right: 18px; }
.lb .prev { left: 18px; top: 50%; translate: 0 -50%; }
.lb .nxt { right: 18px; top: 50%; translate: 0 -50%; }
.lb .count { position: absolute; bottom: 18px; left: 50%; translate: -50% 0; color: var(--muted); font-size: 14px; }

/* reveal */
.js .rv { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.js .rv.in { opacity: 1; transform: none; }
[data-lb]:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 1100px) {
  .reels { grid-template-columns: repeat(3, 1fr); }
  .masonry, .masonry.cols-4 { columns: 2; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .nav { display: none; }
  .hero-foot, .case-intro, .case-section-head { grid-template-columns: 1fr; gap: 24px; }
  .stats { justify-content: flex-start; }
  .cards { grid-template-columns: 1fr; }
  .card.wide { grid-column: auto; }
  .card.wide .card-media { aspect-ratio: 4 / 3; }
  .card-info { flex-direction: column; gap: 4px; }
  .card-info span { text-align: left; }
  .reels { grid-template-columns: repeat(2, 1fr); }
  .service { grid-template-columns: 1fr; gap: 8px; }
  .block-head { flex-direction: column; align-items: start; }
  .masonry, .masonry.cols-2, .masonry.cols-4 { columns: 1; }
  .masonry.keep-2 { columns: 2; }
  .lb-stage, .lb-stage img, .lb-stage video { max-width: 100vw; max-height: calc(100vh - 140px); }
  .lb .prev, .lb .nxt { top: auto; bottom: 12px; translate: none; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; }
  .marquee-track { animation: none; }
  .js .rv { opacity: 1; transform: none; transition: none; }
}
