/* ==============================================
   Portfolio Module — portfolio.css
   ============================================== */

/* ---------- Карточка ---------- */
.portfolio-card {
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: block;
}
.portfolio-card--link {
    text-decoration: none;
    color: inherit;
}
.portfolio-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    transform: translateY(-3px);
}
.portfolio-card__cover {
    position: relative;
    width: 100%;
    padding-top: 75%;
    overflow: hidden;
    background: #f0f0f0;
}
.portfolio-card__cover img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.portfolio-card:hover .portfolio-card__cover img {
    transform: scale(1.04);
}
.portfolio-card__no-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #e0e0e0;
}
.portfolio-card__video-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 54px; height: 54px;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    pointer-events: none;
}
.portfolio-card__info {
    padding: 12px 14px 14px;
}
.portfolio-card__name {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.portfolio-card__desc {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Модуль-виджет ---------- */
.portfolio-module {
    margin: 24px 0;
}
.portfolio-module__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.portfolio-module__title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}
.portfolio-module__view-all {
    font-size: 14px;
    color: #e44d26;
    text-decoration: none;
}
.portfolio-module__view-all:hover { text-decoration: underline; }

/* ---------- Лента ---------- */
.portfolio-ribbon {
    position: relative;
    overflow: hidden;
}
.portfolio-ribbon__track {
    display: flex;
    transition: transform 0.5s ease;
    will-change: transform;
}
.portfolio-ribbon__card {
    flex: 0 0 auto;
    padding: 0 8px;
    box-sizing: border-box;
}
.portfolio-ribbon__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.45);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px; height: 38px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.portfolio-ribbon__btn:hover { background: rgba(0,0,0,0.7); }
.portfolio-ribbon__btn--prev { left: 4px; }
.portfolio-ribbon__btn--next { right: 4px; }
.portfolio-ribbon__dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}
.portfolio-ribbon__dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.2s;
}
.portfolio-ribbon__dot.active { background: #e44d26; }

/* ---------- Страница портфолио ---------- */
.portfolio-page__title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a1a;
}
.portfolio-page__grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 24px;
}
@media (max-width: 991px) { .portfolio-page__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .portfolio-page__grid { grid-template-columns: 1fr; } }

/* ============================================================
   POPUP — БОЛЬШОЙ, С ГАЛЕРЕЕЙ
   ============================================================ */
.portfolio-popup-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.78);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.portfolio-popup {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 1100px;
    max-height: 92vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transition: max-width 0.3s ease, max-height 0.3s ease;
}
.portfolio-popup--fullscreen {
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0;
}
.portfolio-popup__close {
    position: absolute;
    top: 10px; right: 14px;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #555;
    z-index: 10;
    line-height: 1;
    padding: 0;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.portfolio-popup__close:hover { background: #f0f0f0; color: #e44d26; }
.portfolio-popup__fullscreen-btn {
    position: absolute;
    top: 10px; right: 58px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 34px; height: 34px;
    cursor: pointer;
    z-index: 10;
    display: flex; align-items: center; justify-content: center;
    color: #555;
    transition: background 0.15s;
}
.portfolio-popup__fullscreen-btn:hover { background: #f0f0f0; color: #333; }

/* Внутренний layout: медиа + инфо */
.portfolio-popup__inner {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Левая колонка — медиа */
.portfolio-popup__media-col {
    width: 60%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #111;
    border-radius: 10px 0 0 10px;
    overflow: hidden;
}
/* Главный медиа-экран */
.portfolio-popup__main-media {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}
.portfolio-popup__main-media iframe {
    width: 100%; height: 100%;
    border: none;
    min-height: 340px;
    display: block;
}
.portfolio-popup__main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    min-height: 320px;
    max-height: 520px;
    cursor: zoom-in;
}
/* Ряд миниатюр */
.portfolio-popup__thumbs {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    background: #1a1a1a;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}
.portfolio-popup__thumbs::-webkit-scrollbar { height: 4px; }
.portfolio-popup__thumbs::-webkit-scrollbar-track { background: transparent; }
.portfolio-popup__thumbs::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

.portfolio-popup__thumb {
    width: 76px;
    height: 58px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, opacity 0.15s;
    opacity: 0.6;
    position: relative;
}
.portfolio-popup__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.portfolio-popup__thumb:hover,
.portfolio-popup__thumb.active {
    border-color: #e44d26;
    opacity: 1;
}
.portfolio-popup__thumb-video {
    width: 100%; height: 100%;
    position: relative;
}
.portfolio-popup__thumb-video img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.portfolio-popup__thumb-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

/* Правая колонка — инфо */
.portfolio-popup__info-col {
    flex: 1;
    padding: 40px 28px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.portfolio-popup__title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 14px;
    color: #1a1a1a;
    padding-right: 80px;
    line-height: 1.3;
}
.portfolio-popup__desc {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}
.portfolio-popup__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}
.portfolio-popup__btn-order {
    display: inline-flex;
    align-items: center;
    padding: 10px 24px;
    background: #e44d26;
    color: #fff;
    border-radius: 5px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s;
}
.portfolio-popup__btn-order:hover { background: #c43d1e; color: #fff; text-decoration: none; }
.portfolio-popup__btn-full {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s, border-color 0.2s;
}
.portfolio-popup__btn-full:hover { background: #f5f5f5; border-color: #999; color: #333; text-decoration: none; }

/* Адаптив попапа */
@media (max-width: 768px) {
    .portfolio-popup__inner { flex-direction: column; }
    .portfolio-popup__media-col { width: 100%; border-radius: 10px 10px 0 0; min-height: 260px; }
    .portfolio-popup__info-col { padding: 20px 16px; }
    .portfolio-popup__title { padding-right: 50px; font-size: 18px; }
    .portfolio-popup__main-img { min-height: 200px; max-height: 280px; }
    .portfolio-popup__main-media iframe { min-height: 220px; }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.portfolio-lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portfolio-lightbox__content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portfolio-lightbox__content img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0,0,0,0.6);
}
.portfolio-lightbox__video {
    width: 90vw;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
}
.portfolio-lightbox__video iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
}
.portfolio-lightbox__close {
    position: absolute;
    top: 16px; right: 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    border-radius: 50%;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    z-index: 10;
}
.portfolio-lightbox__close:hover { background: rgba(255,255,255,0.28); }
.portfolio-lightbox__prev,
.portfolio-lightbox__next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    font-size: 44px;
    cursor: pointer;
    border-radius: 50%;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    z-index: 10;
    line-height: 1;
}
.portfolio-lightbox__prev { left: 16px; }
.portfolio-lightbox__next { right: 16px; }
.portfolio-lightbox__prev:hover,
.portfolio-lightbox__next:hover { background: rgba(255,255,255,0.32); }

/* ============================================================
   СТРАНИЦА ОТДЕЛЬНОЙ РАБОТЫ (portfolio_item)
   ============================================================ */
#portfolio-item-page {
    padding: 20px 0 40px;
}
.portfolio-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}
@media (max-width: 767px) {
    .portfolio-item { grid-template-columns: 1fr; gap: 20px; }
}

