/* ============================================================
   PORTFOLIO.CSS — стили для страниц портфолио Феликс ДВ
   ============================================================ */

/* ── HERO ──────────────────────────────────────────────── */
.portfolio-hero {
  position: relative;
  padding: 80px 0 70px;
  overflow: hidden;
  min-height: 420px;
  display: flex;
  align-items: center;
}

/* Цветовые акценты героя по категории */
.portfolio-hero[data-category="fundament"] { --cat-color: #d8b43d; --cat-glow: rgba(216,180,61,.18); }
.portfolio-hero[data-category="kladka"]    { --cat-color: #e07a5f; --cat-glow: rgba(224,122,95,.18); }
.portfolio-hero[data-category="krovlya"]   { --cat-color: #5b99c2; --cat-glow: rgba(91,153,194,.18); }
.portfolio-hero[data-category="otdelka"]   { --cat-color: #a5c95a; --cat-glow: rgba(165,201,90,.18); }
.portfolio-hero[data-category="zabory"]    { --cat-color: #9b8fcf; --cat-glow: rgba(155,143,207,.18); }

.portfolio-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.portfolio-hero-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, var(--cat-glow, rgba(216,180,61,.12)), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(165,201,90,.07), transparent 40%);
}

/* Анимированные точки-частицы на фоне */
.portfolio-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: particlesDrift 20s linear infinite;
  pointer-events: none;
}

@keyframes particlesDrift {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-40px); }
}

.portfolio-hero-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: heroFadeUp .7s ease both;
}

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

.portfolio-hero-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 8px 20px var(--cat-glow, rgba(216,180,61,.3)));
  animation: iconFloat 4s ease-in-out infinite;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.portfolio-hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(38px, 5.5vw, 70px);
  line-height: 1.03;
  letter-spacing: -.04em;
}

.portfolio-hero h1 span {
  color: var(--cat-color, var(--gold));
}

.portfolio-hero p {
  max-width: 58ch;
  color: var(--muted);
  font-size: 17px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  transition: color .2s, gap .2s;
  margin-bottom: 12px;
  width: fit-content;
}

.back-btn:hover {
  color: #fff;
  gap: 10px;
}

/* ── STATS ─────────────────────────────────────────────── */
.portfolio-stats {
  display: flex;
  gap: 32px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat strong {
  font-size: 28px;
  font-weight: 800;
  color: var(--cat-color, var(--gold));
  line-height: 1;
}

.stat span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* ── CATEGORY TABS ─────────────────────────────────────── */
.portfolio-nav-section {
  position: sticky;
  top: 82px;
  z-index: 30;
  background: rgba(11, 16, 22, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  padding: 0;
}

.portfolio-category-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: none;
}

.portfolio-category-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  transition: all .22s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--lime));
  color: #10151c;
  border-color: transparent;
  font-weight: 800;
}

/* ── GALLERY HEADER ────────────────────────────────────── */
.gallery-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.gallery-header h2 {
  margin: 8px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -.03em;
}

/* ── FILTER BUTTONS ────────────────────────────────────── */
.gallery-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  cursor: pointer;
  transition: all .2s ease;
}

.filter-btn:hover { color: #fff; background: rgba(255, 255, 255, .09); }

.filter-btn.active {
  color: var(--gold);
  background: rgba(216, 180, 61, .12);
  border-color: rgba(216, 180, 61, .3);
}

/* ── MASONRY GRID ──────────────────────────────────────── */
.masonry-grid {
  columns: 3 300px;
  column-gap: 16px;
}

/* Карточка проекта */
.project-card {
  break-inside: avoid;
  margin-bottom: 16px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);

  /* Анимация появления */
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity .5s ease,
    transform .5s ease,
    box-shadow .25s ease;
}

.project-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
  transform: translateY(-4px) scale(1.01);
}

/* Размеры карточек */
.project-card.size-large  .project-img { aspect-ratio: 4/3; }
.project-card.size-medium .project-img { aspect-ratio: 1/1; }
.project-card.size-small  .project-img { aspect-ratio: 3/2; }

.project-img {
  width: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.project-card:hover .project-img {
  transform: scale(1.06);
}

/* Оверлей с информацией */
.project-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 14, 20, .92) 0%,
    rgba(10, 14, 20, .4) 50%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  transition: opacity .3s ease;
}

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

.project-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}

.project-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, .65);
  margin: 0;
}

/* Иконка-лупа */
.project-zoom {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s ease, transform .25s ease;
}

.project-card:hover .project-zoom {
  opacity: 1;
  transform: scale(1);
}

/* Теги категорий */
.project-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.project-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(216, 180, 61, .2);
  color: var(--gold);
}

/* Lazy-load skeleton */
.project-img[data-src] {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.04) 25%,
    rgba(255,255,255,.08) 50%,
    rgba(255,255,255,.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* ── EMPTY STATE ───────────────────────────────────────── */
.gallery-empty {
  display: none;
  text-align: center;
  padding: 80px 20px;
  border-radius: 24px;
  border: 1px dashed rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .02);
}

.gallery-empty.show { display: block; }

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: .6;
}

.gallery-empty h3 {
  font-size: 22px;
  margin: 0 0 10px;
  color: #fff;
}

.gallery-empty p {
  color: var(--muted);
  max-width: 42ch;
  margin: 0 auto 24px;
}

