/* portfolio.css — стили раздела «Наши работы» (paketoff.ru) */

:root {
    --pf-coral: var(--c-coral, #ea5b71);
    --pf-coral-dark: #d04a60;
    --pf-bg: #f7f7f9;
    --pf-text: #1a1a1f;
    --pf-text-muted: #6c6c75;
    --pf-border: #e6e6ec;
    --pf-radius: 14px;
    --pf-shadow: 0 2px 12px rgba(0,0,0,0.06);
    --pf-shadow-hover: 0 8px 32px rgba(0,0,0,0.14);
}

/* === Расширяем main за пределы стандартного padding === */
.v2-content:has(.portfolio-page) {
    max-width: none !important;
    padding: 0 !important;
}

.portfolio-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--page-pad, 16px) 80px;
    color: var(--pf-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === Hero === */
.portfolio-hero {
    text-align: center;
    padding: 56px 16px 32px;
}

.portfolio-hero__title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--pf-text);
    letter-spacing: -0.02em;
}

.portfolio-hero__subtitle {
    font-size: clamp(15px, 1.5vw, 17px);
    line-height: 1.55;
    color: var(--pf-text-muted);
    max-width: 720px;
    margin: 0 auto 32px;
}

.portfolio-hero__stats {
    display: flex;
    justify-content: center;
    gap: clamp(16px, 4vw, 64px);
    flex-wrap: wrap;
    margin-top: 24px;
}

/* Цифра и подпись — влево: .portfolio-hero задаёт text-align:center,
   он наследуется в hero__trust-text и центрирует цифру относительно
   более широкой подписи (особенно заметно на мобиле в столбике). */
.portfolio-hero__stats .hero__trust-text {
    text-align: left;
}

.portfolio-hero__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.portfolio-hero__stat strong {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    color: var(--pf-coral);
    line-height: 1;
}

.portfolio-hero__stat span {
    font-size: 13px;
    color: var(--pf-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* === Filter tabs === */
.portfolio-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px auto 32px;
    padding: 0 8px;
    position: sticky;
    top: 64px;
    z-index: 5;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding-top: 12px;
    padding-bottom: 12px;
}

.portfolio-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1.5px solid var(--pf-border);
    background: #fff;
    color: var(--pf-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    white-space: nowrap;
}

.portfolio-filter:hover {
    border-color: var(--pf-coral);
    color: var(--pf-coral);
    transform: translateY(-1px);
}

.portfolio-filter.is-active {
    background: var(--pf-coral);
    border-color: var(--pf-coral);
    color: #fff;
}

.portfolio-filter__count {
    display: inline-block;
    min-width: 22px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(0,0,0,0.06);
    color: inherit;
    line-height: 1.6;
}

.portfolio-filter.is-active .portfolio-filter__count {
    background: rgba(255,255,255,0.25);
}

/* === Grid === */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 64px;
}

.portfolio-card {
    position: relative;
    border-radius: var(--pf-radius);
    overflow: hidden;
    background: var(--pf-bg);
    box-shadow: var(--pf-shadow);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.portfolio-card.is-hidden {
    display: none;
}

.portfolio-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pf-shadow-hover);
}

.portfolio-card__img-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(135deg, #ececec 0%, #f6f6f6 100%);
}

.portfolio-card__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.portfolio-card:hover .portfolio-card__img-wrap img {
    transform: scale(1.05);
}

.portfolio-card__overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 14px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    pointer-events: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.portfolio-card:hover .portfolio-card__overlay {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-card__tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--pf-coral);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.portfolio-card__rubric {
    font-size: 12px;
    opacity: 0.85;
}

.portfolio-card__zoom {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: var(--pf-coral);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.portfolio-card:hover .portfolio-card__zoom {
    opacity: 1;
    transform: scale(1);
}

.portfolio-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px;
    color: var(--pf-text-muted);
    font-size: 16px;
}

/* === Bottom CTA block === */
.portfolio-cta-block {
    text-align: center;
    padding: 56px 24px;
    border-radius: var(--pf-radius);
    background: linear-gradient(135deg, var(--pf-coral) 0%, var(--pf-coral-dark) 100%);
    color: #fff;
    margin: 32px 0;
}

