/* 
 * RESET & BASE
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Centralize repeating colors and fonts to make the CSS easier to manage and update */
:root {
    /* Color variables */
    --primary-color: #0d0d0d;
    --secondary-color: #f7f7f7;
    --accent-color: #d9d9d9;
    --highlight-color: #f0f2aec2;
    --error-color: #ea2a2a;
    --popup-color: #efefef;
    --text-muted: #8c8984;
    --text-secondary: #595754;

    /* Font variables */
    --font-primary: 'Inter', sans-serif;
    --font-secondary: 'Lora', serif;

    /* Font weights */
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
}

html,
body {
    /* Make the page fill height, and place footer at bottom */
    height: 100%;
    font-family: Arial, sans-serif;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    scrollbar-gutter: stable;
}

body.no-scroll {
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    text-transform: uppercase;
}

ul {
    list-style: none;
}

main {
    /* Main grows to fill space, pushing footer to bottom if content is short */
    flex: 1 0 auto;
}

/* 
 * Base Typography Styles
 */
h1 {
    color: var(--primary-color);
    font-family: var(--font-secondary);
    font-weight: var(--font-weight-medium);
    font-size: 96px;
    line-height: 106px;
    letter-spacing: 2px;
    text-align: left;
}

h2 {
    color: var(--primary-color);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-regular);
    font-size: 24px;
    line-height: 28px;
    letter-spacing: 2px;
    text-align: left;
    text-transform: uppercase;
}

h3 {
    color: var(--primary-color);
    font-family: var(--font-secondary);
    font-weight: var(--font-weight-semibold);
    font-size: 24px;
    line-height: 28px;
    letter-spacing: 0;
    text-align: left;
}

p {
    color: var(--primary-color);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-regular);
    font-size: 16px;
    line-height: 28px;
    letter-spacing: 2px;
    text-align: left;
    text-wrap: balance;
}