/* Слайдер */
.portfolio-item__gallery-col {}
.portfolio-item__main-media {
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.portfolio-item__main-link {
    display: block;
    width: 100%; height: 100%;
    position: relative;
}
.portfolio-item__main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    cursor: zoom-in;
}
.portfolio-item__zoom-hint {
    position: absolute;
    bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.portfolio-item__main-link:hover .portfolio-item__zoom-hint { opacity: 1; }

.portfolio-item__video-wrap {
    width: 100%; height: 100%;
    aspect-ratio: 16/9;
}
.portfolio-item__video-wrap iframe {
    width: 100%; height: 100%;
    border: none;
    display: block;
}

/* Миниатюры */
.portfolio-item__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.portfolio-item__thumb {
    width: 80px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
    flex-shrink: 0;
    position: relative;
}
.portfolio-item__thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.portfolio-item__thumb:hover,
.portfolio-item__thumb.active {
    border-color: #e44d26;
}
.portfolio-item__thumb-video {
    width: 100%; height: 100%;
    position: relative;
}
.portfolio-item__thumb-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 16px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}

/* Правая колонка */
.portfolio-item__info-col {
    padding-top: 8px;
}
.portfolio-item__title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
}
.portfolio-item__short-desc {
    font-size: 15px;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.6;
    font-style: italic;
}
.portfolio-item__description {
    font-size: 14px;
    color: #333;
    line-height: 1.7;
    margin-bottom: 24px;
}
.portfolio-item__actions {
    margin-top: 20px;
}
.portfolio-item__btn-order {
    display: inline-flex;
    align-items: center;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    background: #e44d26;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.2s;
}
.portfolio-item__btn-order:hover { background: #c43d1e; color: #fff; text-decoration: none; }

/* Карусель связанных товаров */
.portfolio-item__related {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid #e8e8e8;
}
.portfolio-item__related-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 20px;
}
.portfolio-item__products-carousel {
    display: flex;
    gap: 16px;
    overflow: hidden;
    transition: transform 0.4s ease;
    will-change: transform;
}
.portfolio-item__product-card {
    flex: 0 0 200px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.portfolio-item__product-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.16);
    transform: translateY(-2px);
}
.portfolio-item__product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.portfolio-item__product-img {
    width: 100%;
    padding-top: 100%;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}
.portfolio-item__product-img img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.portfolio-item__product-info {
    padding: 10px 12px;
}
.portfolio-item__product-name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}
.portfolio-item__product-price {
    font-size: 14px;
    font-weight: 700;
    color: #e44d26;
}
.portfolio-item__carousel-nav {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.portfolio-item__carousel-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    color: #333;
}
.portfolio-item__carousel-btn:hover { background: #e44d26; color: #fff; }
