:root {
  --bg-top: #f5f9fd;
  --bg-mid: #e9f2fa;
  --bg-bot: #dde9f5;
  --ink: #0e2338;
  --ink-2: #163450;
  --muted: #536f89;
  --orange: #ee5318;
  --orange-light: rgba(238, 83, 24, 0.12);
  --line: rgba(14, 35, 56, 0.12);
  --line-hover: rgba(14, 35, 56, 0.28);
  --pad: clamp(1.2rem, 4vw, 4rem);
  --wrap: 1600px;
  --topbar-h: 4.4rem;
  --radius: 8px;
  --ff-sans: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 40%, var(--bg-bot) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--ff-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

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

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--orange);
  color: #fff;
}

.mono {
  font-family: var(--ff-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */
.progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2.5px;
  z-index: 70;
  background: transparent;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--orange), #ff7a45);
  transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--pad);
  background: rgba(245, 249, 253, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(0.7rem, 1.8vw, 1.7rem);
}

.topnav-link {
  position: relative;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.25rem 0;
  white-space: nowrap;
  transition: color 0.25s ease;
}

.topnav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.topnav-link:hover,
.topnav-link:focus-visible {
  color: var(--ink);
}

.topnav-link:hover::after,
.topnav-link:focus-visible::after {
  transform: scaleX(1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  transition: transform 0.3s var(--ease-spring);
}

.brand:hover .brand-logo {
  transform: scale(1.06);
}

.brand-name {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

#about,
#services,
#projects,
#contacts {
  scroll-margin-top: 96px;
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 3.9rem;
  }

  .topbar {
    padding: 0.85rem var(--pad);
  }

  .topnav {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .topnav::-webkit-scrollbar {
    display: none;
  }

  .topnav-link {
    font-size: 0.8rem;
  }
}

@media (max-width: 520px) {
  .brand-name {
    display: none;
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(14, 35, 56, 0.04);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulse-dot 2.2s infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --------------------------------------------------------------------------
   Hero Section: BIM-сопровождение, опыт, услуги и контакты
   -------------------------------------------------------------------------- */
.hero-section {
  padding: 0 var(--pad) clamp(1.2rem, 2.5vh, 1.8rem);
}

.hero-stage {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-h));
  min-height: calc(100dvh - var(--topbar-h));
  margin-inline: calc(var(--pad) * -1);
  padding: clamp(1.6rem, 4vh, 3rem) var(--pad);
}

.hero-header {
  position: relative;
  z-index: 1;
  max-width: 46rem;
  text-align: center;
}

/* Абстрактный ai-saas фон hero, плавно уходящий в фон сайта */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 48%, rgba(0, 0, 0, 0) 100%);
  mask-image: linear-gradient(180deg, #000 48%, rgba(0, 0, 0, 0) 100%);
}

.hero-bg::before {
  content: "";
  position: absolute;
  inset: -18% -10% -6%;
  background:
    radial-gradient(42% 46% at 16% 26%, rgba(13, 131, 253, 0.32), rgba(13, 131, 253, 0) 70%),
    radial-gradient(46% 50% at 84% 14%, rgba(0, 69, 252, 0.22), rgba(0, 69, 252, 0) 72%),
    radial-gradient(40% 48% at 74% 74%, rgba(238, 83, 24, 0.16), rgba(238, 83, 24, 0) 72%),
    radial-gradient(56% 62% at 24% 88%, rgba(45, 168, 255, 0.24), rgba(45, 168, 255, 0) 74%);
  animation: hero-aurora 28s ease-in-out infinite alternate;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(14, 35, 56, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 35, 56, 0.05) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(72% 62% at 50% 34%, #000 0%, rgba(0, 0, 0, 0) 76%);
  mask-image: radial-gradient(72% 62% at 50% 34%, #000 0%, rgba(0, 0, 0, 0) 76%);
}

@keyframes hero-aurora {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1.02); }
  to { transform: translate3d(2%, 1.5%, 0) scale(1.06); }
}

.hero-status {
  margin-bottom: 0.9rem;
  animation: intro-fade 0.8s var(--ease) both;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 1.4rem + 4.2vw, 4.8rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--ink);
  background-image: linear-gradient(115deg, #0e2338 0%, #163752 55%, #1e527a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-wrap: balance;
  animation: intro-fade 0.9s var(--ease) 0.1s both;
}

/* Подзаголовок hero: тот же размер и жирность, что и у «BIM - наша задача» */
.hero-subtitle {
  margin-top: clamp(0.4rem, 1.2vh, 0.8rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink-2);
  background-image: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: var(--ink-2);
  animation-delay: 0.18s;
}

.hero-subtitle .hero-accent {
  color: var(--orange);
  -webkit-text-fill-color: var(--orange);
}

