/* Portfolio-specific fixes */

/* Add container constraints to portfolio section content */
.portfolio-section .featured-project,
.portfolio-section .subhead-cluster,
.portfolio-section .integrated-grid,
.portfolio-section .integrated-cta {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Fix for container on smaller screens */
@media (max-width: 768px) {

    .portfolio-section .featured-project,
    .portfolio-section .subhead-cluster,
    .portfolio-section .integrated-grid,
    .portfolio-section .integrated-cta {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Fix for project cards */
.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(140deg, rgba(0, 25, 32, 0.55), rgba(0, 40, 46, 0.35));
    border: 1px solid rgba(0, 255, 255, 0.18);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 6px 22px -8px rgba(0, 0, 0, 0.7);
    transition: 0.45s cubic-bezier(0.16, 0.8, 0.3, 1);
    min-height: 100%;
    margin-bottom: 1.5rem;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 255, 255, 0.4);
    box-shadow: 0 18px 38px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(0, 255, 255, 0.35);
}

/* Fix for project badges */
.project-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, var(--secondary), #7dffff);
    color: #003034;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 0.38rem 0.68rem 0.34rem;
    border-radius: 40px;
    text-transform: uppercase;
    box-shadow: 0 0 0 1px rgba(0, 255, 255, 0.55), 0 4px 12px -4px rgba(0, 255, 255, 0.55);
    z-index: 1;
}

/* Card image container */
.card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #021b20;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
    transition: 1s cubic-bezier(0.16, 0.8, 0.3, 1);
    filter: contrast(1.05) saturate(1.06);
}

.project-card:hover .card-img img {
    transform: scale(1.16) rotate(0.6deg);
}

/* Card body/content */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.15rem 1.15rem 1.35rem;
    flex: 1;
}

.card-title {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    background: linear-gradient(90deg, #fff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Fix for project grid */
.projects-shell {
    --gap: 2rem;
    max-width: 1300px !important;
    margin: 0 auto !important;
    padding: 0 2rem !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: var(--gap) !important;
    min-height: auto !important;
    height: auto !important;
    align-items: start !important;
}

/* Prevent excessive spacing after recent projects */
.projects-shell::after,
.recent-grid::after,
.integrated-grid::after {
    content: none !important;
    display: none !important;
}

/* Ensure all grid containers have proper height constraints */
.portfolio-section > * {
    min-height: auto !important;
    height: auto !important;
}

.recent-grid {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--gap);
    margin-bottom: 1.5rem;
}

/* Recent section header */
.section-subheader {
    grid-column: 1/-1;
    margin: 1rem 0 0.25rem;
}

.section-subheader h3 {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.section-subheader h3:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 70px;
    height: 3px;
    background: var(--secondary);
    border-radius: 2px;
}

/* Main portfolio section */
.portfolio-section {
    background: linear-gradient(to bottom, #111922, #0d1419);
    padding: 4rem 0 5rem;
}

/* Fix for featured project */
.featured-project {
    position: relative;
    background: rgba(0, 20, 40, 0.3);
    border-radius: 16px;
    border: 1px solid rgba(0, 255, 255, 0.15);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    margin-bottom: 3rem;
    transition: all 0.4s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.featured-project:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 255, 255, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* FIX: Add styles for the proj-card and pc-* classes */
.proj-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(140deg, rgba(0, 25, 32, 0.55), rgba(0, 40, 46, 0.35));
    border: 1px solid rgba(0, 255, 255, 0.18);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 6px 22px -8px rgba(0, 0, 0, 0.7);
    transition: 0.45s cubic-bezier(0.16, 0.8, 0.3, 1);
    min-height: 100%;
    margin-bottom: 1.5rem;
}

.proj-card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 255, 255, 0.4);
    box-shadow: 0 18px 38px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(0, 255, 255, 0.35);
}

.pc-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #021b20;
}

.pc-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
    transition: 1s cubic-bezier(0.16, 0.8, 0.3, 1);
    filter: contrast(1.05) saturate(1.06);
}

.proj-card:hover .pc-media img {
    transform: scale(1.16) rotate(0.6deg);
}

.pc-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, var(--secondary), #7dffff);
    color: #003034;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 0.38rem 0.68rem 0.34rem;
    border-radius: 40px;
    text-transform: uppercase;
    box-shadow: 0 0 0 1px rgba(0, 255, 255, 0.55), 0 4px 12px -4px rgba(0, 255, 255, 0.55);
    z-index: 1;
}

.pc-badge.finalizing {
    background: linear-gradient(135deg, #ffaa00, #ffcc44);
    color: #2d1800;
    box-shadow: 0 0 0 1px rgba(255, 170, 0, 0.55), 0 4px 12px -4px rgba(255, 170, 0, 0.55);
    animation: pulse-finalizing 2s ease-in-out infinite;
}

@keyframes pulse-finalizing {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.pc-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.15rem 1.15rem 1.35rem;
    flex: 1;
}

.pc-body h4 {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    background: linear-gradient(90deg, #fff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pc-text {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.pc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.pc-link {
    display: block;
    margin-top: auto;
    text-align: right;
    color: var(--secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.pc-link.disabled {
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    pointer-events: none;
}

.pc-link.disabled:hover {
    color: rgba(255, 255, 255, 0.4);
}

/* Integrated grid */
.integrated-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    gap: 2rem !important;
    margin-bottom: 3rem !important;
    min-height: auto !important;
    height: auto !important;
    justify-content: center !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Fix for grid items to prevent excessive height */
.integrated-grid > * {
    align-self: start !important;
    height: auto !important;
    min-height: auto !important;
}

/* Ensure grid container doesn't expand unnecessarily */
.portfolio-section .integrated-grid {
    overflow: hidden;
    max-height: none !important;
}

/* Subhead cluster */
.subhead-cluster {
    margin-bottom: 2rem;
}

.subhead-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.glow-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: var(--secondary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--secondary);
}

.subhead-note {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    margin: 0.5rem 0 0;
}

/* Enhanced CTA section styling */
.integrated-cta {
    position: relative;
    background: linear-gradient(135deg, rgba(0, 38, 46, 0.85), rgba(0, 20, 30, 0.95));
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    padding: 3rem;
    text-align: center;
    box-shadow: 0 15px 40px -10px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    overflow: hidden;
    z-index: 1;
    margin: 4rem auto 2rem;
}

.integrated-cta::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: url(../img/grid-pattern.svg) center/cover;
    opacity: 0.04;
    z-index: -1;
}

.integrated-cta::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--secondary), transparent);
}

