/* Portfolio Khvatov — shared styles */
/* ===== CSS Variables & Reset ===== */
/* LIGHT is the default theme. Dark is opt-in via html[data-theme="dark"]. */
:root {
  /* Палитра построена от ОДНОЙ краски: всё вторичное — её прозрачности.
     Так цвета не спорят между собой (приём взят с videinfra.com). */
  --bg: #ffffff;
  --bg-2: #f2f2f3;
  --ink: #191b1d;
  --ink-dim: rgba(25,27,29,0.70);   /* 6.4:1 на белом */
  --muted: rgba(25,27,29,0.62);     /* AA и на белом, и на --bg-2 */
  --line: rgba(25,27,29,0.10);
  --line-2: rgba(25,27,29,0.16);
  --glass-bg: rgba(255,255,255,0.72);
  --glass-bd: rgba(25,27,29,0.08);
  --accent: #191b1d;
  --warm: rgba(25,27,29,0.70);

  /* theme-aware primitives */
  --ov: 25,27,29;
  --invert: #191b1d;
  --invert-hi: #000;
  --on-invert: #ffffff;
  --footer-bg: #f2f2f3;
  --img-bg: #ededee;
  --lb-bg: rgba(255,255,255,0.94);
  --panel-bg: rgba(255,255,255,0.97);
  --scrim: rgba(25,27,29,0.28);
  --glow-1: transparent;
  --glow-2: transparent;
  --shadow-lg: 0 30px 60px -30px rgba(25,27,29,0.16);
  --shadow-card: 0 18px 40px -20px rgba(25,27,29,0.14);
  --focus-ring: rgba(25,27,29,0.12);
  --radius: 22px;
  --radius-lg: 28px;
  --wrap: 1280px;
  --wrap-wide: 2040px;              /* потолок; поля пропорциональные — см. .wrap-wide */
  --pad: clamp(20px, 4vw, 40px);
  --font-sans: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  --pace: 1;
  --card: var(--bg-2);
  --line-hi: var(--line-2);
  --fg: var(--ink);
  --fg-mute: var(--ink-dim);
  --fg-dim: var(--muted);
}

:root[data-theme="dark"] {
  /* Та же логика, но краска светлая */
  --bg: #191b1d;
  --bg-2: #212325;
  --ink: #f5f5f6;
  --ink-dim: rgba(245,245,246,0.72);  /* 8.6:1 на тёмном */
  --muted: rgba(245,245,246,0.55);    /* AA и на --bg, и на --bg-2 */
  --line: rgba(245,245,246,0.12);
  --line-2: rgba(245,245,246,0.18);
  --glass-bg: rgba(33,35,37,0.72);
  --glass-bd: rgba(245,245,246,0.10);
  --accent: #f5f5f6;
  --warm: rgba(245,245,246,0.72);

  --ov: 245,245,246;
  --invert: #f5f5f6;
  --invert-hi: #ffffff;
  --on-invert: #191b1d;
  --footer-bg: #141618;
  --img-bg: #212325;
  --lb-bg: rgba(20,22,24,0.92);
  --panel-bg: rgba(33,35,37,0.96);
  --scrim: rgba(0,0,0,0.5);
  --glow-1: transparent;
  --glow-2: transparent;
  --shadow-lg: 0 30px 60px -30px rgba(0,0,0,0.55);
  --shadow-card: 0 18px 40px -20px rgba(0,0,0,0.6);
  --focus-ring: rgba(245,245,246,0.14);
}

/* Theme transition — applied ONLY while the theme is being switched.
   As a permanent rule it clobbered the `transition` of anything it touched
   (.glass.reveal lost its opacity/transform easing entirely), so theme.js
   adds .theme-anim for the duration of the toggle and then removes it. */
