/* ================================================
   Vitagor Premium Design System - Main Styles
   Version: 2.0 | Meceya 2 (include-based)
   Style: Dark Premium Automotive Minimal Brutalism
   ================================================ */

/* ========== DESIGN TOKENS ========== */

:root {
  --btn-radius: 0.375rem;     /* rounded-md (6px) — единый радиус кнопок */
  --card-radius: 0.375rem;    /* rounded-md — единый радиус карточек */
  --popup-radius: 0.375rem;   /* rounded-md — единый радиус попапов */
}

/* ========== BASE STYLES ========== */

html {
  overflow-x: hidden;
}

body {
  font-family: 'Lora', serif;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ========== ШАПКА: фикс «дрожания» при overscroll (rubber-band на трекпаде) ==========
   Заставляем браузер положить fixed-header в отдельный GPU-слой,
   чтобы координаты не пересчитывались на каждом кадре инерционного скролла.
   Решает проблему «меню кривеет, когда страницу тянешь как резинку» на macOS Safari/Chrome. */
header.fixed {
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========== FULL-SCREEN MENU OVERLAY (Aesop / Lemaire style) ==========
   Изначальное состояние пунктов навигации — для stagger-анимации
   при первом открытии (JS снимет opacity:0 и translateX(20px)). */
.mobile-menu .menu-link {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease,
              color 0.3s ease;
}

/* ========== GLOBAL BUTTON RADIUS ========== */
/* Все кнопки и CTA-ссылки наследуют единый радиус */

button:not(.burger-btn):not(.filter-tab):not(.quiz-option):not(.quiz-option-multi),
[type="submit"],
a[data-lead-source],
a.btn-callback,
a.bg-accent,
.cta-project {
  border-radius: var(--btn-radius);
}

/* ========== GLOBAL CARD RADIUS ========== */
/* Все карточки и блоки с рамками наследуют единый радиус.
   Любой новый include с bg-[#141414]/bg-[#1A1A1A] + border
   автоматически получит скругление — не нужно добавлять rounded-md вручную. */

/* Карточки: тёмный фон + рамка */
[class*="bg-[#141414]"][class*="border"],
[class*="bg-[#1A1A1A]"][class*="border"],
[class*="bg-[#1a1a1a]"][class*="border"] {
  border-radius: var(--card-radius);
}

/* Блоки с glass-morphism inline-стилями (border в style="") */
[style*="border: 1px solid rgba(255,255,255"] {
  border-radius: var(--card-radius);
}

/* Фото-контейнеры с рамкой */
[class*="overflow-hidden"][class*="border"][class*="border-white"] {
  border-radius: var(--card-radius);
}

/* Скрытие скроллбара для фильтров */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ========== NOISE OVERLAY (Grain Texture) ========== */

.noise-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('https://grainy-gradients.vercel.app/noise.svg');
  opacity: 0.04;
  pointer-events: none;
  z-index: 2;
}

/* ========== HERO GRADIENT ========== */

.hero-gradient {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.25) 0%,
    rgba(0, 0, 0, 0.45) 50%,
    rgba(0, 0, 0, 0.75) 100%
  );
  backdrop-filter: blur(1px);
  pointer-events: none;
}

/* ========== PROJECT CARDS ========== */

.project-card {
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}

.project-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
}

.project-card__cta {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card:hover {
  box-shadow: 0 8px 30px rgba(212, 163, 115, 0.1);
  border-color: rgba(212, 163, 115, 0.2);
}

.project-card img {
  transition: opacity 0.3s ease;
}

.project-card:hover img {
  opacity: 1;
}

/* ========== SCROLL REVEAL ANIMATIONS ========== */

.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }

/* ========== MAGNETIC BUTTON EFFECT ========== */