.hero-lead {
  margin: 0.9rem auto 0;
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.26rem);
  line-height: 1.5;
  color: #2b455e;
  font-weight: 500;
  max-width: 46ch;
  text-wrap: balance;
  animation: intro-fade 0.9s var(--ease) 0.18s both;
}

/* Кнопки контактов */
.contacts-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: clamp(2.25rem, 5.5vh, 3.5rem);
  animation: intro-fade 0.9s var(--ease) 0.26s both;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(14, 35, 56, 0.04);
  transition: all 0.28s var(--ease);
  position: relative;
  overflow: hidden;
}

.contact-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.contact-btn:hover {
  transform: translateY(-2px);
  border-color: var(--ink);
  box-shadow: 0 8px 22px -4px rgba(14, 35, 56, 0.15);
}

.contact-btn:hover::before {
  opacity: 1;
}

.contact-btn:active {
  transform: translateY(0);
}

.btn-icon {
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring);
}

.contact-btn:hover .btn-icon {
  transform: scale(1.15);
}

.btn-tg:hover {
  color: #0088cc;
  border-color: #0088cc;
  background: #f0f9ff;
}

.btn-wa:hover {
  color: #128c7e;
  border-color: #25d366;
  background: #f0fdf4;
}

.btn-mail:hover {
  color: var(--orange);
  border-color: var(--orange);
  background: #fff8f5;
}

.btn-phone:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: #fff;
}

/* --------------------------------------------------------------------------
   Спецификация: Опыт и услуги (обведённые и залитые блоки)
   -------------------------------------------------------------------------- */
.spec {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  gap: clamp(0.8rem, 1.6vw, 1.2rem);
  animation: intro-fade 0.9s var(--ease) 0.32s both;
}

.spec-block {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdff;
  padding: clamp(1.2rem, 2.4vw, 1.9rem);
  text-align: center;
  box-shadow: 0 2px 12px rgba(14, 35, 56, 0.03);
}

.spec-label {
  margin: 0 0 clamp(0.95rem, 2vw, 1.4rem);
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.spec-label::after {
  content: "";
  display: block;
  width: clamp(48px, 8vw, 72px);
  height: 4px;
  margin: 0.65rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange), rgba(238, 83, 24, 0));
}

/* Опыт */
.spec-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.6rem, 1.3vw, 0.9rem);
}

@media (min-width: 600px) {
  .spec-facts {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .spec-facts {
    grid-template-columns: repeat(3, 1fr);
  }
}

.fact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.6rem;
  padding: clamp(0.9rem, 1.8vw, 1.25rem) clamp(0.9rem, 1.8vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.fact:hover {
  background: #fff3ec;
  border-color: rgba(238, 83, 24, 0.35);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -22px rgba(14, 35, 56, 0.32);
}

.fact-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--paper);
  font-size: 1.02rem;
  line-height: 1;
  transition: background 0.3s ease, transform 0.3s var(--ease-spring);
}

.fact:hover .fact-mark {
  background: var(--orange-light);
  transform: translateY(-2px) scale(1.06);
}

.fact-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Что делаем */
.spec-services {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.6rem, 1.3vw, 0.9rem);
}

@media (min-width: 600px) {
  .spec-services {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .spec-services {
    grid-template-columns: repeat(3, 1fr);
  }
}

.service {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  padding: clamp(0.9rem, 1.8vw, 1.25rem) clamp(0.9rem, 1.8vw, 1.2rem);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.service:hover {
  background: #fff3ec;
  border-color: rgba(238, 83, 24, 0.35);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -22px rgba(14, 35, 56, 0.32);
}

.service-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--paper);
  font-size: 1.02rem;
  line-height: 1;
  transition: background 0.3s ease, transform 0.3s var(--ease-spring);
}

.service:hover .service-icon {
  background: var(--orange-light);
  transform: translateY(-2px) scale(1.06);
}

.service-body {
  min-width: 0;
}

.service-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  transition: color 0.3s ease;
}

.service:hover .service-title {
  color: var(--orange);
}

.service-desc {
  margin: 0.3rem auto 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 34ch;
}

/* --------------------------------------------------------------------------
   Обо мне (фото + текст внутри общей панели)
   -------------------------------------------------------------------------- */
.about-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.1rem, 3vw, 2.6rem);
  align-items: start;
  text-align: left;
}