.portfolio-cta-block h2 {
    font-size: clamp(22px, 2.6vw, 32px);
    font-weight: 700;
    margin: 0 0 12px;
    color: #fff;
}

.portfolio-cta-block p {
    font-size: 15px;
    line-height: 1.55;
    opacity: 0.92;
    max-width: 540px;
    margin: 0 auto 24px;
}

.portfolio-cta-block__btn {
    display: inline-block;
    padding: 14px 36px;
    background: #fff;
    color: var(--pf-coral);
    border: none;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.portfolio-cta-block__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* === Sticky CTA (плавающая) === */
.portfolio-sticky-cta {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    background: var(--pf-coral);
    color: #fff !important;
    border-radius: 999px;
    box-shadow: 0 6px 22px rgba(234,91,113,0.45);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none !important;
    z-index: 99;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    animation: pf-cta-pulse 2.5s ease-in-out infinite;
}

@keyframes pf-cta-pulse {
    0%, 100% { box-shadow: 0 6px 22px rgba(234,91,113,0.45); }
    50%      { box-shadow: 0 6px 32px rgba(234,91,113,0.7); }
}

.portfolio-sticky-cta:hover {
    background: var(--pf-coral-dark);
    transform: translateY(-2px);
    text-decoration: none !important;
}

/* === Lightbox === */
.portfolio-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.94);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.portfolio-lightbox.is-open {
    opacity: 1;
}

.portfolio-lightbox[hidden] {
    display: none;
}

