/* ===== SCROLL ANIMATIONS ===== */
.project-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-action-container {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.modal-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #354c6b 0%, #2d3748 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(53, 76, 107, 0.3);
    position: relative;
    overflow: hidden;
}

.modal-action-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.modal-action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(53, 76, 107, 0.4);
}

.modal-action-button:hover::before {
    left: 100%;
}

.modal-action-button:active {
    transform: translateY(0);
}

.modal-button-icon {
   width: 20px;
   height: 20px;
   transition: transform 0.3s ease;
}

.modal-action-button:hover .modal-button-icon {
   transform: translate(4px, -4px);
}

/* ===== RESPONSIVE DESIGN FOR MODAL BUTTON ===== */
@media (max-width: 768px) {
   .modal-action-container {
       margin-top: 2rem;
       padding-top: 1.5rem;
   }

   .modal-action-button {
       padding: 0.9rem 2rem;
       font-size: 1rem;
       gap: 0.6rem;
   }

   .modal-button-icon {
       width: 18px;
       height: 18px;
   }
}

@media (max-width: 480px) {
   .modal-action-container {
       margin-top: 1.5rem;
       padding-top: 1rem;
   }

   .modal-action-button {
       padding: 0.8rem 1.5rem;
       font-size: 0.95rem;
       gap: 0.5rem;
   }

   .modal-button-icon {
       width: 16px;
       height: 16px;
   }
}

.project-animate.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* ===== PROJECTS CONTAINER ===== */
.projects {
    width: 100%;
    background: #d4d8e4;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    min-height: 100vh;
    box-sizing: border-box;
}

/* ===== HEADER SECTION ===== */
.projects-header {
    text-align: right;
    max-width: 1200px;
    width: 100%;
    align-self: flex-end;
    margin-right: 50px;
}

.projects-title {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    color: #354c6b;
    background: linear-gradient(135deg, #354c6b 0%, #2d3748 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.projects-description {
    font-size: 1.5rem;
    line-height: 1.5;
    color: #718096;
    margin: 0;
    max-width: 550px;
    margin-left: auto;
}

/* ===== PROJECTS GRID ===== */
.projects-grid {
    display: flex;
    flex-direction: column;
    gap: 11rem;
    width: 95%;
    max-width: none;
}

/* ===== PROJECT ITEM ===== */
.project-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
}

/* Text Left Layout */
.project-item[data-layout="text-left"] {
    grid-template-areas: "text image";
}

.project-item[data-layout="text-left"] .project-text {
    grid-area: text;
}

.project-item[data-layout="text-left"] .project-image {
    grid-area: image;
}

/* Image Left Layout */
.project-item[data-layout="image-left"] {
    grid-template-areas: "image text";
}

.project-item[data-layout="image-left"] .project-text {
    grid-area: text;
}

.project-item[data-layout="image-left"] .project-image {
    grid-area: image;
}

/* ===== PROJECT TEXT ===== */
.project-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
    padding: 0;
}

.project-title {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    color: #354c6b;
    margin: 0;
    padding: 0;
}

.project-description {
    font-size: 1.3rem;
    line-height: 1.7;
    color: #4a5568;
    margin: 0;
    text-align: justify;
}

/* ===== PROJECT BUTTON ===== */
.project-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #354c6b 0%, #2d3748 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
    box-shadow: 0 4px 12px rgba(53, 76, 107, 0.3);
}

.project-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(53, 76, 107, 0.4);
}

.project-button:active {
    transform: translateY(0);
}

.button-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.project-button:hover .button-icon {
    transform: translate(4px, -4px);
}

/* ===== PROJECT IMAGE ===== */
.project-image {
    width: 100%;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.project-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-image:hover img {
    transform: scale(1.05);
}

/* ===== HIDDEN PROJECTS ===== */
/* display: none keeps the collapsed projects out of the tab order and away
   from screen readers. Once shown, display: contents makes them items of
   .projects-grid, so they get the same gap as the first projects at every
   breakpoint; they then fade in like the others (.project-animate). */
.hidden-projects {
    display: none;
}

.hidden-projects.show-projects {
    display: contents;
}

/* ===== SHOW MORE BUTTON ===== */
.show-more-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.show-more-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: rgba(53, 76, 107, 0.1);
    color: #354c6b;
    border: 2px solid #354c6b;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.show-more-button:hover {
    background: #354c6b;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(53, 76, 107, 0.3);
}