/* ── LIGHTBOX ──────────────────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, .96);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  backdrop-filter: blur(8px);
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img-wrap {
  position: relative;
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .7);
  transition: opacity .25s ease, transform .25s ease;
}

.lightbox-img.loading { opacity: 0; }
.lightbox-img.loaded  { opacity: 1; }

/* Спиннер загрузки */
.lightbox-spinner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, .15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  opacity: 0;
  pointer-events: none;
}

.lightbox-spinner.show { opacity: 1; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Кнопка закрыть */
.lightbox-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .2s;
  z-index: 1002;
}

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

/* Стрелки навигации */
.lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .2s;
  z-index: 1002;
}

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

.lightbox-arrow:hover {
  background: rgba(255, 255, 255, .18);
}

.lightbox-prev:hover { transform: translateY(-50%) translateX(-3px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(3px); }

/* Подпись и счётчик */
.lightbox-caption {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: rgba(255, 255, 255, .85);
  font-size: 14px;
  font-weight: 600;
  max-width: 60ch;
  padding: 8px 16px;
  background: rgba(0, 0, 0, .5);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.lightbox-counter {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .45);
  font-size: 12px;
  letter-spacing: .1em;
}

/* ── PORTFOLIO CTA ─────────────────────────────────────── */
.portfolio-cta-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
}

.cta-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ── FILTER ANIMATION ──────────────────────────────────── */
.project-card.hiding {
  opacity: 0;
  transform: scale(.9);
  transition: opacity .25s ease, transform .25s ease;
}

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
  .masonry-grid { columns: 2 240px; }
  .gallery-header { flex-direction: column; align-items: flex-start; }
  .portfolio-cta-inner { grid-template-columns: 1fr; }
  .cta-actions { justify-content: flex-start; }
}

@media (max-width: 600px) {
  .masonry-grid { columns: 1; }
  .portfolio-hero { padding: 60px 0 50px; min-height: 360px; }
  .portfolio-category-tabs { gap: 6px; }
  .tab-btn { padding: 7px 12px; font-size: 12px; }
  .portfolio-stats { gap: 20px; }
  .stat strong { font-size: 22px; }
  .lightbox-arrow { display: none; }
}


/* ============================================================
   GALLERY CARDS — новые классы (portfolio.js v2.0)
   ============================================================ */

/* Карточка */
.gallery-card {
  break-inside: avoid;
  margin-bottom: 16px;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity .5s ease,
    transform .5s ease,
    box-shadow .25s ease;
}

.gallery-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-card:hover {
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  transform: translateY(-4px) scale(1.01);
}

/* Размеры */
.gallery-card.size-large  .card-img { aspect-ratio: 4/3; }
.gallery-card.size-medium .card-img { aspect-ratio: 1/1; }
.gallery-card.size-small  .card-img { aspect-ratio: 3/2; }

/* Обёртка изображения */
.card-img-wrap {
  position: relative;
  overflow: hidden;
}

/* Изображение */
.card-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.gallery-card:hover .card-img {
  transform: scale(1.06);
}

/* Overlay при наведении */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,.0) 0%, rgba(0,0,0,.5) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
}

.gallery-card:hover .card-overlay {
  opacity: 1;
}

/* Иконка увеличения */
.card-zoom-icon {
  width: 48px;
  height: 48px;
  color: #fff;
  stroke: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.6));
  transform: scale(.7);
  transition: transform .3s ease;
}

.gallery-card:hover .card-zoom-icon {
  transform: scale(1);
}

/* Подпись карточки */
.card-body {
  padding: 12px 14px 14px;
}

.card-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text, #fff);
  margin: 0 0 4px;
  line-height: 1.3;
}

.card-desc {
  font-size: .78rem;
  color: rgba(255,255,255,.55);
  margin: 0 0 8px;
  line-height: 1.4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.card-tag {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cat-color, #d8b43d);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 4px;
  padding: 2px 7px;
}

/* ============================================================
   LIGHTBOX — новые классы (portfolio.js v2.0)
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 10, .95);
  backdrop-filter: blur(10px);
}

.lb-track {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 1200px);
  max-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 40px 100px rgba(0,0,0,.7);
  transition: opacity .3s ease, transform .3s ease;
  display: block;
}

/* Кнопки навигации */
.lb-close,
.lb-prev,
.lb-next {
  position: fixed;
  z-index: 2;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .2s ease, transform .15s ease;
}

.lb-close {
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
}

.lb-close:hover { background: rgba(255,255,255,.18); transform: scale(1.1) rotate(90deg); }

.lb-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
}

.lb-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
}

.lb-prev:hover { background: rgba(255,255,255,.18); transform: translateY(-50%) scale(1.1); }
.lb-next:hover { background: rgba(255,255,255,.18); transform: translateY(-50%) scale(1.1); }

.lb-prev svg,
.lb-next svg,
.lb-close svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

/* Подпись */
.lb-caption {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 16px 20px 24px;
  z-index: 2;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
}

.lb-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px;
}

.lb-desc {
  font-size: .85rem;
  color: rgba(255,255,255,.65);
  margin: 0 0 4px;
}

.lb-counter {
  font-size: .78rem;
  color: rgba(255,255,255,.4);
  margin: 0;
}

/* Mobile */
@media (max-width: 640px) {
  .lb-prev { left: 8px; width: 44px; height: 44px; }
  .lb-next { right: 8px; width: 44px; height: 44px; }
  .lb-img  { border-radius: 8px; }
  .lb-close { top: 12px; right: 12px; }
}