html.theme-anim body,
html.theme-anim .site-footer,
html.theme-anim .glass,
html.theme-anim .nav-pill a,
html.theme-anim .mItem {
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease) !important;
}
@media (prefers-reduced-motion: reduce) {
  html.theme-anim body, html.theme-anim .site-footer,
  html.theme-anim .glass, html.theme-anim .nav-pill a,
  html.theme-anim .mItem { transition: none !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: 'ss01','cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45; overflow-x: hidden; position: relative;
}
body::before {
  content: ""; position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 700px at -10% 30%, var(--glow-2), transparent 60%);
  pointer-events: none; z-index: 0;
}
main, footer { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
/* Поля растут вместе с экраном (приём Clay), а не остаются остатком от
   фиксированного лимита. На 1440 ширина та же, что была; на 1920 — плюс ~400px. */
.wrap-wide {
  max-width: var(--wrap-wide); margin: 0 auto;
  padding-left: clamp(20px, 2.8vw, 56px);
  padding-right: clamp(20px, 2.8vw, 56px);
}

/* ===== LANG SWITCHER ===== */
.lang-switch {
  position: fixed; z-index: 51;
  top: calc(24px + env(safe-area-inset-top));
  left: calc(24px + env(safe-area-inset-left));
  height: 40px; box-sizing: border-box;
  display: flex; align-items: center; gap: 2px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--glass-bd);
  border-radius: 999px;
  padding: 0 12px;
  pointer-events: auto;
}
.lang-btn {
  font-family: var(--font-sans); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); background: none; border: none;
  cursor: pointer; padding: 3px 5px; border-radius: 999px;
  transition: color .2s, background .2s;
  line-height: 1;
}
.lang-btn.active { color: var(--ink); background: var(--line-2); }
.lang-btn:hover:not(.active) { color: var(--ink-dim); }
.lang-sep { font-size: 9px; color: rgba(var(--ov),0.30); user-select: none; padding: 0 1px; }
@media (max-width: 480px) {
  .lang-switch { top: 14px; left: 14px; }
}

/* ===== NAV ===== */
.nav {
  position: fixed; top: 18px; left: 0; right: 0;
  z-index: 50; display: flex; justify-content: center; pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px; border-radius: 999px; font-size: 14px; font-weight: 500;
}
.nav-pill a {
  padding: 9px 16px; border-radius: 999px; color: var(--ink-dim);
  transition: color .25s ease, background .25s ease; letter-spacing: -0.01em;
}
.nav-pill a:hover { color: var(--ink); }
.nav-pill a.active { background: rgba(var(--ov),0.08); color: var(--ink); }

/* Позиция задана и до того, как theme.js завернёт кнопку в .nav-right —
   иначе при загрузке страницы она успевает отрисоваться в потоке слева. */
.nav-cta {
  position: fixed; z-index: 51;
  top: calc(24px + env(safe-area-inset-top));
  right: calc(24px + env(safe-area-inset-right));
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  background: var(--invert); color: var(--on-invert);
  font-weight: 500; font-size: 14px; letter-spacing: -0.01em;
  z-index: 51; transition: transform .3s cubic-bezier(.2,.7,.2,1); overflow: hidden;
}
/* Роллап надписи: высота контейнера ДОЛЖНА совпадать с line-height строк.
   При 17px против строки в 20.3px текст подрезался снизу и на hover
   приходил на 3.3px выше — надпись заметно прыгала. */
.cta-label {
  position: relative; display: inline-block; overflow: hidden;
  height: 20px; line-height: 20px; white-space: nowrap;
}
.cta-in, .cta-out { white-space: nowrap; display: block; line-height: 20px; }
.cta-label > span { display: block; transition: transform .35s cubic-bezier(.7,.0,.3,1); }
.cta-out { position: absolute; left: 0; top: 100%; }
.nav-cta:hover .cta-in { transform: translateY(-100%); }
.nav-cta:hover .cta-out { transform: translateY(-100%); }
.cta-arrow { display: inline-block; transition: transform .16s cubic-bezier(.23,1,.32,1); }
.nav-cta:hover .cta-arrow { transform: translateX(3px); }

/* ===== GLASS ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border: 1px solid var(--glass-bd);
  box-shadow: 0 1px 0 rgba(var(--ov),0.04) inset, var(--shadow-lg);
}

/* ===== PAGE HERO ===== */
.page-hero {
  padding-top: 160px; padding-bottom: 40px;
  display: flex; flex-direction: column; gap: 18px;
}
.page-hero h1 {
  font-size: clamp(54px, 9vw, 140px);
  letter-spacing: -0.03em; font-weight: 500; line-height: 0.96;
}
.page-hero h1 .word { display: block; overflow: hidden; padding-bottom: 0.16em; margin-bottom: -0.16em; }
.page-hero h1 .word > span { display: inline-block; }
.page-hero h1 .muted { color: var(--muted); font-weight: 400; }
.page-hero p { max-width: 640px; color: var(--ink-dim); font-size: clamp(15px,1.2vw,18px); line-height: 1.55; }