.portfolio-lightbox__stage {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portfolio-lightbox__img {
    max-width: 95vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    user-select: none;
    -webkit-user-drag: none;
}

.portfolio-lightbox__caption-wrap {
    color: #fff;
    text-align: center;
    padding: 18px 16px 8px;
    max-width: 720px;
    width: 100%;
}

.portfolio-lightbox__counter {
    font-size: 12px;
    opacity: 0.6;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.portfolio-lightbox__tag {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    min-height: 22px;
}

.portfolio-lightbox__comment {
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.85;
    margin-bottom: 14px;
    min-height: 0;
}

.portfolio-lightbox__order {
    display: inline-block;
    padding: 10px 28px;
    background: var(--pf-coral);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, transform 0.15s ease;
}

.portfolio-lightbox__order:hover {
    background: var(--pf-coral-dark);
    transform: translateY(-1px);
}

.portfolio-lightbox__close,
.portfolio-lightbox__nav {
    position: absolute;
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
    user-select: none;
}

.portfolio-lightbox__close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

.portfolio-lightbox__close:hover {
    background: rgba(255,255,255,0.25);
}

.portfolio-lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 36px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 4px;
}

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

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

/* === Mobile === */
@media (max-width: 850px) {
    .portfolio-hero {
        padding: 32px 12px 24px;
    }
    .portfolio-filters {
        top: 56px;
        gap: 6px;
        margin: 16px -8px 24px;
        padding-left: 12px;
        padding-right: 12px;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    .portfolio-filter {
        flex-shrink: 0;
        scroll-snap-align: start;
        font-size: 13px;
        padding: 8px 14px;
    }
    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    .portfolio-card__overlay {
        opacity: 1;
        transform: none;
        padding: 10px 8px 8px;
    }
    .portfolio-card__zoom {
        opacity: 1;
        transform: scale(1);
        width: 30px;
        height: 30px;
    }
    .portfolio-cta-block {
        padding: 36px 16px;
    }
    .portfolio-sticky-cta {
        right: 12px;
        bottom: 12px;
        padding: 12px 16px;
        font-size: 13px;
    }
    .portfolio-sticky-cta span {
        display: none;
    }
    .portfolio-sticky-cta {
        width: 52px;
        height: 52px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }
    .portfolio-lightbox__close {
        top: 8px;
        right: 8px;
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
    .portfolio-lightbox__nav {
        width: 40px;
        height: 40px;
        font-size: 26px;
    }
    .portfolio-lightbox__nav--prev { left: 6px; }
    .portfolio-lightbox__nav--next { right: 6px; }
    .portfolio-lightbox__img {
        max-height: 70vh;
    }
    .portfolio-lightbox__tag { font-size: 15px; }
    .portfolio-lightbox__comment { font-size: 13px; }
}

@media (max-width: 480px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .portfolio-hero__title { font-size: 24px; }
    .portfolio-hero__subtitle { font-size: 14px; }
    .portfolio-hero__stat strong { font-size: 22px; }
}

/* Прячем sticky CTA, если открыт lightbox или contactModal */
body.pf-lightbox-open .portfolio-sticky-cta { display: none; }
body.pf-lightbox-open { overflow: hidden; }

/* ====================================================================
   Модалка «Заказать похожее»
   ==================================================================== */
.pf-order-modal {
    position: fixed;
    inset: 0;
    z-index: 10001; /* выше lightbox */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.pf-order-modal[hidden] { display: none; }

.pf-order-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 25, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pf-order-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 920px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: pf-order-in 0.22s cubic-bezier(0.2, 0.8, 0.4, 1);
    display: flex;
    flex-direction: column;
}
@keyframes pf-order-in {
    from { transform: scale(0.96) translateY(8px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.pf-order-modal__close {
    position: absolute;
    top: 12px; right: 14px;
    width: 36px; height: 36px;
    border: none;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: #555;
    z-index: 3;
    transition: background 0.15s ease;
}
.pf-order-modal__close:hover { background: #fff; color: #000; }

.pf-order-modal__body {
    display: grid;
    grid-template-columns: 5fr 7fr;
    overflow: auto;
}

.pf-order-modal__preview {
    background: #11111a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 240px;
}
.pf-order-modal__preview img {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 80px);
    object-fit: cover;
    display: block;
}
.pf-order-modal__preview-tag {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 14px 18px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.pf-order-modal__form {
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
}
.pf-order-modal__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1f;
    letter-spacing: -0.01em;
}
.pf-order-modal__lead {
    margin: 0 0 6px;
    color: #6c6c75;
    font-size: 13px;
    line-height: 1.5;
}

.pf-order-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pf-order-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.pf-order-field label {
    font-size: 12px;
    font-weight: 500;
    color: #6c6c75;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pf-order-field input,
.pf-order-field textarea {
    padding: 10px 12px;
    border: 1.5px solid #e2e2e8;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    color: #1a1a1f;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}
.pf-order-field input:focus,
.pf-order-field textarea:focus {
    outline: none;
    border-color: #ea5b71;
    box-shadow: 0 0 0 3px rgba(234,91,113,0.15);
}
.pf-order-field input.is-error,
.pf-order-field textarea.is-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231,76,60,0.12);
}

.pf-order-required { color: #e74c3c; }
.pf-order-optional {
    color: #b0b0b8;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 11px;
    margin-left: 4px;
}

.pf-order-hint {
    margin: -4px 0 4px;
    color: #b0b0b8;
    font-size: 12px;
}
.pf-order-hint.is-error { color: #e74c3c; }

.pf-order-submit {
    margin-top: 6px;
    padding: 13px 20px;
    background: linear-gradient(135deg, #ea5b71 0%, #d04a60 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    box-shadow: 0 4px 16px rgba(234,91,113,0.35);
}
.pf-order-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(234,91,113,0.45);
}
.pf-order-submit:disabled { opacity: 0.7; cursor: not-allowed; }

.pf-order-submit__spin {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    animation: pf-spin 0.7s linear infinite;
}
.pf-order-submit.is-loading .pf-order-submit__spin { display: inline-block; }
.pf-order-submit.is-loading .pf-order-submit__text { opacity: 0.85; }
@keyframes pf-spin {
    to { transform: rotate(360deg); }
}

.pf-order-policy {
    margin: 4px 0 0;
    color: #b0b0b8;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}
.pf-order-policy a { color: #6c6c75; }

.pf-order-success {
    text-align: center;
    padding: 24px 12px;
}
.pf-order-success h3 {
    margin: 12px 0 4px;
    font-size: 20px;
    color: #1a1a1f;
}
.pf-order-success p {
    margin: 0;
    color: #6c6c75;
    font-size: 14px;
}

@media (max-width: 720px) {
    .pf-order-modal { padding: 0; }
    .pf-order-modal__dialog {
        max-width: none;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }
    .pf-order-modal__body {
        grid-template-columns: 1fr;
    }
    .pf-order-modal__preview {
        max-height: 30vh;
    }
    .pf-order-modal__preview img { max-height: 30vh; }
    .pf-order-modal__form {
        padding: 20px 16px 24px;
    }
    .pf-order-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