.about-photo {
  margin: 0;
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

.about-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 5%;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px -26px rgba(14, 35, 56, 0.45);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

@media (min-width: 860px) {
  .about-layout {
    grid-template-columns: minmax(220px, 300px) 1fr;
    gap: clamp(1.2rem, 3vw, 2.6rem);
  }

  .about-photo {
    max-width: 340px;
    justify-self: start;
  }

  .about-photo img {
    aspect-ratio: 3 / 4;
    object-position: 50% 18%;
  }
}

.about-photo:hover img {
  transform: translateY(-4px) scale(1.012);
  box-shadow: 0 26px 55px -28px rgba(14, 35, 56, 0.5);
}

.about-body {
  min-width: 0;
}

.about-lead {
  margin: 0 0 0.8rem;
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.32;
  letter-spacing: -0.015em;
}

.about-text {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 62ch;
}

.about-meta {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.about-meta li {
  font-size: 0.76rem;
  font-weight: 600;
  color: #3d5a75;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: #ffffff;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.about-meta li:hover {
  background: #fff3ec;
  border-color: rgba(238, 83, 24, 0.35);
  color: var(--orange);
}

@keyframes intro-fade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Masonry Gallery (Основной визуальный массив 70-80%)
   -------------------------------------------------------------------------- */
.gallery-section {
  padding: 0 var(--pad) clamp(2rem, 5vh, 3.2rem);
}

.gallery-panel {
  max-width: 1240px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdff;
  padding: clamp(1.2rem, 2.4vw, 1.9rem);
  box-shadow: 0 2px 12px rgba(14, 35, 56, 0.03);
}

.gallery-header {
  margin: 0 0 clamp(1rem, 2vw, 1.4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.gallery-title {
  margin: 0;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.gallery-title::after {
  content: "";
  display: block;
  width: clamp(48px, 8vw, 72px);
  height: 4px;
  margin: 0.65rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange), rgba(238, 83, 24, 0));
}

.gallery-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Карусель моделей (центрированная, с «peek» соседних карточек)
   -------------------------------------------------------------------------- */
.gallery-carousel {
  position: relative;
}

.carousel-track {
  --card-w: min(86%, 520px);
  position: relative;
  display: flex;
  gap: clamp(0.8rem, 1.6vw, 1.3rem);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 0.6rem 0;
  margin: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .carousel-track {
    --card-w: min(80%, 920px);
  }
}

/* Карточки внутри карусели: активная — по центру и крупнее */
.carousel-track .masonry-card {
  flex: 0 0 auto;
  width: var(--card-w);
  scroll-snap-align: center;
  opacity: 0.62;
  transform: scale(0.94);
  transition: transform 0.5s var(--ease), opacity 0.4s var(--ease),
    border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.carousel-track .masonry-card.is-active {
  opacity: 1;
  transform: scale(1);
  z-index: 2;
}

.carousel-track .masonry-card:hover {
  transform: scale(0.94) translateY(-5px);
}

.carousel-track .masonry-card.is-active:hover {
  transform: scale(1) translateY(-5px);
}

/* Стрелки */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  box-shadow: 0 8px 24px -10px rgba(14, 35, 56, 0.35);
  z-index: 6;
  transition: background 0.25s ease, border-color 0.25s ease, opacity 0.25s ease,
    transform 0.25s var(--ease);
}

.carousel-arrow::before {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.carousel-prev {
  left: -6px;
}

.carousel-prev::before {
  transform: rotate(-135deg);
  margin-left: 3px;
}

.carousel-next {
  right: -6px;
}

.carousel-next::before {
  transform: rotate(45deg);
  margin-right: 3px;
}

.carousel-arrow:hover:not(:disabled) {
  background: #fff;
  border-color: var(--ink);
  transform: translateY(-50%) scale(1.06);
}

.carousel-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 767px) {
  .carousel-arrow {
    display: none;
  }
}

/* Точки-индикаторы */
.carousel-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: clamp(1rem, 2vw, 1.4rem);
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(14, 35, 56, 0.18);
  transition: width 0.3s var(--ease), background 0.3s ease;
}

.carousel-dot:hover {
  background: rgba(14, 35, 56, 0.35);
}

.carousel-dot.is-active {
  width: 22px;
  background: var(--orange);
}

/* Карточка в галерее */
.masonry-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-bot);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(14, 35, 56, 0.05);
  cursor: pointer;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
  will-change: transform;
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
}

/* Единое соотношение сторон 16:9 для всех моделей */
.masonry-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(180deg, #c4dbf1, #a7c6e6);
}

.masonry-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.7s var(--ease);
  will-change: transform;
}

.masonry-card:hover {
  transform: translateY(-5px);
  border-color: var(--line-hover);
  box-shadow: 0 20px 45px -12px rgba(14, 35, 56, 0.18);
}

.masonry-card:hover .masonry-img {
  transform: scale(1.035);
}

/* Информационный оверлей */
.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.2rem;
  background: linear-gradient(
    180deg,
    rgba(14, 35, 56, 0.4) 0%,
    transparent 35%,
    transparent 55%,
    rgba(14, 35, 56, 0.85) 100%
  );
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  color: #fff;
}

.masonry-card:hover .card-overlay,
.masonry-card:focus-visible .card-overlay {
  opacity: 1;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  transform: translateY(-8px);
  transition: transform 0.35s var(--ease);
}