.integrated-cta h3 {
    font-size: 2.2rem;
    margin: 0 0 1rem;
    background: linear-gradient(90deg, #ffffff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.integrated-cta p {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.85);
    max-width: 700px;
    margin: 0 auto 2rem;
    line-height: 1.5;
}

.cta-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.cta-actions .btn-primary,
.cta-actions .btn-outline {
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 220px;
}

.cta-actions .btn-primary {
    background: linear-gradient(135deg, #00E5FF, #00BFFF);
    color: #00172D;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.cta-actions .btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.5);
    background: linear-gradient(135deg, #00F5FF, #00CFFF);
}

.cta-actions .btn-outline {
    background: rgba(0, 28, 40, 0.3);
    color: #00E5FF;
    border: 2px solid #00C3D8;
    backdrop-filter: blur(5px);
}

.cta-actions .btn-outline:hover {
    background: rgba(0, 255, 255, 0.15);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.3);
    border-color: #00E5FF;
}

.cta-actions .btn-primary i,
.cta-actions .btn-outline i {
    font-size: 0.9rem;
}

/* Improved CTA section styling */
.integrated-cta {
    padding: 3.5rem;
    border-width: 2px;
}

.integrated-cta h3 {
    font-size: 2.4rem;
    margin-bottom: 1.2rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.integrated-cta p {
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    max-width: 760px;
    line-height: 1.6;
}

@media (max-width: 992px) {
    .featured-project {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .integrated-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .projects-shell {
        padding: 0 1rem;
    }

    .section-subheader h3 {
        font-size: 1.3rem;
    }

    .card-title,
    .pc-body h4 {
        font-size: 1.1rem;
    }

    .subhead-title {
        font-size: 1.5rem;
    }

    .integrated-cta {
        padding: 2.5rem 1.5rem;
        margin: 3rem auto 1.5rem;
    }

    .integrated-cta h3 {
        font-size: 1.8rem;
    }

    .integrated-cta p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .cta-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .cta-actions .btn-primary,
    .cta-actions .btn-outline {
        width: 100%;
        text-align: center;
        padding: 0.9rem 1.5rem;
    }
}

@media (max-width: 576px) {
    .integrated-grid {
        grid-template-columns: 1fr !important;
        margin-bottom: 2rem !important;
        padding-bottom: 0 !important;
    }
    
    /* Fix for mobile spacing issues - prevent phantom space */
    .projects-shell,
    .recent-grid,
    .integrated-grid {
        margin-bottom: 2rem !important;
        padding-bottom: 0 !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    /* Remove any phantom spacing on mobile */
    .portfolio-section {
        padding-bottom: 3rem !important;
        min-height: auto !important;
        height: auto !important;
        overflow: hidden;
    }
    
    /* Ensure grid containers don't expand unnecessarily on mobile */
    .portfolio-section .integrated-grid,
    .portfolio-section .recent-grid,
    .portfolio-section .projects-shell {
        max-height: none !important;
        overflow: visible;
    }
}

/* Mobile responsive fixes for tech stack badges */
@media (max-width: 768px) {
    .tech-stack {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.8rem !important;
        max-width: 100% !important;
    }
    
    .tech-card {
        height: 90px !important;
    }
    
    .tech-front span {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .tech-front i {
        font-size: 1.6rem !important;
        margin-bottom: 0.3rem !important;
    }
    
    .tech-back .exp {
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        text-align: center !important;
        line-height: 1.2 !important;
    }
}

@media (max-width: 576px) {
    .tech-stack {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
        padding: 0 1rem !important;
    }
    
    .tech-card {
        height: 85px !important;
    }
    
    .tech-front span {
        font-size: 0.75rem !important;
        padding: 0 0.2rem !important;
        white-space: normal !important;
        word-break: break-word !important;
        text-overflow: unset !important;
        overflow: visible !important;
        line-height: 1.1 !important;
    }
    
    .tech-front i {
        font-size: 1.4rem !important;
        margin-bottom: 0.2rem !important;
    }
    
    .tech-back .exp {
        font-size: 0.8rem !important;
        line-height: 1.1 !important;
    }
}

@media (max-width: 480px) {
    .tech-stack {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
        padding: 0 0.5rem !important;
    }
    
    .tech-card {
        height: 80px !important;
    }
    
    .tech-front span {
        font-size: 0.7rem !important;
        font-weight: 600 !important;
        padding: 0 0.1rem !important;
        line-height: 1 !important;
    }
    
    .tech-front i {
        font-size: 1.2rem !important;
        margin-bottom: 0.1rem !important;
    }
    
    .tech-back .exp {
        font-size: 0.75rem !important;
        line-height: 1 !important;
    }
}