html {
    scroll-behavior: smooth;
    /* background: #192D49; */
}

:root {
    --bg: linear-gradient(to bottom, #488ccf 0%, #fee2b5 75%, #febb74 100%);
    --text: #111;
    --card: rgba(255,255,255,0.14);
    --border: rgba(0,0,0,0.06);
}

/* DARK MODE */
body.dark {
    --bg: linear-gradient(to bottom, #192D49 0%, #5B87C8 75%, #695D92 100%);
    --text: #f5f5f5;
    --card: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.12);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 18px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    background-attachment: fixed;
    opacity: 0;
    transition: opacity 0.35s ease;
}

body.loaded {
    opacity: 1;
}

body.fade-out {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.theme-btn {
    width: 44px;
    height: 44px;

    border-radius: 50%;

    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
    /* font-size: 18px; */

    transition: transform 0.25s ease, background 0.25s ease;
}

/* hover effect */
.theme-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* dark mode styling */
body.dark .theme-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
}

body.dark .theme-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* CONTAINER */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
}

/* NAV */
nav {
    position: sticky;
    top: 18px;
    z-index: 1000;

    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;

    max-width: 1100px;
    padding: 14px 22px;
    margin: 18px auto;

    border-radius: 999px;

    backdrop-filter: blur(14px);
    background: var(--card);
    border: 1px solid var(--border);

    transition: transform 0.25s ease, opacity 0.25s ease;

    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
}

.logo {
    font-weight: 700;
    font-size: 22px;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -0.5px;
}

.logo:hover {
    opacity: 0.65;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    margin-left: 28px;
    font-weight: 400;
    transition: opacity 0.2s ease;
}

.nav-links a:hover {
    opacity: 0.6;
}

.nav-links a.active {
    opacity: 1;
    font-weight: 500;
}

/* INDEX PAGE */
/* HERO */
.hero {
    padding: 80px 0 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
}

.hero-content {
    flex: 1;
}

.hero h1 {
    font-size: 54px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 16px;
}

.hero-intro {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 12px;
}

.hero-details {
    /* font-size: 16px; */
    color: var(--muted);
}

/* BUTTONS */
.hero-actions {
    margin-top: 24px;
}

/* PRIMARY BUTTON (View Resume) */
.resume-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 14px 26px;

    border-radius: 999px;

    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);

    border: 1px solid rgba(255,255,255,0.3);

    color: var(--text);

    font-weight: 600;
    font-size: 16px;

    text-decoration: none; /* IMPORTANT: removes underline */

    transition:
        transform 0.3s ease,
        background 0.3s ease,
        box-shadow 0.3s ease;
}

.resume-btn:hover {
    transform: translateY(-3px);

    background: rgba(255,255,255,0.4);

    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}


/* SECONDARY LINK (Explore Projects) */
.secondary-link {
    display: inline-block;
    margin: 18px;

    font-size: 16px;
    font-weight: 600;

    color: var(--muted);
    opacity: 1;

    text-decoration: none;

    position: relative; /* needed for underline */
}

/* animated underline */
.secondary-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;

    width: 100%;
    height: 1px;

    background: currentColor;

    transform: scaleX(0);
    transform-origin: left;

    transition: transform 0.25s ease;
}

/* hover state */
.secondary-link:hover {
    color: var(--text);
}

/* animate underline in */
.secondary-link:hover::after {
    transform: scaleX(1);
}


.portfolio-selector {
    margin-top: 24px;
}

.portfolio-selector-text {
    margin-bottom: 12px;
}

.portfolio-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.portfolio-button {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid currentColor;
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.portfolio-button:hover {
    opacity: 0.7;
    transform: translateY(-1px);
}


/* AVATAR (CLICKABLE) */
.avatar-container {
    flex-shrink: 0;
}

.avatar-link {
    display: inline-block;
    transition: transform 0.3s ease;
}

.avatar-link:hover {
    transform: translateY(-6px);
}

.avatar {
    width: 180px;
    display: block;
}

/* SECTION TITLE */
.section-title {
    font-size: 28px;
    text-transform: uppercase;
    letter-spacing: 3.5px;
    margin-top: 40px;
    margin-bottom: 40px;
    font-weight: 600;
    text-align: center;
}

/* GRID */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    padding-bottom: 120px;
}

#projects {
    scroll-margin-top: 120px;
}

#resume {
    scroll-margin-top: 120px;
}

/* CARD */
.card {
    text-decoration: none;
    color: inherit;
}

.image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;

    border-radius: 16px;

    overflow: hidden;

    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.45),
        rgba(255,255,255,0.15)
    );

    margin-bottom: 18px;

    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

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

    transition: transform 0.5s ease;
}

.card:hover .image-container {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
}

