/* =========================================================
   azamatzaseev.ru — стили
   «Фотолаборатория»: сырая сетка с видимыми линиями, гигантский узкий
   кегль, моноширинные подписи как данные съёмки, контактный лист
   и пометки красным маркером. Тёмная тема — лаборатория,
   светлая — фотобумага (data-theme="light"). Цвета — в переменных ниже.
   ========================================================= */
:root {
  /* Лаборатория (тёмная тема) */
  --bg: #121010;               /* фон */
  --bg-2: #1C1919;             /* ячейки, наведение */
  --bg-3: #272322;             /* подложка картинок, пока грузятся */
  --text: #F2EFEA;             /* текст — фотобумага */
  --muted: rgba(242, 239, 234, .68);
  --silver: #8F8D88;           /* служебные подписи */
  --line: rgba(242, 239, 234, .16);
  --line-strong: rgba(242, 239, 234, .38);
  --paper: #FFFFFF;            /* подложка под логотипы */

  /* Живой красный — единственный акцент: кнопки, номера, пометки маркером */
  --red: #E4194A;
  --red-hover: #FF2D5D;
  --on-red: #F2EFEA;

  /* Плёнка и контактный лист — тёмные в обеих темах (в светлой — графит, см. ниже) */
  --film: #0A0909;
  --film-frame: #1C1919;       /* кадр, пока картинка грузится */
  --film-empty: #141212;       /* пустой кадр в конце плёнки */
  --film-ink: #F2EFEA;
  --edge: rgba(232, 135, 58, .88);   /* надпечатка на краю плёнки */

  --f-display: "Sofia Sans Extra Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --wrap: 1360px;
  --gutter: clamp(18px, 4vw, 56px);
  --header-h: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.6 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .07 0 0 0 0 .06 0 0 0 0 .06 0 0 0 1.6 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  color-scheme: dark;
}
/* Фотобумага (светлая тема) */
:root[data-theme="light"] {
  --bg: #F2EFEA;
  --bg-2: #E8E4DD;
  --bg-3: #DCD7CF;
  --text: #121010;
  --muted: rgba(18, 16, 16, .7);
  --silver: #6B6863;
  --line: rgba(18, 16, 16, .14);
  --line-strong: rgba(18, 16, 16, .36);
  --red-hover: #C70F3D;
  /* Плёнка на фотобумаге — графитовая, не чёрная */
  --film: #414141;
  --film-frame: #535353;
  --film-empty: #4B4B4B;
  color-scheme: light;
}
/* Подвал всегда тёмный — «последний кадр» */
.site-footer {
  --f-display: "Sofia Sans Extra Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --red: #E4194A; --on-red: #F2EFEA;
  --bg: #121010; --bg-2: #1C1919; --bg-3: #272322; --text: #F2EFEA;
  --muted: rgba(242, 239, 234, .68); --silver: #8F8D88;
  --line: rgba(242, 239, 234, .16); --line-strong: rgba(242, 239, 234, .38); --red-hover: #FF2D5D;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.7 var(--f-mono); font-stretch: 87.5%;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: hidden;
}
/* Плёночное зерно поверх всей страницы */
body::after { content: ""; position: fixed; inset: 0; z-index: 49; pointer-events: none; opacity: .14; mix-blend-mode: overlay; background-image: var(--grain); }
:root[data-theme="light"] body::after { opacity: .07; mix-blend-mode: normal; background-image: var(--grain-dark); }
img, video { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0 0 1em; }
::selection { background: var(--red); color: var(--on-red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--red); color: var(--on-red); padding: 10px 14px; font: 500 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; }
.skip:focus { left: 12px; }
.muted { color: var(--muted); }
.red { color: var(--red); }

/* ---------- Типографика ---------- */
.mono { font-family: var(--f-mono); font-stretch: 87.5%; font-weight: 500; font-size: 10.5px; line-height: 1.35; letter-spacing: .06em; text-transform: uppercase; }
.kicker { color: var(--silver); margin: 0 0 12px; }
.h1, .h2, .h3, .h4, .hero-name, .dir-title, .footer-title, .contact-big, .next-title, .foot-end, .card-title, .ph-name {
  font-family: var(--f-display); font-weight: 900; margin: 0; text-transform: uppercase; letter-spacing: -.005em; text-wrap: balance;
}
.h1 { font-size: clamp(56px, 9vw, 150px); line-height: .82; overflow-wrap: break-word; hyphens: auto; }
.h2 { font-size: clamp(52px, 7.2vw, 124px); line-height: .84; }
.h3 { font-size: clamp(36px, 3.8vw, 64px); line-height: .86; }
.h4 { font-size: 26px; font-weight: 800; line-height: .95; }
.lead { font-size: 15px; line-height: 1.7; color: var(--muted); max-width: 62ch; margin: 22px 0 0; }
.prose { max-width: 70ch; }
.prose p { margin: 0 0 1.1em; }

/* ---------- Ячейки «данных съёмки» ---------- */
.cells { display: flex; flex-wrap: wrap; margin: 0; border-bottom: 1px solid var(--line); color: var(--silver); }
.cells > span { padding: 14px 16px 13px 0; margin-right: 16px; border-right: 1px solid var(--line); white-space: nowrap; }
.cells > span:last-child { border-right: 0; margin-left: auto; margin-right: 0; padding-right: 0; }
.rec { display: inline-flex; align-items: center; gap: 9px; color: var(--text); }
.rec i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: rec 1.8s steps(2, start) infinite; }
@keyframes rec { 50% { opacity: .2; } }

