/* ============================================================
   Portfolio detail page — Vexoo-inspired
   Targets: /portfolio/<slug> page (view.php)
   Markup НЕ меняется, только визуал поверх существующих стилей.
   ============================================================ */

/* ---------- Hero (header#h-service) ---------- */
body:has(.content-portfolio .image-portfolio) #h-service,
.portfolio-detail-hero #h-service {
    position: relative;
}

#h-service .h-service-main {
    min-height: 80vh;
    position: relative;
    background-size: cover !important;
    background-position: center !important;
    overflow: hidden;
}

/* Затемнение поверх обложки для читаемости заголовка */
#h-service .h-service-main::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0,0,0,0.15) 0%,
        rgba(0,0,0,0.35) 60%,
        rgba(0,0,0,0.75) 100%
    );
    pointer-events: none;
    z-index: 1;
}

#h-service .container-service {
    position: relative;
    z-index: 2;
    padding-top: 18vh;
    padding-bottom: 8vh;
    max-width: 1200px;
    text-align: center;
}

#h-service .title-service {
    font-family: 'Inter', sans-serif !important;
    font-weight: 500 !important;
    font-size: clamp(48px, 7vw, 104px) !important;
    line-height: 1 !important;
    letter-spacing: -0.03em !important;
    color: #fff !important;
    margin: 0 0 24px !important;
    text-transform: none !important;
    text-align: center !important;
}

#h-service .description-service {
    font-family: 'Inter', sans-serif !important;
    font-weight: 400 !important;
    font-size: clamp(16px, 1.4vw, 22px) !important;
    line-height: 1.45 !important;
    color: rgba(255, 255, 255, 0.78) !important;
    max-width: 720px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    text-align: center !important;
}

/* ---------- Контент кейса ---------- */
.content-portfolio {
    background: #0e0e0e;
}

/* Контейнер контента не уже хедерного, чтоб текст шёл от того же края что и логотип */
.content-portfolio .container {
    padding-left: 15px;
    padding-right: 15px;
}

/* Текстовый блок ($portfolio['content']) — слева внутри родительского .container,
   в линию с логотипом (логотип тоже в .container) */
.content-portfolio .container > .content-portfolio {
    padding: 80px 0 40px;
    font-family: 'Inter', sans-serif;
    font-size: clamp(16px, 1.3vw, 19px);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    max-width: 820px;
    margin-left: 0;
    margin-right: auto;
    text-align: left;
}

.content-portfolio .container > .content-portfolio p {
    margin: 0 0 1.2em;
}

.content-portfolio .container > .content-portfolio h2,
.content-portfolio .container > .content-portfolio h3 {
    font-weight: 500;
    color: #fff;
    margin: 1.8em 0 0.6em;
    letter-spacing: -0.01em;
}

.content-portfolio .container > .content-portfolio h2 {
    font-size: clamp(28px, 2.8vw, 38px);
    line-height: 1.15;
}

.content-portfolio .container > .content-portfolio h3 {
    font-size: clamp(22px, 2vw, 28px);
    line-height: 1.2;
}

/* ---------- Картинки галереи с parallax ---------- */
/* Расширяем картинки за пределы Bootstrap-контейнера до ширины почти-viewport,
   с теми же отступами от краёв что и шапка с логотипом / меню (~48px). */
.content-portfolio .image-portfolio {
    margin-top: 40px;
    margin-bottom: 40px;
    /* выход за рамки .container */
    margin-left: calc(-50vw + 50% + 48px);
    margin-right: calc(-50vw + 50% + 48px);
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    background: #0a0a0a;
    isolation: isolate;
}

.content-portfolio .image-portfolio picture {
    display: block;
    width: 100%;
    position: relative;
}

/* Картинка показывается в натуральных пропорциях, без обрезки. */
.content-portfolio .image-portfolio img {
    display: block;
    width: 100%;
    height: auto;
}

/* Большой первый кадр после контента */
.content-portfolio .image-portfolio:first-of-type {
    margin-top: 60px;
}

.content-portfolio .image-portfolio:last-of-type {
    margin-bottom: 120px;
}

/* Film grain поверх каждой картинки кейса (как на референсе) */
.content-portfolio .image-portfolio::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0.32;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.95 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 220px 220px;
    background-repeat: repeat;
    animation: bt-grain 1.6s steps(6) infinite;
}

/* Адаптив */
@media (max-width: 1199.98px) {
    .content-portfolio .image-portfolio {
        margin-left: calc(-50vw + 50% + 32px);
        margin-right: calc(-50vw + 50% + 32px);
    }
}

@media (max-width: 991.98px) {
    #h-service .h-service-main { min-height: 60vh; }
    #h-service .container-service { padding-top: 14vh; padding-bottom: 6vh; }
    .content-portfolio .container > .content-portfolio { padding: 56px 0 28px; }
    .content-portfolio .image-portfolio {
        margin-top: 28px;
        margin-bottom: 28px;
        margin-left: calc(-50vw + 50% + 24px);
        margin-right: calc(-50vw + 50% + 24px);
        border-radius: 14px;
    }
    .content-portfolio .image-portfolio:last-of-type { margin-bottom: 80px; }
}

@media (max-width: 575.98px) {
    #h-service .h-service-main { min-height: 56vh; }
    #h-service .container-service {
        padding-top: 12vh;
        padding-bottom: 5vh;
        padding-left: 16px;
        padding-right: 16px;
    }
    #h-service .title-service { letter-spacing: -0.02em !important; }
    .content-portfolio .container { padding-left: 16px; padding-right: 16px; }
    .content-portfolio .image-portfolio {
        margin-top: 20px;
        margin-bottom: 20px;
        margin-left: calc(-50vw + 50% + 16px);
        margin-right: calc(-50vw + 50% + 16px);
        border-radius: 12px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .content-portfolio .image-portfolio img,
    .content-portfolio .image-portfolio::after {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
    .content-portfolio .image-portfolio img { height: 100%; }
}