.card:hover img {
    transform: scale(1.05);
}

/* OVERLAY */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 18px;

    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);

    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover .overlay {
    opacity: 1;
}

.overlay-text {
    color: white;
    font-size: 16px;
    font-weight: 600;
}

/* TEXT */
.card h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card p {
    font-size: 16px;
    color: var(--muted);
}

/* PROJECT PAGES */
/* HERO */
.project-hero {
    padding: 40px 0 0 0;
}

.project-hero h1 {
    font-size: 54px;
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 16px;
}

.project-slogan {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: -0.4px;
}

.project-tagline {
    /* font-size: 17px; */
    color: var(--text);
    line-height: 1.6;
    max-width: 650px;
}

.project-banner {
    width: 100%;
    margin: 0 auto 32px auto;

    border-radius: 16px;
    overflow: hidden;
}

.project-banner img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
}

/* META GRID */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;

    padding: 24px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);

    /* margin-bottom: 60px; */
}

.meta-item h4 {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    margin-bottom: 8px;
}

.meta-item p {
    font-size: 16px;
    color: var(--text);
}

/* CONTENT */
/* .content-section {
    margin-top: 60px;
} */

.content-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 18px;
}

.content-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
}

.content-section p {
    /* font-size: 16px; */
    color: var(--text);
    margin-bottom: 20px;
}

.content-section ul {
    margin-left: 20px;
    color: var(--text);
}

.content-section li {
    margin-bottom: 8px;
}

/* IMAGES */
.project-image {
    width: 100%;
    aspect-ratio: 16 / 10;

    border-radius: 16px;
    overflow: hidden;

    margin: 32px 0 48px 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.45),
        rgba(255,255,255,0.15)
    );

    border: 1px solid rgba(255,255,255,0.4);

    box-shadow: 0 15px 30px rgba(0,0,0,0.04);
}

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

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    /* justify-content: center; */
}

.image-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.image-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.image-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.image-grid img,
.image-grid-2 img,
.image-grid-4 img,
.image-grid-5 img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    /* outline: 2px solid red; */
}

.image-grid-small {
    display: flex;
    justify-content: center;
}

.image-grid-small img {
    width: 60%;
    border-radius: 10px;
}

.image-grid-avatar1 {
    display: flex;
    gap: 10px;
    width: 100%;
}

.image-grid-avatar1 img {
    height: auto;
    min-width: 0;
    display: block;
    border-radius: 10px;
}

.image-grid-avatar1 img:nth-child(1) {
    flex: 1;
}

.image-grid-avatar1 img:nth-child(2) {
    flex: 0.563;
}

.image-grid-avatar1 img:nth-child(3) {
    flex: 0.562;
}

.image-grid-avatar1 img:nth-child(4) {
    flex: 0.8;
}

.image-grid-avatar1 img:nth-child(5) {
    flex: 1;
}

.image-grid-avatar2 {
    display: flex;
    gap: 10px;
    width: 100%;
}

.image-grid-avatar2 img {
    display: block;
    height: auto;
    min-width: 0;
    border-radius: 10px;
}

.image-grid-avatar2 img:nth-child(1) {
    flex: 0.5625;
}

.image-grid-avatar2 img:nth-child(2) {
    flex: 0.6669;
}

.embed-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 24px 0;
}

.embed-container iframe {
    width: 100%;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

.embed-portrait {
    max-width: 420px;
    margin: 0 auto;
    aspect-ratio: 9 / 19.5;
}

.embed-portrait iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.embed-video {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
}

.embed-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* LIGHTBOX */

.zoomable {
    cursor: pointer;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.zoomable:hover {
    transform: scale(1.02);
}

#lightbox {
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);

    justify-content: center;
    align-items: center;

    transition: opacity 0.25s ease;
    flex-direction: column;
    z-index: 9999;

    padding: 20px;
    box-sizing: border-box;
}

#lightbox.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#lightbox-track {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
}

/* #lightbox .nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255,255,255,0.2);
    border: none;
    color: white;

    font-size: 28px;
    cursor: pointer;

    border-radius: 50%;
    z-index: 10000;
} */

#lightbox .nav:hover {
    background: rgba(255,255,255,0.35);
}

/* #lightbox .left {
    left: 20px;
}

#lightbox .right {
    right: 20px;
} */

.lightbox-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;

    padding: 20px 0;
    z-index: 10001;
}

.lightbox-controls .nav {
    width: 48px;
    height: 48px;

    border-radius: 50%;
    border: none;

    background: rgba(255,255,255,0.2);
    color: white;

    font-size: 24px;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

/* #lightbox::after {
    content: "← swipe →";
    position: absolute;
    bottom: 20px;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
} */

#lightbox-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;

    margin-bottom: 10px;
}