/* ---------- Кнопки и ссылки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px; border: 1px solid var(--line-strong); background: transparent; color: inherit;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  font: 500 11px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .08em; text-transform: uppercase;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn-cut, .btn-solid { background: var(--red); color: var(--on-red); border-color: var(--red); }
.btn-cut:hover, .btn-solid:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-arr { display: inline-block; transition: transform .3s var(--ease); }
.btn:hover .btn-arr { transform: translate(2px, -2px); }
.hero-actions .btn:hover .btn-arr { transform: translateY(3px); }
.link { color: var(--text); text-decoration: none; border: 0; border-bottom: 1px solid var(--red); padding: 0 0 3px; background: none; cursor: pointer;
  font: 500 10.5px/1.3 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; transition: color .2s; }
.link:hover { color: var(--red); }

/* ---------- Шапка: строка ячеек, как таблица проявки ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg); border-bottom: 1px solid var(--line-strong);
  transition: transform .45s var(--ease), background-color .4s var(--ease);
}
.site-header.hidden { transform: translateY(-100%); }
.header-row { display: flex; align-items: stretch; height: var(--header-h); padding: 0 max(clamp(12px, 2vw, 28px), env(safe-area-inset-right, 0px)) 0 max(clamp(12px, 2vw, 28px), env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 12px; padding-right: 18px; margin-right: auto; text-decoration: none;
  font: 500 11px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; flex: none; color: var(--red); transition: transform .3s steps(2, end); }
.brand-cut { fill: none; stroke: var(--bg); stroke-width: 3.2; stroke-linejoin: miter; stroke-linecap: square; transition: stroke .4s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-4deg); }
.nav { display: flex; align-items: stretch; }
.nav a { display: flex; align-items: center; gap: 9px; padding: 0 clamp(14px, 1.5vw, 22px); border-left: 1px solid var(--line); text-decoration: none; white-space: nowrap;
  font: 500 11px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .05em; text-transform: uppercase; transition: background-color .15s, color .15s; }
.nav a b { font-weight: 400; color: var(--silver); }
.nav a:hover { background: var(--text); color: var(--bg); }
.nav a:hover b { color: inherit; opacity: .6; }
.nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--red); }
.nav a[aria-current="page"] b { color: var(--red); }
.nav .nav-contact { background: var(--red); color: var(--on-red); }
.nav .nav-contact b { color: var(--on-red); opacity: .7; }
.nav .nav-contact:hover { background: var(--text); color: var(--bg); }
.header-tools { display: flex; border-left: 1px solid var(--line); }
.icon-btn { width: var(--header-h); height: 100%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--text); color: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: block; }
.burger { display: none; border-left: 1px solid var(--line); }
.burger span { display: block; width: 18px; height: 1.5px; background: currentColor; transition: transform .3s var(--ease); grid-area: 1/1; }
.burger span:first-child { transform: translateY(-4px); }
.burger span:last-child { transform: translateY(4px); }
.menu-open .burger span:first-child { transform: rotate(45deg); }
.menu-open .burger span:last-child { transform: rotate(-45deg); }

/* ---------- Первый экран: лист проявки ---------- */
.hero { margin-top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line-strong); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.hero-solo { grid-template-columns: minmax(0, 1fr); }
.hero-copy { display: flex; flex-direction: column; min-width: 0; padding: clamp(20px, 2.2vw, 30px) clamp(20px, 3vw, 44px) clamp(20px, 2.2vw, 28px) 0; border-right: 1px solid var(--line); }
.hero-solo .hero-copy { border-right: 0; }
.hero-role { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0; color: var(--muted); }
.hero-no { padding: 5px 7px 4px; background: var(--red); color: var(--on-red); }
.hero-name { margin: auto 0 0; padding-top: clamp(28px, 4vw, 56px); font-size: clamp(88px, 14.2vw, 228px); line-height: .8; letter-spacing: -.01em; overflow-wrap: anywhere; }
.hero-name span { display: block; }
.hero-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 18px 32px; margin-top: clamp(22px, 2.8vw, 36px); padding-top: 18px; border-top: 1px solid var(--line); }
.hero-lead { margin: 0; max-width: 48ch; color: var(--muted); font-size: 13px; line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-sheet { display: flex; flex-direction: column; justify-content: center; gap: 12px; min-width: 0; padding: clamp(20px, 2.2vw, 30px) 0 clamp(16px, 1.8vw, 24px) clamp(20px, 3vw, 44px); }
.hero-sheet-cap { display: flex; justify-content: space-between; gap: 16px; margin: 0; color: var(--silver); }
.hero-sheet-cap a { color: var(--text); text-decoration: none; }
.hero-sheet-cap a:hover { color: var(--red); }

/* Направления — две ячейки под первым экраном */
.dirs { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line-strong); }
.dir {
  position: relative; display: flex; align-items: center; gap: clamp(14px, 1.6vw, 24px); min-width: 0;
  padding: clamp(12px, 1.1vw, 16px) 0; text-decoration: none; transition: background-color .2s;
}
.dir + .dir { border-left: 1px solid var(--line); padding-left: clamp(16px, 2vw, 28px); }
.dir:first-child { padding-right: clamp(16px, 2vw, 28px); }
.dir-no { flex: none; min-width: 1.1em; font: 900 clamp(64px, 6.6vw, 108px)/.76 var(--f-display); color: var(--red); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.dir-body { display: grid; gap: 7px; min-width: 0; flex: 1; }
.dir-count { color: var(--silver); }
.dir-title { font-size: clamp(26px, 2.5vw, 40px); line-height: .88; }
.dir-text { color: var(--muted); font-size: 12px; line-height: 1.55; max-width: 46ch; }
.dir-media { position: relative; flex: none; display: block; width: clamp(110px, 12vw, 176px); aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-3); }
.dir-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.dir-web .dir-media img { object-position: top; }
.dir-media:empty { background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 16px 16px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 16px 16px, var(--bg-3); }
.dir-arrow { position: absolute; right: 0; bottom: clamp(12px, 1.1vw, 16px); z-index: 2; width: 34px; height: 34px; display: grid; place-items: center; background: var(--red); color: var(--on-red); transition: background-color .2s, color .2s; }
.dir:first-child .dir-arrow { right: clamp(16px, 2vw, 28px); }
.dir-arrow::after { content: ""; width: 13px; height: 13px; background: currentColor; -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 13 13 3M5 3h8v8' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E"); mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 13 13 3M5 3h8v8' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E"); transition: transform .3s var(--ease); }
.dir:hover { background: var(--bg-2); }
.dir:hover .dir-arrow { background: var(--text); color: var(--bg); }
.dir:hover .dir-arrow::after { transform: translate(2px, -2px); }
.dir:hover .dir-media img { transform: scale(1.05); }
.dir:hover .dir-title { color: var(--red); }

/* Брендбуки — первым блоком, сразу под шапкой; блок с именем идёт следом, как обычный раздел */
.section.books-top { padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }
.books-top .fhead { border-top: 0; }
.hero.hero-below { margin-top: clamp(64px, 8vw, 120px); }
.hero-below .hero-meta { border-top: 1px solid var(--line-strong); }

/* ---------- Разделы-кадры ---------- */
.section { padding: clamp(64px, 8vw, 120px) 0 0; }
.section-tight { padding-top: 0; }
.fhead { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); margin-bottom: clamp(24px, 3vw, 40px); }
.fhead-meta { grid-column: span 3; display: grid; align-content: space-between; gap: 20px; padding: 16px 16px 16px 0; border-right: 1px solid var(--line); }
.fhead-meta .mono { color: var(--silver); }
.fhead-meta b { font: 900 clamp(56px, 7vw, 120px)/.78 var(--f-display); color: var(--red); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fhead-title { grid-column: span 9; min-width: 0; padding: 16px 0 20px clamp(16px, 1.6vw, 22px); }
.fhead-lead { grid-column: 4 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 32px; padding: 16px 0 18px clamp(16px, 1.6vw, 22px); border-top: 1px solid var(--line); }
.fhead-lead p { margin: 0; max-width: 74ch; color: var(--muted); }
.fhead-quote { flex-direction: column; align-items: flex-start; gap: 24px; padding-bottom: 24px; }
.quote { font: 800 clamp(26px, 2.8vw, 44px)/.98 var(--f-display); text-transform: uppercase; color: var(--text) !important; max-width: 30ch !important; text-wrap: pretty; }

/* ---------- Контактный лист ---------- */
.sheet {
  position: relative; isolation: isolate; margin: 0; padding: clamp(10px, 1.2vw, 16px) 0;
  background: var(--film); color: var(--film-ink); box-shadow: inset 0 0 0 1px rgba(242, 239, 234, .08);
}
.sheet-edge { position: absolute; left: clamp(10px, 1.4vw, 18px); top: 3px; color: var(--edge); font-size: 9px; letter-spacing: .2em; }
.strip { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(6px, .8vw, 12px); padding: clamp(18px, 2vw, 26px) clamp(10px, 1.4vw, 18px); }
.strip-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.strip::before, .strip::after { content: ""; position: absolute; left: 0; right: 0; height: clamp(7px, .8vw, 11px); border-radius: 2px;
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(242, 239, 234, .22) 10px 20px, transparent 20px 28px); }
.strip::before { top: 4px; } .strip::after { bottom: 4px; }
.fr { position: relative; display: block; aspect-ratio: 3 / 2; background: var(--film-frame); text-decoration: none; color: inherit; }
.fr-img { position: absolute; inset: 0; overflow: hidden; }
.fr-img > img { width: 100%; height: 100%; object-fit: cover; filter: contrast(1.04); transition: transform .9s var(--ease); }
.fr-img.fit-logo { background: var(--paper); }
.fr-web .fr-img > img { object-position: left top; }
.fr-img .ph-live { position: absolute; inset: 0; height: 100%; }
.fr:hover { z-index: 5; }
.fr:hover .fr-img > img { transform: scale(1.04); }
.fr-no { position: absolute; left: 3px; bottom: -3px; transform: translateY(118%); color: var(--edge); font-size: 9px; letter-spacing: .1em; }
.fr-title { position: absolute; left: 0; bottom: 0; z-index: 2; max-width: 100%; padding: 7px 10px 6px; background: var(--film-ink); color: #121010;
  font: 500 10px/1.2 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .25s var(--ease); }