/* ===== MASONRY ===== */
.masonry { column-count: 5; column-gap: 20px; padding-top: 40px; }
@media (max-width: 1500px) { .masonry { column-count: 4; } }
@media (max-width: 1180px) { .masonry { column-count: 3; column-gap: 18px; } }
@media (max-width: 820px)  { .masonry { column-count: 2; column-gap: 12px; } }
@media (max-width: 520px)  { .masonry { column-count: 1; } }

.mItem {
  break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid;
  margin: 0 0 20px; display: block; cursor: zoom-in;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-2);
  transition: border-color .3s, box-shadow .5s var(--ease); position: relative;
}
.mItem:hover { border-color: var(--line-2); box-shadow: var(--shadow-card); }
.mItem .imgWrap {
  display: block; width: 100%; overflow: hidden; background: var(--img-bg); position: relative;
}
.mItem .imgWrap > svg { width: 100%; height: 100%; transition: transform .6s var(--ease); }
.mItem:hover .imgWrap > svg { transform: scale(1.04); }
.mItem .cap {
  padding: 12px 14px 14px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.mItem .cap .label {
  font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.16em;
  color: var(--ink-dim); text-transform: uppercase;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mItem .cap .y { font-family: var(--font-sans); font-size: 10px; color: var(--muted); letter-spacing: 0.18em; }

/* ===== LIGHTBOX ===== */
.lb {
  position: fixed; inset: 0; z-index: 9999; display: none;
  background: var(--lb-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  align-items: center; justify-content: center; padding: 60px;
  animation: lbIn .35s var(--ease);
}
.lb.open { display: flex; }
.lb-card {
  max-width: 92vw; max-height: 88vh;
  display: inline-flex; flex-direction: column; align-items: stretch;
  animation: lbIn .4s var(--ease);
}
.lb-card #lbVisual { display: flex; justify-content: center; }
.lb-card .imgWrap {
  background: transparent !important;
  height: min(70vh, 92vw); width: auto !important;
  max-width: 92vw; border-radius: 16px; overflow: hidden;
}
.lb-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 18px 4px 0; width: 100%;
}
.lb-foot .lb-cap { font-size: 18px; font-weight: 500; color: var(--ink); flex: 1; padding: 4px 8px; }
.lb-meta { font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.18em; color: var(--ink-dim); text-transform: uppercase; }
.lb-close {
  position: absolute; top: 24px; right: 28px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(var(--ov),0.08); border: 1px solid var(--line-2);
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .3s, background .3s; font-size: 18px;
}
.lb-close:hover { transform: rotate(90deg); background: rgba(var(--ov),0.16); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(var(--ov),0.06); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink); font-size: 22px; transition: background .3s;
}
.lb-nav:hover { background: rgba(var(--ov),0.14); }
.lb-nav.prev { left: 24px; }
.lb-nav.next { right: 24px; }
.lb-edit-hint {
  position: absolute; bottom: 24px; left: 0; right: 0;
  text-align: center; font-family: var(--font-sans); font-size: 10px;
  letter-spacing: 0.22em; color: rgba(var(--ov),0.4);
  text-transform: uppercase; pointer-events: none;
}
@keyframes lbIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ===== CONTACT ===== */
.contact.compact { margin: 160px auto 120px; text-align: center; }
.eyebrow {
  font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-dim); margin-bottom: 28px;
}
.contact-link { display: inline-block; }
.contact-hover {
  font-size: clamp(40px, 11vw, 180px); font-weight: 500;
  letter-spacing: -0.05em; line-height: 1;
  display: inline-flex; align-items: center; gap: clamp(12px, 2vw, 32px);
  white-space: nowrap;
}
@media (max-width: 480px) {
  .contact-hover { font-size: clamp(36px, 10vw, 56px); white-space: normal; flex-wrap: wrap; gap: 12px; }
  .contact-hover .ct-arrow { width: 48px; height: 48px; }
}
.contact-hover .ct-label {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 50%, var(--ink-dim) 50%);
  background-size: 200% 100%;
  background-position: 0% center;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: background-position .9s cubic-bezier(.4,0,.2,1);
}
.contact-link:hover .ct-label {
  background-position: -100% center;
}
.contact-hover .ct-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: clamp(56px, 8vw, 100px); height: clamp(56px, 8vw, 100px);
  border: 1.5px solid var(--line-2); border-radius: 50%;
  transition:
    transform .7s cubic-bezier(.4,0,.2,1),
    border-color .5s cubic-bezier(.4,0,.2,1),
    box-shadow .5s ease;
  flex-shrink: 0; overflow: hidden; position: relative;
}
.contact-hover .ct-arrow::before {
  content: '';
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
  transition: transform .6s cubic-bezier(.4,0,.2,1);
}
.contact-link:hover .ct-arrow::before { transform: scale(1); }
.contact-hover .ct-arrow svg {
  width: 38%; height: 38%;
  position: relative; z-index: 1;
  transition: transform .7s cubic-bezier(.4,0,.2,1), color .4s ease;
}
.contact-link:hover .ct-arrow {
  border-color: var(--ink);
  box-shadow: 0 0 0 6px var(--focus-ring);
  transform: rotate(45deg);
  color: var(--on-invert);
}