.lightbox-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;

    background: rgba(255,255,255,0.4);
    cursor: pointer;

    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.lightbox-dot.active {
    background: white;
    transform: scale(1.3);
}

/* .doc-embed {
    width: 100%;
    height: 80vh;
    border: 0;
}

.sheet-embed {
    width: 100%;
    height: 50vh;
    border: 0;
} */

.project-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin: 80px 0 40px;
    padding-top: 24px;

    border-top: 1px solid rgba(0,0,0,0.1);
}

.project-nav-link {
    /* font-size: 14px; */
    text-decoration: none;
    color: inherit;

    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.project-nav-link:hover {
    opacity: 1;
}

/* CONTACT AND RESUME PAGES */

.resume-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 20px;
}

.text-page h1 {
    margin-bottom: 20px;
}

.text-page p {
    line-height: 1.6;
    margin-bottom: 16px;
}

/* .contact-links a,
.resume-actions a {
    text-decoration: none;
    color: inherit;
    opacity: 0.8;
}

.contact-links a:hover,
.resume-actions a:hover {
    opacity: 1;
}

.resume-actions {
    display: flex;
    gap: 12px;
    margin: 20px 0 40px;
}

.button {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.2);
    text-decoration: none;
} */

/* .button.secondary {
    opacity: 0.7;
} */

.contact-buttons {
    display: flex;
    /* justify-content: center; */
    gap: 12px; /* 👈 this is the key */
    flex-wrap: wrap;
}

/* .contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 12px 18px;
    border-radius: 999px;

    text-decoration: none;
    font-weight: 600;

    background: var(--text);
    color: var(--bg);

    transition: transform 0.2s ease, opacity 0.2s ease;
}

.contact-btn.secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--text);
} */

.icon {
    /* font-size: 16px; */
    line-height: 1;
}

.about-hero {
    display: flex;
    gap: 40px;
    /* align-items: flex-start; */
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    /* flex-direction: row; */
}

.about-text {
    flex: 1;
}

/* .about-image {
    order: 2;
} */

.about-image img {
    margin-top: 100px;
    width: 280px;
    height: auto;
    border-radius: 16px;
    object-fit: cover;
}

.about-text {
    flex: 1;
}

.about-text h1 {
    margin-top: 0;
}

.coursework-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 20px;
}

.course-column h3 {
    margin-bottom: 12px;
    /* font-size: 16px; */
    /* opacity: 0.8; */
}

.course-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.course-column li {
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--muted);
}

/* BACK TO TOP BUTTON */

.back-to-top-float {
    opacity: 0;
    pointer-events: none;
    position: fixed;
    bottom: 24px;
    right: 24px;

    width: 52px;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    /* background: rgba(0, 0, 0, 0.6); */
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.5);
    color: white;

    text-decoration: none;
    font-size: 20px;
    font-weight: 500;

    z-index: 9998;

    transition: transform 0.2s ease, opacity 0.2s ease;
}

.back-to-top-float:hover {
    transform: scale(1.08);
    opacity: 0.9;
}

/* FOOTER */
footer {
    border-top: 1px solid var(--border);
    padding: 48px 0;
    text-align: center;
    font-size: 16px;
    color: var(--text);
}

/* MOBILE */
@media (max-width: 768px) {
    
    /* INDEX PAGE  */

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

    .hero h1 {
        font-size: 32px;
    }

    .hero-intro {
        font-size: 20px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    nav {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 16px 18px;
        text-align: center;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 16px;
        margin-left: 0;
    }

    .nav-links a {
        margin-left: 0;
    }

    nav.nav-hidden {
    transform: translateY(-140%);
    opacity: 0;
    pointer-events: none;
    }

    .portfolio-links {
        justify-content: center;
        width: 100%;
    }

    #projects {
        scroll-margin-top: 50px;
    }

    /* PROJECT PAGES */
    .project-hero h1 {
        font-size: 38px;
    }

    .meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Fixed gradient background */
    body {
        background-attachment: scroll;
    }

    /* #lightbox::after {
        display: none;
    } */
    
    .back-to-top-float {
        position: fixed;
        bottom: 20px;
        right: 20px;

        width: 54px;
        height: 54px;

        background: rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255,255,255,0.5);
        color: white;

        text-decoration: none;

        z-index: 9998;
    }

    .image-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .image-grid.single {
        grid-template-columns: 1fr;
    }

    .image-grid img {
        width: calc(50% - 10px);
    }

    .image-grid.single img {
        width: 100%;
    }

    .overlay {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    /* .project-nav {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    } */
    
    .about-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .about-image img {
        margin-top: 0;
        width: 100%;
        max-width: 320px;
    }

    .about-image,
    .about-text {
        order: unset;
    }

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