.fr-title i { font-style: normal; margin-left: 8px; color: var(--red); }
.fr:hover .fr-title, .fr:focus-visible .fr-title { opacity: 1; transform: none; }
@media (hover: none) { .fr-title { opacity: 1; transform: none; } .hero-sheet .fr-title { display: none; } }
.fr-empty { background: var(--film-empty); }
.fr-pick { position: absolute; inset: -16% -9%; pointer-events: none; z-index: 4; }
.fr-pick .mk { position: absolute; inset: 0; width: 100%; height: 100%; }
.fr-note { position: absolute; right: -2%; bottom: -27%; z-index: 6; font: 900 clamp(22px, 2.2vw, 36px)/1 var(--f-display); color: var(--red); text-transform: uppercase; transform: rotate(-7deg); pointer-events: none; }
.sheet-cross { position: absolute; z-index: 4; right: 2.4%; top: 4%; width: clamp(30px, 3.6vw, 54px); aspect-ratio: 1; pointer-events: none; }
.sheet-cross .mk { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Уголки кадра при наведении ---------- */
.card-media::after, .fr::after, .th-media::after, .dir-media::after, .browser-view::after, .next-media::after, .case-stage a::after {
  --c: var(--red); --l: 20px; --t: 3px;
  content: ""; position: absolute; inset: 9px; z-index: 1; pointer-events: none; opacity: 0;
  transition: opacity .2s, inset .35s var(--ease);
  background:
    linear-gradient(var(--c), var(--c)) left top / var(--l) var(--t) no-repeat, linear-gradient(var(--c), var(--c)) left top / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--l) var(--t) no-repeat, linear-gradient(var(--c), var(--c)) right top / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--l) var(--t) no-repeat, linear-gradient(var(--c), var(--c)) left bottom / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--l) var(--t) no-repeat, linear-gradient(var(--c), var(--c)) right bottom / var(--t) var(--l) no-repeat;
}
.fr::after, .dir-media::after, .next-media::after { --l: 14px; inset: 6px; }
.card:hover .card-media::after, .card:focus-visible .card-media::after, .fr:hover::after, .fr:focus-visible::after, .th-media:hover::after, .th-media:focus-visible::after,
.dir:hover .dir-media::after, .browser:hover .browser-view::after, .next-case a:hover .next-media::after, .case-stage a:hover::after { opacity: 1; inset: 14px; }
.fr:hover::after, .dir:hover .dir-media::after, .next-case a:hover .next-media::after { inset: 9px; }

/* ---------- Карточки работ ---------- */
.card { display: block; text-decoration: none; color: inherit; }
.card:focus-visible { outline: none; }
.card-media { display: block; position: relative; overflow: hidden; background: var(--bg-3); aspect-ratio: 4 / 3; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.card:hover .card-media img { transform: scale(1.03); }
.card-web .card-media img { object-position: left top; }
.card-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0 0; }
.card-title { font-size: 24px; font-weight: 800; line-height: .95; }
.card:hover .card-title { color: var(--red); }
.card-sub { flex: none; max-width: 50%; text-align: right; color: var(--silver); font: 500 10px/1.4 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; }
.card-tags { position: absolute; left: 0; top: 0; z-index: 2; display: flex; pointer-events: none; }
.card-no, .card-plate { font: 500 10px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .08em; padding: 7px 8px 6px; }
.card-no { background: rgba(18, 16, 16, .86); color: #F2EFEA; }
.card-plate { background: var(--red); color: var(--on-red); font-weight: 600; letter-spacing: .12em; }

.featured { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(26px, 2.6vw, 40px) clamp(14px, 1.4vw, 22px); }
.featured .card-lg { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; }
.featured .card-lg .card-media { aspect-ratio: auto; flex: 1; min-height: 320px; }
.featured-1 { grid-template-columns: 1fr; }
.featured-1 .card-lg { grid-column: auto; }

/* Сетка раздела «Дизайн»: естественные пропорции картинок */
.masonry { columns: 3 300px; column-gap: clamp(16px, 1.6vw, 24px); }
.masonry .card { break-inside: avoid; margin-bottom: clamp(28px, 3vw, 40px); }
.masonry .card-media { aspect-ratio: auto; }
.masonry .card-media .ph { aspect-ratio: 4 / 3; }
.masonry .card.is-hidden { display: none; }
.masonry .card.is-in { animation: cardIn .45s var(--ease) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } }

/* Квадратные картинки (логотипы) — на светлой подложке */
.card-media.fit-logo, .dir-media.fit-logo, .next-media.fit-logo, .th-media.fit-logo { background: var(--paper); }

/* Заглушки, пока нет обложки */
.ph { display: grid; place-items: center; width: 100%; height: 100%; min-height: 200px; position: relative;
  background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 24px 24px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 24px 24px, var(--bg-3); }
.ph-name { font-size: clamp(26px, 2.6vw, 38px); line-height: .9; padding: 20px; text-align: center; }
.ph-web { align-content: start; }
.ph-bar { position: absolute; inset: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.ph-bar i, .browser-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.ph-bar b, .browser-bar b { font-weight: 500; font-size: 10.5px; color: var(--silver); margin-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .02em; }
.ph-web .ph-name { position: absolute; inset: 40px 0 0; display: grid; place-items: center; }

/* Живое превью HTML-документа: страница 1440 px, уменьшенная под рамку */
.ph.ph-live { display: block; min-height: 0; height: 100%; overflow: hidden; background: var(--bg-3); }
.ph-live iframe { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; border: 0; transform-origin: 0 0; transform: scale(.25); pointer-events: none; background: transparent; }

/* ---------- Фильтры ---------- */
.filters { display: flex; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1) clamp(28px, 4vw, 44px); padding: 0 var(--gutter);
  position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); z-index: 10;
  background: var(--bg); border-bottom: 1px solid var(--line); transition: top .45s var(--ease), background-color .4s var(--ease); }
.header-hidden .filters { top: env(safe-area-inset-top, 0px); }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; gap: 9px; align-items: center; height: 46px; padding: 0 16px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; white-space: nowrap;
  font: 500 11px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .05em; text-transform: uppercase; transition: background-color .15s, color .15s; }
.chip:first-child { border-left: 1px solid var(--line); }
.chip span { color: var(--silver); font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--bg-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .6; }
.chip-plate::before { content: ""; width: 7px; height: 7px; background: var(--red); }
.chip-plate[aria-pressed="true"] { background: var(--red); color: var(--on-red); }
.chip-plate[aria-pressed="true"]::before { background: var(--on-red); }
.empty { color: var(--muted); padding: 40px 0; }

/* ---------- Шапка разделов «Дизайн» и «Сайты» ---------- */
.page-head { padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + clamp(22px, 3vw, 40px)) 0 clamp(32px, 4.4vw, 56px); }
.page-head-grid { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.page-head-grid .page-kicker { grid-column: 1 / -1; margin: 0; padding: 0 0 13px; border-bottom: 1px solid var(--line); }
.page-count { grid-column: 1 / span 3; grid-row: 2 / span 2; display: flex; flex-direction: column-reverse; justify-content: space-between; gap: 18px; margin: 0; padding: 18px 16px 20px 0; border-right: 1px solid var(--line); }
.page-count b { font: 900 clamp(88px, 12vw, 200px)/.74 var(--f-display); color: var(--red); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.page-count .mono { color: var(--silver); }
.page-head-grid .h1 { grid-column: 4 / -1; grid-row: 2; padding: 18px 0 24px clamp(16px, 1.6vw, 22px); }
.page-head-grid .lead { grid-column: 4 / -1; grid-row: 3; margin: 0; padding: 18px 0 22px clamp(16px, 1.6vw, 22px); border-top: 1px solid var(--line); }
.two-col { position: relative; display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(28px, 5vw, 80px); align-items: start; padding-top: 18px; }

/* Линии у блоков, которые сами являются .wrap: по ширине содержимого, без полей */
.wrap.two-col::before, .wrap.case-text::before, .wrap.page-head-grid::after { content: ""; position: absolute; left: var(--gutter); right: var(--gutter); border-top: 1px solid var(--line-strong); }
.wrap.two-col::before, .wrap.case-text::before { top: 0; }
.wrap.page-head-grid::after { bottom: 0; }

/* ---------- Раздел «Сайты» ---------- */
.sites { display: grid; gap: clamp(64px, 9vw, 120px); }
.site-row { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(28px, 4.5vw, 72px); align-items: center; }
.site-row:nth-child(even) .browser { order: 2; }
.browser { display: block; overflow: hidden; border: 1px solid var(--line-strong); background: var(--bg-2); text-decoration: none; transition: border-color .2s; }
.browser:hover, .browser:focus-visible { border-color: var(--red); }
.browser-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-family: var(--f-mono); }
.browser-view { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-3); }
.browser-view img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: object-position 3s var(--ease); }
.browser:hover .browser-view img { object-position: bottom; }
.browser-view .ph-bar { display: none; }
.browser-view .ph-web .ph-name { inset: 0; }
.site-kind { color: var(--silver); margin: 0 0 14px; }
.site-kind.mono { display: flex; align-items: center; gap: 12px; }
.site-no { padding: 5px 7px 4px; background: var(--red); color: var(--on-red); font-weight: 600; }
.site-sub { font-weight: 500; font-size: 14px; margin: 14px 0; }
.site-info > p:not(.site-kind):not(.site-sub) { color: var(--muted); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0; padding: 0; margin: 20px 0 28px; border-left: 1px solid var(--line-strong); }
.tags li { font: 500 10px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; padding: 9px 11px; border: 1px solid var(--line-strong); border-left: 0; margin-bottom: -1px; }
.site-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stack-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
.stack-list li { padding: 16px 0; border-bottom: 1px solid var(--line); font: 800 clamp(22px, 2vw, 30px)/.95 var(--f-display); text-transform: uppercase; }

/* ---------- Страница работы ---------- */
.read-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--red); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.case-head { padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + clamp(22px, 3.4vw, 48px)) 0 clamp(24px, 3.4vw, 44px); }
.case-head .h1 { font-size: clamp(56px, 8.4vw, 140px); max-width: 18ch; }
.back { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; padding: 11px 14px 10px 12px; border: 1px solid var(--line-strong); color: var(--text); text-decoration: none;
  font: 500 10.5px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; transition: background-color .15s, color .15s; }
