/* BASE SETTINGS */

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    overflow-x: hidden;
    /* Ngăn scroll ngang khi zoom trình duyệt */
}

@media (min-width:768px) {
    html {
        font-size: 16px;
    }
}

/* GOOGLE FONT CLASSES */

.poetsen-one-regular {
    font-family: "Poetsen One", sans-serif;
    font-weight: 400;
}

.saira-font {
    font-family: "Saira", sans-serif;
}

.bitter-font {
    font-family: "Bitter", serif;
}


/* BODY */

body {
    margin-bottom: 60px;
    padding-top: 90px;
    font-family: "Bitter", serif;
    background-image: url("/img/background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: white;
    overflow-x: hidden;
    /* Ngăn scroll ngang do 100vw */
}


/* NAVBAR */

.navbar {
    font-family: "Saira", sans-serif;
    font-weight: 200;
    background: transparent !important;
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.navbar a {
    color: white !important;
}

/* HERO BANNER */

.hero {
    height: calc(100vh - 90px);
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    background-image: url("/img/banner.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.hero-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.hero-text h3 {
    font-family: 'Saira', sans-serif;
    font-weight: 200;
    letter-spacing: 8px;
}

.hero-text h1 {
    font-size: 120px;
    letter-spacing: 10px;
}

.scroll-area {
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 100%;
    height: 15vh;
    z-index: 10;
    display: block;

    text-decoration: none;
    cursor: pointer;
}

.scroll-area:hover {
    opacity: 0.8;
}

/* ABOUT SECTION */

.about {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 100px 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    margin: 40px auto;
    border-radius: 40px;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 25px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

#name {
    font-family: 'Saira', sans-serif;
    font-size: 42px;
    font-weight: 600;
    margin-bottom: 5px;
    letter-spacing: 2px;
}

#title {
    font-family: 'Bitter', serif;
    font-size: 20px;
    font-weight: 300;
    color: #b0c4de;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

#desc {
    font-size: 16px;
    line-height: 1.8;
    color: #e0e0e0;
    max-width: 600px;
}

/* WORKS TITLE */

.works-title {
    font-family: 'Saira', sans-serif;
    text-align: center;
    font-size: 36px;
    font-weight: 400;
    letter-spacing: 6px;
    margin-top: 60px;
    margin-bottom: -20px;
    /* Pull the carousel slightly closer */
    position: relative;
    z-index: 2;
}


/* BUTTON FOCUS */

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* WORKS CAROUSEL */

.works-grid {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 40px;
    /* Reduced gap to fit 3 cards better */
    padding: 80px 0;
    overflow: visible;
    width: max-content;
    /* Ensure container expands to hold all duplicated cards */
}

.carousel-container {
    width: 100%;
    max-width: 1000px;
    /* Limit width to fit 3 cards */
    margin: 0 auto;
    /* Center carousel block on page */
    overflow: hidden;
    position: relative;
    touch-action: pan-y;
}

/* WORK CARD */

.work-card {
    width: 260px;
    height: 360px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border-radius: 140px;
    transform: scale(0.85);
    /* Slightly smaller default state */
    opacity: 0.5;
    /* Dim default state */
    transition: all 0.6s ease;
    box-sizing: border-box;
}

/* CENTER PROJECT */

.work-card.active {
    transform: scale(1.15);
    /* Enlarge active card */
    opacity: 1;
    /* Full visibility for active card */
    z-index: 5;
}

/* IMAGE */

.work-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* INFO OVERLAY */

.work-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 25px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    color: white;
    opacity: 0;
    transition: 0.4s;
}

/* ACTIVE SHOW INFO */

.work-card.active .work-info {
    opacity: 1;
}

/* HIDE INFO ON HOMEPAGE CAROUSEL */
.home-carousel .work-info {
    display: none !important;
}

/* HOVER EFFECT ONLY ON CURRENTLY HOVERED CARD */

.work-card:hover {
    transform: scale(1.15) !important;
    /* Match active scale on hover */
    opacity: 1 !important;
}

/* DIM AND SHRINK ALL PROJECTS (INCLUDING ACTIVE) ON GRID HOVER */

.works-grid:hover .work-card:not(:hover) {
    opacity: 0.3 !important;
    transform: scale(0.85) !important;
}

/* ========================================= */
/* RESPONSIVE DESIGN (TABLETS & MOBILE)       */
/* ========================================= */

@media (max-width: 900px) {
    .hero-text h1 {
        font-size: 80px;
        letter-spacing: 5px;
    }

    .hero-text h3 {
        font-size: 20px;
        letter-spacing: 4px;
    }

    .work-card {
        width: 200px;
        height: 280px;
    }

    .works-grid {
        gap: 20px;
    }

    .carousel-container {
        max-width: 90%;
    }

    .work-card {
        width: 70vw; /* Focus on one card on mobile */
        height: 60vh;
        max-height: 450px;
    }
}

@media (max-width: 600px) {
    .hero-text h1 {
        font-size: 50px;
        letter-spacing: 2px;
    }

    .hero-text h3 {
        font-size: 14px;
        letter-spacing: 2px;
    }

    .work-card {
        width: 140px;
        height: 220px;
        border-radius: 80px;
    }

    .works-grid {
        gap: 15px;
    }

    .carousel-container {
        max-width: 100vw;
    }

    .work-info {
        padding: 15px;
    }

    .work-info h3 {
        font-size: 16px;
    }

    .work-info p {
        font-size: 12px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* MOBILE ADJUSTMENTS FOR ABOUT & TITLE */
    .about {
        padding: 60px 20px;
        margin: 20px 10px;
        border-radius: 20px;
    }

    #avatar {
        width: 120px;
        height: 120px;
    }

    #name {
        font-size: 28px;
    }

    #title {
        font-size: 16px;
    }

    #desc {
        font-size: 14px;
    }

    .works-title {
        font-size: 24px;
        letter-spacing: 4px;
        margin-top: 40px;
    }
}