.show-more-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.show-more-button:hover .show-more-icon {
    transform: translateY(2px);
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 24px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    overflow: hidden;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #354c6b #f0f0f0;
}

/* Webkit scrollbar styling for better appearance */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #354c6b;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #2d3748;
}

.modal-image {
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 24px 0px 0 0;
    flex-shrink: 0;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-text {
    padding: 2rem;
}

.modal-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #354c6b;
    margin: 0 0 1.5rem 0;
    line-height: 1.2;
}

.modal-description {
    font-size: 1rem;
    line-height: 1.7;
    color: #4a5568;
}

.modal-description h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #354c6b;
    margin: 2rem 0 1rem 0;
}

.modal-description p {
    margin: 0 0 1.5rem 0;
    text-align: justify;
}

.modal-description ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.modal-description li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .projects {
        padding: 3rem 1rem;
    }

    .projects-grid {
        width: 95%;
        gap: 4rem;
    }

    .projects-title {
        font-size: 4rem;
    }

    .projects-description {
        font-size: 1.3rem;
    }

    .project-item {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .project-item[data-layout="text-left"],
    .project-item[data-layout="image-left"] {
        grid-template-areas:
            "text"
            "image";
    }

    .project-text {
        padding: 0;
    }

    .project-title {
        font-size: 2.5rem;
    }

    .project-image {
        height: auto;
        aspect-ratio: 3 / 2;
    }
}

@media (max-width: 768px) {
    .projects {
        padding: 2rem 1.25rem;
        gap: 3rem;
    }

    .projects-grid {
        width: 100%;
        gap: 3rem;
    }

    .projects-title {
        font-size: 3rem;
    }

    .projects-description {
        font-size: 1.1rem;
        margin: 0 auto;
    }

    .project-text {
        padding: 0;
    }

    .project-title {
        font-size: 2.2rem;
    }

    .project-description {
        font-size: 1.2rem;
    }


    .modal-overlay {
        padding: 1rem;
    }

    .modal-container {
        max-height: 85vh;
        max-height: 85dvh;
    }

    .modal-image {
        height: 350px;
    }

    .modal-text {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 2rem;
    }
    .projects-header {
                text-align: center;
    max-width: 1200px;
    width: 100%;
    align-self: flex-end;
    margin-right: 0px;
}
}

@media (max-width: 480px) {
    .projects {
        padding: 1.5rem 1.25rem;
        gap: 2rem;
    }

    .projects-grid {
        width: 100%;
        gap: 2rem;
    }

    .projects-title {
        font-size: 2.5rem;
    }

    .projects-description {
        font-size: 1rem;
    }

    .project-text {
        padding: 0;
    }

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

    .project-description {
        font-size: 0.9rem;
    }

    .project-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }


    .modal-overlay {
        padding: 0.5rem;
    }

    .modal-container {
        max-height: 85vh;
        max-height: 85dvh;
    }

    .modal-image {
        height: 300px;
    }

    .modal-text {
        padding: 1rem;
    }

    .modal-title {
        font-size: 1.8rem;
    }

    .modal-description {
        font-size: 0.9rem;
    }
}

/* ===== WORK vs. COMPANY PROJECTS =====
   The TELUS work experience comes first; everything after the
   "Built at MySoftwareSV" label is from Alex's own company. Each project
   names who it was built for (.project-org). */

.project-org {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: fit-content;
    margin-bottom: -0.5rem;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(53, 76, 107, 0.14);
    background: rgba(255, 255, 255, 0.45);
    color: #354c6b;
    font-family: var(--font-nunito), sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.project-org::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.55;
}

