/* styles/portfolio.css */

/* ========================
   Variables (Modern, Clean Theme - Consistent)
======================== */
:root {
    --color-bg: #fdfdfd; /* Clean, soft white background */
    --color-primary: #3b82f6; /* Professional Blue */
    --color-secondary: #1d4ed8; /* Darker Blue for gradient depth */
    --color-accent: #60a5fa; /* Lighter Blue for highlights */
    --color-text: #1f2937; /* Dark Gray Text */
    --color-subtext: #4b5563; /* Medium Gray Subtext */
    --color-card-bg: #ffffff; /* Pure white cards */
    --color-border-light: #e5e7eb; /* Light border for separation */
    --color-light-bg: #eff6ff; /* Very light blue background for subtle elements */

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    --border-radius-main: 0.75rem;

    --shadow-subtle: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-button: 0 8px 20px rgba(59, 130, 246, 0.3);
    --shadow-button-hover: 0 12px 30px rgba(59, 130, 246, 0.45);

    --transition-duration: 0.5s;
    --transition-easing: ease-in-out;
}

/* Base Styles */
.portfolio-section {
    position: relative;
    padding: 7rem 1rem;
    background-color: var(--color-bg);
    overflow: hidden;
    font-family: var(--font-body);
    color: var(--color-text);
}

/* Subtle Background Texture */
.portfolio-bg-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

.portfolio-container {
    position: relative;
    z-index: 1;
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4rem; /* Adjusted gap */
    min-height: 85vh;
}

/* Section Header */
.portfolio-header {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 3rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.portfolio-header .section-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
    display: inline-block;
}
.portfolio-header .section-subtitle::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--color-accent);
    border-radius: 2px;
}

.portfolio-header .section-title {
    font-family: var(--font-heading);
    font-size: clamp(2.8rem, 5.8vw, 4.2rem);
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.2;
}

.portfolio-header .section-description {
    font-size: 1.2rem;
    color: var(--color-subtext);
    line-height: 1.7;
    max-width: 750px;
    margin: 0.8rem auto 0 auto;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 3rem;
}

.filter-btn {
    background-color: var(--color-light-bg);
    color: var(--color-subtext);
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--color-border-light);
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
    outline: none;
}

.filter-btn:hover {
    background-color: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.filter-btn.active {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

/* Project Gallery Grid */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Adjusted card size */
    gap: 2.5rem;
}

.project-card {
    background-color: var(--color-card-bg);
    border-radius: var(--border-radius-main);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-subtle);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-duration) var(--transition-easing),
                box-shadow var(--transition-duration) var(--transition-easing),
                border-color var(--transition-duration) var(--transition-easing);
    will-change: transform, box-shadow;
    display: flex;
    flex-direction: column;
}

.project-card:hover,
.project-card:focus-within {
    transform: translateY(-8px) scale(1.01);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-primary);
    outline: none;
}

.project-card img {
    width: 100%;
    height: 200px; /* Fixed height for consistency */
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.project-card:hover img {
    transform: scale(1.05); /* Slight zoom on image */
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 0.5rem;
}

.project-category {
    display: inline-block;
    background-color: var(--color-light-bg);
    color: var(--color-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    align-self: flex-start; /* Align to start */
}

.project-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.project-outcome {
    font-size: 0.95rem;
    color: var(--color-subtext);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    flex-grow: 1; /* Pushes button to bottom */
}
.project-outcome i {
    color: var(--color-accent);
}

.btn-view-details {
    background-color: var(--color-primary);
    color: #fff;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: var(--border-radius-main);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    align-self: flex-start; /* Align to start */
    margin-top: 1rem;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.btn-view-details:hover {
    background-color: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
}

/* Final Call to Action - Consistent */
.final-cta {
    margin-top: 5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.cta-text {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--color-text);
    max-width: 800px;
    line-height: 1.6;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #fff;
    border: none;
    padding: 1.1rem 2.8rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    box-shadow: var(--shadow-button);
    transition: transform var(--transition-duration) var(--transition-easing),
                box-shadow var(--transition-duration) var(--transition-easing);
    will-change: transform, box-shadow;
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-button-hover);
    outline: none;
}
.btn-primary i {
    font-size: 1.1em;
    transition: transform 0.3s ease;
}
.btn-primary:hover i {
    transform: translateX(5px);
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0, 0, 0, 0.6); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--color-card-bg);
    margin: auto;
    padding: 2rem;
    border-radius: var(--border-radius-main);
    box-shadow: var(--shadow-hover);
    max-width: 900px;
    width: 90%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

.modal.active .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-btn {
    color: var(--color-subtext);
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.3s ease;
    outline: none;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--color-primary);
    transform: rotate(90deg);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 80vh; /* Max height for scrollable content */
    overflow-y: auto;
    padding-right: 0.5rem; /* For scrollbar spacing */
}