/* ========================================= */
/* RECENT WORKS PAGE                         */
/* ========================================= */

.recent-works-bg {
    color: white;
    font-family: 'Saira', sans-serif;
    min-height: 100vh;
    height: 100%; /* Allows it to expand beyond 100vh if content is larger */
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding-bottom: 100px;
    padding-top: 50px;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.works-container {
    width: 90%;
    max-width: 1200px;
    margin: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 30px;
    position: relative;
    align-items: start;
}

/* Explicit Grid Placement */
.rw-col1-row1 { grid-area: 1 / 1 / 2 / 2; }
.rw-col2-row1 { grid-area: 1 / 2 / 2 / 3; }
.rw-col3-row1 { grid-area: 1 / 3 / 2 / 4; }
.rw-col1-row2 { grid-area: 2 / 1 / 3 / 2; }
.rw-col2-row2 { grid-area: 2 / 2 / 3 / 3; }
.rw-col3-row2 { grid-area: 2 / 3 / 3 / 4; }

.left-text {
    margin-top: 140px; /* Align horizontally with .middle-image (work5) */
}

.work-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Align the pill images to the right of their column if visually better, or flex-start */
}



.middle-image {
    margin-left: 0;
    z-index: 2;
    margin-top: 140px; /* Offset to create stepped effect relative to right-image */
}



/* CARDS */
.card {
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    background: transparent; /* Ensure no background */
    border: none; /* Ensure no bootstrap borders */
}

.project-img {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    transition: transform 0.4s ease;
    object-fit: cover; /* Important when enforcing height/ratio */
}

/* Ensure editwork1 matches the exact proportions of work2 */
.rw-col1-row1 .project-img, 
.rw-col3-row2 .project-img {
    width: 100%;
    aspect-ratio: 4 / 5;
}

.rw-col1-row3 { grid-area: 3 / 1 / 4 / 3; } /* Spans first two columns for the long image */
.rw-col2-row3 { grid-area: 3 / 2 / 5 / 4; z-index: 5; } /* Overlaps and spans down */
.rw-col3-row3 { grid-area: 3 / 3 / 4 / 4; } /* Right text */
.rw-col4-row3 { grid-area: 4 / 1 / 5 / 2; } /* Left text, under long image */

.rw-col1-row3 .project-img{
    width: 100%;
    aspect-ratio: 5 / 1;
    object-position: top;
}

.rw-col2-row3 .project-img{
    margin-left: 0;
    margin-top: 20px;
    width: 100%;
    aspect-ratio: 4 / 3.25;
    object-fit: contain;
    box-shadow: none;
    border-radius: 0;
}

/* Image size */
.rw-col1-row4 .project-img,
.rw-col2-row4 .project-img,
.rw-col1-row5 .project-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 20px;
}

/* Top left */
.rw-col1-row4 {
    grid-area: 5 / 1 / 6 / 2;
}

/* Top right */
.rw-col2-row4 {
    grid-area: 5 / 2 / 6 / 3;
    margin-left: -20px;
}

/* Bottom left */
.rw-col1-row5 {
    grid-area: 6 / 1 / 7 / 2;
}

/* Remove margin, except for pulling bottom-left up */
.rw-col1-row4 .project-img,
.rw-col2-row4 .project-img {
    margin: 0;
}

.rw-col1-row5 .project-img {
    margin: 0;
    margin-top: -50px; /* Pull it up closer to the top-left image */
}

/* Phone overlap */
.rw-overlap-phone {
    grid-area: 5 / 1 / 7 / 3;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translate(20%, 50%);
}

/* Phone */
.phone-img {
    width: 100%;
    max-width: 600px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(10px 25px 45px rgba(0,0,0,0.45));
}

/* Right text block */
.rw-col3-row45 {
    grid-area: 5 / 3 / 7 / 4;
}

.project-img:hover {
    transform: translateY(-8px);
}

/* TEXT CONTENT */
.work-text {
    position: relative;
    z-index: 2;
    padding-right: 15px;
}

.work-text h3 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ffffff;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.work-text h4 {
    font-weight: 400;
    font-size: 18px;
    color: #ffffff;
    margin-bottom: 15px;
}

.work-text p {
    font-size: 16px;
    line-height: 1.7;
    color: #e5e7eb; /* Brighter grey for readability */
    font-family: 'Bitter', serif;
}

/* Specific styling for Row 3 Texts */
.rw-col3-row3 h3 {
    font-size: 18px;
    letter-spacing: 1px;
}
.rw-col3-row3 h4 {
    color: #cbd5e1;
    font-size: 16px;
}

.rw-col4-row3 p {
    margin-bottom: 20px;
}

.rw-col4-row3 {
    margin-bottom: 20px;
    margin-top: -170px;
}

/* RIGHT MENU (Categories) */
.category {
    margin-bottom: 5px;
    width: 90%;
    display: block;
    transition: transform 0.3s ease;
}

.category img {
    width: 85%;
    height: auto;
    display: block;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* RESPONSIVENESS FOR RECENT WORKS */
@media (max-width: 900px) {
    .works-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* Reset grid areas for mobile flow */
    .rw-col1-row1,
    .rw-col2-row1,
    .rw-col3-row1,
    .rw-col1-row2,
    .rw-col2-row2,
    .rw-col3-row2 {
        grid-area: auto;
    }

    /* Reset staggered margins for a clean single column */
    .middle-text,
    .work-right,
    .middle-image,
    .right-image {
        margin-top: 0;
    }

}