.back::before { content: "←"; transition: transform .3s var(--ease); }
.back:hover { background: var(--text); color: var(--bg); }
.back:hover::before { transform: translateX(-4px); }
.job { display: inline-flex; flex-wrap: wrap; margin: 0 0 clamp(18px, 2vw, 26px); border: 1px solid var(--line-strong); color: var(--silver); }
.job span { padding: 10px 14px 9px; border-right: 1px solid var(--line); white-space: nowrap; }
.job span:last-child { border-right: 0; }
.job-rec { color: var(--text); }
.job-rec::first-letter { color: var(--red); }
.case-job { display: flex; width: fit-content; max-width: 100%; margin: 0 0 22px; }
.case-head .lead { font-size: 15px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; margin: clamp(26px, 3.4vw, 40px) 0 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.facts div { padding: 13px 16px 15px 0; border-right: 1px solid var(--line); min-width: 0; }
.facts div + div { padding-left: 16px; }
.facts div:last-child { border-right: 0; }
.facts dt { font: 500 10px/1.3 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; color: var(--silver); }
.facts dd { margin: 6px 0 0; font-weight: 500; font-size: 13px; overflow-wrap: anywhere; }
.facts a { text-decoration-color: var(--red); text-underline-offset: 4px; }
.case-head .hero-actions { margin-top: 26px; }

/* Главный кадр — целиком, не выше экрана */
.case-stage { margin: 0; display: flex; justify-content: center; }
.case-stage a { position: relative; display: block; max-width: 100%; overflow: hidden; background: var(--bg-3); cursor: zoom-in; }
.case-stage img { width: auto; max-width: 100%; max-height: min(78vh, 880px); object-fit: contain; }
.case-stage.fit-logo a { background: var(--paper); }
.case-stage.fit-logo img { max-height: min(62vh, 640px); }
.case-cover { margin: 0; overflow: hidden; background: var(--bg-3); max-width: 750px; justify-self: center; }
.case-cover img { width: 100%; max-height: 88vh; object-fit: cover; cursor: zoom-in; }
.case-cover-web img { object-position: top; }

/* Остальное — небольшие карточки с подписями */
.case-more { padding-top: clamp(28px, 3.4vw, 48px); }
.case-more + .case-more { padding-top: clamp(36px, 4vw, 56px); }
.th-group { display: flex; align-items: baseline; gap: 10px; margin: 0 0 16px; padding-top: 13px; border-top: 1px solid var(--line-strong); color: var(--silver); font-size: 10.5px; }
.th-group span { color: var(--red); }
.case-thumbs + .th-group { margin-top: clamp(30px, 3.2vw, 44px); }
.case-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(18px, 1.8vw, 26px) clamp(10px, 1.2vw, 16px); }
.th { margin: 0; min-width: 0; }
.th-media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-3); cursor: zoom-in; }
.th-media img, .th-media video { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.th-media:hover img { transform: scale(1.04); }
.th-web img { object-position: top; }
.th-doc, .th-video { cursor: pointer; }
.th-doc { background: var(--film); }
.th-doc .ph-live { position: absolute; inset: 0; }
.th-badge { position: absolute; left: 0; top: 0; z-index: 2; font: 600 10px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .1em; padding: 7px 8px 6px; background: var(--red); color: var(--on-red); }
.th-play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; background: rgba(18, 16, 16, .7); border: 1px solid rgba(242, 239, 234, .7); transition: background-color .2s, border-color .2s; }
.th-play::after { content: ""; position: absolute; left: 50%; top: 50%; margin: -9px 0 0 -5px; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #F2EFEA; }
.th-media:hover .th-play { background: var(--red); border-color: var(--red); }
.th figcaption { color: var(--muted); font-size: 12px; line-height: 1.5; padding-top: 9px; }
.th figcaption b { color: var(--text); font-weight: 600; }

/* HTML-брендбук на странице работы */
.docs { padding-top: clamp(8px, 1vw, 16px); }
.doc-main { position: relative; display: block; text-decoration: none; color: var(--film-ink); background: var(--film); box-shadow: inset 0 0 0 1px rgba(242, 239, 234, .1); transition: box-shadow .2s; }
.doc-main:hover, .doc-main:focus-visible { box-shadow: inset 0 0 0 2px var(--red); }
.doc-bar { display: flex; align-items: center; gap: 14px; padding: 13px 16px; color: rgba(242, 239, 234, .6); border-bottom: 1px solid rgba(242, 239, 234, .12); font-size: 10.5px; }
.doc-dots { display: inline-flex; gap: 6px; }
.doc-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(242, 239, 234, .22); }
.doc-dots i:first-child { background: var(--red); }
.doc-bar b { color: var(--film-ink); font-weight: 600; }
.doc-file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(242, 239, 234, .38); text-transform: none; letter-spacing: .02em; }
.doc-open { margin-left: auto; color: var(--film-ink); white-space: nowrap; }
.doc-screen { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; }
.doc-screen .ph-live { position: absolute; inset: 0; }
.doc-cta { position: absolute; z-index: 2; right: clamp(14px, 2.2vw, 32px); bottom: clamp(14px, 2.2vw, 32px); display: grid; gap: 8px; padding: 14px 20px 16px;
  background: var(--red); color: var(--on-red); transform: rotate(-2deg); transition: transform .3s steps(2, end), background-color .2s, color .2s; }
