/* ============================================================
   PORTFOLIO PAGE
   Подключать после основного style.css
============================================================ */

/* --- Hero --- */
.pf-hero {
    position: relative;
    overflow: hidden;
    padding: 180px 0 90px;
}

.pf-hero-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
            linear-gradient(rgba(123,97,255,0.18) 1px, transparent 1px),
            linear-gradient(90deg, rgba(123,97,255,0.18) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 60%, black 10%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 60%, black 10%, transparent 70%);
    pointer-events: none;
}

.pf-hero-nebula {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(123,97,255,0.22) 0%, transparent 60%);
    filter: blur(80px);
    pointer-events: none;
}

.pf-hero-inner { max-width: 700px; }

/* --- Projects Section --- */
.pf-projects { padding: 0 0 130px; }

/* --- Grid --- */
.pf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* --- Card --- */
.pf-card {
    border-radius: 28px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    overflow: hidden;
    transition: .45s var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.pf-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, rgba(123,97,255,0.4), transparent, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: .45s ease;
    pointer-events: none;
}

.pf-card:hover {
    transform: translateY(-8px);
    border-color: rgba(123,97,255,0.3);
    box-shadow: 0 24px 70px rgba(0,0,0,0.5), 0 0 80px rgba(123,97,255,0.1);
}

.pf-card:hover::before { opacity: 1; }

/* --- Thumbnail wrap --- */
.pf-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.pf-thumb-wrap a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.pf-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    opacity: 0.82;
    transition: transform .6s var(--transition), opacity .3s ease;
}

.pf-card:hover .pf-thumb-wrap img {
    transform: scale(1.04);
    opacity: 1;
}

/* Иконка зума */
.pf-zoom-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.8);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity .3s ease, transform .3s ease;
}

.pf-card:hover .pf-zoom-icon {
    opacity: 1;
    transform: scale(1);
}

/* Плейсхолдер */
.pf-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(123,97,255,0.1), transparent 70%);
    font-size: 48px;
    color: rgba(123,97,255,0.2);
}

/* --- Card body --- */
.pf-card-body {
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

.pf-card-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.25;
}

.pf-card-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
}

.pf-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    transition: color .25s ease, gap .25s ease;
    width: fit-content;
}

.pf-link:hover { color: var(--accent-hover); gap: 12px; }

.pf-link-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    border: 1px solid currentColor;
    font-size: 11px;
    flex-shrink: 0;
    transition: transform .25s ease;
}

.pf-link:hover .pf-link-arrow { transform: translate(2px, -2px); }

/* --- Empty state --- */
.pf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 100px 0;
    text-align: center;
}

.pf-empty-icon { font-size: 48px; color: rgba(123,97,255,0.25); }
.pf-empty-text { font-size: 18px; color: var(--text-secondary); }

/* ============================================================
   LIGHTBOX
============================================================ */
#pf-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

/* Затемнённый фон */
#pf-lb-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: zoom-out;
}

/* Обёртка картинки */
#pf-lb-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px;
    pointer-events: none; /* клики проходят насквозь к фону, кроме img */
    min-height: 100%;
}

#pf-lb-img {
    display: block;
    max-width: min(90vw, 1200px);
    max-height: 82vh;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 30px 90px rgba(0,0,0,0.6);
    cursor: zoom-in;
    transition: transform .35s ease;
    pointer-events: auto;
    object-fit: contain;
}

#pf-lb-img.zoomed {
    max-width: min(98vw, 2400px);
    max-height: none;
    cursor: zoom-out;
}

/* Подпись */
#pf-lb-caption {
    pointer-events: none;
    color: rgba(255,255,255,0.55);
    font-size: 14px;
    letter-spacing: 0.02em;
    text-align: center;
}

/* Крестик закрытия */
#pf-lb-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, color .2s ease;
}

#pf-lb-close:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

/* Стрелки */
#pf-lb-prev,
#pf-lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.85);
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, color .2s ease, transform .2s ease;
    line-height: 1;
}

#pf-lb-prev { left: 20px; }
#pf-lb-next { right: 20px; }

#pf-lb-prev:hover {
    background: rgba(123,97,255,0.25);
    border-color: rgba(123,97,255,0.4);
    color: #fff;
    transform: translateY(-50%) translateX(-2px);
}

#pf-lb-next:hover {
    background: rgba(123,97,255,0.25);
    border-color: rgba(123,97,255,0.4);
    color: #fff;
    transform: translateY(-50%) translateX(2px);
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1024px) {
    .pf-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .pf-hero { padding: 140px 0 60px; }
    .pf-projects { padding: 0 0 80px; }
    .pf-grid { grid-template-columns: 1fr; gap: 16px; }
    .pf-card:hover { transform: none; }
    .pf-zoom-icon { opacity: 1; transform: scale(1); }
    .pf-card-body { padding: 20px 22px 24px; }
    .pf-card-title { font-size: 18px; }

    #pf-lb-prev { left: 8px; }
    #pf-lb-next { right: 8px; }
    #pf-lb-prev,
    #pf-lb-next { width: 42px; height: 42px; font-size: 22px; }
}

@media (max-width: 480px) {
    .pf-card-body { padding: 16px 18px 20px; }
}

/* Убираем стрелки если только один проект */
#pf-lightbox.single #pf-lb-prev,
#pf-lightbox.single #pf-lb-next { display: none; }
#pf-lightbox.zoomed-mode {
    align-items: flex-start;
}