/* ===== FOOTER ===== */
.site-footer { border-top: 1px solid var(--line); background: var(--footer-bg); position: relative; z-index: 1; }
.foot-main { padding: 96px 0 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 60px; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr; gap: 40px; } }
.foot-logo { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; margin-bottom: 18px; }
.foot-brand p { color: var(--ink-dim); max-width: 340px; font-size: 14px; line-height: 1.6; }
.foot-pills { margin-top: 22px; }
.foot-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(var(--ov),0.04); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-dim);
}
.foot-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 3px rgba(46,204,113,0.18); }
.foot-head { font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 20px; }
.foot-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.foot-list a { color: var(--ink-dim); font-size: 14px; transition: color .2s ease; }
.foot-list a:hover { color: var(--ink); }
.foot-bottom {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding-top: 30px; margin-top: 60px; border-top: 1px solid var(--line);
  font-family: var(--font-sans); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}

/* ===== PRESS FEEDBACK ===== */
/* Кнопки должны отзываться на нажатие. Диапазон 0.95–0.98 — ниже выглядит утрированно. */
.btn, .nav-cta, .burger, .menu-cta, .lang-btn, .menu-seg button {
  transition-property: transform, background-color, color, border-color;
  transition-duration: .16s;
  transition-timing-function: cubic-bezier(.23,1,.32,1);
}
.btn:active, .nav-cta:active, .menu-cta:active { transform: scale(0.97); }
.burger:active, .lang-btn:active, .menu-seg button:active { transform: scale(0.96); }

/* Hover-эффекты со сдвигом — только для мыши, чтобы не залипали после тапа */
@media (hover: none) {
  .case:hover .thumb img, .mItem:hover .imgWrap > svg,
  .mItem:hover .imgWrap img, .mItem:hover .imgWrap video { transform: none; }
}

/* ===== REVEAL ===== */
.reveal { transition: opacity .42s cubic-bezier(.23,1,.32,1), transform .42s cubic-bezier(.23,1,.32,1); }
.js-anim .reveal { opacity: 0; transform: translateY(16px); }
.js-anim .reveal.in { opacity: 1; transform: translateY(0); }
.reveal.d1 { transition-delay: .05s; }
.reveal.d2 { transition-delay: .10s; }
.reveal.d3 { transition-delay: .15s; }
.reveal.d4 { transition-delay: .20s; }
.reveal.d5 { transition-delay: .25s; }
.word > span { transition: opacity .5s cubic-bezier(.23,1,.32,1), transform .5s cubic-bezier(.23,1,.32,1); }
.js-anim .word > span { opacity: 0; transform: translateY(110%); }
.js-anim .word.in > span { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal, .word > span { opacity: 1 !important; transform: none !important; } }

/* ===== TEXTURE ===== */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0; transition: opacity .4s ease;
}
body[data-texture="noise"]::after {
  opacity: 0.10;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 220px; mix-blend-mode: overlay;
}
body[data-texture="grid"]::after {
  opacity: 1;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px), linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 90%);
  -webkit-mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 90%);
}

/* ===== RIGHT-HAND CONTROLS ===== */
/* Тема и CTA лежат в одном flex-контейнере, поэтому переключатель всегда
   прижат к кнопке независимо от её ширины (она меняется при смене языка). */
.nav-right {
  position: fixed; z-index: 51;
  top: calc(24px + env(safe-area-inset-top));
  right: calc(24px + env(safe-area-inset-right));
  display: flex; align-items: center; gap: 10px;
}
.nav-right .nav-cta { position: static; top: auto; right: auto; }