.doc-cta b { font: 900 clamp(30px, 3.6vw, 56px)/.82 var(--f-display); text-transform: uppercase; }
.doc-cta .mono { font-size: 9.5px; opacity: .85; }
.doc-main:hover .doc-cta { transform: rotate(0); background: var(--film-ink); color: #121010; }
.doc-mark { position: absolute; z-index: 3; right: clamp(40px, 9vw, 150px); top: clamp(-58px, -4.4vw, -40px); display: flex; align-items: flex-end; gap: 4px; pointer-events: none;
  font: 900 clamp(20px, 2vw, 30px)/1 var(--f-display); color: var(--red); text-transform: uppercase; transform: rotate(-3deg); }
.doc-mark .mk { position: relative; width: clamp(60px, 6vw, 96px); height: auto; aspect-ratio: 160 / 60; order: 2; transform: rotate(28deg) translateY(18px); }
.doc-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr)); gap: clamp(12px, 1.4vw, 20px); margin-top: clamp(12px, 1.4vw, 20px); }
.doc-fr { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); text-decoration: none; background: var(--film); color: var(--film-ink); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(242, 239, 234, .1); }
.doc-strip > .doc-fr:only-child { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.doc-fr:hover, .doc-fr:focus-visible { box-shadow: inset 0 0 0 2px var(--red); }
.doc-fr-img { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; }
.doc-fr-img .ph-live { position: absolute; inset: 0; }
.doc-fr-meta { display: flex; flex-direction: column; gap: 10px; padding: clamp(16px, 2vw, 28px); min-width: 0; border-left: 1px solid rgba(242, 239, 234, .1); }
.doc-fr-meta .mono { color: var(--edge); font-size: 10px; }
.doc-fr-meta b { font: 900 clamp(30px, 3.4vw, 54px)/.84 var(--f-display); text-transform: uppercase; overflow-wrap: anywhere; }
.doc-fr-go { margin-top: auto; padding-top: 14px; color: var(--red); }
.doc-fr:hover .doc-fr-go { color: var(--film-ink); }

/* До / после */
.m { margin: 0; }
.m > a, .m > video, .m .compare { display: block; overflow: hidden; background: var(--bg-3); }
.m img { width: 100%; cursor: zoom-in; }
.m figcaption { color: var(--muted); font-size: 12px; padding-top: 9px; }
.case-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 20px); }
.case-compare .compare > img:first-child { height: auto; max-height: min(72vh, 680px); object-fit: cover; }
.compare { position: relative; user-select: none; touch-action: pan-y; }
.compare img { width: 100%; pointer-events: none; cursor: default; }
.compare .compare-before { position: absolute; inset: 0; height: 100%; object-fit: cover; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 0; border-left: 2px solid var(--red); margin-left: -1px; pointer-events: none; }
.compare-handle::after { content: "‹ ›"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; background: var(--red); color: #F2EFEA; display: grid; place-items: center; font: 500 16px/1 var(--f-mono); letter-spacing: 2px; }
.compare input:focus-visible ~ .compare-handle::after { outline: 2px solid #fff; outline-offset: 3px; }
.compare-tag { position: absolute; top: 0; font: 500 10px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .08em; text-transform: uppercase; padding: 7px 9px 6px; background: rgba(18, 16, 16, .82); color: #F2EFEA; pointer-events: none; }
.compare-tag-l { left: 0; } .compare-tag-r { right: 0; }

/* Текст работы */
.case-text { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px clamp(28px, 5vw, 88px); margin-top: clamp(44px, 5vw, 76px); padding-top: 22px; }
.case-text .lead { color: var(--text); margin: 0; font: 800 clamp(24px, 2.4vw, 38px)/.98 var(--f-display); text-transform: uppercase; max-width: 28ch; }
.case-text .prose { color: var(--muted); }
.case-text .prose:empty { display: none; }

/* Следующая работа — строка-ячейка */
.next-case { padding-top: clamp(56px, 7vw, 100px); }
.next-case a { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); padding: clamp(12px, 1.2vw, 16px) clamp(14px, 1.6vw, 20px) clamp(12px, 1.2vw, 16px) 0;
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); text-decoration: none; transition: background-color .2s; }
.next-case a:hover { background: var(--bg-2); }
.next-media { position: relative; flex: none; order: -1; width: clamp(110px, 12vw, 176px); aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-3); }
.next-media img { width: 100%; height: 100%; object-fit: cover; }
.next-media .ph-live { aspect-ratio: auto; }
.next-text { display: grid; gap: 8px; min-width: 0; flex: 1; }
.next-text .muted { font: 500 10.5px/1.3 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; color: var(--silver); }
.next-title { display: block; font-size: clamp(32px, 3.8vw, 64px); line-height: .86; }
.next-case a:hover .next-title { color: var(--red); }
.next-go { flex: none; color: var(--text); transition: transform .3s var(--ease); }
.next-case a:hover .next-go { transform: translateX(4px); }

/* ---------- Обо мне ---------- */
.about-hero { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(36px, 6vw, 96px); align-items: end; }
.about-photo { position: relative; aspect-ratio: 4 / 5; margin: 18px; }
.about-photo img, .about-photo .ph { width: 100%; height: 100%; object-fit: cover; }
/* Уголки кадра вокруг фото */
.crop { position: absolute; width: 24px; height: 24px; border-color: var(--red); border-style: solid; border-width: 0; z-index: 2; }
.crop-tl { top: -14px; left: -14px; border-left-width: 3px; border-top-width: 3px; }
.crop-tr { top: -14px; right: -14px; border-right-width: 3px; border-top-width: 3px; }
.crop-bl { bottom: -14px; left: -14px; border-left-width: 3px; border-bottom-width: 3px; }
.crop-br { bottom: -14px; right: -14px; border-right-width: 3px; border-bottom-width: 3px; }
.about-hero .h1 { padding-bottom: 18px; border-bottom: 1px solid var(--line-strong); }
.about-hero .lead { color: var(--text); margin-top: 18px; }
.about-hero .prose { margin-top: 22px; color: var(--muted); }
.about-hero .hero-actions { margin-top: 28px; }
.skills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: clamp(28px, 3.4vw, 44px); border-top: 1px solid var(--line-strong); }
.skill-group { padding: 0 18px 0 0; border-right: 1px solid var(--line); min-width: 0; }
.skill-group + .skill-group { padding-left: 18px; }
.skill-group:last-child { border-right: 0; }
.skill-group h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 16px 0 14px; border-bottom: 1px solid var(--line); }
.skill-group h3 span { font: 500 10.5px/1 var(--f-mono); font-stretch: 87.5%; color: var(--red); letter-spacing: .06em; }
.skill-group ul { list-style: none; margin: 0; padding: 0; }
.skill-group li { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 200px 1fr; gap: 6px 28px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.t-when { grid-row: span 2; padding-top: 4px; font: 500 10.5px/1.4 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.t-what { font: 800 clamp(24px, 2.2vw, 32px)/.95 var(--f-display); text-transform: uppercase; }
.t-desc { color: var(--muted); font-size: 13px; }

/* ---------- Подвал: последний кадр ---------- */
.site-footer { position: relative; margin-top: clamp(80px, 10vw, 150px); padding: 0 0 calc(26px + env(safe-area-inset-bottom, 0px)); background: var(--bg); color: var(--text); border-top: 1px solid var(--line-strong); }
.foot-meta { color: var(--silver); }
.footer-title { margin: clamp(30px, 4vw, 56px) 0 clamp(30px, 4vw, 52px); font-size: clamp(52px, 7.6vw, 132px); line-height: .84; max-width: 15ch; }
.footer-title .red { display: block; }
.contact-lines { border-top: 1px solid var(--line-strong); }
.c-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: center; padding: 0; border-bottom: 1px solid var(--line); }
.c-label { grid-column: span 3; align-self: stretch; display: flex; align-items: center; padding: 16px 16px 16px 0; color: var(--silver); border-right: 1px solid var(--line); }
.c-row .contact-big { grid-column: 4 / -1; margin: 14px 0 12px clamp(16px, 1.6vw, 22px); }
.contact-mail .contact-big { grid-column: 4 / 11; }
.contact-mail .copy-btn { grid-column: 11 / -1; justify-self: end; }
.contact-big { width: fit-content; max-width: 100%; font-size: clamp(30px, 4vw, 64px); font-weight: 800; line-height: .95; text-transform: none; text-decoration: none; overflow-wrap: anywhere;
  background: linear-gradient(var(--red), var(--red)) 0 100% / 0 3px no-repeat; padding-bottom: 4px; transition: background-size .4s var(--ease), color .2s; }
.contact-big:hover { background-size: 100% 3px; color: var(--red); }
.copy-btn { border: 1px solid var(--line-strong); background: transparent; padding: 11px 14px 10px; cursor: pointer; color: var(--text); transition: background-color .15s, color .15s; }
.copy-btn:hover { background: var(--text); color: var(--bg); }
.footer-bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; padding-top: clamp(44px, 6vw, 80px); }
.foot-end { margin: 0; font-size: clamp(56px, 9vw, 152px); line-height: .8; }
.foot-info { display: grid; justify-items: end; gap: 12px; text-align: right; color: var(--silver); padding-bottom: 4px; }
.foot-info nav { display: flex; gap: 18px; }
.foot-info a { text-decoration: none; color: var(--text); }
.foot-info a:hover { color: var(--red); }
.foot-info .foot-top { color: var(--red); }
.foot-info .foot-top:hover { color: var(--text); }

