/* ============================================================
   PORTFOLIO — UIXED · Виталий Маньшин
   Mobile-first, dark, modern
   ============================================================ */

:root {
  --bg: #0b0b0f;
  --surface: #131318;
  --surface-2: #181820;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f4f0;
  --muted: #8a8a93;
  --accent: #ff4d8d;
  --accent-2: #7c5cff;
  --radius: 20px;
  --pad: 20px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: #0b0b0f;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

/* Cursor: hide native on fine pointers */
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  a, button { cursor: none; }
}

/* ---------- Grain ---------- */
.grain {
  position: fixed;
  inset: -100%;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -5%); }
  30% { transform: translate(3%, -4%); }
  50% { transform: translate(-4%, 3%); }
  70% { transform: translate(5%, 4%); }
  90% { transform: translate(-3%, 5%); }
}

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 10000;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
  mix-blend-mode: difference;
}
.cursor__ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 77, 141, 0.5);
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, border-color 0.3s, background 0.3s;
}
.cursor__ring.is-hover {
  width: 64px;
  height: 64px;
  background: rgba(255, 77, 141, 0.08);
  border-color: var(--accent);
}
@media (hover: none), (pointer: coarse) {
  .cursor, .cursor__ring { display: none; }
  /* подписи работ видны на тач-устройствах (hover отсутствует) */
  .work__meta {
    opacity: 1;
    transform: none;
    background: linear-gradient(to top, rgba(11, 11, 15, 0.88), rgba(11, 11, 15, 0) 60%);
  }
  .works__filter,
  .chip { padding: 12px 20px; }
}

/* ---------- Preloader ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preloader__inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(320px, 70vw);
}
.preloader__num {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.preloader__bar {
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.preloader__fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) var(--pad);
  transition: background 0.4s, padding 0.4s;
}
.header.is-scrolled {
  background: rgba(11, 11, 15, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.header__logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.header__nav {
  display: none;
  gap: 32px;
}
.header__nav a {
  font-size: 14px;
  color: var(--muted);
  transition: color 0.3s;
  position: relative;
}
.header__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.header__nav a:hover { color: var(--text); }
.header__nav a:hover::after { width: 100%; }

.header__burger {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.header__burger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.4s var(--ease);
}
.header__burger.is-open span:nth-child(1) { transform: translateY(3.75px) rotate(45deg); }
.header__burger.is-open span:nth-child(2) { transform: translateY(-3.75px) rotate(-45deg); }

/* ---------- Fullscreen menu ---------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: var(--surface);
  padding: clamp(96px, 18vh, 120px) var(--pad) calc(40px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path 0.6s var(--ease), visibility 0.6s;
}
.menu.is-open {
  clip-path: inset(0 0 0% 0);
  visibility: visible;
}
.menu__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu__link {
  font-family: var(--font-display);
  font-size: clamp(34px, 9vw, 64px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 16px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), color 0.3s;
}
.menu.is-open .menu__link { opacity: 1; transform: translateY(0); }
.menu__link:hover { color: var(--accent); }
.menu__index {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}
.menu__foot {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  opacity: 0;
  transition: opacity 0.5s 0.2s;
}
.menu.is-open .menu__foot { opacity: 1; }
.menu__foot a { font-size: 15px; color: var(--muted); }
.menu__socials { display: flex; gap: 20px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 100px var(--pad) 60px;
  overflow: hidden;
}
.hero__canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero__canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.hero__glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(60% 50% at 80% 10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(50% 40% at 10% 80%, rgba(255, 77, 141, 0.14), transparent 60%);
  pointer-events: none;
}
.hero__content {
  position: relative;
  z-index: 2;
  max-width: 1200px;
}
.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 22px;
}
.hero__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.6; }
}
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(56px, 16vw, 160px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.hero__title .line {
  display: block;
  overflow: hidden;
}
.hero__title .line__inner {
  display: block;
  will-change: transform;
  transform: translateY(110%);
}
.line--outline {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(244, 244, 240, 0.85);
}
.hero__sub {
  max-width: 520px;
  color: var(--muted);
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 300;
  margin-top: 28px;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}
@media (max-width: 479px) {
  .hero__actions { flex-direction: column; }
  .hero__actions .btn { width: 100%; justify-content: center; }
}
.hero__meta {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px 24px;
  margin-top: clamp(36px, 8vw, 60px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  max-width: 520px;
}
.hero__meta-item { display: flex; flex-direction: column; }
.hero__meta-num {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.hero__meta-label {
  font-size: 14px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.hero__scroll {
  position: absolute;
  right: var(--pad);
  bottom: 28px;
  z-index: 2;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
}
.hero__scroll-line {
  width: 1px;
  height: 60px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.hero__scroll-line::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: var(--accent);
  animation: scrollLine 1.8s infinite var(--ease);
}
@keyframes scrollLine {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(250%); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 500;
  transition: transform 0.3s var(--ease), background 0.3s, color 0.3s, border-color 0.3s;
}
.btn--solid {
  background: var(--accent);
  color: #0b0b0f;
}
.btn--solid:hover { background: #e2ff5a; }
.btn--ghost {
  border: 1px solid var(--line);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Marquee ---------- */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  overflow: hidden;
  background: var(--surface);
}
.marquee__track {
  display: flex;
  align-items: center;
  gap: 32px;
  white-space: nowrap;
  width: max-content;
  animation: marquee 24s linear infinite;
}
.marquee__track span {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.marquee__star { color: var(--accent); }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(64px, 12vw, 90px) var(--pad);
}
.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(28px, 6vw, 48px);
}
.section__title {
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 72px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.section__index {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 14px;
}
.accent { color: var(--accent); }

/* ---------- Cases ---------- */
.cases__list {
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 9vw, 72px);
}
.case__media {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.case__img {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.case__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.case__media:hover .case__img img { transform: scale(1.06); }
.case__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 7px 14px;
  border-radius: 100px;
  background: rgba(11, 11, 15, 0.6);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
}
.case__info {
  margin-top: 20px;
}
.case__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.case__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.case__year {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 14px;
}
.case__tags {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  margin-top: 8px;
  letter-spacing: 0.02em;
}
.case__desc {
  color: var(--muted);
  margin-top: 10px;
  max-width: 560px;
}

/* ---------- Works ---------- */
.works__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}
.works__filter {
  padding: 10px 20px;
  border-radius: 100px;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
  transition: all 0.3s var(--ease);
}
.works__filter:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }
.works__filter.is-active {
  background: var(--accent);
  color: #0b0b0f;
  border-color: var(--accent);
}
.works__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.work {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.work__img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.work__img img,
.work__img video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease), opacity 0.5s;
}
.work:hover .work__img img,
.work:hover .work__img video { transform: scale(1.08); }
.work__meta {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  background: linear-gradient(to top, rgba(11,11,15,0.9), transparent 60%);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s, transform 0.4s var(--ease);
}
.work:hover .work__meta { opacity: 1; transform: translateY(0); }
.work__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}
.work__cat {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
}
.work.is-hidden { display: none; }
.work.is-entering {
  animation: workIn 0.5s var(--ease) both;
}
@keyframes workIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Works lightbox ----------
   Картинка показывается в натуральном размере (не увеличивается
   и не ужимается искусственно); если она больше экрана —
   масштабируется, чтобы целиком поместиться во вьюпорт. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 980;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 11, 15, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}