.card-category {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(14, 35, 56, 0.7);
  backdrop-filter: blur(8px);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  letter-spacing: 0.02em;
}

.card-index {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.8);
}

.card-bottom {
  transform: translateY(8px);
  transition: transform 0.35s var(--ease);
}

.masonry-card:hover .card-top,
.masonry-card:hover .card-bottom {
  transform: none;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.card-type {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0.25rem 0 0;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.7rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: #ffc7b2;
}

.card-action svg {
  transition: transform 0.2s ease;
}

.masonry-card:hover .card-action svg {
  transform: translate(2px, -2px);
}

/* Статичный нижний бэдж для мобильных экранов (без ховера) */
@media (hover: none) {
  .card-overlay {
    opacity: 1;
    background: linear-gradient(
      180deg,
      transparent 50%,
      rgba(14, 35, 56, 0.75) 100%
    );
  }
  .card-top {
    transform: none;
  }
  .card-bottom {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Каскадная анимация появления карточек
   -------------------------------------------------------------------------- */
.masonry-card.is-visible {
  animation: card-appear 0.7s var(--ease) both;
}

@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem var(--pad);
  background: rgba(245, 249, 253, 0.6);
}

.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.4rem;
}

.footer-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.footer-brand {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--ink);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--muted);
}

.to-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  transition: all 0.25s ease;
}

.to-top-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Полноэкранный разворот (Viewer / Lightbox)
   -------------------------------------------------------------------------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(7, 18, 30, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s ease;
  padding: clamp(1rem, 3.5vw, 2.5rem);
}

.viewer[hidden] {
  display: none;
}

.viewer.is-open {
  opacity: 1;
  visibility: visible;
}

.viewer-figure {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
  max-width: 1620px;
  max-height: 90vh;
  align-items: center;
  transform: scale(0.97);
  transition: transform 0.35s var(--ease-spring);
}

.viewer.is-open .viewer-figure {
  transform: scale(1);
}

@media (min-width: 980px) {
  .viewer-figure {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 3rem;
  }
}

.viewer-media {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-height: 76vh;
}

.viewer-img {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  transition: opacity 0.3s ease;
}

.viewer-info {
  color: #fff;
  display: flex;
  flex-direction: column;
}

.viewer-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.viewer-count {
  font-size: 0.78rem;
  color: var(--orange);
  font-weight: 700;
}

.viewer-category {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #dfeaf4;
  letter-spacing: 0.02em;
}

.viewer-title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.4rem, 1rem + 1.2vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.viewer-type {
  margin: 0.4rem 0 0;
  color: #9cb5cb;
  font-size: 0.88rem;
}

.viewer-divider {
  width: 40px;
  height: 2px;
  background: var(--orange);
  margin: 1.2rem 0;
}

.viewer-note {
  margin: 0;
  color: #d1e2f1;
  font-size: 0.92rem;
  line-height: 1.6;
}

.viewer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.2rem;
}

.viewer-tags span {
  font-size: 0.7rem;
  color: #b7d1e8;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}

/* Колл-ауты в развороте */
.viewer-callouts {
  margin-top: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.viewer-callout-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: #c0d7ec;
}

.viewer-callout-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
  transform: translateY(-1px);
}

/* Кнопки управления просмотром */
.viewer-close {
  position: absolute;
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.25s ease;
  z-index: 10;
}

.viewer-close::before,
.viewer-close::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 1.5px;
  background: #fff;
  transition: background 0.2s ease;
}

.viewer-close::before { transform: rotate(45deg); }
.viewer-close::after { transform: rotate(-45deg); }

.viewer-close:hover {
  background: rgba(238, 83, 24, 0.2);
  border-color: var(--orange);
}

.viewer-close:hover::before,
.viewer-close:hover::after {
  background: var(--orange);
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  transition: all 0.25s ease;
  z-index: 10;
}

.viewer-nav::before {
  content: "";
  width: 10px;
  height: 10px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  transition: border-color 0.2s ease;
}

.viewer-prev { left: clamp(0.6rem, 2vw, 2rem); }
.viewer-prev::before { transform: rotate(-45deg) translate(2px, 2px); }

.viewer-next { right: clamp(0.6rem, 2vw, 2rem); }
.viewer-next::before { transform: rotate(135deg) translate(2px, 2px); }

.viewer-nav:hover {
  background: rgba(238, 83, 24, 0.2);
  border-color: var(--orange);
}

.viewer-nav:hover::before {
  border-color: var(--orange);
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-bg::before { animation: none !important; }
  .hero-status, .intro-title, .intro-lead, .contacts-bar, .masonry-card.is-visible {
    animation: none !important;
  }
  .masonry-card, .masonry-img, .contact-btn {
    transition: none !important;
  }
}