@media (min-width: 768px) {
    .modal-body {
        flex-direction: row;
        gap: 2rem;
    }
}

.modal-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 0.5rem;
}
@media (min-width: 768px) {
    .modal-image {
        flex: 1;
        max-width: 40%;
        height: auto;
    }
}

.modal-text-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.modal-text-content h3 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    font-weight: 700;
    color: var(--color-text);
}

.modal-category {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
    background-color: var(--color-light-bg);
    padding: 0.3rem 0.8rem;
    border-radius: 0.375rem;
    align-self: flex-start;
}

.modal-description {
    font-size: 1rem;
    color: var(--color-subtext);
    line-height: 1.6;
    flex-grow: 1;
}

.modal-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--color-border-light);
}
.modal-stat-item {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.modal-stat-item i {
    color: var(--color-accent);
}

.modal-testimonial {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--color-light-bg);
    border-left: 4px solid var(--color-primary);
    border-radius: 0.25rem;
    font-style: italic;
    color: var(--color-subtext);
    font-size: 0.9rem;
}

.modal-cta {
    align-self: flex-start;
    margin-top: 1.5rem;
}

/* Animations (Reveal on Scroll) - Consistent */
.reveal-from-bottom,
.reveal-from-right {
    opacity: 0;
    transition: opacity var(--transition-duration) var(--transition-easing),
                transform var(--transition-duration) var(--transition-easing);
    will-change: opacity, transform;
}

.reveal-from-bottom {
    transform: translateY(70px);
}

.reveal-from-right {
    transform: translateX(70px);
}

.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .portfolio-bg-texture {
        animation: none !important;
        background-image: none !important;
    }
    .reveal-from-bottom,
    .reveal-from-right,
    .filter-btn,
    .project-card,
    .project-card img,
    .btn-view-details,
    .btn-primary,
    .modal,
    .modal-content,
    .close-btn {
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
        animation: none !important;
        box-shadow: none !important;
        filter: none !important;
    }
    .modal {
        display: flex !important; /* Always show if active */
    }
    .modal-content {
        opacity: 1 !important;
    }
}

/* Media Queries */
@media (min-width: 1024px) {
    .project-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .project-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    .project-card h3 {
        font-size: 1.35rem;
    }
    .project-outcome {
        font-size: 0.9rem;
    }
}

@media (max-width: 767px) {
    .portfolio-section {
        padding: 5rem 1rem;
    }
    .portfolio-container {
        gap: 3rem;
    }
    .portfolio-header .section-title {
        font-size: clamp(2.2rem, 8vw, 2.8rem);
    }
    .portfolio-header .section-description {
        font-size: 0.95rem;
    }
    .filter-controls {
        gap: 0.6rem;
        margin-bottom: 2rem;
    }
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    .project-gallery {
        grid-template-columns: 1fr;
        gap: 1.8rem;
    }
    .card-content {
        padding: 1.2rem;
        gap: 0.4rem;
    }
    .project-card h3 {
        font-size: 1.25rem;
    }
    .project-outcome {
        font-size: 0.85rem;
    }
    .btn-view-details {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    .final-cta {
        margin-top: 3.5rem;
        gap: 1.5rem;
    }
    .cta-text {
        font-size: 1.1rem;
    }
    .btn-primary {
        padding: 1rem 2rem;
        font-size: 1rem;
        gap: 0.6rem;
    }
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    .modal-body {
        gap: 1rem;
    }
    .modal-text-content h3 {
        font-size: 1.6rem;
    }
    .modal-description {
        font-size: 0.9rem;
    }
    .modal-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    .modal-stat-item {
        font-size: 0.85rem;
    }
    .modal-cta {
        margin-top: 1rem;
    }
}
