/* ============================================================
   Карточки реализованных проектов и попап с галереей.
   Подключается на главной, странице печей и /proekty/.
   ============================================================ */

/* — сетка карточек — */
.pcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 1000px) { .pcards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .pcards { grid-template-columns: 1fr; } }

.pcard {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #e6ecf3; border-radius: 16px; overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.pcard:hover { box-shadow: 0 16px 36px rgba(15, 35, 70, .10); transform: translateY(-2px); }

.pcard__cover {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer;
  aspect-ratio: 4 / 3; background: linear-gradient(135deg, #0658AF, #0a3a6b); overflow: hidden;
}
.pcard__cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.pcard:hover .pcard__cover img { transform: scale(1.04); }

/* плашка «5 фото · 2 видео» */
.pcard__count {
  position: absolute; left: 12px; bottom: 12px;
  padding: 6px 11px; border-radius: 8px;
  background: rgba(9, 22, 40, .72); color: #fff;
  font-size: 12.5px; font-weight: 500; letter-spacing: .01em;
  backdrop-filter: blur(3px);
}

.pcard__body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.pcard__type {
  font-family: var(--font-wide); font-weight: 400; font-size: 17px; line-height: 1.3;
  color: #1B1B1C; margin: 0 0 6px;
}
.pcard__city { font-size: 14px; color: #6a7178; margin: 0 0 14px; flex: 1; }
.pcard__more {
  align-self: flex-start; border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 10px;
  background: #0658AF; color: #fff;
  font-family: var(--font-wide); font-size: 14px;
  transition: background .15s ease;
}
.pcard__more:hover { background: #0a4a91; }

/* — развёрнутые карточки на /proekty/ —
   Сфера, задача и характеристики стоят прямо в карточке видимым текстом,
   а не только в попапе: краулеры JavaScript не исполняют, и без этого
   страница отдавала им одну шапку с подвалом. Текста стало больше,
   поэтому сетка здесь двухколоночная, а не трёхколоночная. */
.pcards--full { grid-template-columns: repeat(2, 1fr); gap: 28px; }
@media (max-width: 760px) { .pcards--full { grid-template-columns: 1fr; } }

.pcard--full .pcard__body { padding: 18px 20px 20px; }
.pcard--full .pcard__type { font-size: 18px; margin-bottom: 4px; }
.pcard--full .pcard__city { flex: none; margin-bottom: 12px; }
.pcard--full .pcard__sphere,
.pcard--full .pcard__task {
  font-size: 14.5px; line-height: 1.55; color: #3c444b; margin: 0 0 8px;
}
.pcard--full .pcard__sphere b,
.pcard--full .pcard__task b { font-weight: 500; color: #1B1B1C; }
.pcard--full .pcard__task { margin-bottom: 14px; }

.pcard__specs { margin: 0 0 18px; flex: 1; }
.pcard__specs dt {
  padding: 9px 0 0; border-top: 1px solid #eef1f5;
  font-size: 13.5px; color: #6a7178;
}
.pcard__specs dd { padding: 1px 0 9px; margin: 0; font-size: 14.5px; color: #1B1B1C; }

/* кнопка «Смотреть все» под сеткой */
.pcards-all {
  /* кнопка по центру под сеткой карточек */
  display: flex; width: fit-content; align-items: center; gap: 8px;
  margin: 28px auto 0;
  padding: 13px 26px; border-radius: 12px;
  border: 1px solid #cdd9ea; background: #fff; color: #0658AF;
  font-family: var(--font-wide); font-size: 15px; text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.pcards-all:hover { background: #eef4fb; border-color: #0658AF; }

/* — попап — */
.pmodal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pmodal[hidden] { display: none; }
.pmodal__back { position: absolute; inset: 0; background: rgba(9, 18, 32, .78); backdrop-filter: blur(2px); }
.pmodal__win {
  position: relative; z-index: 1; width: min(920px, 100%); max-height: calc(100vh - 48px);
  overflow-y: auto; background: #fff; border-radius: 18px; padding: 22px;
}
.pmodal__close {
  position: absolute; right: 14px; top: 14px; z-index: 2;
  width: 38px; height: 38px; border: 0; border-radius: 10px; cursor: pointer;
  background: #f1f4f8; color: #3a4047; display: inline-flex; align-items: center; justify-content: center;
}
.pmodal__close:hover { background: #e4eaf2; }

.pmodal__gal { position: relative; background: #0d1927; border-radius: 12px; overflow: hidden; }
.pmodal__stage { position: relative; display: flex; align-items: center; justify-content: center;
  height: min(66vh, 560px); overflow: hidden; }
.pmodal__bg { position: absolute; inset: 0; background-size: cover; background-position: center;
  filter: blur(26px) brightness(.5); transform: scale(1.15); }
.pmodal__media { position: relative; max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.pmodal__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .9); color: #1B1B1C; font-size: 26px; line-height: 1;
}
.pmodal__nav:hover { background: #fff; }
.pmodal__nav--prev { left: 12px; }
.pmodal__nav--next { right: 12px; }
.pmodal__counter {
  position: absolute; right: 14px; bottom: 12px;
  padding: 5px 10px; border-radius: 7px;
  background: rgba(9, 22, 40, .7); color: #fff; font-size: 12.5px;
}

.pmodal__thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; }
.pmodal__thumb {
  position: relative; flex: none; width: 76px; height: 58px; padding: 0; cursor: pointer;
  border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #eef1f5;
}
.pmodal__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pmodal__thumb.is-active { border-color: #0658AF; }
.pmodal__thumb-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(9, 22, 40, .35); color: #fff;
}
.pmodal__thumb-play svg { width: 20px; height: 20px; }

.pmodal__info { padding-top: 16px; }
.pmodal__title { font-family: var(--font-wide); font-weight: 400; font-size: 22px; color: #1B1B1C; margin: 0 0 4px; }
.pmodal__city { font-size: 14.5px; color: #6a7178; margin: 0 0 12px; }
.pmodal__sphere { font-size: 15px; line-height: 1.55; color: #3c444b; margin: 0 0 6px; }
.pmodal__task { font-size: 15px; line-height: 1.55; color: #3c444b; margin: 0 0 14px; }
.pmodal__specs { display: grid; grid-template-columns: 260px 1fr; gap: 0; margin: 0 0 18px; }
.pmodal__specs dt { padding: 11px 0; border-top: 1px solid #eef1f5; font-size: 14.5px; color: #6a7178; }
.pmodal__specs dd { padding: 11px 0; border-top: 1px solid #eef1f5; margin: 0; font-size: 14.5px; color: #1B1B1C; }
@media (max-width: 640px) {
  .pmodal { padding: 12px; }
  .pmodal__win { padding: 16px; }
  .pmodal__specs { grid-template-columns: 1fr; }
  .pmodal__specs dt { padding-bottom: 0; border-top: 1px solid #eef1f5; }
  .pmodal__specs dd { padding-top: 2px; border-top: 0; }
}
.pmodal__cta {
  display: inline-block; padding: 13px 26px; border-radius: 12px;
  background: #FE5507; color: #fff; text-decoration: none;
  font-family: var(--font-wide); font-size: 15px;
  transition: background .15s ease;
}
.pmodal__cta:hover { background: #e44b04; }

/* Отступы вокруг сетки: от заголовка сверху и от подвала снизу.
   На главной и странице печей блок лежит внутри секции со своими
   паддингами, поэтому отступ снизу задаём только там, где карточки
   идут последними на странице (страница проектов). */
[data-proj-cards] { margin-top: 26px; }
.prj-main [data-proj-cards] { margin-bottom: 72px; }
@media (max-width: 640px) { .prj-main [data-proj-cards] { margin-bottom: 48px; } }