/* ===== THEME TOGGLE (desktop) ===== */
.theme-switch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 999px; flex: 0 0 auto;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--glass-bd);
  color: var(--ink-dim); cursor: pointer;
  transition: color .2s ease, transform .3s var(--ease);
}
.theme-switch:hover { color: var(--ink); }
.theme-switch:active { transform: scale(0.96); }
.theme-switch svg { width: 16px; height: 16px; display: block; }
.theme-switch .ic-moon { display: none; }
:root[data-theme="dark"] .theme-switch .ic-moon { display: block; }
:root[data-theme="dark"] .theme-switch .ic-sun  { display: none; }

/* ===== BURGER (mobile) ===== */
.burger {
  display: none;
  position: fixed; top: calc(14px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  z-index: 60;
  width: 42px; height: 42px; border-radius: 999px;
  align-items: center; justify-content: center;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--glass-bd);
  color: var(--ink); cursor: pointer; padding: 0;
}
.burger-lines { position: relative; width: 17px; height: 11px; }
.burger-lines span {
  position: absolute; left: 0; width: 100%; height: 1.5px; border-radius: 2px;
  background: currentColor;
  transition: transform .34s var(--ease), opacity .2s ease;
}
.burger-lines span:nth-child(1) { top: 0; }
.burger-lines span:nth-child(2) { top: 50%; margin-top: -0.75px; }
.burger-lines span:nth-child(3) { bottom: 0; }
body.menu-open .burger-lines span:nth-child(1) { transform: translateY(4.75px) rotate(45deg); }
body.menu-open .burger-lines span:nth-child(2) { opacity: 0; transform: scaleX(0.4); }
body.menu-open .burger-lines span:nth-child(3) { transform: translateY(-4.75px) rotate(-45deg); }

body.menu-open { overflow: hidden; }

.menu-scrim {
  position: fixed; inset: 0; z-index: 58;
  background: var(--scrim);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .32s var(--ease), visibility .32s;
}
body.menu-open .menu-scrim { opacity: 1; visibility: visible; }

.menu-panel {
  position: fixed; z-index: 59;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  width: min(268px, calc(100vw - 20px));
  padding: 62px 12px 12px;
  border-radius: 24px;
  background: var(--panel-bg);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--glass-bd);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  opacity: 0; visibility: hidden;
  transform: scale(0.9) translateY(-8px);
  transition: opacity .3s var(--ease), transform .34s var(--ease), visibility .34s;
}
body.menu-open .menu-panel { opacity: 1; visibility: visible; transform: scale(1) translateY(0); }

.menu-nav { display: flex; flex-direction: column; gap: 2px; }
.menu-nav a {
  padding: 13px 14px; border-radius: 14px;
  font-size: 17px; font-weight: 500; letter-spacing: -0.015em;
  color: var(--ink-dim); transition: background .2s ease, color .2s ease;
}
.menu-nav a:hover { color: var(--ink); }
.menu-nav a.active { background: rgba(var(--ov),0.07); color: var(--ink); }

.menu-sep { height: 1px; background: var(--line); margin: 12px 4px; }
.menu-row { padding: 4px 14px 10px; }
.menu-label {
  font-family: var(--font-sans); font-size: 9.5px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 9px;
}
.menu-seg {
  display: flex; gap: 4px; padding: 3px;
  border-radius: 12px; background: rgba(var(--ov),0.05);
  border: 1px solid var(--line);
}
.menu-seg button {
  flex: 1; appearance: none; border: 0; background: transparent;
  color: var(--ink-dim); font-family: var(--font-sans);
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 9px 6px; border-radius: 9px; cursor: pointer;
  transition: background .22s ease, color .22s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.menu-seg button svg { width: 13px; height: 13px; }
.menu-seg button:hover:not(.active) { color: var(--ink); }
.menu-seg button.active {
  background: var(--invert); color: var(--on-invert);
}
.menu-cta {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 4px; padding: 14px; border-radius: 14px;
  background: var(--invert); color: var(--on-invert);
  font-weight: 500; font-size: 15px;
}

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .nav { display: none; }
  .nav-right { display: none; }
  .lang-switch { display: none; }
  .burger { display: inline-flex; }
  .contact.compact { margin: 120px auto 90px; }
}
@media (min-width: 641px) {
  .menu-panel, .menu-scrim, .burger { display: none !important; }
}