/* Placeholder panel (TELUS card and its modal) until real media is added */
.project-placeholder {
    position: relative;
    flex-direction: column;
    gap: 0.9rem;
    text-align: center;
    color: #fff;
    background:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.12) 1px, transparent 0) 0 0 / 22px 22px,
        radial-gradient(circle at 75% 20%, rgba(111, 211, 168, 0.18), transparent 45%),
        linear-gradient(145deg, #354c6b 0%, #2d3748 100%);
    border: none;
}

.placeholder-mark {
    font-family: var(--title-h1), serif;
    font-size: clamp(2.6rem, 6vw, 4.5rem);
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1;
}

.placeholder-note {
    font-family: var(--font-nunito), sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    opacity: 0.75;
    padding: 0 1.5rem;
}

.modal-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* "Built at MySoftwareSV" divider; the negative margins pull it into the
   grid's large gap so it sits between the TELUS card and the projects. */
.projects-group-label {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: -6rem 0 -5rem;
    color: #5f7190;
    font-family: var(--font-nunito), sans-serif;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
}

.projects-group-label::before,
.projects-group-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(53, 76, 107, 0.3), transparent);
}

.projects-group-label strong {
    color: #354c6b;
}

@media (max-width: 1024px) {
    .projects-group-label {
        margin: 0;
    }
}

@media (max-width: 768px) {
    /* stacked: a short rule above the centred text */
    .projects-group-label {
        flex-direction: column;
        gap: 0.9rem;
        font-size: 0.95rem;
        text-align: center;
    }

    .projects-group-label::before {
        flex: none;
        width: 70px;
        height: 2px;
        border-radius: 2px;
        background: rgba(53, 76, 107, 0.35);
    }

    .projects-group-label::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .project-org {
        font-size: 0.7rem;
        padding: 0.35rem 0.8rem;
    }
}

/* Wide screenshots shown whole (not cropped) on a white panel */
.project-image-contain,
.modal-image-contain {
    background: #fff;
}

.project-image-contain img,
.modal-image-contain img {
    object-fit: contain;
    box-sizing: border-box;
    padding: 1.25rem;
}

/* ===== OPEN TO WORK (highlight above the projects) ===== */
.open-to-work {
    box-sizing: border-box;
    width: 95%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.25rem 2.5rem;
    padding: 2rem 2.5rem;
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.72) 0%, rgba(232, 236, 243, 0.55) 100%);
    border: 1px solid rgba(53, 76, 107, 0.14);
    box-shadow:
        0 24px 60px rgba(53, 76, 107, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.otw-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #354c6b 0%, #2d3748 100%);
    color: #fff;
    font-family: var(--font-nunito), sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(53, 76, 107, 0.28);
}

/* green "available" dot with a soft pulse */
.otw-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6fd3a8;
    animation: otwPulse 2.4s ease-out infinite;
}

@keyframes otwPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(111, 211, 168, 0.55);
    }
    70%,
    100% {
        box-shadow: 0 0 0 8px rgba(111, 211, 168, 0);
    }
}

.otw-title {
    margin: 0 0 0.35rem;
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.25;
    color: #354c6b;
}

.otw-sub {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.55;
    color: #4a5568;
}

.otw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

/* links styled as the project buttons: same font the <button>s get (Arial) */
.otw-actions .project-button {
    font-family: Arial, sans-serif;
    text-decoration: none;
}

.project-button-outline {
    background: rgba(255, 255, 255, 0.55);
    color: #354c6b;
    box-shadow: inset 0 0 0 2px #354c6b;
}

.project-button-outline:hover {
    background: #fff;
    box-shadow:
        inset 0 0 0 2px #354c6b,
        0 8px 20px rgba(53, 76, 107, 0.2);
}

@media (max-width: 1200px) {
    .open-to-work {
        grid-template-columns: 1fr;
        justify-items: start;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .open-to-work {
        width: 100%;
        padding: 1.5rem;
        border-radius: 22px;
    }

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

    .otw-sub {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .open-to-work {
        padding: 1.2rem;
    }

    .otw-badge {
        font-size: 0.72rem;
    }

    .otw-title {
        font-size: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .otw-dot {
        animation: none;
    }
}

/* The image opens the project, like its "View" button */
.projects-grid .project-image {
    cursor: pointer;
}
