/* ===================================
   Portfolio Page Specific Styles
   =================================== */

/* Portfolio Header */
.portfolio-header {
    padding-top: calc(64px + var(--spacing-3xl));
    padding-bottom: var(--spacing-2xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.portfolio-header-content {
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-lg);
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--accent-primary);
}

.back-link svg {
    width: 16px;
    height: 16px;
}

.portfolio-header h1 {
    margin-bottom: var(--spacing-sm);
    font-size: clamp(2rem, 5vw, 3rem);
}

.portfolio-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Project Section */
.project-section {
    padding: var(--spacing-3xl) 0;
    border-bottom: 1px solid var(--border-color);
}

.project-section.alt {
    background: var(--bg-secondary);
}

.project-section:last-of-type {
    border-bottom: none;
}

/* Project Layout */
.project-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
    align-items: start;
}

.project-layout.reverse {
    direction: rtl;
}

.project-layout.reverse > * {
    direction: ltr;
}

/* Project Info */
.project-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.project-header {
    margin-bottom: var(--spacing-md);
}

/* Project Header with Icon */
.project-header-top {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg);
}

.project-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.project-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--accent-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-badge.team {
    background: #34C759;
}

.project-badge-dev {
    background: #FF9500;
}

.project-badge-macos {
    background: #8E8E93;
}

.project-badge-row {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.project-badge-row .project-badge {
    margin-bottom: 0;
}

/* ===================================
   macOS Project Section (Full-width layout)
   =================================== */

.project-section-mac .project-mac-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.project-section-mac .project-header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
}

.project-section-mac .project-header-top > div {
    text-align: left;
}

.project-mac-gallery {
    margin-bottom: var(--spacing-2xl);
}

.project-mac-gallery .gallery-slider {
    max-width: 100%;
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.project-mac-gallery .gallery-main {
    width: 100%;
}

.project-mac-gallery .gallery-image {
    width: 100%;
    display: block;
    transition: opacity 0.2s ease;
}

.project-mac-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-2xl);
}

.project-mac-story h3,
.project-mac-features h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.project-mac-story p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--spacing-md);
}

@media (max-width: 768px) {
    .project-section-mac .project-header-top {
        flex-direction: column;
        text-align: center;
    }

    .project-section-mac .project-header-top > div {
        text-align: center;
    }

    .project-badge-row {
        justify-content: center;
    }

    .project-mac-details-grid {
        grid-template-columns: 1fr;
    }

    .project-mac-gallery .gallery-slider {
        aspect-ratio: auto;
    }
}

.project-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.project-tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.project-role {
    font-size: 0.9rem;
    color: var(--accent-primary);
    font-weight: 500;
}

/* Project Story */
.project-story h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.project-story p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* Project Features */
.project-features h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.feature-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.feature-list li div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feature-list li strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.feature-list li span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Tech Detail */
.project-tech-detail h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
}

.tech-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
}

.tech-detail-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
}

.project-section.alt .tech-detail-item {
    background: var(--bg-tertiary);
}

.tech-detail-item h4 {
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.tech-detail-item ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.tech-detail-item li {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Project Highlight */
.project-highlight h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
}

.highlight-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

.project-section.alt .highlight-card {
    background: var(--bg-tertiary);
}

.highlight-card h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.highlight-card p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* Project Gallery */
.project-gallery {
    position: sticky;
    top: calc(64px + var(--spacing-xl));
}

.gallery-placeholder {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    aspect-ratio: 9/16;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    color: var(--text-tertiary);
}

.gallery-placeholder svg {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.gallery-placeholder span {
    font-size: 1rem;
    font-weight: 500;
}

.gallery-placeholder small {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Gallery Slider */
.gallery-slider {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.gallery-main {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.gallery-main img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.2s ease;
}

/* Gallery Arrows */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), transform var(--transition-fast);
    z-index: 10;
}

.gallery-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.gallery-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-arrow svg {
    width: 24px;
    height: 24px;
}

.gallery-prev {
    left: var(--spacing-md);
}

.gallery-next {
    right: var(--spacing-md);
}

/* Gallery Indicator */
.gallery-indicator {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: var(--spacing-sm) 0;
}

.gallery-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* Hidden sources container */
.gallery-sources {
    display: none;
}

/* Gallery Error State */
.gallery-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-2xl);
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    min-height: 200px;
}

.gallery-error svg {
    opacity: 0.5;
}

.gallery-error span {
    font-size: 0.9rem;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 1024px) {
    .project-layout {
        grid-template-columns: 1fr;
        gap: var(--spacing-2xl);
    }

    .project-layout.reverse {
        direction: ltr;
    }

    .project-gallery {
        position: static;
        order: -1;
    }

    .gallery-placeholder {
        aspect-ratio: 16/9;
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .portfolio-header {
        padding-top: calc(64px + var(--spacing-2xl));
    }

    .project-section {
        padding: var(--spacing-2xl) 0;
    }

    .tech-detail-grid {
        grid-template-columns: 1fr;
    }

    .gallery-placeholder {
        aspect-ratio: 4/3;
        max-height: 300px;
    }

    .project-icon {
        width: 64px;
        height: 64px;
    }

    .gallery-arrow {
        width: 40px;
        height: 40px;
    }

    .gallery-arrow svg {
        width: 20px;
        height: 20px;
    }

    .gallery-prev {
        left: var(--spacing-sm);
    }

    .gallery-next {
        right: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .feature-list li {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .feature-icon {
        font-size: 1.25rem;
    }
}

/* ===================================
   Animation Enhancements
   =================================== */

.project-section .reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.project-section .reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger effect for project sections */
.project-info.reveal.active {
    animation: slideInLeft 0.6s ease forwards;
}

.project-gallery.reveal.active {
    animation: slideInRight 0.6s ease forwards;
}

.project-layout.reverse .project-info.reveal.active {
    animation: slideInRight 0.6s ease forwards;
}

.project-layout.reverse .project-gallery.reveal.active {
    animation: slideInLeft 0.6s ease forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile: disable slide animations, use fade only */
@media (max-width: 1024px) {
    .project-info.reveal.active,
    .project-gallery.reveal.active,
    .project-layout.reverse .project-info.reveal.active,
    .project-layout.reverse .project-gallery.reveal.active {
        animation: fadeInUp 0.6s ease forwards;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