.btn-magnetic {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

/* ========== SKELETON LOADER ========== */

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ========== MOBILE MENU TRANSITIONS ========== */

.mobile-menu {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-link {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== GLASS-MORPHISM ========== */

.glass {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========== TEXT GRADIENT ========== */

.text-gradient {
  background: linear-gradient(135deg, #ffffff 0%, rgba(212, 163, 115, 1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== SMOOTH FADE-IN ========== */

.fade-in {
  animation: fadeIn 0.6s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== RESPONSIVE IMAGES ========== */

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

/* ========== SELECTION STYLING ========== */

::selection {
  background-color: rgba(212, 163, 115, 0.3);
  color: #ffffff;
}

::-moz-selection {
  background-color: rgba(212, 163, 115, 0.3);
  color: #ffffff;
}

/* ========== SCROLLBAR STYLING ========== */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0C0C0C; }
::-webkit-scrollbar-thumb { background: rgba(212, 163, 115, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212, 163, 115, 0.5); }

/* ========== FOCUS STATES ========== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #D4A373;
  outline-offset: 2px;
}

/* ========== OPTION TAGS ========== */

.option-tag {
  transition: all 0.3s ease;
}

.option-tag.active {
  background-color: #D4A373;
  color: #000000;
  border-color: #D4A373;
}

.option-tag:hover {
  transform: translateY(-2px);
}

/* ========== FILTER MODAL ========== */

.filter-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.filter-modal.active {
  opacity: 1;
  visibility: visible;
}

.filter-modal-content {
  position: relative;
  width: 90%;
  max-width: 600px;
  background: linear-gradient(135deg, #1a1a1a 0%, #141414 100%);
  border: 1px solid rgba(212, 163, 115, 0.2);
  border-radius: var(--popup-radius);
  padding: 2rem 1.5rem;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.filter-modal.active .filter-modal-content {
  transform: scale(1);
}

/* ========== STICKY FILTER ========== */

.sticky-filter {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(12, 12, 12, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.sticky-filter-btn.active {
  background-color: rgba(212, 163, 115, 0.1);
  color: #ffffff;
  border-color: #D4A373;
}

.sticky-filter-btn:not(.active):hover {
  background-color: rgba(212, 163, 115, 0.1);
  border-color: #D4A373;
  color: #ffffff;
}

/* ========== LAZY VIDEO ========== */

.video-poster {
  filter: brightness(0.45) saturate(0.7) blur(1px);
  transition: all 0.5s ease;
}

.video-lazy:hover .video-poster {
  filter: brightness(0.55) saturate(0.85) blur(0px);
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  background: transparent;
  transition: all 0.4s ease;
  cursor: pointer;
  overflow: hidden;
}

.video-placeholder::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(212, 163, 115, 0.15) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
}

.video-placeholder:hover::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

.video-placeholder .play-icon {
  animation: pulse 2s ease-in-out infinite;
  filter: drop-shadow(0 6px 20px rgba(212, 163, 115, 0.4));
  transition: all 0.4s ease;
  position: relative;
  z-index: 2;
}

.video-placeholder:hover .play-icon {
  filter: drop-shadow(0 8px 30px rgba(212, 163, 115, 0.6));
  transform: scale(1.08);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.video-lazy.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(212, 163, 115, 0.2);
  border-top-color: #D4A373;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 10;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========== RADIAL GLOW BREATHING ========== */
@keyframes glow-breathe {
  0%, 100% { opacity: 0.03; }
  50% { opacity: 0.07; }
}

.glow-breathe {
  animation: glow-breathe 6s ease-in-out infinite;
}

.glow-breathe-slow {
  animation: glow-breathe 9s ease-in-out infinite;
}

.video-lazy.loaded .video-placeholder,
.video-lazy.loaded .video-poster {
  display: none;
}

.video-lazy video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
}

/* ========== SWIPER CUSTOMIZATION ========== */

.finishesSwiper .swiper-button-prev::after,
.finishesSwiper .swiper-button-next::after,
.teamSwiper .swiper-button-prev::after,
.teamSwiper .swiper-button-next::after,
.reviewsSwiper .swiper-button-prev::after,
.reviewsSwiper .swiper-button-next::after {
  display: none !important;
}

/* Card mini-gallery inside finishes slides */
.card-gallery-slide {
  transition: opacity 0.4s ease;
}

.team-pagination,
.reviews-pagination {
  position: relative !important;
  bottom: auto !important;
  width: auto !important;
}

.team-pagination .swiper-pagination-bullet,
.reviews-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
  transition: all 0.3s ease;
}

.team-pagination .swiper-pagination-bullet-active,
.reviews-pagination .swiper-pagination-bullet-active {
  background: #D4A373;
  width: 24px;
  border-radius: 4px;
}

.review-card {
  transition: all 0.3s ease;
}

.review-card:hover {
  transform: translateY(-4px);
  border-color: rgba(212, 163, 115, 0.3) !important;
  box-shadow: 0 10px 30px rgba(212, 163, 115, 0.1);
}

/* ========== FLOATING MENU ATTENTION ========== */

@keyframes attention-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes attention-glow {
  0% { box-shadow: 0 0 0 rgba(212, 163, 115, 0); }
  50% { box-shadow: 0 0 20px rgba(212, 163, 115, 0.6), 0 0 40px rgba(212, 163, 115, 0.3); }
  100% { box-shadow: 0 0 0 rgba(212, 163, 115, 0); }
}

#floating-menu .menu-container.is-attention {
  animation: attention-shake 0.6s ease-in-out, attention-glow 1.2s ease-in-out;
}

#floating-menu .menu-container.is-glow {
  animation: attention-glow 1.2s ease-in-out;
}

/* ========== LEAD POPUP ========== */

.lead-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.lead-popup.active {
  opacity: 1;
  visibility: visible;
}

.lead-popup__content {
  width: 90%;
  max-width: 480px;
  background: linear-gradient(135deg, #1a1a1a 0%, #141414 100%);
  border: 1px solid rgba(212, 163, 115, 0.2);
  border-radius: var(--popup-radius);
  padding: 2.5rem 2rem;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lead-popup.active .lead-popup__content {
  transform: scale(1);
}

/* ========== COOKIE BANNER ========== */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: rgba(26, 26, 26, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(212, 163, 115, 0.1);
  transform: translateY(100%);
  transition: transform 0.5s ease;
}

.cookie-banner.visible {
  transform: translateY(0);
}

/* ===================================================
   PORTFOLIO PAGE — карточки проектов
   =================================================== */

.portfolio-page {
    padding: 120px 60px 80px;
    max-width: 1600px;
    margin: 0 auto;
}

.portfolio-page__header {
    margin-bottom: 48px;
}

.portfolio-page__tag {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #D4A373;
    margin-bottom: 16px;
}

.portfolio-page__title {
    font-family: 'Spectral', serif;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.15;
    color: #fff;
    margin: 0 0 16px;
}

.portfolio-page__desc {
    font-size: 17px;
    color: rgba(255,255,255,0.5);
    max-width: 640px;
    line-height: 1.6;
    margin: 0 0 8px;
}

.portfolio-page__count {
    font-size: 14px;
    color: rgba(255,255,255,0.35);
    margin: 0;
}

/* Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* Card */
.p-card {
    background: #141414;
    border-radius: var(--card-radius);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    transition: border-color 0.3s;
    display: flex;
    flex-direction: column;
}

.p-card:hover {
    border-color: rgba(212,163,115,0.3);
}

/* Gallery */
.p-card__gallery {
    position: relative;
}

.p-card__main-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #0C0C0C;
}

.p-card__main-img,
.p-card__main-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.p-card__main-video {
    display: none;
}

.p-card__main-wrap--video .p-card__main-img {
    display: none;
}

.p-card__main-wrap--video .p-card__main-video {
    display: block;
}

/* Navigation arrows */
.p-card__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.75);
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.p-card:hover .p-card__nav {
    opacity: 1;
}

.p-card__nav--prev { left: 8px; }
.p-card__nav--next { right: 8px; }

.p-card__nav:hover {
    background: rgba(0,0,0,0.8);
    border-color: #D4A373;
}

/* Counter badge */
.p-card__counter {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    z-index: 2;
}

/* Video badge */
.p-card__video-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

/* Thumbnails */
.p-card__thumbs {
    display: flex;
    gap: 4px;
    padding: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.p-card__thumbs::-webkit-scrollbar {
    display: none;
}

.p-card__thumb {
    flex-shrink: 0;
    width: 52px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: #1a1a1a;
    position: relative;
    transition: border-color 0.2s;
}

.p-card__thumb--active {
    border-color: #D4A373;
}

.p-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.p-card__thumb--more {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
}

.p-card__thumb--video {
    position: relative;
}

.p-card__thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* Card info */
.p-card__info {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.p-card__name {
    font-family: 'Spectral', serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.3;
}

.p-card__meta {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 14px;
}

.p-card__cta {
    width: 100%;
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: auto;
    border: none;
    border-radius: var(--btn-radius);
    background: #D4A373;
    color: #0C0C0C;
    cursor: pointer;
    transition: background 0.2s;
}

.p-card__cta:hover {
    background: #fff;
}

.p-card__trust {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    text-align: center;
    margin-top: 6px;
    letter-spacing: 0.04em;
}

/* CTA-карточка «Расширенное портфолио» */
.p-card--cta-card {
    background: linear-gradient(135deg, rgba(212,163,115,0.08) 0%, rgba(212,163,115,0.03) 100%);
    border: 2px dashed rgba(212,163,115,0.3);
}

.p-card--cta-card:hover {
    border-color: #D4A373;
}

.p-card__cta-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 28px;
    gap: 16px;
    min-height: 100%;
}

.p-card__cta-icon {
    color: #D4A373;
    opacity: 0.7;
}

.p-card__cta-title {
    font-family: 'Spectral', serif;
    font-size: 1rem;
    color: #fff;
    line-height: 1.3;
}

.p-card__cta-text {
    font-size: 0.88rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.55;
}

.p-card__cta-note {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.3);
    line-height: 1.4;
}

.p-card--cta-card .p-card__cta {
    margin-top: 4px;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox--active {
    opacity: 1;
    visibility: visible;
}

.lightbox__img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.lightbox__close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    z-index: 2;
}

.lightbox__nav:hover {
    background: rgba(255,255,255,0.25);
}

.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }

.lightbox__counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2;
}

/* ========== PHOTO LIGHTBOX (каталог + топ-9) ========== */

#photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#photo-lightbox.active {
    opacity: 1;
    visibility: visible;
}

#photo-lightbox .lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
}

#photo-lightbox .lightbox-img {
    position: relative;
    z-index: 1;
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    user-select: none;
    -webkit-user-drag: none;
}

#photo-lightbox .lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    transition: background 0.2s, transform 0.2s;
}

