/* =========================================================
   Марина Расторгуева — иллюстратор. Портфолио.
   Светлый редакционный минимализм: белое поле, плотная
   типографика Inter, фиолетовый акцент — и всё внимание
   на иллюстрациях.
   ========================================================= */

:root{
  --bg: #ffffff;
  --fg: #121212;
  --muted: #6b6b6b;
  --muted-light: #9a9a9a;
  --line: #e7e7e5;
  --line-strong: #121212;
  --ph-bg: #f4f3f1;
  --hero-blue: #7faaf8;          /* ровно цвет фона автопортрета — без «шва» */
  --hero-ink: #0d1a3a;
  --nav-accent: #6c5ce7;
  --accent-text: #5b4bd6;        /* фиолетовый для текста — контраст 5.9:1 */
  --accent-soft: rgba(108, 92, 231, .12);
  --header-bg: #faf9f7;
  --card-bg: #faf9f7;
  --card-bg-hover: #f2efe9;
  --focus: #6c5ce7;
  --shadow-lift: 0 18px 36px -18px rgba(24, 20, 60, .45);

  --font-display: 'Inter', -apple-system, Segoe UI, sans-serif;
  --font-text: 'Inter', -apple-system, Segoe UI, sans-serif;
  --font-accent: 'Cormorant Garamond', Georgia, serif;

  --container: 1680px;
  --container-wide: 1680px;
  --pad-x: 32px;
  --gap: 24px;
  --section-y: clamp(56px, 4vw + 32px, 112px);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: .18s;
  --dur: .32s;
}

:root[data-theme="dark"]{
  --bg: #121212;
  --fg: #f2f2f0;
  --muted: #a3a3a3;
  --muted-light: #7c7c7c;
  --line: #2a2a2a;
  --line-strong: #f2f2f0;
  --ph-bg: #1c1c1c;
  --header-bg: #161616;
  --card-bg: #181818;
  --card-bg-hover: #212121;
  --accent-text: #a79dff;
  --accent-soft: rgba(167, 157, 255, .14);
  --focus: #a79dff;
  --shadow-lift: 0 18px 40px -16px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after{ box-sizing: border-box; }

html{ -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) ease, color var(--dur) ease;
}