/* ---------- Всплывающие элементы ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 90;
  background: var(--text); color: var(--bg); padding: 13px 18px 12px; font: 500 11px/1 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; transition: opacity .3s, transform .35s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(10, 9, 9, .96); display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); animation: fadeIn .25s var(--ease); }
.lightbox[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.lightbox figure { margin: 0; grid-column: 2; display: grid; justify-items: center; gap: 12px; }
.lightbox img { max-height: 84vh; max-height: 84dvh; width: auto; }
.lightbox video { max-height: 84vh; max-height: 84dvh; max-width: 100%; width: auto; background: #000; }
.lightbox [hidden] { display: none !important; }
.lightbox figcaption { color: #B8B5AF; font: 500 10.5px/1.4 var(--f-mono); font-stretch: 87.5%; letter-spacing: .06em; text-transform: uppercase; text-align: center; }
.lightbox button { background: transparent; border: 1px solid rgba(242, 239, 234, .3); color: #F2EFEA; font-size: 28px; line-height: 1; cursor: pointer; width: 52px; height: 52px; transition: background-color .15s, border-color .15s; }
.lightbox button:hover { background: var(--red); border-color: var(--red); }
.lb-close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }
.lb-prev { grid-column: 1; justify-self: center; } .lb-next { grid-column: 3; justify-self: center; }
.lb-count { position: absolute; top: calc(30px + env(safe-area-inset-top, 0px)); left: 24px; color: #8F8D88; font: 500 10.5px/1 var(--f-mono); letter-spacing: .08em; font-variant-numeric: tabular-nums; }

/* ---------- Пометки маркером ---------- */
.mk { position: absolute; overflow: visible; pointer-events: none; z-index: 4; }
.mk path { fill: none; stroke: var(--red); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
/* Маркер дорисовывается, когда попадает в кадр. Длину штриха в пикселях экрана считает main.js (--len) */
.js .mk:not(.drawn) path { opacity: 0; }
.mk.drawn path { stroke-dasharray: var(--len) var(--len); animation: draw .7s cubic-bezier(.6, 0, .3, 1) both; }
.mk.drawn path + path { animation-delay: .25s; }
.mk.done path { stroke-dasharray: none; animation: none; }
@keyframes draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.mk-wrap { position: relative; display: inline-block; }
.mk-under { left: -3%; bottom: -.16em; width: 106%; height: .3em; }

/* ---------- Щелчок затвора: элемент появляется рывком, со вспышкой ---------- */
@keyframes shutter {
  0% { opacity: 0; clip-path: inset(0 0 100% 0); }
  40% { opacity: 1; clip-path: inset(0 0 45% 0); filter: brightness(2.2); }
  100% { opacity: 1; clip-path: inset(0); filter: none; }
}
.armed[data-snap] { opacity: 0; }
.go[data-snap] { animation: shutter .42s steps(3, end) both; }
/* Картинки и превью: мягкая «проявка» — из бледного, чуть ниже */
@keyframes develop {
  from { opacity: 0; transform: translateY(18px); filter: saturate(.35) brightness(1.08); }
  55% { opacity: 1; }
  to { opacity: 1; transform: none; filter: none; }
}
.go.is-photo[data-snap] { animation: develop .9s cubic-bezier(.2, .7, .2, 1) both; }
/* Первый экран при загрузке: имя — щелчком затвора, кадры листа проявляются по очереди.
   Если первыми идут брендбуки, так появляются они, а блок с именем — при прокрутке (data-snap) */
.js .hero:not(.hero-below) .hero-name span { animation: shutter .42s steps(3, end) .1s both; }
.js .hero:not(.hero-below) .hero-name span + span { animation-delay: .24s; }
.js .hero:not(.hero-below) .hero-sheet .fr-img { animation: develop .9s cubic-bezier(.2, .7, .2, 1) .3s both; }
.js .hero:not(.hero-below) .hero-sheet .strip:first-of-type .fr:nth-child(2) .fr-img { animation-delay: .42s; }
.js .hero:not(.hero-below) .hero-sheet .strip + .strip .fr:nth-child(1) .fr-img { animation-delay: .54s; }
.js .hero:not(.hero-below) .hero-sheet .strip + .strip .fr:nth-child(2) .fr-img { animation-delay: .66s; }
.js .books-top .h2 { animation: shutter .42s steps(3, end) .1s both; }
.js .books-top .strip:first-of-type .fr-img { animation: develop .9s cubic-bezier(.2, .7, .2, 1) .3s both; }
.js .books-top .strip:first-of-type .fr:nth-child(2) .fr-img { animation-delay: .4s; }
.js .books-top .strip:first-of-type .fr:nth-child(3) .fr-img { animation-delay: .5s; }
.js .books-top .strip:first-of-type .fr:nth-child(4) .fr-img { animation-delay: .6s; }

/* ---------- Адаптив ---------- */
/* Шесть пунктов меню: на средних экранах прячем номера и имя рядом со знаком */
@media (max-width: 1320px) and (min-width: 961px) {
  .nav a b { display: none; }
  .nav a { padding: 0 clamp(11px, 1.1vw, 16px); }
}
@media (max-width: 1100px) and (min-width: 961px) { .brand span { display: none; } }
@media (max-width: 1180px) {
  .skills { grid-template-columns: 1fr 1fr; }
  .skill-group:nth-child(2) { border-right: 0; }
  .skill-group:nth-child(3) { padding-left: 0; }
  .featured { grid-template-columns: 1fr 1fr; }
  .dir-text { display: none; }
}
@media (max-width: 1100px) {
  .case-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  :root { --header-h: 52px; }
  .burger { display: grid; }
  .brand { padding-right: 12px; }
  .nav { position: fixed; inset: 0; z-index: -1; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 0;
    padding: calc(var(--header-h) + env(safe-area-inset-top, 0px)) var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px));
    background: var(--bg); opacity: 0; visibility: hidden; transition: opacity .25s steps(3, end), visibility .25s; }
  .menu-open .nav { opacity: 1; visibility: visible; }
  .nav a { justify-content: space-between; padding: 16px 0 12px; border-left: 0; border-top: 1px solid var(--line); font: 900 clamp(48px, 13vw, 76px)/.86 var(--f-display); letter-spacing: 0; }
  .nav a b { order: 2; font: 500 11px/1 var(--f-mono); color: var(--silver); align-self: flex-start; }
  .nav a:hover { background: none; color: var(--red); }
  .nav a[aria-current="page"] { box-shadow: none; color: var(--red); }
  .nav .nav-contact { background: none; color: var(--red); border-bottom: 1px solid var(--line); }
  .nav .nav-contact b { color: var(--red); opacity: 1; }
  .nav .nav-contact:hover { background: none; color: var(--text); }
  .menu-open { overflow: hidden; }
  .menu-open .site-header { transform: none; }

  .hide-m { display: none; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { border-right: 0; padding-right: 0; }
  .hero-name { padding-top: 26px; font-size: clamp(88px, 22vw, 190px); }
  .hero-sheet { padding: 22px 0 18px; border-top: 1px solid var(--line); }
  .dirs { grid-template-columns: 1fr; }
  .dir + .dir { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .dir:first-child { padding-right: 0; }
  .dir:first-child .dir-arrow { right: 0; }
  .dir-text { display: block; }

  .fhead-meta { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; align-items: end; border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .fhead-title, .fhead-lead { grid-column: 1 / -1; padding-left: 0; }
  .fhead-lead { border-top: 0; padding-top: 0; }
  .page-count { grid-column: 1 / -1; grid-row: auto; flex-direction: row-reverse; align-items: flex-end; justify-content: flex-end; border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .page-count .mono { padding-bottom: .3em; }
  .page-head-grid .h1, .page-head-grid .lead { grid-column: 1 / -1; grid-row: auto; padding-left: 0; }

  .two-col, .site-row, .about-hero, .case-text { grid-template-columns: minmax(0, 1fr); }
  .site-row:nth-child(even) .browser { order: 0; }
  .about-photo { max-width: 400px; }
  .timeline li { grid-template-columns: 1fr; }
  .t-when { grid-row: auto; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: clamp(26px, 5vw, 34px); }
  .books .fr-empty { display: none; }
  .doc-mark { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 13.5px; }
  .brand span { display: none; }
  .header-row { padding-left: max(14px, env(safe-area-inset-left, 0px)); }
  .hide-s { display: none; }
  .cells > span { padding: 12px 10px 11px 0; margin-right: 10px; }
  .hero-meta > span:first-child { display: none; }
  .hero-name { font-size: 25vw; }
  .hero-foot { grid-template-columns: minmax(0, 1fr); }
  .hero-actions .btn { flex: 1 1 auto; }
  .fr-note { bottom: -32%; font-size: 22px; }
  .dir { gap: 12px; padding: 14px 0; }
  .dir-no { font-size: 52px; min-width: 0; }
  .dir-title { font-size: 25px; }
  .dir-text { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .dir-media { width: 92px; }
  .dir-arrow { width: 26px; height: 26px; bottom: 14px; }
  .dir-arrow::after { width: 10px; height: 10px; }

  .h1 { font-size: 17vw; }
  .h2 { font-size: 15vw; }
  .fhead-meta b { font-size: 60px; }
  .featured, .stack-list { grid-template-columns: 1fr; }
  .featured { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 10px; }
  .featured .card-lg { grid-column: auto; grid-row: auto; }
  .featured .card-lg .card-media { flex: none; min-height: 0; aspect-ratio: 4 / 3; }
  .card-meta { flex-direction: column; gap: 5px; padding-top: 9px; }
  .card-title { font-size: 19px; }
  .card-sub { text-align: left; max-width: none; font-size: 9.5px; }
  .skills { grid-template-columns: 1fr; }
  .skill-group, .skill-group + .skill-group { padding: 0; border-right: 0; }
  .case-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
  .th figcaption { font-size: 11.5px; padding-top: 7px; }
  .th-play { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .case-compare { grid-template-columns: 1fr; }
  .case-stage img { max-height: 70vh; }
  .case-job { flex-wrap: wrap; }
  .job span:nth-child(3) { display: none; }
  .facts div, .facts div + div { padding-left: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .facts div:last-child { border-bottom: 0; }
  .doc-screen { aspect-ratio: 4 / 5; }
  .doc-bar .doc-file { display: none; }
  .doc-cta { left: 14px; right: 14px; transform: none; }
  .doc-fr, .doc-strip > .doc-fr:only-child { grid-template-columns: 1fr; }
  .doc-fr-meta { border-left: 0; border-top: 1px solid rgba(242, 239, 234, .1); }
  .next-case a { padding: 10px 0; }
  .next-media { width: 92px; }
  .next-go { display: none; }

  .c-row, .contact-mail { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 12px 0 14px; }
  .c-label, .c-row .contact-big, .contact-mail .contact-big, .contact-mail .copy-btn { grid-column: 1 / -1; }
  .c-label { border-right: 0; padding: 0 0 6px; }
  .c-row .contact-big { margin: 0; }
  .contact-mail .copy-btn { margin-top: 12px; }
  .contact-big { font-size: clamp(26px, 8.6vw, 40px); }
  .contact-mail .copy-btn { justify-self: start; }
  .footer-bottom { grid-template-columns: minmax(0, 1fr); }
  .foot-info { justify-items: start; text-align: left; }
  .lightbox { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; }
  .lightbox figure { grid-column: 1 / -1; padding: 0 8px; }
  .lb-prev { grid-column: 1; } .lb-next { grid-column: 2; }
}
/* На телефонах «наведение» залипает после касания — инверсию у кнопок не показываем */
@media (hover: none) {
  .icon-btn:hover, .nav a:hover { background: transparent; color: inherit; }
  .btn:hover { background: transparent; border-color: var(--line-strong); color: inherit; }
  .btn-cut:hover, .btn-solid:hover { background: var(--red); border-color: var(--red); color: var(--on-red); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .armed[data-snap] { opacity: 1; }
}