.lightbox__stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__figure {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.lightbox__video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}
.lightbox__img.is-hidden-media,
.lightbox__video.is-hidden-media {
  display: none;
}
.lightbox__info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 16px;
  row-gap: 6px;
  padding: 64px 96px 26px;
  background: linear-gradient(to top, rgba(11, 11, 15, 0.94), rgba(11, 11, 15, 0));
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.lightbox.is-caption-hidden .lightbox__info {
  opacity: 0;
}
.lightbox__cat {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.lightbox__title {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.lightbox__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}
.lightbox__text {
  flex-basis: 100%;
  color: var(--muted);
}
.lightbox__close,
.lightbox__nav {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(19, 19, 24, 0.6);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.lightbox__close:hover,
.lightbox__nav:hover {
  background: var(--accent);
  color: #0b0b0f;
  border-color: var(--accent);
}
.lightbox__close {
  top: 18px;
  right: 18px;
  z-index: 3;
}
.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.lightbox__nav--prev { left: 18px; }
.lightbox__nav--next { right: 18px; }

@media (max-width: 640px) {
  .lightbox__close {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }
  .lightbox__nav { width: 44px; height: 44px; }
  .lightbox__nav--prev { left: calc(8px + env(safe-area-inset-left)); }
  .lightbox__nav--next { right: calc(8px + env(safe-area-inset-right)); }
  .lightbox__info { padding: 48px 20px calc(18px + env(safe-area-inset-bottom)); column-gap: 12px; }
}

/* ---------- About ---------- */
.about__grid {
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.about__lead {
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 40px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
  max-width: 760px;
}
.about__services {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}
.service {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  transition: background 0.3s, padding 0.3s;
}
.service__num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 14px;
}
.service__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}
.service__text {
  grid-column: 2;
  color: var(--muted);
  font-size: 15px;
  max-width: 480px;
}
.about__subtitle {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}
.about__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  padding: 10px 18px;
  border-radius: 100px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 14px;
  transition: border-color 0.3s, color 0.3s, transform 0.3s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }

/* ---------- Contact ---------- */
.contact {
  padding-top: 0;
}
.contact__inner {
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), #1a1a26);
  border: 1px solid var(--line);
  padding: 56px var(--pad);
  overflow: hidden;
  text-align: left;
}
.contact__inner::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,92,255,0.35), transparent 65%);
  pointer-events: none;
}
.contact__eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}
.contact__title {
  font-family: var(--font-display);
  font-size: clamp(34px, 9vw, 80px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.contact__mail {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: clamp(20px, 4.5vw, 36px);
  font-weight: 600;
  margin-top: 34px;
  transition: color 0.3s;
}
.contact__mail svg { transition: transform 0.3s var(--ease); }
.contact__mail:hover { color: var(--accent); }
.contact__mail:hover svg { transform: translateX(6px); }
.contact__socials {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.contact__socials a {
  color: var(--muted);
  font-size: 15px;
  transition: color 0.3s;
}
.contact__socials a:hover { color: var(--accent); }

/* ---------- Footer ---------- */.footer {
  padding: 28px var(--pad) calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}
.footer__logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.footer__top { transition: color 0.3s; }
.footer__top:hover { color: var(--accent); }

@media (max-width: 479px) {
  .footer__row { justify-content: space-between; }
  .footer__copy { order: 3; width: 100%; text-align: center; margin-top: 6px; }
  .footer__top { order: 2; }
}

/* ---------- Hero variant switcher ---------- */
.hero-switcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.hero-switcher__label {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
  padding-right: 4px;
}
.hero-switcher__btn {
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: rgba(11, 11, 15, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  transition: color 0.3s, border-color 0.3s, background 0.3s, transform 0.3s;
}
.hero-switcher__btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(-3px);
}
.hero-switcher__btn.is-active {
  background: var(--accent);
  color: #0b0b0f;
  border-color: var(--accent);
}

/* dev-панель переключения hero не нужна на планшетах/телефонах */
@media (max-width: 899px) {
  .hero-switcher { display: none; }
}

/* ---------- Reveal (initial state, animated by JS) ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
}

/* ============================================================
   TABLET
   ============================================================ */
@media (min-width: 640px) {
  :root { --pad: 32px; }
  .works__grid { grid-template-columns: repeat(2, 1fr); }
  .about__services { grid-template-columns: repeat(2, 1fr); column-gap: 32px; }
  .service:nth-child(odd) { border-right: 1px solid var(--line); }
  .contact__inner { padding: 72px 56px; }
}

/* ============================================================
   DESKTOP
   ============================================================ */
@media (min-width: 1024px) {
  :root { --pad: clamp(32px, 5vw, 80px); }
  .header { padding: 22px var(--pad); }
  .header__nav { display: flex; }
  .header__burger { display: none; }
  .menu { display: none; }
  .hero { padding-top: 120px; }
  .hero__scroll { display: flex; }
  .section { padding: 140px var(--pad); }
  .works__grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }

  .case {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 40px;
    align-items: center;
  }
  .case:nth-child(even) .case__media { order: 2; }
  .case__media { aspect-ratio: 16 / 10; }
  .case__info { margin-top: 0; }
  .case:nth-child(even) .case__info { text-align: right; }
  .case:nth-child(even) .case__desc { margin-left: auto; }

  .about__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 80px;
  }
  .about__lead { grid-column: 1; grid-row: 1; }
  .about__services { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
  .about__tools { grid-column: 1; grid-row: 2; }
}

/* Промежуточные планшеты (900–1023): кейсы в две колонки, медиа шире */
@media (min-width: 900px) and (max-width: 1023px) {
  .case {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
  }
  .case__media { aspect-ratio: 16 / 10; }
  .case__info { margin-top: 0; }
}
@media (min-width: 768px) and (max-width: 899px) {
  .case__media { aspect-ratio: 16 / 10; }
}

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

/* Hero variant: Glass — типографика «UIXED» рисуется в canvas,
   HTML-заголовок скрывается, контент прижимается к низу */
.hero--glass .hero__title { display: none; }
.hero--glass .hero__content { margin-top: auto; }

/* ============================================================
   CASE PAGE
   ============================================================ */
.header__back {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  transition: color 0.3s;
}
.header__back:hover { color: var(--accent); }

/* --- Case hero --- */
.case-hero {
  padding: 120px var(--pad) 0;
}
.case-hero__top {
  max-width: 1280px;
  margin: 0 auto 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.case-hero__index {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.case-hero__grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
.case-hero__title {
  font-family: var(--font-display);
  font-size: clamp(34px, 11vw, 96px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  overflow-wrap: break-word;
}
.case-hero__sub {
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 300;
  line-height: 1.6;
  max-width: 640px;
  margin-top: 24px;
}
.case-hero__meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 20px;
  align-content: start;
}
.case-hero__meta-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.case-hero__meta-item dt {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.case-hero__meta-item dd {
  font-size: 15px;
  font-weight: 500;
}
.case-hero__cover {
  margin-top: 56px;
}
.case-hero__cover img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  border: 1px solid var(--line);
}

/* --- Case content sections --- */
.case-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--pad);
}
.csec {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 72px 0;
  border-top: 1px solid var(--line);
}
.csec__rail {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.csec__num {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
}
.csec__tag {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  opacity: 0.9;
}
.csec__title {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.5vw, 48px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 22px;
}
.csec__p {
  color: var(--muted);
  font-size: clamp(16px, 1.2vw, 18px);
  line-height: 1.75;
  max-width: 720px;
  margin-bottom: 18px;
}
.csec__p strong { color: var(--text); font-weight: 600; }
.csec__lead {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.45;
  color: var(--text);
  max-width: 760px;
  margin-bottom: 26px;
}
.csec__lead strong { color: var(--accent); }

/* --- Figures (any aspect ratio, width-only constraints) --- */
.cfig { margin: 40px 0; }
.cfig img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.cfig--narrow img { max-width: 560px; margin: 0 auto; }
.cfig--wide img {
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.cfig__cap {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  margin-top: 10px;
}
.cfig--narrow .cfig__cap { text-align: center; }

/* --- Cards (ecosystem) --- */
.ccards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 28px 0;
}
.ccard {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  background: var(--surface);
  transition: border-color 0.3s, transform 0.3s var(--ease);
}
.ccard:hover { border-color: var(--accent); transform: translateY(-4px); }
.ccard__code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.ccard__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 14px 0 10px;
}
.ccard ul { list-style: none; }
.ccard li {
  color: var(--muted);
  font-size: 14px;
  padding: 4px 0 4px 16px;
  position: relative;
}
.ccard li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* --- Role --- */
.crole {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin: 26px 0;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.crole__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}
.crole ul { list-style: none; }
.crole li {
  color: var(--muted);
  font-size: 15px;
  padding: 6px 0 6px 18px;
  position: relative;
}
.crole li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* --- Stages --- */
.cstages {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin: 26px 0;
}
.cstage {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.cstage__num {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent);
}
.cstage__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 12px 0 8px;
}
.cstage ul { list-style: none; }
.cstage li { color: var(--muted); font-size: 14px; padding: 3px 0; }

/* --- Metrics --- */
.cmetrics {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0 0 72px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--surface), #1a1a26);
  overflow: hidden;
}
.cmetric {
  padding: 32px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmetric:last-child { border-bottom: none; }
.cmetric__value {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--accent);
}
.cmetric__label {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.cmetric__text { color: var(--muted); font-size: 14px; }

/* --- Access points --- */
.clinks {
  margin: 56px 0 0;
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.clinks__title {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.clinks__list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.clinks__item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 14px;
  transition: border-color 0.3s, color 0.3s;
}
.clinks__item:hover { border-color: var(--accent); color: var(--accent); }
.clinks__arrow { color: var(--accent); }

/* --- Prev / next nav --- */
.case-nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px var(--pad);
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.case-nav__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  background: var(--surface);
  transition: border-color 0.3s, background 0.3s;
}
.case-nav__item:hover { border-color: var(--accent); }
.case-nav__item--next { text-align: right; }
.case-nav__item--all { text-align: center; justify-content: center; }
.case-nav__dir {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.case-nav__title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ============================================================
   CASE PAGE — responsive
   ============================================================ */
@media (min-width: 640px) {
  .ccards { grid-template-columns: repeat(2, 1fr); }
  .crole { grid-template-columns: repeat(2, 1fr); gap: 48px; }
  .cstages { grid-template-columns: repeat(2, 1fr); }
  .case-nav { grid-template-columns: 1fr auto 1fr; }
}

@media (min-width: 768px) {
  .ccards { grid-template-columns: repeat(3, 1fr); }
  .cmetrics { grid-template-columns: repeat(3, 1fr); }
  .cmetric { border-bottom: none; border-right: 1px solid var(--line); }
  .cmetric:last-child { border-right: none; }
}

@media (min-width: 1024px) {
  .case-hero { padding-top: 160px; }
  .case-hero__grid {
    grid-template-columns: repeat(12, 1fr);
    gap: 48px;
  }
  .case-hero__main { grid-column: 1 / 9; }
  .case-hero__meta {
    grid-column: 9 / 13;
    grid-template-columns: 1fr;
    align-self: end;
  }
  .csec {
    grid-template-columns: 220px 1fr;
    gap: 48px;
    padding: 120px 0;
  }
  .csec__rail {
    position: sticky;
    top: 120px;
    align-self: start;
    flex-direction: column;
    gap: 6px;
  }
  .cstages { grid-template-columns: repeat(4, 1fr); }
}