/* ── Next Case Block ─────────────────────────────── */
/* Case gallery — replaces the single "Next case" block at the end of every case page.
   Reuses the exact card component from cases.html/.thumb+.case-meta (see cases.html's own
   inline styles), just in a horizontal overflowing row instead of a grid. */
/* padding-top/bottom, НЕ шорткат: `padding:96px 0 0` обнуляет горизонтальные
   отступы .wrap-wide и уводит левый край галереи левее футера. */
.case-gallery{padding-top:96px;padding-bottom:160px}
.case-gallery-head{font-size:clamp(32px,4.5vw,56px);letter-spacing:-0.035em;font-weight:500;line-height:1;margin-bottom:40px}
/* Строка выходит за правый край контейнера до края экрана — карточки уезжают
   за пределы окна, а не обрезаются по контейнеру. `50%` считается от контент-бокса
   .wrap-wide, поэтому margin ровно закрывает поле справа; padding возвращает тот же
   отступ в конце скролла. body{overflow-x:hidden} гасит вылет из-за скроллбара.
   2026-11-22: то же слева — при прокрутке карточки уходят до левого края окна,
   а в начальном положении первая стоит ровно на поле контейнера. */
.case-gallery-row{display:flex;gap:40px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch;padding-bottom:8px;margin-left:calc(50% - 50vw);padding-left:calc(50vw - 50%);scroll-padding-left:calc(50vw - 50%);margin-right:calc(50% - 50vw);padding-right:calc(50vw - 50%)}
.case-gallery-row::-webkit-scrollbar{display:none}
/* Ширина живёт на карточке, а не на обложке: иначе .cgc-desc с max-width:64ch
   растягивает карточку шире картинки и текст вылезает за её край (видно на мобиле). */
.case-gallery-card{flex:0 0 auto;width:min(810px,90vw);text-decoration:none;display:block}
/* Одно соотношение на все карточки — обложки кейсов разного формата
   (InOut 3045/2099, Sarex 3004/2109) кадрируются через object-fit, как в .thumb
   на cases.html, а не сжимаются по ширине. */
.cgc-thumb{position:relative;width:100%;aspect-ratio:2430/1380;border-radius:var(--radius-lg);box-shadow:inset 0 0 0 1px var(--line);overflow:hidden}
.cgc-thumb img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .8s cubic-bezier(.2,.7,.2,1)}
.case-gallery-card:hover .cgc-thumb img{transform:scale(1.04)}
.cgc-meta{padding:18px 2px 0;display:flex;flex-direction:column;gap:6px}
.cgc-title{font-size:22px;font-weight:500;letter-spacing:-0.02em}
/* Временное превью Innotech: обложки ещё нет, поэтому карточка рисуется
   стилями, а не картинкой. Живёт в общем CSS, потому что нужно и на
   cases.html, и в галерее «Related works» на каждой странице кейса.
   Цвета поверх тёмной подложки — намеренно жёсткие, верны в обеих темах. */