#photo-lightbox .lightbox-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

#photo-lightbox .lightbox-prev,
#photo-lightbox .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
}

#photo-lightbox .lightbox-prev { left: 16px; }
#photo-lightbox .lightbox-next { right: 16px; }

#photo-lightbox .lightbox-prev:hover,
#photo-lightbox .lightbox-next:hover {
    background: rgba(255,255,255,0.25);
}

#photo-lightbox .lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    #photo-lightbox .lightbox-prev,
    #photo-lightbox .lightbox-next {
        width: 40px;
        height: 40px;
    }
    #photo-lightbox .lightbox-prev { left: 8px; }
    #photo-lightbox .lightbox-next { right: 8px; }
    #photo-lightbox .lightbox-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
    #photo-lightbox .lightbox-img {
        max-width: 96vw;
        max-height: 85vh;
    }
}

/* Portfolio Responsive */
@media (max-width: 1200px) {
    .portfolio-page {
        padding: 100px 40px 60px;
    }
}

@media (max-width: 840px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .portfolio-page {
        padding: 100px 20px 60px;
    }
}

@media (max-width: 768px) {
    .lightbox__nav {
        width: 40px;
        height: 40px;
    }
    .lightbox__nav--prev { left: 8px; }
    .lightbox__nav--next { right: 8px; }
    .lightbox__close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
    .lightbox__img {
        max-width: 96vw;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .portfolio-page__title {
        font-size: 24px;
    }
    .p-card__main-wrap {
        aspect-ratio: 3 / 2;
    }
    .p-card__nav {
        width: 34px;
        height: 34px;
        opacity: 0.8;
    }
}


/* ── Защита контента ─────────────────────────────────────────────────────── */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}
img {
    -webkit-user-drag: none;
    user-drag: none;
}

/* ========== FOUC PREVENTION ==========
   Эти правила грузятся в <head> через style.css — до рендера body.
   Цель: скрыть элементы, CSS для которых подключается позже (в footer.php).
   ======================================== */

/* 1. Виджет переведён обратно в режим Bubble (2026-05-18) — правило
      .vg-bubble { display: none !important } отключено, чтобы пузырь
      снова показывался. Если когда-то снова включим modal-режим, можно
      вернуть это правило как страховку от кэша браузера. */

/* 2. AI-чат кнопка в карточках (.ai-chat-btn) — скрыта до загрузки
      ai-chat-btn.css (который подключается в footer.php).
      Без этого правила SVG пузырь чата (stroke="currentColor") виден
      без оформления = "белый кружок с хвостиком" в момент рендера карточек. */
.ai-chat-btn {
    opacity: 0;
    pointer-events: none;
}
