/* ==========================================================================
   Awwwards-quality Portfolio Showcase Style Sheet
   Inspired by Apple, Stripe, and Linear
   ========================================================================== */

/* Grid and Glow Variables */
:root {
    --portfolio-bg: #050212;
    --portfolio-border: rgba(168, 85, 247, 0.15);
    --portfolio-border-hover: rgba(168, 85, 247, 0.35);
    --portfolio-text-primary: #ffffff;
    --portfolio-text-secondary: rgba(255, 255, 255, 0.85);
    --portfolio-accent: #a78bfa;
    --portfolio-accent-glow: rgba(168, 85, 247, 0.25);
    --portfolio-card-bg: rgba(255, 255, 255, 0.03);
    --portfolio-card-glow: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0), rgba(168, 85, 247, 0.1), transparent 40%);
}

:root[data-theme="light"],
body.light-theme {
    --portfolio-bg: #ffffff;
    --portfolio-border: rgba(168, 85, 247, 0.08);
    --portfolio-border-hover: rgba(168, 85, 247, 0.18);
    --portfolio-text-primary: #0f172a;
    --portfolio-text-secondary: #581c87;
    --portfolio-accent: #8b5cf6;
    --portfolio-accent-glow: rgba(139, 92, 246, 0.15);
    --portfolio-card-bg: rgba(255, 255, 255, 0.85);
    --portfolio-card-glow: radial-gradient(800px circle at var(--mouse-x, 0) var(--mouse-y, 0), rgba(139, 92, 246, 0.03), transparent 40%);
}

/* SECTION STRUCTURE */
.portfolio-showcase-section,
.portfolio-hero-section,
.portfolio-detail-section {
    position: relative;
    padding: 100px 0;
    background-color: var(--portfolio-bg);
    overflow: hidden;
    color: var(--portfolio-text-primary);
}

.portfolio-hero-section {
    padding-top: 160px;
    min-height: 50vh;
    display: flex;
    align-items: center;
}

/* Decorative Glows */
.hero-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}
.hero-glow-1 {
    top: -10%;
    left: -10%;
}
.hero-glow-2 {
    bottom: -10%;
    right: -10%;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center;
    pointer-events: none;
    z-index: 1;
    mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 70%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 70%, transparent 100%);
}

/* Hero Content */
.portfolio-hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin-bottom: 60px;
}

.portfolio-hero-content .hero-title {
    font-size: clamp(2.5rem, 5vw, 4.2rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #ffffff 30%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.portfolio-hero-content .subtitle {
    font-size: 1.15rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.88) !important;
}

/* Filters */
.portfolio-filters {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 48px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--portfolio-border);
}

.filter-pill {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--portfolio-text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--portfolio-border);
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-pill:hover, 
.filter-pill.active {
    color: var(--portfolio-text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* MASONRY GRID LAYOUT */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 32px;
    position: relative;
    z-index: 2;
}

/* CARDS */
.portfolio-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: var(--portfolio-card-bg);
    border: 1px solid var(--portfolio-border);
    transition: border-color 0.5s ease, box-shadow 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card-featured {
    grid-column: span 8;
}

.card-small {
    grid-column: span 4;
}

/* Mouse hover shine tracking */
.portfolio-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--portfolio-card-glow);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2;
    pointer-events: none;
}

.portfolio-card:hover::before {
    opacity: 1;
}

.portfolio-card:hover {
    border-color: var(--portfolio-border-hover);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), 0 0 50px 0 var(--portfolio-accent-glow);
    transform: translateY(-8px);
}

.portfolio-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.portfolio-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* CARD MEDIA */
.portfolio-image-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
    background: #090d16;
}

/* Image zoom effect */
.portfolio-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    filter: brightness(0.9) contrast(1.05);
}

.portfolio-card:hover .portfolio-image {
    transform: scale(1.06);
    filter: brightness(1.02) contrast(1.02);
}

.portfolio-card-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(15, 23, 42, 0.9) 100%);
    pointer-events: none;
    z-index: 1;
}

.portfolio-placeholder-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: var(--portfolio-text-secondary);
    gap: 12px;
}

.portfolio-placeholder-img i {
    font-size: 2.5rem;
}

/* CARD CONTENT */
.portfolio-card-meta {
    padding: 32px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    border-top: 1px solid var(--portfolio-border);
    position: relative;
    z-index: 3;
}

.meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.portfolio-category {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--portfolio-accent);
}

.portfolio-client {
    font-size: 0.8rem;
    color: var(--portfolio-text-secondary);
    font-family: monospace;
}

.portfolio-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    transition: color 0.3s ease;
}

.portfolio-card:hover .portfolio-title {
    color: #ffffff;
}