.innotech-thumb{background:radial-gradient(120% 100% at 50% 0%,#1a2f4e,#070d18 70%);
  display:flex;align-items:center;justify-content:center}
.in-stage{display:flex;flex-direction:column;align-items:center;gap:14px}
.in-mark{width:60px;height:60px;border-radius:16px;background:linear-gradient(135deg,#2a5fa5,#1a3a6a);
  border:1px solid rgba(255,255,255,0.15);display:flex;align-items:center;justify-content:center;
  font-size:30px;font-weight:500;color:#fff}
.in-word{font-family:var(--font-sans);font-size:18px;letter-spacing:0.22em;font-weight:500;color:#eaf2ff}
.in-sub{font-family:var(--font-sans);font-size:10px;letter-spacing:0.18em;text-transform:uppercase;
  color:rgba(200,220,245,0.6)}
.cgc-desc{color:var(--muted);font-size:14px;line-height:1.55;margin-top:4px;max-width:64ch}
@media(max-width:640px){
  .case-gallery{padding-bottom:96px}
  .case-gallery-head{margin-bottom:28px}
  .case-gallery-row{gap:24px}
  .cgc-title{font-size:19px}
}
.next-case-block{position:relative;display:block;text-decoration:none;overflow:hidden;min-height:360px;display:flex;flex-direction:column;justify-content:flex-end;padding:64px;border-top:1px solid var(--line);transition:border-color .3s}
.next-case-block:hover{border-color:transparent}
.next-case-bg{position:absolute;inset:0;background-size:cover;background-position:center;opacity:0;transition:opacity .7s cubic-bezier(.2,.7,.2,1);z-index:0}
.next-case-block:hover .next-case-bg{opacity:1}
.next-case-overlay{position:absolute;inset:0;background:linear-gradient(to top,rgba(0,0,0,.82) 0%,rgba(0,0,0,.45) 60%,rgba(0,0,0,.2) 100%);z-index:1;opacity:0;transition:opacity .7s cubic-bezier(.2,.7,.2,1)}
.next-case-block:hover .next-case-overlay{opacity:1}
.next-case-content{position:relative;z-index:2;display:flex;flex-direction:column;gap:12px}
.next-case-label{font-family:var(--font-sans);font-size:10px;letter-spacing:.2em;text-transform:uppercase;color:var(--muted);transition:color .3s}
.next-case-block:hover .next-case-label{color:rgba(255,255,255,.5)}
.next-case-title{font-size:clamp(36px,5.5vw,80px);font-weight:500;letter-spacing:-.04em;line-height:1.0;color:var(--ink);transition:color .3s}
.next-case-block:hover .next-case-title{color:#fff}
.next-case-tags{font-family:var(--font-sans);font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);transition:color .3s}
.next-case-block:hover .next-case-tags{color:rgba(255,255,255,.45)}
.next-case-arrow{position:absolute;top:56px;right:64px;z-index:2;width:48px;height:48px;border-radius:50%;border:1px solid var(--line);display:flex;align-items:center;justify-content:center;color:var(--muted);transition:transform .5s cubic-bezier(.2,.7,.2,1),border-color .3s,color .3s,background .3s}
.next-case-block:hover .next-case-arrow{transform:translate(4px,-4px);border-color:rgba(255,255,255,.3);color:#fff;background:rgba(255,255,255,.08)}
@media(max-width:640px){.next-case-block{padding:40px 24px;min-height:280px}.next-case-arrow{top:36px;right:24px}}

/* ── Case TL;DR — the 30-second version, list of three, hairline separators ── */
.case-tldr{padding-top:8px;padding-bottom:40px}
.tldr-head{font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin-bottom:16px}
.tldr-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:0 40px}
.tldr-item{border-top:1px solid var(--line);padding-top:16px}
.tldr-lbl{display:block;font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin-bottom:8px}
.tldr-item p{margin:0;font-size:15px;line-height:1.6;color:var(--ink-dim);max-width:64ch}
@media (min-width:1600px){.tldr-item p{font-size:16px;line-height:1.7}}
@media (max-width:780px){.tldr-grid{grid-template-columns:1fr;gap:16px}}

/* ── Showcase slider: Teardowns + Pet projects (index). One slide at a time. ── */
.showcase{padding-top:96px}
.show-head{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:40px}
.show-head h2{font-size:clamp(32px,4.5vw,56px);letter-spacing:-0.035em;font-weight:500;line-height:1}
.show-nav{display:flex;align-items:center;gap:8px}
.show-count{font-size:11px;letter-spacing:.12em;color:var(--muted);min-width:48px;text-align:center}
.show-btn{width:40px;height:40px;border-radius:50%;border:1px solid var(--line);background:none;color:var(--ink);font-size:16px;cursor:pointer;transition:background .2s}
.show-btn:hover{background:var(--bg-2)}
.show-stage{position:relative;width:100%;border-radius:var(--radius-lg);box-shadow:inset 0 0 0 1px var(--line);overflow:hidden;background:var(--bg-2)}
.show-stage img,.show-stage iframe{position:absolute;inset:0;width:100%;height:100%;border:0;object-fit:cover;display:block}
.show-play{position:absolute;inset:0;width:100%;height:100%;border:0;background:none;cursor:pointer;display:grid;place-items:center}
.show-play span{width:88px;height:88px;border-radius:50%;background:var(--invert);color:var(--on-invert);display:grid;place-items:center;font-size:24px;padding-left:4px;transition:transform .3s}
.show-play:hover span{transform:scale(1.06)}
.show-meta{padding-top:24px}
.show-title{font-size:22px;font-weight:500;letter-spacing:-0.02em;margin-bottom:8px}
.show-desc{font-size:14px;line-height:1.6;color:var(--ink-dim);max-width:64ch}
@media(max-width:640px){.show-play span{width:64px;height:64px}}
/* play button over a poster: sits on an image, so hardcoded white like other on-photo badges */
.show-play.on-img span{background:#fff;color:#191b1d;box-shadow:0 8px 32px rgba(0,0,0,.35)}

/* ── Case contents (built by theme.js). Only where the left margin can hold it: at 2040px the 1712 container leaves 164px + gutter. ── */
.case-toc{display:none}
@media (min-width:2040px){
  .case-toc{display:flex;flex-direction:column;gap:12px;position:fixed;left:40px;top:50%;transform:translateY(-50%);z-index:40;max-width:150px;opacity:0;pointer-events:none;transition:opacity .3s}
  .case-toc.on{opacity:1;pointer-events:auto}
  .case-toc a{font-size:13px;line-height:1.3;color:var(--muted);text-decoration:none;transition:color .2s}
  .case-toc a:hover,.case-toc a.active{color:var(--ink)}
  .case-toc a.active{font-weight:500}
}

/* ── Intro video bubble (theme.js buildIntro) — sits on a photo, so colours are hardcoded ── */
.intro{position:fixed;right:24px;bottom:24px;z-index:60}
.intro [hidden]{display:none}
.intro-bubble{display:block;width:112px;height:112px;padding:0;border:0;border-radius:50%;overflow:hidden;cursor:pointer;background:#222;box-shadow:var(--shadow-card),inset 0 0 0 1px var(--line);transition:transform .25s cubic-bezier(.2,.8,.2,1)}
.intro-bubble:hover{transform:scale(1.06)}
.intro-bubble:focus-visible{outline:2px solid var(--ink);outline-offset:3px}
.intro-bubble video{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}
.intro-card{position:relative;width:280px;aspect-ratio:9/16;border-radius:20px;overflow:hidden;background:#111;box-shadow:var(--shadow-lg)}
.intro-card video{width:100%;height:100%;object-fit:cover;display:block;cursor:pointer}
.intro-top{position:absolute;left:0;right:0;top:0;display:flex;align-items:center;justify-content:space-between;padding:10px;background:linear-gradient(rgba(0,0,0,.45),transparent)}
.intro-time{color:#fff;font-size:13px;font-variant-numeric:tabular-nums}
.intro-ic{width:32px;height:32px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:rgba(0,0,0,.35);color:#fff;font-size:17px;line-height:1;cursor:pointer;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
.intro-ic:hover{background:rgba(0,0,0,.55)}
.intro-sub{position:absolute;left:12px;right:12px;bottom:32px;margin:0;padding:6px 10px;border-radius:10px;background:rgba(0,0,0,.55);color:#fff;font-size:13px;line-height:1.35;text-align:center;opacity:0;transition:opacity .2s;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.intro-sub.on{opacity:1}
.intro-seek{position:absolute;left:4px;right:4px;bottom:2px;height:24px;padding:0 8px;cursor:pointer;touch-action:none;display:flex;align-items:center}
.intro-seek:focus-visible{outline:2px solid #fff;outline-offset:-2px;border-radius:8px}
.intro-bar{position:relative;flex:1;height:3px;background:rgba(255,255,255,.3);border-radius:3px;transition:height .15s}
.intro-bar i{position:absolute;inset:0;display:block;background:#fff;border-radius:3px;transform-origin:0 50%;transform:scaleX(0)}
.intro-bar b{position:absolute;top:50%;left:0;width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:50%;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.4);transform:scale(0);transition:transform .15s}
.intro-seek:hover .intro-bar,.intro-seek.drag .intro-bar{height:5px}
.intro-seek:hover .intro-bar b,.intro-seek.drag .intro-bar b,.intro-seek:focus-visible .intro-bar b{transform:scale(1)}
@media(max-width:640px){.intro{right:16px;bottom:16px}.intro-bubble{width:76px;height:76px}.intro-card{width:min(220px,60vw)}}
@media(prefers-reduced-motion:reduce){.intro-bubble,.intro-bar,.intro-bar b{transition:none}}

/* back-to-top sits above the intro bubble, centred on it (bubble 112 @ right/bottom 24; 76 @ 16 on mobile) */
body .scroll-top{right:58px;bottom:152px;width:44px;height:44px}
@media(max-width:640px){body .scroll-top{right:34px;bottom:104px;width:40px;height:40px}}