::selection{ background: var(--nav-accent); color: #fff; }

img{ max-width: 100%; display: block; }
a{ color: inherit; text-decoration: none; }
ul{ margin: 0; padding: 0; list-style: none; }
h1,h2,h3,h4{
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.02em;
  text-wrap: balance;
}
p{ margin: 0; }

.container{
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* ---------- Keyboard focus ---------- */

:focus{ outline: none; }
:focus-visible{
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}
.hero :focus-visible{ outline-color: var(--hero-ink); }
.lightbox :focus-visible{ outline-color: #fff; outline-offset: 4px; }

.skip-link{
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  transition: top var(--dur-fast) ease;
}
.skip-link:focus-visible{ top: 12px; }

/* ---------- Header ---------- */

.site-header{
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  transition: box-shadow var(--dur) ease, background-color var(--dur) ease;
}
.site-header.is-scrolled{
  box-shadow: 0 10px 30px -22px rgba(20, 16, 50, .45);
}

.site-header .container{
  max-width: var(--container-wide);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 40px;
  row-gap: 10px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.header-left{
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle{
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur) var(--ease-out);
}
.theme-toggle svg{ width: 18px; height: 18px; transition: transform .5s var(--ease-out); }
.theme-toggle:hover{ border-color: var(--nav-accent); color: var(--accent-text); }
.theme-toggle:hover svg{ transform: rotate(-20deg); }
.theme-toggle:active{ transform: scale(.92); }


.logo{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -.015em;
  white-space: nowrap;
  color: var(--fg);
  transition: color var(--dur-fast) ease;
}
.logo:hover{ color: var(--accent-text); }
.logo span{
  color: var(--muted);
  font-family: var(--font-text);
  font-size: 11.5px;
  font-weight: 500;
  display: block;
  margin-top: 3px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.quicknav{
  display: flex;
  flex-wrap: wrap;
  row-gap: 6px;
}
.quicknav a{
  position: relative;
  font-family: var(--font-text);
  font-size: 15px;
  color: var(--fg);
  white-space: nowrap;
  padding: 6px 16px;
  border-left: 1px solid var(--line);
  transition: color var(--dur-fast) ease;
}
.quicknav a::after{
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 2px;
  background: var(--nav-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur) var(--ease-out);
}
.quicknav a:first-child{ padding-left: 0; border-left: none; }
.quicknav a:first-child::after{ left: 0; }
.quicknav a:hover{ color: var(--accent-text); }
.quicknav a:hover::after{ transform: scaleX(1); }
.quicknav a.is-current{ color: var(--accent-text); cursor: default; }
.quicknav a.is-current::after{ transform: scaleX(1); }

.site-header--lg .container{ padding-top: 20px; padding-bottom: 20px; }
.site-header--lg .logo{ font-size: 24px; }
.site-header--lg .logo span{ font-size: 12px; margin-top: 6px; }
.site-header--lg .quicknav a{ font-size: 16px; padding: 8px 20px; }
.site-header--lg .quicknav a::after{ left: 20px; right: 20px; }
.site-header--lg .quicknav a:first-child{ padding-left: 0; }
.site-header--lg .quicknav a:first-child::after{ left: 0; }
@media (max-width: 1360px) and (min-width: 781px){
  .site-header--lg .quicknav a{ font-size: 15px; padding: 8px 15px; }
  .site-header--lg .quicknav a::after{ left: 15px; right: 15px; }
  .site-header--lg .quicknav a:first-child{ padding-left: 0; }
  .site-header--lg .quicknav a:first-child::after{ left: 0; }
}

.menu-btn{
  display: none;
  flex: none;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  border: none;
  background: none;
  padding: 0 2px;
  color: var(--fg);
  cursor: pointer;
}
.menu-btn-icon{
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 22px;
  height: 22px;
}
.menu-btn-icon span{
  display: block;
  width: 20px;
  height: 2px;
  background: var(--fg);
  transition: transform var(--dur) var(--ease-out), opacity var(--dur-fast) ease;
}
.menu-btn-label{
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}
.menu-btn[aria-expanded="true"] .menu-btn-icon span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn-icon span:nth-child(2){ opacity: 0; }
.menu-btn[aria-expanded="true"] .menu-btn-icon span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 780px){
  :root{ --pad-x: 20px; }

  .site-header .container,
  .site-header--lg .container{
    flex-wrap: nowrap;
    justify-content: space-between;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .header-left{ flex: 1 1 auto; min-width: 0; gap: 12px; }
  .site-header--lg .header-left{ flex: 1 1 auto; }
  .logo{
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .site-header--lg .logo{ font-size: 16px; }
  .logo span{ display: none; }
  .menu-btn{ display: flex; order: 3; margin-left: auto; }

  .quicknav.nav-overlay{
    position: fixed;
    top: var(--header-h, 64px);
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    flex-direction: column;
    flex-wrap: nowrap;
    background: var(--header-bg);
    padding: 8px var(--pad-x) calc(32px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity .25s ease, transform .4s var(--ease-out), visibility 0s linear .4s;
  }
  .quicknav.nav-overlay.is-open{
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .25s ease, transform .4s var(--ease-out), visibility 0s;
  }
  html.nav-locked, html.nav-locked body{ overflow: hidden; }
  .quicknav.nav-overlay a,
  .site-header--lg .quicknav.nav-overlay a{
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: none;
    border-bottom: 1px solid var(--line);
    padding: 16px 2px;
    width: 100%;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -.01em;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .3s ease, transform .4s var(--ease-out), color var(--dur-fast) ease;
  }
  .quicknav.nav-overlay a::after,
  .site-header--lg .quicknav.nav-overlay a::after{
    content: '→';
    position: static;
    height: auto;
    background: none;
    color: var(--muted-light);
    font-size: 16px;
    transform: translateX(-4px);
    transition: transform var(--dur) var(--ease-out), color var(--dur-fast) ease;
  }
  .quicknav.nav-overlay a:hover::after,
  .quicknav.nav-overlay a.is-current::after{ transform: none; color: var(--accent-text); }
  .quicknav.nav-overlay.is-open a{
    opacity: 1;
    transform: none;
    transition-delay: calc(var(--i, 0) * 35ms);
  }
  .quicknav.nav-overlay a:first-child{ padding-left: 2px; }
  .quicknav.nav-overlay a:last-child{ border-bottom: none; }
}

/* ---------- Hero (index) ---------- */

.hero{
  position: relative;
  overflow: hidden;
  background: var(--hero-blue);
  color: var(--hero-ink);
}
/* портрет прижат к правому краю контейнера 1680 */
.hero-portrait-img{
  position: absolute;
  right: max(var(--pad-x), calc((100% - var(--container-wide)) / 2 + var(--pad-x)));
  bottom: 0;
  height: 108%;
  width: auto;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}
.hero-inner{
  position: relative;
  z-index: 2;
  max-width: var(--container-wide);
  height: clamp(460px, 46vw, 680px);
  display: flex;
  align-items: center;
}
.hero-kicker{
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--hero-ink);
}
.hero-kicker::before{
  content: '';
  width: 32px;
  height: 2px;
  background: currentColor;
}
.hero-name{
  font-size: clamp(46px, 7.2vw, 112px);
  font-weight: 600;
  line-height: .94;
  letter-spacing: -.045em;
  color: var(--hero-ink);
}
.hero-role{
  margin-top: 24px;
  max-width: 36ch;
  font-size: clamp(16px, 1.25vw, 20px);
  line-height: 1.45;
  color: rgba(13, 26, 58, .86);
}
.hero-cta{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
  padding: 6px 6px 6px 28px;
  background: #fff;
  color: var(--hero-ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .005em;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 10px 24px -14px rgba(13, 26, 58, .55);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) ease;
}
.hero-cta:hover{ transform: translateY(-2px); box-shadow: 0 18px 34px -16px rgba(13, 26, 58, .6); }
.hero-cta::after{
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(108, 92, 231, .35), rgba(108, 92, 231, 0) 70%);
  opacity: 0;
  pointer-events: none;
}
.hero-cta.is-pressed{ transform: scale(.96); }
.hero-cta.is-pressed::after{ animation: cta-glow .5s ease-out; }
@keyframes cta-glow{
  0%   { opacity: .9; }
  100% { opacity: 0; }
}
.hero-cta-icon{
  flex: none;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nav-accent);
  color: #fff;
  border-radius: 50%;
}
.hero-cta-icon svg{ transition: transform var(--dur) var(--ease-out); }
.hero-cta:hover .hero-cta-icon svg{ transform: translateX(3px); }

/* тёмная тема: hero мягко «уходит» в тёмную страницу, цвет за портретом не меняется */


@media (prefers-reduced-motion: no-preference){
  .hero-kicker, .hero-name, .hero-role, .hero-cta{
    animation: hero-rise .9s var(--ease-out) both;
  }
  .hero-name{ animation-delay: .08s; }
  .hero-role{ animation-delay: .16s; }
  .hero-cta{ animation-delay: .3s; }
  .hero-portrait-img{ animation: hero-portrait 1.1s var(--ease-out) .1s both; }
}
@keyframes hero-rise{
  from{ opacity: 0; translate: 0 18px; }
  to  { opacity: 1; translate: 0 0; }
}
@keyframes hero-portrait{
  from{ opacity: 0; translate: 0 28px; }
  to  { opacity: 1; translate: 0 0; }
}

@media (max-width: 1100px) and (min-width: 701px){
  .hero-portrait-img{ height: 96%; }
}

@media (max-width: 700px){
  .hero{ display: flex; flex-direction: column; }
  .hero-inner{
    order: 1;
    width: 100%;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 40px;
    padding-bottom: 8px;
  }
  .hero-kicker{ margin-bottom: 16px; font-size: 11.5px; }
  .hero-role{ margin-top: 14px; }
  .hero-cta{ margin-top: 24px; font-size: 15px; padding-left: 22px; }
  .hero-cta-icon{ width: 44px; height: 44px; }
  .hero-portrait-img{
    order: 2;
    position: static;
    height: auto;
    width: 78%;
    max-width: 340px;
    margin: -36px auto 0;
    display: block;
  }
}

/* ---------- Section heading (shared) ---------- */

.eyebrow,
.section-eyebrow{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow::before,
.section-eyebrow::before{
  content: '';
  width: 24px;
  height: 2px;
  background: currentColor;
}

/* ---------- Featured works (home) ---------- */

.featured{ padding-top: var(--section-y); padding-bottom: var(--section-y); }
section.container.featured{ max-width: var(--container-wide); }
.featured-head{
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.featured-head h2{
  margin-top: 12px;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1;
  letter-spacing: -.035em;
  color: var(--fg);
}
.featured-head .back-link{ margin-bottom: 0; }

/* ---------- Page header (subpages) ---------- */

.page-head{
  padding: clamp(36px, 4vw, 64px) 0 clamp(28px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
}
.page-head .eyebrow{ margin-bottom: 14px; }
.page-head h1{
  max-width: 22ch;
  font-size: clamp(34px, 4.8vw, 64px);
  line-height: 1.02;
  letter-spacing: -.04em;
}
.page-head p{
  margin-top: 18px;
  max-width: 60ch;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}
.page-head--auto{ border-bottom: none; padding-bottom: 0; }
.page-head--center{ text-align: center; }
.page-head--center h1{ margin: 0 auto; }
.page-head--center + .contact{ padding-top: clamp(28px, 3vw, 48px); }


/* ---------- Gallery ----------
   Иллюстрации не обрезаются никогда:
   - галереи без подписей — «кладка» (CSS columns), каждая работа в своей пропорции;
   - галереи с подписями (книжные проекты) — ровная сетка обложек 2:3,
     изображение вписано целиком (contain) на нейтральном паспарту. */

.gallery{
  --g-gap: 12px;
  --g-cols: 3;
  padding: 48px 0 var(--section-y);
  display: grid;
  grid-template-columns: repeat(var(--g-cols), minmax(0, 1fr));
  gap: var(--g-gap);
}
.gallery.cols-1{ --g-cols: 1; }
.gallery.cols-2{ --g-cols: 2; }
.gallery.cols-3{ --g-cols: 3; }
.gallery.cols-4{ --g-cols: 4; }
.gallery.cols-5{ --g-cols: 5; }
.gallery:has(> .g-item.tall){ --g-cols: 6; }
.gallery:has(> .g-item.wide){ --g-cols: 2; }

/* кладка */
.gallery.masonry,
.gallery:not(:has(.g-caption)){
  display: block;
  columns: var(--g-cols);
  column-gap: var(--g-gap);
}
.gallery.masonry > .g-item,
.gallery:not(:has(.g-caption)) > .g-item{
  break-inside: avoid;
  margin-bottom: var(--g-gap);
}

.g-item{ display: block; position: relative; }
.g-item .frame{
  background: var(--ph-bg);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), border-color var(--dur) ease;
}
.g-item .frame img{
  width: 100%;
  height: auto;
  transition: transform .8s var(--ease-out);
}

/* сетка с подписями: одинаковое «паспарту» 2:3, работа целиком */
.gallery:has(.g-caption){ row-gap: clamp(36px, 3.5vw, 52px); align-items: start; }
/* «книжная полка»: обложки стоят на общей линии, каждая в своей пропорции */
.gallery:has(.g-caption) .frame{ aspect-ratio: 2 / 3; }
.gallery:has(.g-caption) .frame img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* hover: плитка мягко приподнимается, картинка чуть «дышит» */
@media (hover: hover){
  .g-item:hover .frame,
  .g-item .frame:hover{
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
    border-color: transparent;
    z-index: 2;
  }
  .g-item:hover .frame img{ transform: scale(1.03); }
}

/* значок «рассмотреть» на плитках, открывающих лайтбокс */
.frame.is-zoomable{ cursor: zoom-in; }
.frame.is-zoomable::after{
  content: '';
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d1a3a' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6'/%3E%3Cpath d='M15 15l5 5M10.5 8v5M8 10.5h5'/%3E%3C/svg%3E") center / 18px no-repeat;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translateY(6px) scale(.9);
  transition: opacity var(--dur) ease, transform var(--dur) var(--ease-out);
  pointer-events: none;
}
.frame.is-zoomable:hover::after,
.frame.is-zoomable:focus-visible::after{ opacity: 1; transform: none; }
.frame.is-zoomable:focus-visible{ outline-offset: 2px; border-radius: 0; }
.g-item.tall .frame.is-zoomable::after{ right: 50%; margin-right: -19px; }

.placeholder{
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px;
  color: var(--muted-light);
  font-size: 13px;
  text-align: center;
  padding: 16px;
  background-image: repeating-linear-gradient(135deg, var(--line) 0 1px, transparent 1px 14px);
}
.placeholder .plus{ font-size: 26px; color: var(--muted-light); }

.g-caption{
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.g-caption .row{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.g-caption .t{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -.015em;
  transition: color var(--dur-fast) ease;
}
.g-caption .a{ font-size: 13px; color: var(--muted); }
.g-caption .m{ font-size: 13px; color: var(--muted); white-space: nowrap; }

a.g-item .g-caption .t::after{
  content: '→';
  display: inline-block;
  margin-left: 6px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--dur-fast) ease, transform var(--dur) var(--ease-out);
}
a.g-item:hover .g-caption .t,
a.g-item:focus-visible .g-caption .t{ color: var(--accent-text); }
a.g-item:hover .g-caption .t::after,
a.g-item:focus-visible .g-caption .t::after{ opacity: 1; transform: none; }
a.g-item:focus-visible{ outline-offset: 6px; }


@media (max-width: 1100px){
  .gallery.cols-5{ --g-cols: 4; }
  .gallery:has(> .g-item.tall){ --g-cols: 4; }
}
@media (max-width: 900px){
  .gallery, .gallery.cols-3, .gallery.cols-4, .gallery.cols-5{ --g-cols: 2; --g-gap: 14px; }
  .gallery:has(> .g-item.tall){ --g-cols: 3; }
  .gallery:has(> .g-item.wide){ --g-cols: 1; }
}
@media (max-width: 560px){
  .gallery{ padding-top: 28px; }
  .gallery, .gallery.cols-3, .gallery.cols-4{ --g-cols: 1; --g-gap: 16px; }
  .gallery.cols-5{ --g-cols: 2; --g-gap: 10px; }
  .gallery:has(> .g-item.tall){ --g-cols: 2; --g-gap: 10px; }
  .gallery:has(.g-caption){ --g-cols: 2; --g-gap: 12px; row-gap: 32px; }
  .g-caption .t{ font-size: 15px; }
}

/* мало работ — меньше колонок, без пустых «дыр»; размер плитки как в полной сетке */
@media (min-width: 561px){
  .gallery:not(:has(.g-caption)):not(:has(> .g-item:nth-child(3))){ --g-cols: 2; max-width: 66.67%; }
  .gallery:not(:has(.g-caption)):not(:has(> .g-item:nth-child(2))){ --g-cols: 1; max-width: 33.33%; }
}

/* ряд узких вертикальных работ под кладкой */
.strip-row{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: var(--section-y);
}
.strip-row .g-item{ width: clamp(120px, 12vw, 200px); }
.strip-row .g-item .frame img{ width: 100%; height: auto; }
.gallery.has-strips{ padding-bottom: 12px; }
.featured .strip-row{ padding-bottom: 0; margin-top: 0; }
@media (max-width: 560px){ .strip-row .g-item{ width: calc((100% - 24px) / 3); } }

/* ---------- Reveal on scroll ----------
   Стартовая непрозрачность не нулевая: даже если наблюдатель не сработал
   (полностраничный скриншот, печать), работа остаётся видна. */

.has-reveal .reveal{
  opacity: .35;
  transform: translateY(24px);
  transition: opacity .7s ease var(--reveal-delay, 0s), transform .9s var(--ease-out) var(--reveal-delay, 0s);
}
.has-reveal .reveal.is-visible{ opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .has-reveal .reveal{ opacity: 1; transform: none; }
}

/* ---------- Back to top ---------- */

.to-top{
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 28px -14px rgba(20, 16, 50, .5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--dur) ease, transform var(--dur) var(--ease-out), visibility 0s linear var(--dur), background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.to-top.is-shown{ opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.to-top:hover{ background: var(--nav-accent); border-color: var(--nav-accent); color: #fff; }
.to-top svg{ width: 18px; height: 18px; }

/* ---------- Process steps (Этапы работы) ---------- */

.steps{ padding: 24px 0 var(--section-y); }
.step{
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  padding: 56px 0;
  border-top: 1px solid var(--line);
}
.step:last-child{ border-bottom: 1px solid var(--line); }
.step-info .n{
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 500;
  font-size: 64px;
  line-height: .9;
  color: var(--accent-text);
}
.step-info h3{ font-size: 24px; margin-top: 14px; letter-spacing: -.025em; }
.step-info p{ margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.step-info .badge{
  display: inline-block;
  margin-top: 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 6px 10px;
}
.step-imgs{ display: grid; gap: 16px; }
.step-imgs.n1{ grid-template-columns: 1fr; max-width: 360px; }
.step-imgs.n3{ grid-template-columns: repeat(3, 1fr); }
.step-imgs.n4{ grid-template-columns: repeat(4, 1fr); }
.step-imgs .frame{
  aspect-ratio: 3/4;
  background: var(--ph-bg);
  border: 1px solid var(--line);
}

@media (max-width: 800px){
  .step{ grid-template-columns: 1fr; gap: 20px; padding: 40px 0; }
  .step-info .n{ font-size: 52px; }
  .step-imgs.n3, .step-imgs.n4{ grid-template-columns: repeat(2,1fr); }
}

/* ---------- Project detail page ---------- */

.proj-block{
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: clamp(32px, 4vw, 64px);
  padding: 56px 0;
  border-top: 1px solid var(--line);
  align-items: start;
}
.proj-block:first-of-type{ border-top: none; }
.proj-block .frame{
  background: var(--ph-bg);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lift);
}
.proj-block .frame:empty{ aspect-ratio: 3 / 4; }
.proj-block .frame img{ width: 100%; height: auto; }
.proj-block.reverse{ grid-template-columns: 1fr 340px; }
.proj-block.reverse .frame{ order: 2; }
.proj-text{ padding-top: 4px; }
.proj-text h3{
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 18px;
}
.proj-text h3::before{ content: ''; width: 24px; height: 2px; background: currentColor; }
.proj-text p{
  max-width: 62ch;
  color: var(--fg);
  opacity: .82;
  font-size: clamp(16px, 1.15vw, 18px);
  line-height: 1.75;
}
.proj-text p + p{ margin-top: 14px; }
.proj-media{ display: grid; gap: 16px; }
.proj-media.split{ grid-template-columns: 1fr 1fr; }
.proj-media .frame:empty{ aspect-ratio: 4/3; }

@media (max-width: 800px){
  .proj-block, .proj-block.reverse{ grid-template-columns: 1fr; padding: 32px 0; }
  .proj-block .frame{ max-width: 420px; }
  .proj-block.reverse .frame{ order: 0; }
}

/* ---------- Contact (Почта) ---------- */

.contact{
  padding: clamp(48px, 6vw, 96px) 0 clamp(80px, 9vw, 140px);
  text-align: center;
}
.mail-row{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.contact .big-mail{
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(20px, 3.6vw, 44px);
  letter-spacing: -.03em;
  padding-bottom: 6px;
  display: inline-block;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--nav-accent), var(--nav-accent)) left bottom / 100% 2px no-repeat;
  transition: color var(--dur-fast) ease, background-size var(--dur) var(--ease-out);
}
.contact .big-mail:hover{ color: var(--accent-text); background-size: 100% 4px; }
.copy-mail{
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: 600 14px/1 var(--font-text);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.copy-mail:hover{ border-color: var(--nav-accent); color: var(--accent-text); }
.copy-mail.is-done{ background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.copy-toast{
  min-height: 20px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--accent-text);
}
.contact .socials{
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  justify-content: center;
}
.contact .socials a{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--dur-fast) ease, transform var(--dur) var(--ease-out);
}
.contact .socials a svg{ width: 28px; height: 28px; color: var(--muted); transition: color var(--dur-fast) ease; }
.contact .socials a:hover{ color: var(--fg); transform: translateY(-3px); }
.contact .socials a:hover svg{ color: var(--accent-text); }

/* ---------- Footer ---------- */

.site-footer{
  border-top: 1px solid var(--line);
  padding: 28px 0 32px;
}
.site-footer .container{
  max-width: var(--container-wide);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.site-footer .container > span:first-child{ color: var(--fg); font-weight: 500; }
@media (max-width: 700px){
  .site-footer .container{ flex-direction: column; align-items: flex-start; }
}

/* ---------- Lightbox ---------- */

body.lb-locked{ overflow: hidden; }

.lightbox{
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(14, 14, 18, .95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.lightbox.is-open{ opacity: 1; visibility: visible; transition: opacity .3s ease, visibility 0s; }

.lb-stage{
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 64px;
  overflow: auto;
  transform: scale(.97);
  transition: transform .45s var(--ease-out);
}
.lightbox.is-open .lb-stage{ transform: none; }
.lb-img{
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform .2s ease, opacity .25s ease;
  cursor: default;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.lb-img.is-loading{ opacity: 0; }
.lb-img.is-zoomed{ cursor: move; }
.lb-img.is-dragging{ transition: none; cursor: grabbing; }

.lb-btn{
  position: absolute;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.lb-btn:hover{ background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.5); }

.lb-close{
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  z-index: 4;
}

.lb-project-link{
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 72px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  text-decoration: none;
  transition: background-color var(--dur-fast) ease;
}
.lb-project-link:hover{ background: rgba(0,0,0,.75); }
.lb-project-link[hidden]{ display: none; }
.lb-project-link-text{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: linear-gradient(100deg, #fff 20%, #ffe9a8 40%, #fff 50%, #ffe9a8 60%, #fff 80%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: lb-shimmer 2.8s linear infinite;
}
.lb-project-link-arrow{ display: inline-flex; transition: transform var(--dur) var(--ease-out); }
.lb-project-link:hover .lb-project-link-arrow{ transform: translateX(4px); }
@keyframes lb-shimmer{
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.lb-prev, .lb-next{
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  z-index: 2;
}
.lb-prev{ left: 20px; }
.lb-next{ right: 20px; }

.lb-zoom{
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}
.lb-zoom .lb-btn{
  position: static;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
}

.lb-counter{
  position: absolute;
  top: 28px;
  left: 28px;
  color: rgba(255,255,255,.8);
  font-family: var(--font-text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  z-index: 4;
}

@media (max-width: 700px){
  .lb-stage{ padding: 72px 52px 64px; }
  .lb-prev{ left: 6px; }
  .lb-next{ right: 6px; }
  .lb-prev, .lb-next{ width: 40px; height: 40px; font-size: 22px; }
  .lb-project-link{ padding: 20px 64px; }
  .lb-project-link-text{ font-size: 14px; }
  .lb-counter{ top: 26px; left: 16px; }
}

/* ---------- Width-specific refinements ---------- */

/* планшеты: компактнее навигация, чтобы она не расползалась на три строки */
@media (max-width: 1100px) and (min-width: 781px){
  .quicknav a{ font-size: 13.5px; padding: 5px 8px; }
  .quicknav a::after{ left: 8px; right: 8px; }
  .quicknav a:first-child{ padding-left: 0; }
  .quicknav a:first-child::after{ left: 0; }
  .site-header--lg .quicknav a{ font-size: 14px; padding: 6px 11px; }
  .site-header--lg .quicknav a::after{ left: 11px; right: 11px; }
}

/* ≥1280: шапка в одну строку — логотип слева, навигация справа, тема в конце */
@media (min-width: 1280px){
  .site-header .container{ flex-wrap: nowrap; column-gap: 24px; min-height: 76px; padding-top: 12px; padding-bottom: 12px; }
  .site-header .header-left{ display: contents; }
  .site-header .logo{ order: 1; }
  .site-header .quicknav{ order: 2; margin-left: auto; flex-wrap: nowrap; }
  .site-header .theme-toggle{ order: 3; }
  .site-header .quicknav a,
  .site-header--lg .quicknav a{ font-size: 13.5px; padding: 6px 8px; }
  .site-header .quicknav a::after,
  .site-header--lg .quicknav a::after{ left: 8px; right: 8px; }
  .site-header .logo{ font-size: 17px; }
  .site-header .quicknav a:first-child::after{ left: 0; }
  .site-header .quicknav a:first-child{ padding-left: 0; }
  .site-header .quicknav a:last-child{ padding-right: 0; }
  .site-header .quicknav a:last-child::after{ right: 0; }
  /* главная: имени в шапке нет — навигация от левого края контейнера */
  .site-header--lg .quicknav{ margin-left: 0; margin-right: auto; }
}
@media (min-width: 1440px){
  .site-header .logo{ font-size: 19px; }
  .site-header .quicknav a,
  .site-header--lg .quicknav a{ font-size: 14.5px; padding: 6px 11px; }
  .site-header .quicknav a::after,
  .site-header--lg .quicknav a::after{ left: 11px; right: 11px; }
  .site-header .quicknav a:first-child::after{ left: 0; }
  .site-header .quicknav a:last-child::after{ right: 0; }
}
@media (min-width: 1600px){
  .site-header .quicknav a,
  .site-header--lg .quicknav a{ font-size: 15.5px; padding: 6px 16px; }
  .site-header .quicknav a::after,
  .site-header--lg .quicknav a::after{ left: 16px; right: 16px; }
  .site-header .quicknav a:first-child::after{ left: 0; }
  .site-header .quicknav a:last-child::after{ right: 0; }
}

/* главная: общий список работ ровной сеткой 4 в ряд, обложки 2:3 */
.gallery.featured-grid{
  display: grid;
  columns: auto;
  grid-template-columns: repeat(var(--g-cols), minmax(0, 1fr));
  gap: 8px;
  padding-top: 0;
}
.gallery.featured-grid > .g-item{ margin-bottom: 0; break-inside: auto; }
.gallery.featured-grid .frame{ aspect-ratio: 2 / 3; }
.gallery.featured-grid .frame img{ width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px){ .gallery.featured-grid{ --g-cols: 2; } }

/* главная (десктоп): навигация лежит прямо на голубой панели hero */
@media (min-width: 781px){
  .site-header.site-header--lg{
    position: absolute;
    left: 0;
    right: 0;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
  }
  .site-header--lg .quicknav a{ color: #0d1a3a; border-left-color: rgba(13, 26, 58, .22); }
  .site-header--lg .quicknav a:hover{ color: #fff; border-bottom-color: #fff; }
  .site-header--lg .theme-toggle{ background: rgba(255, 255, 255, .7); border-color: rgba(13, 26, 58, .2); color: #0d1a3a; }
  .site-header--lg + main .hero-inner{ padding-top: 72px; }
}

/* главная: панель навигации на голубом — матовая плашка для читаемости */
@media (min-width: 781px){
  .site-header--lg .container{ padding-top: 20px; padding-bottom: 20px; }
  .site-header--lg .header-left{
    padding: 6px 14px 6px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 24px -10px rgba(13, 26, 58, .35);
  }
  .site-header--lg .quicknav a{ font-weight: 500; }
  .site-header--lg .quicknav a:hover{ color: #6c5ce7; border-bottom-color: #6c5ce7; }
}

/* главная: панель навигации по центру */
@media (min-width: 781px){
  .site-header.site-header--lg .container{ justify-content: center; }
  .site-header.site-header--lg .header-left{ margin-left: 0; margin-right: 0; flex: 0 1 auto; }
}
@media (min-width: 781px){
  .site-header.site-header--lg .header-left{ display: flex; order: 0; }
  .site-header.site-header--lg .quicknav{ margin-left: 0; margin-right: 0; order: 0; }
  .site-header.site-header--lg .theme-toggle{ order: 0; }
}

/* внутренние страницы (десктоп): та же матовая плашка по центру; логотип слева */
@media (min-width: 781px){
  .site-header:not(.site-header--lg) .container{ justify-content: center; position: relative; }
  .site-header .container .header-left{
    display: flex;
    order: 0;
    flex: 0 1 auto;
    padding: 6px 14px 6px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 24px -10px rgba(13, 26, 58, .25);
  }
  .site-header .container .quicknav{ margin-left: 0; margin-right: 0; order: 0; }
  .site-header .container .theme-toggle{ order: 0; }
  .site-header:not(.site-header--lg) .logo{
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    border-right: none;
    margin: 0;
    padding: 0;
  }
}
@media (min-width: 781px) and (max-width: 1279px){
  .site-header:not(.site-header--lg) .logo{ display: none; }
}
@media (min-width: 781px){
  .site-header:not(.site-header--lg) .container .header-left{
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #fff;
    border: 1px solid var(--line);
  }
}

/* одинаковая высота и положение панели навигации на главной и в разделах */
@media (min-width: 781px){
  .site-header.site-header--lg .container,
  .site-header:not(.site-header--lg) .container{
    min-height: 76px;
    padding-top: 12px;
    padding-bottom: 12px;
    align-items: center;
  }
}
@media (min-width: 781px){ .site-header--lg .container .header-left{ border: 1px solid transparent; } }

/* контакты: значки по центру между заголовком и почтой */
.contact .socials{ margin-bottom: 59px; }

/* этапы работы: скетчи в своих пропорциях, без обрезки */
.step-imgs.masonry{ display: block; columns: 4; column-gap: 12px; max-width: none; }
.step-imgs.masonry .frame{ aspect-ratio: auto; break-inside: avoid; margin-bottom: 12px; background: #fff; }
.step-imgs.masonry .frame img{ width: 100%; height: auto; display: block; }
@media (max-width: 1100px){ .step-imgs.masonry{ columns: 3; } }
@media (max-width: 800px){ .step-imgs.masonry{ columns: 2; } }
.step-imgs.n1.wide{ max-width: none; }
.step-imgs.n1 .frame, .step-imgs.n1.wide .frame{ aspect-ratio: auto; }
.step-imgs.n1 .frame img{ width: 100%; height: auto; display: block; }

/* главная (десктоп): hero ниже на 20% — портрет уменьшается вместе с ним */
@media (min-width: 701px){
  .hero-inner{ height: clamp(368px, 36.8vw, 544px); }
  .site-header--lg + main .hero-inner{ padding-top: 56px; }
}

/* главная: компактные отступы вокруг «Избранные работы» */
.featured{ padding-top: 44px; }
.featured-head{ padding-bottom: 18px; margin-bottom: 28px; }
.featured-head h2{ margin-top: 0; }

/* планшеты и узкие окна (781–1279): на внутренних страницах панель — сплошная полоса
   на всю ширину, прилипает к верху без зазоров сверху и снизу; пункты в одну строку */
.site-header{ position: -webkit-sticky; position: sticky; top: 0; }
@media (min-width: 781px) and (max-width: 1279px){
  .site-header:not(.site-header--lg) .container{ padding: 0; max-width: none; min-height: 0; }
  .site-header:not(.site-header--lg) .container .header-left{
    width: 100%;
    justify-content: center;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: var(--header-bg);
    padding: 10px 16px;
  }
  .site-header:not(.site-header--lg) .quicknav{ flex-wrap: nowrap; }
  .site-header:not(.site-header--lg) .quicknav a{ font-size: 13px; padding: 6px 8px; white-space: nowrap; }
}

/* шапка закреплена через fixed — надёжно в браузерах внутри Telegram/ВК и на iPad */
.site-header, .site-header.site-header--lg{ position: fixed; top: 0; left: 0; right: 0; z-index: 100; }
body:has(.site-header:not(.site-header--lg)){ padding-top: var(--header-h, 76px); }
@media (max-width: 780px){ body:has(.site-header--lg){ padding-top: var(--header-h, 60px); } }
@media (min-width: 781px){
  .site-header.site-header--lg.is-scrolled{ background: var(--header-bg); box-shadow: 0 1px 0 var(--line); }
  .site-header.site-header--lg.is-scrolled .container{ padding-top: 8px; padding-bottom: 8px; min-height: 0; }
}

/* афиши: плитки того же размера, что в сетке из 4 колонок */
@media (min-width: 901px){
  .gallery.afishi-grid{ --g-cols: 2; max-width: 50%; }
}
@media (min-width: 901px){
  .gallery.afishi-grid.cols-4.tight:not(:has(.g-caption)){ --g-cols: 2; max-width: 50%; }
}

/* бриф как страница текста */
.brief-page{
  background: #fff;
  color: #1d1a24;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: clamp(24px, 3.2vw, 44px);
  max-width: 640px;
  box-shadow: 0 1px 0 var(--line), 0 24px 40px -28px rgba(24, 20, 60, .35);
}
.brief-label{ font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 10px; }
.brief-title{ font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 30px); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.brief-list{ margin: 0; display: grid; gap: 18px; }
.brief-list dt{ font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6b6b6b; margin-bottom: 4px; }
.brief-list dd{ margin: 0; font-size: 17px; line-height: 1.55; }
.brief-list ul{ margin: 4px 0 0; padding-left: 1.2em; list-style: disc; }
.brief-list li{ margin: 2px 0; }
:root[data-theme="dark"] .brief-page{ background: #1c1c1c; color: var(--fg); }
:root[data-theme="dark"] .brief-list dt{ color: var(--muted); }

/* вводный текст страницы «Оформление ВК» */
.page-intro-wrap{ padding-top: 4px; }
.page-intro{ max-width: 720px; display: grid; gap: 12px; }
.page-intro p{ margin: 0; font-size: 18px; line-height: 1.6; color: var(--fg); }
.page-intro a{ color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.page-intro a:hover{ text-decoration-thickness: 2px; }
.page-intro-wrap{ padding-top: 24px; }

/* ====== шапка: слева имя, по центру плашка с меню, справа отдельный круглый переключатель темы ====== */
@media (min-width: 781px){
  header.site-header.site-header.site-header .container{
    display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap;
    max-width: 1680px; min-height: 76px; padding: 12px 32px; gap: 16px; position: static;
  }
  header.site-header.site-header.site-header .container .header-left{
    display: contents; padding: 0; background: none; border: 0; box-shadow: none; border-radius: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none; width: auto;
  }
  header.site-header.site-header.site-header .logo{
    order: 1; position: static; transform: none; border: 0; margin: 0; padding: 0; flex: none;
  }
  header.site-header.site-header.site-header .quicknav{
    order: 2; margin: 0 auto; flex: 0 1 auto; flex-wrap: nowrap;
    background: #fff; border: 1px solid var(--line); border-radius: 999px;
    padding: 6px 14px; box-shadow: 0 6px 24px -12px rgba(13, 26, 58, .3);
  }
  header.site-header.site-header.site-header .quicknav a{
    color: #1d1a24; font-size: 13.5px; padding: 6px 8px; white-space: nowrap;
  }
  header.site-header.site-header.site-header .quicknav a:hover{ color: #6c5ce7; border-bottom-color: #6c5ce7; }
  header.site-header.site-header.site-header .quicknav a.is-current{ color: #6c5ce7; border-bottom-color: #6c5ce7; }
  header.site-header.site-header.site-header .theme-toggle{ order: 3; flex: none; margin: 0; }
  /* главная: имени нет — пустая «подушка» слева, чтобы плашка стояла по центру */
  header.site-header--lg.site-header.site-header .container::before{ content: ""; order: 1; flex: 0 0 44px; }
  header.site-header--lg.site-header.site-header .quicknav{ background: rgba(255, 255, 255, .88); }
}
@media (min-width: 781px) and (max-width: 1279px){
  header.site-header.site-header.site-header:not(.site-header--lg) .logo{ display: none; }
  header.site-header.site-header.site-header:not(.site-header--lg) .container::before{ content: ""; order: 1; flex: 0 0 44px; }
}
@media (min-width: 1440px){
  header.site-header.site-header.site-header .quicknav a{ font-size: 14px; padding: 6px 10px; }
}

/* ====== главная: прежний вид шапки — одна матовая плашка по центру, переключатель темы внутри слева ====== */
@media (min-width: 781px){
  header.site-header.site-header.site-header.site-header--lg .container{
    justify-content: center; max-width: 1680px; min-height: 76px; padding: 12px 32px; gap: 12px;
  }
  header.site-header.site-header.site-header.site-header--lg .container::before{ content: none; display: none; }
  header.site-header.site-header.site-header.site-header--lg .container .header-left{
    display: flex; align-items: center; gap: 16px; order: 0; flex: 0 1 auto;
    padding: 6px 14px 6px 8px; border-radius: 999px; border: 1px solid transparent;
    background: rgba(255, 255, 255, .78);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 6px 24px -10px rgba(13, 26, 58, .35);
  }
  header.site-header.site-header.site-header.site-header--lg .container .quicknav{
    order: 0; margin: 0; background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0;
  }
  header.site-header.site-header.site-header.site-header--lg .container .quicknav a{
    color: #0d1a3a; font-weight: 500; border-left-color: rgba(13, 26, 58, .22);
  }
  header.site-header.site-header.site-header.site-header--lg .container .quicknav a:hover,
  header.site-header.site-header.site-header.site-header--lg .container .quicknav a.is-current{ color: #6c5ce7; border-bottom-color: #6c5ce7; }
  header.site-header.site-header.site-header.site-header--lg .container .theme-toggle{
    order: 0; background: rgba(255, 255, 255, .7); border-color: rgba(13, 26, 58, .2); color: #0d1a3a;
  }
}

/* тёмная тема, главная: без обводок у шапки */
@media (min-width: 781px){
  :root[data-theme="dark"] header.site-header.site-header.site-header.site-header--lg{ border: 0; box-shadow: none; }
  :root[data-theme="dark"] header.site-header.site-header.site-header.site-header--lg.is-scrolled{ border: 0; box-shadow: none; }
  :root[data-theme="dark"] header.site-header.site-header.site-header.site-header--lg .container .header-left{ border-color: transparent; box-shadow: none; }
  :root[data-theme="dark"] header.site-header.site-header.site-header.site-header--lg .container .theme-toggle{ border-color: transparent; box-shadow: none; }
}
@media (min-width: 781px){
  :root[data-theme="dark"] .site-header--lg .theme-toggle{ border-color: transparent !important; box-shadow: none !important; }
  :root[data-theme="dark"] .site-header--lg .header-left{ border-color: transparent !important; box-shadow: none !important; }
  :root[data-theme="dark"] .site-header--lg{ border: 0 !important; box-shadow: none !important; }
}

/* ====== внутренние страницы: та же матовая плашка, что на главной; переключатель темы справа внутри неё ====== */
@media (max-width: 780px){
  header.site-header:not(.site-header--lg) .container .header-left{ display: contents; }
  header.site-header:not(.site-header--lg) .logo{ order: 1; }
  header.site-header:not(.site-header--lg) .theme-toggle{ order: 0; }
}
@media (min-width: 781px){
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container{
    display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap;
    max-width: 1680px; min-height: 76px; padding: 12px 32px; gap: 16px; position: static;
  }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .logo{
    order: 1; position: static; transform: none; border: 0; margin: 0; padding: 0; flex: none;
  }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .header-left{
    display: flex; align-items: center; gap: 16px; order: 2; flex: 0 1 auto; margin: 0 auto; width: auto;
    padding: 6px 8px 6px 14px; border-radius: 999px; border: 1px solid transparent;
    background: rgba(255, 255, 255, .88);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 6px 24px -10px rgba(13, 26, 58, .35);
  }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .quicknav{
    order: 1; margin: 0; background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; flex: 0 1 auto; flex-wrap: wrap;
  }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .quicknav a{
    color: #0d1a3a; font-weight: 500; border-left-color: rgba(13, 26, 58, .22); white-space: nowrap;
  }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .quicknav a:hover,
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .quicknav a.is-current{ color: #6c5ce7; border-bottom-color: #6c5ce7; }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .theme-toggle{
    order: 2; flex: none; margin: 0; background: rgba(255, 255, 255, .7); border-color: rgba(13, 26, 58, .2); color: #0d1a3a;
  }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container::before{ content: none; display: none; }
  :root[data-theme="dark"] header.site-header:not(.site-header--lg) .container .header-left{ box-shadow: none; }
}
@media (min-width: 781px) and (max-width: 1279px){
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container .logo{ display: none; }
  header.site-header.site-header.site-header.site-header:not(.site-header--lg) .container{ justify-content: center; }
}

/* ====== переключатель темы — отдельный кружок справа (и на главной, и внутри) ====== */
@media (max-width: 780px){
  header.site-header .container .header-left{ display: contents; }
  header.site-header .container .theme-toggle{ order: 0; }
  header.site-header--lg .container .menu-btn{ order: 3; margin-left: auto; }
}
@media (min-width: 781px){
  header.site-header.site-header.site-header.site-header .container{ justify-content: space-between; }
  header.site-header.site-header.site-header.site-header .container .header-left{ padding: 6px 14px; }
  header.site-header.site-header.site-header.site-header .container .theme-toggle{ order: 3; flex: none; margin: 0; }
  header.site-header.site-header.site-header.site-header--lg .container .header-left{ order: 2; margin: 0 auto; }
  header.site-header.site-header.site-header.site-header--lg .container::before{ content: ""; display: block; order: 1; flex: 0 0 44px; }
  header.site-header.site-header.site-header.site-header--lg .container .theme-toggle{ order: 3; }
}

/* на телефонах и сенсорных экранах кнопки «+ / −» не нужны — картинку приближают пальцами */
@media (max-width: 780px), (hover: none) and (pointer: coarse){
  .lb-zoom{ display: none; }
}

/* реквизиты и авторские права в подвале */
.site-footer .container{ display: block; padding-top: 22px; padding-bottom: 22px; }
.footer-legal{
  margin: 0; padding: 0; border: 0;
  font-size: 13px; line-height: 1.6; color: var(--muted);
}

/* телефон: реквизиты в первой строке, запрет — во второй */
@media (max-width: 780px){
  .footer-legal .legal-id, .footer-legal .legal-note{ display: block; }
  .footer-legal .legal-sep{ display: none; }
  .footer-legal{ font-size: 12px; }
}

/* на телефоне своя кнопка «Наверх» не нужна: браузер показывает собственную */
@media (max-width: 780px), (hover: none) and (pointer: coarse){
  .to-top{ display: none; }
}

/* кнопка «Назад» */
.back-wrap{ padding-top: 18px; padding-bottom: 0; }
.back-btn{
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--fg);
  font-size: 14px; font-weight: 500; text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}
.back-btn:hover{ border-color: var(--nav-accent); color: var(--nav-accent); }
.back-btn:focus-visible{ outline: 2px solid var(--nav-accent); outline-offset: 2px; }

/* ---------- Планшеты 781–1100: компактное меню ----------
   Девять пунктов при обычном кегле не влезали в «пилюлю»: на 1024px меню
   переносилось на вторую строку, а на главной переключатель темы уходил за край.
   Правила ниже перебивают старые переопределения шапки (у них выше специфичность). */
@media (min-width: 781px) and (max-width: 1100px){
  .site-header .quicknav{ flex-wrap: nowrap !important; }
  .site-header .quicknav a{
    font-size: 12.5px !important;
    padding: 5px 6px !important;
    border-left-color: transparent;
    white-space: nowrap;
  }
  .site-header .quicknav a::after{ left: 6px !important; right: 6px !important; }
  .site-header .quicknav a:first-child{ padding-left: 0 !important; }
  .site-header .quicknav a:first-child::after{ left: 0 !important; }
  .site-header .quicknav a:last-child{ padding-right: 0 !important; }
  .site-header .quicknav a:last-child::after{ right: 0 !important; }
}