.portfolio-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 24px;
}

/* Technologies Tag List */
.portfolio-technologies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.tech-tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    padding: 4px 12px;
    border-radius: 6px;
}

/* Action Trigger */
.portfolio-action {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
}

.action-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--portfolio-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.portfolio-card:hover .action-circle {
    background: #ffffff;
    color: var(--portfolio-bg);
    transform: translate(4px, -4px) rotate(45deg);
}

/* EMPTY STATE */
.portfolio-empty-state {
    grid-column: span 12;
    text-align: center;
    padding: 80px 20px;
    border: 1px dashed var(--portfolio-border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.01);
}

.empty-icon {
    font-size: 3rem;
    color: var(--portfolio-text-secondary);
    margin-bottom: 20px;
}

/* ==========================================================================
   PORTFOLIO DETAIL PAGE
   ========================================================================== */
.portfolio-detail-header {
    margin-bottom: 60px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--portfolio-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 32px;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #ffffff;
}

.detail-title {
    font-size: clamp(2.2rem, 6vw, 3.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-top: 16px;
}

.header-meta-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.detail-category {
    color: var(--portfolio-accent);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.detail-client {
    color: var(--portfolio-text-secondary);
    font-family: monospace;
    font-size: 0.9rem;
}

/* Detail Hero Layout */
.detail-hero-layout {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 40px;
    margin-bottom: 60px;
}

.hero-main-media {
    grid-column: span 8;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--portfolio-border);
    background: #090d16;
}

.detail-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}

.detail-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-placeholder {
    height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--portfolio-text-secondary);
}

/* Sidebar specs */
.detail-specs-sidebar {
    grid-column: span 4;
}

.specs-card {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid var(--portfolio-border);
    padding: 32px;
    border-radius: 24px;
    position: sticky;
    top: 100px;
}

.spec-item {
    margin-bottom: 24px;
}

.spec-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--portfolio-text-secondary);
    margin-bottom: 8px;
}

.spec-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.tech-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.spec-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}

.spec-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Detail Story Layout */
.detail-body-layout {
    max-width: 800px;
    margin-bottom: 80px;
}

.detail-story h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 24px;
}

.story-content {
    font-size: 1.1rem;
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.92) !important;
}

.story-content p {
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.90) !important;
}

.detail-divider {
    border: 0;
    height: 1px;
    background: var(--portfolio-border);
    margin: 80px 0;
}

/* Related header */
.related-header {
    margin-bottom: 40px;
}

.related-header h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.related-header p {
    color: var(--portfolio-text-secondary);
}

/* ==========================================================================
   GSAP & RESPONSIVE ANOMALIES
   ========================================================================== */
.gsap-reveal {
    opacity: 0;
    transform: translateY(40px);
}

/* RESPONSIVE LAYOUT BREAKPOINTS */
@media screen and (max-width: 1024px) {
    .card-featured {
        grid-column: span 12;
    }
    
    .card-small {
        grid-column: span 6;
    }
    
    .hero-main-media {
        grid-column: span 12;
    }
    
    .detail-specs-sidebar {
        grid-column: span 12;
    }
}

@media screen and (max-width: 768px) {
    .portfolio-grid {
        gap: 20px;
    }
    
    .card-small {
        grid-column: span 12;
    }
    
    .portfolio-filters {
        gap: 8px;
    }
    
    .filter-pill {
        padding: 8px 18px;
        font-size: 0.8rem;
    }
    
    .portfolio-hero-section {
        padding-top: 120px;
    }
}

/* ==========================================================================
   LIGHT THEME CONTRAST & VISIBILITY OVERRIDES
   ========================================================================== */
:root[data-theme="light"] .portfolio-showcase-section,
:root[data-theme="light"] .portfolio-hero-section,
:root[data-theme="light"] .portfolio-detail-section,
body.light-theme .portfolio-showcase-section,
body.light-theme .portfolio-hero-section,
body.light-theme .portfolio-detail-section {
    background-color: #f8fafc !important;
    color: #0f172a !important;
}

