/* ==========================================================================
   Portfolio Page - Independent Styles
   ========================================================================== */

/* Portfolio Page Variables */
:root {
    --portfolio-color-background: #0a0a0a;
    --portfolio-color-background-secondary: #111111;
    --portfolio-color-text-primary: #ffffff;
    --portfolio-color-text-secondary: #a0aec0;
    --portfolio-color-text-tertiary: #718096;
    --portfolio-color-border: #2d3748;
    --portfolio-font-main: 'Pretendard', sans-serif;
    --portfolio-transition-fast: all 0.3s ease;
    --portfolio-transition-medium: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ==========================================================================
   Portfolio Custom Cursor
   ========================================================================== */
.portfolio-custom-cursor {
    position: fixed;
    left: 0;
    top: 0;
    pointer-events: none;
    border-radius: 50%;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out,
                width 0.2s ease-out, height 0.2s ease-out;
    z-index: 9999;
    opacity: 0;
}

.portfolio-cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--portfolio-color-text-primary);
    transform: translate(-4px, -4px);
}

.portfolio-cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translate(-20px, -20px);
}

body:hover .portfolio-custom-cursor {
    opacity: 1;
}

/* ==========================================================================
   Portfolio Main Content
   ========================================================================== */
.portfolio-main-content {
    padding-top: 120px;
    background-color: var(--portfolio-color-background);
    color: var(--portfolio-color-text-primary);
    font-family: var(--portfolio-font-main);
    overflow-x: hidden;
}

/* ==========================================================================
   Portfolio Intro Section
   ========================================================================== */
.portfolio-intro {
    text-align: center;
    padding: 4rem 0;
}

.portfolio-intro__title {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.portfolio-intro__description {
    margin-top: 1rem;
    color: var(--portfolio-color-text-secondary);
    font-size: 1.125rem;
    max-width: 50ch;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* ==========================================================================
   Portfolio Filter Navigation
   ========================================================================== */
.portfolio-filter {
    text-align: center;
    padding-bottom: 4rem;
}

.portfolio-filter__nav {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--portfolio-color-border);
    border-radius: 99px;
}

.portfolio-filter__button {
    position: relative;
    background: none;
    border: none;
    color: var(--portfolio-color-text-secondary);
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    cursor: none;
    font-family: inherit;
    font-size: 0.875rem;
    transition: color 0.4s, background-color 0.4s;
}

.portfolio-filter__button.is-active {
    color: var(--portfolio-color-text-primary);
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.1);
}

.portfolio-filter__button:hover:not(.is-active) {
    color: var(--portfolio-color-text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Portfolio Horizontal Gallery Section
   ========================================================================== */
.portfolio-horizontal-gallery {
    position: relative;
    padding-bottom: 2rem;
    width: 100%;
    overflow: hidden;
}

.portfolio-gallery__scroller {
    display: flex;
    gap: 4vw;
    padding: 2rem 4vw;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    scroll-behavior: smooth;
}

.portfolio-gallery__scroller.is-dragging {
    cursor: grabbing;
}

.portfolio-gallery__scroller.is-dragging .portfolio-gallery__slide {
    pointer-events: none;
}

.portfolio-gallery__scroller::-webkit-scrollbar {
    display: none;
}

.portfolio-gallery__slide {
    width: 75vw;
    max-width: 1000px;
    height: 70vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    background-color: #1a202c;
}

.portfolio-gallery__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--portfolio-transition-medium);
}

.portfolio-gallery__slide:hover .portfolio-gallery__image {
    transform: scale(1.05);
}

.portfolio-gallery__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2.5rem 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 70%);
    color: white;
    transform: translateY(0);
    transition: background 0.5s var(--portfolio-transition-medium);
}

.portfolio-gallery__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.portfolio-gallery__category {
    margin-top: 0.5rem;
    color: var(--portfolio-color-text-secondary);
}

.portfolio-gallery__nav {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 1vw;
    pointer-events: none;
    z-index: 10;
}

.portfolio-gallery__arrow {
    pointer-events: auto;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--portfolio-color-border);
    color: var(--portfolio-color-text-primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--portfolio-transition-fast);
    cursor: none;
}

.portfolio-gallery__arrow:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.portfolio-gallery__progress-container {
    width: 50%;
    max-width: 400px;
    height: 2px;
    background-color: var(--portfolio-color-border);
    margin: 3rem auto 0;
    border-radius: 2px;
}