.btn {
    padding: 15px 24px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    font-family: var(--font-primary);
    font-weight: var(--font-weight-regular);
    font-size: 14px;
    line-height: 100%;
    letter-spacing: 0;
    text-align: center;
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

/* 
 * HEADER
 */
header {
    position: sticky;
    top: 0;
    z-index: 999;
    background-color: white;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 42px 42px 0;
}

/* 
 * BRANDING
 */
.branding {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.site-name {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 40px;
    font-family: var(--font-secondary);
    color: var(--primary-color);
    font-weight: var(--font-weight-semibold);
    font-size: 16px;
    line-height: 20px;
    letter-spacing: 2px;
    text-align: left;
}

/* 
 * NAVIGATION
 */
.nav-link {
    font-family: var(--font-primary);
    color: var(--primary-color);
    font-weight: var(--font-weight-medium);
    line-height: 20px;
    letter-spacing: 2px;
}

.desktop-nav ul {
    display: flex;
}

.desktop-nav li a {
    padding: 19px 20px 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    border-top: 1px solid transparent;
}

.desktop-nav a.active {
    border-top: 1px solid var(--text-muted);
}

.mobile-nav ul {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.mobile-nav li a {
    padding: 10px;
    font-size: 18px;
    border-bottom: 1px solid transparent;
}

.mobile-nav a.active {
    border-bottom: 1px solid var(--text-muted);
}

/* MENU ICON (MOBILE) */
.menu-icon {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: auto;
    text-align: right;
}

.menu-icon img {
    width: 23px;
    height: 23px;
}

/* Handle the display of the hamburger and close icons based on the "open" class */
.menu-icon .close-icon {
    display: none;
}

.menu-icon.open .hamburger-icon {
    display: none;
}

.menu-icon.open .close-icon {
    display: block;
}

/* 
 * RESPONSIVE NAVIGATION 
 */
@media (max-width: 890px) {
    .desktop-nav {
        /* Hide desktop nav */
        display: none;
    }

    /* Show hamburger */
    .menu-icon {
        display: block;
    }

    .header-content {
        padding: 15px 20px 9px;
    }

    .logo {
        width: 24px;
        height: 24px;
    }

    .branding {
        gap: 10px;
    }

    .site-name {
        height: 32px;
        font-size: 10px;
        line-height: 16px;
    }
}

/* MOBILE MENU OVERLAY */
.mobile-menu-overlay {
    position: fixed;
    /* Move the overlay down to show it below the navbar */
    top: 55px;
    left: 0;
    width: 100%;
    height: calc(100% - 55px);
    background-color: white;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: visibility, opacity;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* 
 * FOOTER
 */
.footer-middle {
    height: 30px;
    width: 100%;
    overflow: hidden;
    border-top: 3px solid var(--accent-color);
    border-bottom: 3px solid var(--accent-color);
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
}

.scrolling-text {
    white-space: nowrap;
    font-family: var(--font-primary);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
    font-size: 12px;
    line-height: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    animation: scrollText 20s linear infinite;
    will-change: transform;
    gap: 8px;
}

/* 
 * FOOTER BOTTOM
 */
.footer-bottom {
    background-color: var(--highlight-color);
    padding: 10px 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-info p {
    margin: 0;
}

.footer-social {
    display: flex;
    align-items: center;
}

.footer-social a img {
    width: 24px;
    height: auto;
    margin: 20px 20px;
    display: block;
    transition: transform 0.3s ease;
    will-change: transform;
}

.footer-social a:hover img {
    transform: scale(1.1);
}

/* 
 * RESPONSIVE FOOTER
 */
@media (max-width: 890px) {
    .footer-bottom {
        height: 91px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 10px;
        padding: 0 20px;
    }

    .footer-info p {
        font-size: 10px;
    }

    .footer-social {
        gap: 24px;
    }

    .footer-social a img {
        margin: 0;
    }
}

/* 
 * LOADING SPINNER 
 */
.spinner {
    border: 8px solid var(--secondary-color);
    border-top: 8px solid var(--text-muted);
    border-radius: 50%;
    overflow: hidden;
    width: 60px;
    height: 60px;
    animation: spinLoadingIndicator 1s linear infinite;
    margin: 100px auto;
}

/* 
 * MAIN CONTENT - CONTACT PAGE
 */
.contact-content {
    padding: 80px 20px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 122px;
    position: relative;
}

.contact-background-image {
    position: absolute;
    top: 0;
    left: -200px;
    width: 60%;
    height: 50%;
    background: url("../assets/images/ellipse.svg") no-repeat center center;
    background-size: contain;
    z-index: -1;
}

.project-info {
    /* Left column takes 30% of the width */
    flex: 0 0 30%;
}

.project-form {
    /* Right column takes the remaining width */
    flex: 1;
    padding: 85px 0 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-title {
    text-transform: uppercase;
    margin-bottom: 20px;
}

.contact-subtitle {
    margin: 0;
}

fieldset {
    border: none;
}

fieldset label {
    display: block;
    font-family: var(--font-primary);
    font-weight: var(--font-weight-medium);
    margin-bottom: 4px;
    color: #333;
}

fieldset input,
fieldset select,
fieldset textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.3s ease;
    color: var(--primary-color);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-regular);
    font-size: 14px;
    line-height: 16px;
    letter-spacing: 0;
    text-align: left;
    /* Remove default browser outline */
    outline: none;
}

::placeholder {
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-regular);
    font-size: 16px;
    line-height: 150%;
    letter-spacing: 0;
    text-align: left;
    text-wrap: balance;
}

fieldset select {
    appearance: none;
    background-image: url("../assets/images/chevron.svg");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 24px;
}

fieldset select:invalid {
    color: var(--text-muted);
}

fieldset select option {
    color: var(--primary-color);
}

fieldset textarea {
    resize: vertical;
    min-height: 120px;
}

.form-buttons {
    display: flex;
    gap: 16px;
}

.submit-btn {
    background-color: var(--accent-color);
    color: var(--text-secondary);
    border: none;
}

.submit-btn.disabled {
    cursor: not-allowed;
}

.cancel-btn {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--accent-color);
}

.submit-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.cancel-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* FORM FOCUS */
fieldset.focused input,
fieldset.focused select,
fieldset.focused textarea {
    border-color: var(--primary-color);
    /* Ensure no browser outline appears */
    outline: none;
    /* Add a more controlled focus indicator */
    box-shadow: 0 0 0 1px var(--primary-color);
    transition: all 0.3s ease;
}

fieldset.focused label {
    color: var(--primary-color);
    font-weight: var(--font-weight-semibold);
    transition: color 0.3s ease;
}

/* 
 * RESPONSIVE CONTACT PAGE 
 */
@media (max-width: 890px) {
    .contact-content {
        flex-direction: column;
        padding: 40px 20px;
        gap: 30px;
    }

    .contact-title {
        font-size: 48px;
        line-height: 48px;
        letter-spacing: 1px;
        margin-bottom: 14px;
    }

    .contact-subtitle {
        font-size: 14px;
        line-height: 150%;
        letter-spacing: 1px;
    }

    .project-form {
        padding: 0;
    }

    .contact-background-image {
        top: -120px;
        left: 0;
    }

    .form-buttons {
        flex-direction: column;
    }
}

/* 
 * SUCCESS POPUP
 */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000cc;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.success-overlay.active {
    display: flex;
}

.success-popup {
    background-color: var(--popup-color);
    padding: 34px 24px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 500px;
    text-align: center;
    animation: fadeInPopup 0.3s ease-out;
}

.success-popup h1 {
    font-size: 32px;
    line-height: 48px;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.success-message {
    margin-bottom: 20px;
    font-weight: var(--font-weight-semibold);
    font-size: 14px;
    line-height: 150%;
    letter-spacing: 1px;
    text-align: center;
}

.success-details {
    margin-bottom: 30px;
    font-weight: var(--font-weight-light);
    font-size: 14px;
    line-height: 150%;
    letter-spacing: 1px;
    text-align: center;
}

.success-close {
    border: 1.5px solid var(--text-secondary);
    background-color: var(--highlight-color);
    color: var(--text-secondary);
    padding: 15px 53px;
}

.success-close:hover {
    background-color: var(--accent-color);
}

.success-icon {
    width: 180px;
    height: 131px;
    margin-bottom: 38px;
    animation: fadeInPopup 0.5s ease-out;
}

/* FORM ERRORS */
.error-message {
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    color: var(--error-color);
}

.error-message img {
    width: 16px;
    height: 16px;
}

.error-message p {
    margin: 0;
    color: var(--error-color);
    font-weight: var(--font-weight-medium);
    font-size: 12px;
    letter-spacing: 0;
}

fieldset.error .error-message {
    display: flex;
}

fieldset.error input,
fieldset.error select,
fieldset.error textarea {
    border-color: var(--error-color);
}

/* 
 * MAIN CONTENT - ABOUT PAGE 
 */
.about-content {
    padding: 200px 20px 100px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 100px;
}

.about-background-image {
    position: absolute;
    top: -500px;
    left: 350px;
    width: 60%;
    height: 50%;
    background: url("../assets/images/ellipse.svg") no-repeat center center;
    background-size: contain;
    z-index: -1;
}

.about-page-section {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.about-page-section .submit-btn {
    align-self: flex-start;
    width: auto;
}

/* HERO SECTION */
.hero-section {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 123px;
}

.hero-section-illustration-desktop-only {
    display: block;
    /* Allow the image container to grow */
    flex: 1;
    /* Set a minimum width for the image container */
    min-width: 260px;
}

.hero-section img {
    /* Make the image responsive */
    width: 100%;
    /* Maintain aspect ratio */
    height: auto;
}

.hero-section-illustration-mobile-only {
    display: none;
    flex: none;
    width: 100%;
    max-width: 350px;
}

.hero-section-info {
    /* Fix the width of the right div */
    flex: 0 0 50%;
}

/* SERVICES SECTION */
.services-section-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(250px, 1fr));
    gap: 40px;
}

.services-section-card {
    background-color: var(--popup-color);
    padding: 40px 20px;
    max-width: 363px;
    max-height: 448px;
    box-sizing: border-box;
    border-radius: 10px;
    overflow: hidden;
    animation: fadeInPopup 0.3s ease-out;
    transition: transform 0.3s ease;
    will-change: transform, opacity;
}

.services-section-card:hover {
    transform: scale(1.05);
    background-color: var(--highlight-color);
}

.services-section-card img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    overflow: hidden;
}

.services-section-card h3 {
    margin: 28px 0 8px;
}

.services-section-card p {
    color: var(--text-secondary);
    line-height: 24px;
    letter-spacing: 0;
}

/* SOFTWARE SKILLS SECTION */
.skills-section-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skills-section-item {
    display: grid;
    grid-template-columns: 81px auto;
    align-items: center;
}

.skills-section-item img {
    height: 40px;
    justify-self: start;
}

/* 
 * RESPONSIVE ABOUT PAGE 
 */
@media (max-width: 890px) {

    .about-content {
        padding: 64px 20px;
        gap: 64px;
    }

    .about-background-image {
        top: -950px;
        left: 0;
        max-width: 312px;
        min-height: 2120px;
    }

    .about-page-section {
        gap: 24px;
    }

    .about-page-section .submit-btn {
        width: 100%;
    }

    .hero-section {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }

    .hero-section-info {
        flex: none;
        width: 100%;
    }

    .hero-section-illustration-desktop-only {
        display: none;
    }

    .hero-section-illustration-mobile-only {
        display: block;
    }

    .about-page-section h1 {
        font-size: 48px;
        line-height: 120%;
        letter-spacing: 0;
        font-weight: var(--font-weight-regular);
    }

    .about-page-section h2 {
        font-size: 16px;
        letter-spacing: 8%;
        line-height: 150%;
    }

    .about-page-section p {
        letter-spacing: 1px;
        line-height: 150%;
    }

    .services-section-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .services-section-card h3 {
        font-size: 20px;
    }

    .services-section-card p {
        font-size: 14px;
        line-height: 150%;
        letter-spacing: 1px;
    }

    .services-section-card {
        max-width: none;
        max-height: none;
        animation: none;
        /* Hide the card and shift it initially */
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    }

    .services-section-card.appear {
        /* Transition to full opacity and move to card's original position */
        opacity: 1;
        transform: translateY(0);
    }
}

/*
 * MAIN CONTENT - WORK PAGE
 */
.work-content {
    padding: 100px 20px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.work-content h1 {
    height: 126px;
    padding-bottom: 20px;
}

.work-content .project-row {
    display: grid;
    gap: 20px;
    min-height: 335px;
}

.work-content .row-1 {
    grid-template-columns: 651fr 529fr;
}

.work-content .row-2 {
    grid-template-columns: 312fr 392fr 456fr;
}

.work-content .row-3 {
    grid-template-columns: 529fr 651fr;
}

.work-content .row-4 {
    grid-template-columns: 456fr 392fr 320fr;
}

.work-content .project-item {
    background-position: bottom right;
    background-repeat: no-repeat;
    background-size: contain;
    background-blend-mode: normal;
    padding: 42px 40px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 100%;
    will-change: transform, opacity, background-position;
}

/* Hide mobile images by default (desktop mode) */
.work-content .project-img-mobile {
    display: none;
    object-fit: cover;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.work-content p {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 140%;
    letter-spacing: 0;
}

.work-content .btn-arrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-weight: var(--font-weight-regular);
    font-size: 14px;
    line-height: 140%;
    letter-spacing: 0;
    text-align: left;
    text-wrap: balance;
    cursor: pointer;
    transition: text-decoration 0.3s ease;
    will-change: text-decoration;
}

.work-content .btn-arrow .btn-arrow-text {
    /* Initially hide the button text */
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

.work-content .btn-arrow img {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    will-change: transform;
    /* Initially position the arrow on the left */
    transform: translateX(-90px);
}

.work-content .row-1 .project-item:nth-child(1) {
    background-color: #F3F2EE;
    background-image: url("../assets/images/project1-desktop.gif");
}

.work-content .row-1 .project-item:nth-child(2) {
    background-color: #F5F6D5;
    background-image: url("../assets/images/project2-desktop.gif");
}

.work-content .row-2 .project-item:nth-child(1) {
    background-color: #FAECDA;
    background-image: url("../assets/images/project3-desktop.gif");
}

.work-content .row-2 .project-item:nth-child(2) {
    background-color: #EEF1F6;
    background-image: url("../assets/images/project4-desktop.gif");
}

.work-content .row-2 .project-item:nth-child(3) {
    background-color: #758A88;
    background-image: url("../assets/images/project5-desktop.gif");
}

.work-content .row-3 .project-item:nth-child(1) {
    background-color: #343D4B;
    background-image: url("../assets/images/project6-desktop.gif");
}

.work-content .row-3 .project-item:nth-child(2) {
    background-color: #CFDFF3;
    background-image: url("../assets/images/project7-desktop.gif");
}

.work-content .row-4 .project-item:nth-child(1) {
    background-color: #F3F2EE;
    background-image: url("../assets/images/project8-desktop.gif");
}

.work-content .row-4 .project-item:nth-child(2) {
    background-color: #E9F2F0;
    background-image: url("../assets/images/project9-desktop.gif");
}

.work-content .row-4 .project-item:nth-child(3) {
    background-color: #FBF2E7;
    background-image: url("../assets/images/project10-desktop.gif");
}

.work-content .row-2 .project-item:nth-child(3) .btn-arrow,
.work-content .row-2 .project-item:nth-child(3) h3,
.work-content .row-2 .project-item:nth-child(3) p {
    color: white;
}

.work-content .row-3 .project-item:nth-child(1) .btn-arrow,
.work-content .row-3 .project-item:nth-child(1) h3,
.work-content .row-3 .project-item:nth-child(1) p {
    color: white;
}

/* 
 * RESPONSIVE WORK PAGE 
 */
@media (max-width: 890px) {

    .work-content {
        padding: 40px 20px 64px;
        gap: 24px;
    }

    .work-content h1 {
        font-weight: var(--font-weight-regular);
        font-size: 48px;
        line-height: 120%;
        letter-spacing: 0;
        height: 100%;
        padding-bottom: 4px;
    }

    .work-content .project-row {
        /* Stack rows vertically */
        display: flex;
        flex-direction: column;
        gap: 24px;
        min-height: 276px;
    }

    .work-content .project-item {
        /* Remove desktop background image */
        background: none;
        padding: 16px 26px;
        display: flex;
        flex-direction: column;
        animation: none;
        /* Start hidden and shifted for transition effect */
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    }

    .work-content .project-item.appear {
        /* Transition to full opacity and move to card's original position */
        opacity: 1;
        transform: translateY(0);
    }

    .work-content .project-img-mobile {
        /* Show the mobile image */
        display: block;
    }

    .work-content .project-item .btn-arrow {
        /* Hide the view project button */
        display: none;
    }

    .work-content h3 {
        font-size: 20px;
        line-height: 140%;
    }

    .work-content p {
        padding: 8px 0 0;
        font-size: 14px;
        line-height: 150%;
        letter-spacing: 1px;
    }
}