:root[data-theme="light"] .portfolio-hero-content .hero-title,
body.light-theme .portfolio-hero-content .hero-title {
    background: linear-gradient(135deg, #0f172a 30%, #475569 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

:root[data-theme="light"] .portfolio-hero-content .subtitle,
body.light-theme .portfolio-hero-content .subtitle {
    color: #475569 !important;
}

/* Card Styling in Light Mode */
:root[data-theme="light"] .portfolio-card,
body.light-theme .portfolio-card {
    background: #ffffff !important;
    border: 1.5px solid rgba(139, 92, 246, 0.15) !important;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    border-radius: 20px !important;
}

:root[data-theme="light"] .portfolio-card:hover,
body.light-theme .portfolio-card:hover {
    border-color: rgba(139, 92, 246, 0.4) !important;
    box-shadow: 0 20px 45px rgba(139, 92, 246, 0.18) !important;
    transform: translateY(-8px) !important;
}

:root[data-theme="light"] .portfolio-card-glow,
body.light-theme .portfolio-card-glow {
    background: linear-gradient(to bottom, transparent 75%, rgba(15, 23, 42, 0.08) 100%) !important;
}

:root[data-theme="light"] .portfolio-card-meta,
body.light-theme .portfolio-card-meta {
    border-top: 1px solid rgba(139, 92, 246, 0.12) !important;
}

:root[data-theme="light"] .portfolio-category,
body.light-theme .portfolio-category {
    color: #8b5cf6 !important;
}

:root[data-theme="light"] .portfolio-client,
body.light-theme .portfolio-client {
    color: #64748b !important;
}

:root[data-theme="light"] .portfolio-title,
body.light-theme .portfolio-title {
    color: #0f172a !important;
}

:root[data-theme="light"] .portfolio-card:hover .portfolio-title,
body.light-theme .portfolio-card:hover .portfolio-title {
    color: #8b5cf6 !important;
}

/* FIX INVISIBLE DESCRIPTION TEXT IN LIGHT MODE */
:root[data-theme="light"] .portfolio-desc,
body.light-theme .portfolio-desc {
    color: #475569 !important;
}

/* Tech tags in Light Mode */
:root[data-theme="light"] .tech-tag,
body.light-theme .tech-tag {
    color: #475569 !important;
    background: #f1f5f9 !important;
    border: 1px solid rgba(139, 92, 246, 0.15) !important;
}

/* Action button in Light Mode */
:root[data-theme="light"] .portfolio-action,
body.light-theme .portfolio-action {
    color: #0f172a !important;
}

:root[data-theme="light"] .action-circle,
body.light-theme .action-circle {
    background: rgba(139, 92, 246, 0.1) !important;
    border-color: rgba(139, 92, 246, 0.25) !important;
    color: #8b5cf6 !important;
}

:root[data-theme="light"] .portfolio-card:hover .action-circle,
body.light-theme .portfolio-card:hover .action-circle {
    background: #8b5cf6 !important;
    border-color: #8b5cf6 !important;
    color: #ffffff !important;
}

/* Filter pills in Light Mode */
:root[data-theme="light"] .filter-pill,
body.light-theme .filter-pill {
    color: #475569 !important;
    background: #ffffff !important;
    border: 1.5px solid rgba(139, 92, 246, 0.15) !important;
}

:root[data-theme="light"] .filter-pill:hover,
:root[data-theme="light"] .filter-pill.active,
body.light-theme .filter-pill:hover,
body.light-theme .filter-pill.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    border-color: transparent !important;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.25) !important;
}

:root[data-theme="light"] .spec-value,
body.light-theme .spec-value {
    color: #0f172a !important;
}

:root[data-theme="light"] .back-link:hover,
body.light-theme .back-link:hover {
    color: #8b5cf6 !important;
}

/* ==========================================================================
   PORTFOLIO CTA SECTION & CTA BOX
   ========================================================================== */
.portfolio-cta-section {
    padding: 80px 20px;
    background-color: var(--portfolio-bg);
}

.cta-box {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 74px 30px;
    border-radius: 38px;
    background: linear-gradient(135deg, #050212 0%, #0f0724 55%, #0c051a 100%);
    border: 1px solid var(--portfolio-border);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
}

.cta-box::before {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    top: -100px;
    right: -60px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.08);
    filter: blur(40px);
}

.cta-box::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    bottom: -100px;
    left: -50px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.05);
    filter: blur(40px);
}

.cta-box .section-tag {
    position: relative;
    z-index: 1;
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.20);
    color: var(--portfolio-text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 22px;
}

.cta-box h2 {
    position: relative;
    z-index: 1;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.cta-box p {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto 32px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.05rem;
    line-height: 1.6;
}

.cta-box .btn-group {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Light Theme overrides for cta-box */
body.light-theme .cta-box {
    background: var(--portfolio-card-bg) !important;
    border-color: var(--portfolio-border) !important;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.06) !important;
}

body.light-theme .cta-box h2 {
    color: var(--portfolio-text-primary) !important;
}

body.light-theme .cta-box p {
    color: #4b5563 !important;
}

body.light-theme .cta-box .section-tag {
    background: rgba(139, 92, 246, 0.06) !important;
    border-color: rgba(139, 92, 246, 0.15) !important;
    color: var(--portfolio-accent) !important;
}