.portfolio-gallery__progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--portfolio-color-text-primary);
    border-radius: 2px;
    transition: width 0.2s linear;
}

/* ==========================================================================
   Portfolio Detail Section
   ========================================================================== */
.portfolio-detail {
    padding: 8rem 0;
    text-align: center;
}

.portfolio-detail__title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 600;
    margin: 0;
}

.portfolio-detail__description {
    margin: 1rem auto 4rem;
    color: var(--portfolio-color-text-secondary);
    max-width: 50ch;
    line-height: 1.7;
}

.portfolio-detail__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.portfolio-detail__item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    aspect-ratio: 1 / 1;
    background-color: #1a202c;
}

.portfolio-detail__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--portfolio-transition-medium);
}

.portfolio-detail__item:hover img {
    transform: scale(1.1);
}

.portfolio-detail__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: white;
    font-size: 0.875rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s, transform 0.4s;
}

.portfolio-detail__item:hover .portfolio-detail__caption {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Portfolio Before & After Section
   ========================================================================== */
.portfolio-ba-section {
    padding: 6rem 0;
    background-color: var(--portfolio-color-background-secondary);
}

.portfolio-section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.portfolio-section-header__title {
    font-size: 2.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

@media (min-width: 768px) {
    .portfolio-section-header__title {
        font-size: 3rem;
    }
}

.portfolio-section-header__description {
    margin-top: 1rem;
    color: var(--portfolio-color-text-secondary);
    max-width: 50ch;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

.portfolio-ba-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.3);
}

.portfolio-ba-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.portfolio-ba-image--before {
    z-index: 1;
}

.portfolio-ba-image--after {
    z-index: 2;
    clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.portfolio-ba-slider {
    position: absolute;
    z-index: 3;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: ew-resize;
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5));
}

.portfolio-ba-slider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
}

.portfolio-ba-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 54px;
    border-radius: 99px;
    background-color: var(--portfolio-color-text-primary);
    border: 2px solid var(--portfolio-color-background-secondary);
    transition: var(--portfolio-transition-fast);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.portfolio-ba-slider:hover .portfolio-ba-handle,
.portfolio-ba-slider.is-dragging .portfolio-ba-handle {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   Portfolio Anatomy Section
   ========================================================================== */
.portfolio-anatomy-section {
    padding: 8rem 0;
}

.portfolio-anatomy-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.portfolio-anatomy-image {
    border-radius: 0.5rem;
    width: 100%;
    height: auto;
    display: block;
}

.portfolio-anatomy-hotspot {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s;
}

.portfolio-anatomy-hotspot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: var(--portfolio-color-text-primary);
    border-radius: 50%;
    transition: transform 0.3s;
}

.portfolio-anatomy-hotspot:hover {
    transform: scale(1.2);
    background-color: rgba(255, 255, 255, 0.4);
}

.portfolio-anatomy-hotspot:hover::after {
    transform: translate(-50%, -50%) scale(1.5);
}

.portfolio-anatomy-hotspot .portfolio-anatomy-tooltip {
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #111;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.375rem;
    width: 280px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, bottom 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.portfolio-anatomy-hotspot:hover .portfolio-anatomy-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: 150%;
}

.portfolio-anatomy-tooltip__title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    margin-top: 0;
}

.portfolio-anatomy-tooltip__text {
    font-size: 0.875rem;
    color: var(--portfolio-color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Hotspot positions */
.portfolio-hotspot-1 {
    top: 35%;
    left: 25%;
}

.portfolio-hotspot-2 {
    top: 60%;
    left: 55%;
}

.portfolio-hotspot-3 {
    top: 75%;
    left: 15%;
}

/* ==========================================================================
   Portfolio Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .portfolio-intro {
        padding: 2rem 1.5rem;
    }

    .portfolio-intro__title {
        font-size: 2rem;
    }

    .portfolio-intro__description {
        font-size: 1rem;
    }

    .portfolio-gallery__slide {
        width: 85vw;
        height: 60vh;
    }

    .portfolio-detail__grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .portfolio-section-header__title {
        font-size: 1.75rem;
    }

    .portfolio-anatomy-tooltip {
        width: 220px;
    }
}

@media (max-width: 640px) {
    .portfolio-filter__nav {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .portfolio-filter__button {
        padding: 0.375rem 1rem;
        font-size: 0.75rem;
    }

    .portfolio-gallery__arrow {
        width: 40px;
        height: 40px;
    }

    .portfolio-ba-container {
        aspect-ratio: 4 / 3;
    }
}