@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;600&display=swap');

@font-face {
    font-family: 'Rage Italic';
    src: url('resources/RAGE_1.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #561cdb;
    --nav-active: #ffda62;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-light: #f7f5f0;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Section colors */
    --about-color: #63a375;
    --about-border: #4f825d;
    --about-dark: #4a7858;
    --portfolio-color: #d57a66;
    --portfolio-border: #b36252;
    --portfolio-dark: #a15c4f;
    --contact-color: #ca6680;
    --contact-border: #a6546a;
    --contact-dark: #964d61;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(90deg, #8f4ed4 0%, #25006b 100%);
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 1rem;
    z-index: 2000;
    padding: 0.5rem 0.75rem;
    background: #131a27;
    color: white;
    border-radius: 0.25rem;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0.75rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 14px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(90deg, #ffffff 0%, #7a7a7a 100%);
    border-left: 1px solid rgba(0, 0, 0, 0.15);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffffff 0%, #7a7a7a 100%);
    border-radius: 4px;
    border: 2px solid #dddddd;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #c0c0c0 0%, #444444 100%);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #ffffff #c4c4c4;
}

h1,
h2,
h3 {
    font-family: 'Fraunces', serif;
}

/* Navigation */
nav {
    background: linear-gradient(135deg, #561cdb 0%, #9051d3 100%);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 220px;
    z-index: 1000;
}

.top-name-bar {
    position: fixed;
    top: 0;
    left: 220px;
    width: calc(100% - 220px);
    height: 56px;
    background: linear-gradient(90deg, #A17C6B 0%, #CEB5A7 100%);
    border-bottom: 4px solid;
    border-image: linear-gradient(90deg, #131a27 0%, #2a303b 100%);
    border-image-slice: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
    font-family: 'Fraunces', serif;
    font-size: 1.75rem;
    letter-spacing: 0.04em;
    color: white;
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    z-index: 900;
}

.top-name-bar.is-visible {
    transform: translateY(0);
}

.scroll-to-top {
    position: absolute;
    right: 2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0.25rem;
}

.top-name-bar-left {
    position: absolute;
    left: 0.75rem;
    display: none;
    align-items: center;
    justify-content: center;
}

.scroll-to-top:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid #ffda62;
    outline-offset: 2px;
}

.nav-container {
    padding: 2.5rem 1.5rem;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
}

.nav-links {
    display: flex;
    flex-direction: column;
    list-style: none;
    gap: 1rem;
    width: 100%;
}

.nav-links a {
    display: block;
    text-decoration: none;
    color: white;
    font-size: 2.4rem;
    font-weight: 400;
    transition: all 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--nav-active);
    font-weight: 1000;
}

/* Layout */
.page {
    display: flex;
}

.content {
    margin-left: 220px;
    width: calc(100% - 220px);
}

/* Fallback scroll offset for hash navigation */
section[id] {
    scroll-margin-top: 80px;
}

.section-block:not(#about) {
    animation: fade-up 0.25s ease both;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, rgba(41, 41, 41, 0.08), rgba(170, 170, 170, 0.06));
    color: white;
    padding: 8rem 2rem;
    min-height: 100vh;
    position: relative;
    display: grid;
    place-items: center;
    text-align: center;
    overflow: hidden;
}

.hero-media {
    position: absolute;
    inset: 0;
}

.hero-clip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    filter: saturate(0.9) contrast(1.05);
}

.hero-clip.active {
    opacity: 0.85;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(135deg, 
            rgba(255, 255, 255, 0.18) 0%, 
            rgba(255, 255, 255, 0.22) 48%, 
            rgba(255, 255, 255, 0.26) 50%, 
            rgba(255, 255, 255, 0.22) 52%, 
            transparent 60%),
        linear-gradient(120deg, rgba(53, 53, 53, 0.65), rgba(122, 122, 122, 0.35));
    backdrop-filter: blur(3px);
    box-shadow: 
        inset 0 2px 12px rgba(255, 255, 255, 0.2), 
        inset -2px -2px 16px rgba(0, 0, 0, 0.15);
}

.video-pause-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.video-pause-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.video-pause-btn svg {
    width: 24px;
    height: 24px;
}

#toggleContentBtn {
    top: calc(2rem + 48px + 1rem);
}

#videoRestartBtn {
    top: calc(2rem + 96px + 2rem);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 720px;
    transition: opacity 0.3s ease;
}

.name-tag-image {
    width: min(45vw, 750px);
    max-width: 90%;
    height: auto;
    margin: 0 auto 2.5rem;
    display: block;
    transform: rotate(6deg);
    filter: drop-shadow(0 14px 28px rgba(15, 23, 42, 0.35));
}

.tagline {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 50%;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    color: #333;
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* Intro Section */
.intro {
    display: none;
}

/* Page Header */
.page-header {
    background-color: var(--bg-light);
    padding: 4rem 0;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    display: inline-block;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Folder crease line */
#about .page-header::after,
#portfolio .page-header::after,
#contact .page-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

#about .page-header,
#portfolio .page-header,
#contact .page-header {
    position: relative;
}

/* Manila Folder Styling */
#about,
#portfolio,
#contact {
    position: relative;
}

#about::before,
#portfolio::before,
#contact::before {
    content: '';
    position: absolute;
    top: -70px;
    height: 80px;
    width: 300px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 700;
    font-family: 'Rage Italic', 'Fraunces', serif;
    color: #000;
}

#about {
    background: linear-gradient(to bottom, 
        var(--about-color) 0%, 
        var(--about-color) 50%, 
        var(--about-dark) 100%);
    border-top: 4px solid var(--about-border);
    transform: translateY(7.5vh);
    transition: transform 0.5s ease;
}

#about.visible {
    transform: translateY(0);
}

#about::before {
    background: var(--about-color);
    border-top: 4px solid var(--about-border);
}

#portfolio {
    background: linear-gradient(to bottom, 
        var(--portfolio-color) 0%, 
        var(--portfolio-color) 50%, 
        var(--portfolio-dark) 100%);
    border-top: 4px solid var(--portfolio-border);
    padding-bottom: 3rem;
}

#portfolio::before {
    background: var(--portfolio-color);
    border-top: 4px solid var(--portfolio-border);
}

#contact {
    background: linear-gradient(to bottom, 
        var(--contact-color) 0%, 
        var(--contact-color) 50%, 
        var(--contact-dark) 100%);
    border-top: 4px solid var(--contact-border);
}

#contact::before {
    background: var(--contact-color);
    border-top: 4px solid var(--contact-border);
}

#about,
#portfolio,
#contact,
#about .subtitle,
#portfolio .subtitle,
#contact .subtitle,
#about .about-text p,
#about .about-text ul,
#about .about-text li,
#contact .contact-item p,
#contact .contact-item a,
#contact .contact-form label,
#contact .contact-item h3,
#contact .contact-info h2,
#contact .contact-form h2 {
    color: white;
}

/* Portfolio project text on white cards should be black */
#portfolio .project-info p,
#portfolio .tag,
#portfolio .project-info h3 {
    color: var(--text-color);
}

/* Make body text slightly dimmer than headings for hierarchy */
#about .about-text p,
#about .about-text li,
#contact .contact-item p {
    color: rgba(255, 255, 255, 0.85);
}

#about::before {
    content: 'About';
    left: 10rem;
}

#portfolio::before {
    content: 'Portfolio';
    left: 50%;
    transform: translateX(-50%);
}

#contact::before {
    content: 'Contact';
    right: 10rem;
}

/* About Section */
.about-content {
    padding: 4rem 0;
}

#about .page-header {
    background: transparent;
    padding: 1rem 0 0.5rem 0;
}

.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    column-gap: 3rem;
    row-gap: 1rem;
    align-items: start;
    position: relative;
}

.about-image {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.about-text h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.about-text h2:first-child {
    margin-top: 0;
}

.about-text p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

.about-text ul {
    margin-left: 1.5rem;
    color: var(--text-light);
}

.about-wide-paragraph {
    grid-column: 1 / -1;
    margin: 0 0 1rem 0;
    color: rgba(255, 255, 255, 0.85);
}

.about-text-lower {
    grid-column: 1 / -1;
}

.about-text-lower h2:first-child {
    margin-top: 0rem;
}

.about-text-lower ul {
    list-style: none;
    margin: 0 0 1.35rem 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 0.75rem;
}

.about-text-lower ul li {
    margin: 0;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.58);
    background: rgba(74, 120, 88, 0.55);
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    box-shadow: 0 3px 10px rgba(8, 8, 25, 0.16);
}

.about-slideshow {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 83.33%;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.about-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.about-slide.active {
    opacity: 1;
}

.open-resume-btn {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    background: rgba(147, 196, 160, 0.2);
    border: 2px solid rgba(177, 241, 196, 0.4);
    color: rgba(255, 255, 255, 0.774);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.open-resume-btn::before {
    content: 'Open Resume';
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    pointer-events: none;
}

.open-resume-btn:hover {
    background: rgba(218, 218, 218, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.open-resume-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* Skills Section */
.skills {
    padding: 0 0 6.5rem 0;
}

.skills h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: white;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.skill-card {
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.skill-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.skill-card p {
    color: var(--text-light);
}

/* Portfolio Section */
.portfolio-content {
    padding: 4rem 0;
}

#portfolio .page-header {
    background: transparent;
    padding: 2rem 0 1.5rem 0;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    align-items: start;
}

.project-card {
    background-color: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s, border 0.3s;
    border: 4px solid transparent;
    align-self: start;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--primary-color);
}

.project-card.is-selected {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--primary-color);
}

.project-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.project-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.project-img.active {
    opacity: 1;
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.project-dates {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #5f5f5f;
    margin-bottom: 0.2rem;
}

.project-members {
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #7a7a7a;
    margin-bottom: 0.6rem;
}

.project-description {
    color: var(--text-light);
    margin-bottom: 0.35rem;
}

.project-description.is-collapsed {
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-description-toggle {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0 0 0.9rem 0;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.project-description-toggle:hover {
    text-decoration: underline;
}

.project-info p {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tag {
    background-color: var(--bg-light);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.project-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.project-link:hover {
    text-decoration: underline;
}

body.video-modal-open {
    overflow: hidden;
}

body.modal-open {
    overflow: hidden;
}

.video-modal,
.project-details-modal {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.video-modal.is-open,
.project-details-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.video-modal-overlay,
.project-details-overlay {
    position: absolute;
    inset: 0;
    background: rgba(18, 17, 28, 0.78);
    backdrop-filter: blur(2px);
}

.video-modal-dialog,
.project-details-dialog {
    position: relative;
    width: min(900px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: linear-gradient(180deg, #f3e6dc 0%, #dbc9bb 100%);
    border: 3px solid #8f6b57;
    border-radius: 0.5rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
    padding: 1.25rem;
}

.video-modal-title,
.project-details-title {
    font-size: 1.4rem;
    color: #2f2520;
    margin: 0 2rem 0.85rem 0;
}

.video-modal-close,
.project-details-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #ffffff;
    background: rgba(124, 30, 233, 0.9);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-modal-close:hover,
.project-details-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.video-player-shell {
    border-radius: 0.35rem;
    overflow: hidden;
    background: #090909;
    border: 1px solid rgba(0, 0, 0, 0.35);
}

#projectVideoPlayer {
    width: 100%;
    height: auto;
    display: block;
    max-height: calc(100vh - 14rem);
}

.project-details-content {
    display: grid;
    gap: 1rem;
}

.project-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.project-gallery-item {
    margin: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(66, 49, 39, 0.18);
}

.project-gallery-image {
    width: 100%;
    display: block;
    height: 100%;
    object-fit: cover;
}

.project-gallery-caption {
    padding: 0.75rem 0.9rem;
    color: #4d3c34;
    font-size: 0.95rem;
}

.project-parts-list {
    display: grid;
    gap: 0.85rem;
}

.project-part-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(66, 49, 39, 0.18);
}

.project-part-meta {
    display: grid;
    gap: 0.35rem;
}

.project-part-title {
    margin: 0;
    color: #2f2520;
    font-size: 1rem;
}

.project-part-description {
    margin: 0;
    color: #5f4b40;
    font-size: 0.95rem;
}

.project-part-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 8.5rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    background: #561cdb;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
}

.project-part-link.is-disabled {
    background: rgba(86, 28, 219, 0.18);
    color: #5a4679;
}

.more-projects-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1rem;
    position: relative;
}

.toggle-projects-btn {
    width: 100%;
    padding: 1rem 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.toggle-projects-btn:hover {
    opacity: 0.8;
}

.toggle-projects-btn .chevron {
    transition: transform 0.3s ease;
}

.toggle-projects-btn.expanded .chevron {
    transform: rotate(180deg);
}

.additional-projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    align-items: start;
}

.additional-projects.expanded {
    max-height: 5000px;
}

#additionalProjects2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    align-items: start;
}

#additionalProjects2.expanded {
    max-height: 5000px;
}

/* Contact Section */
.contact-content {
    padding: 4rem 0;
}

#contact .page-header {
    background: transparent;
    padding: 2rem 0 1.5rem 0;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.contact-info h2,
.contact-form h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.contact-item {
    margin-bottom: 1.5rem;
}

.contact-item h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.contact-item p,
.contact-item a {
    color: var(--text-light);
    text-decoration: none;
}

.contact-item a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Contact Form */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(156, 156, 156, 0.75);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-status {
    min-height: 1.4rem;
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.88);
}

.form-status.is-success {
    color: #8df0a2;
}

.form-status.is-error {
    color: #ffc9c9;
}

/* Footer */
footer {
    background-color: #131a27;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
}

/* Responsive Design */
@media (max-width: 900px) {
    .page {
        padding-top: 56px;
        flex-direction: column;
    }

    nav {
        position: sticky;
        top: 56px;
        height: auto;
        width: 100%;
        z-index: 950;
    }

    .top-name-bar {
        transform: translateY(0);
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
        font-size: 1.5rem;
    }

    .top-name-bar-left {
        display: inline-flex;
        top: 50%;
        transform: translateY(-50%);
    }

    .top-name-bar .open-resume-btn {
        width: 36px;
        height: 36px;
        border-radius: 0.4rem;
        border: 1px solid rgba(255, 255, 255, 0.45);
        background: rgba(255, 255, 255, 0.18);
        color: #ffffff;
        backdrop-filter: blur(8px);
        order: 1;
    }

    .top-name-bar .open-resume-btn::before {
        display: none;
    }

    .top-name-bar .open-resume-btn svg {
        width: 18px;
        height: 18px;
    }

    .video-pause-btn {
        z-index: 1001;
    }

    .nav-container {
        padding: 1rem 1.5rem;
    }

    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1.25rem;
    }

    .nav-links a {
        font-size: 1.5rem;
        text-align: center;
    }

    .content {
        margin-left: 0;
        width: 100%;
    }

    .hero {
        padding: 5rem 1.5rem;
    }

    /* Shrink folder tabs so they don't overflow */
    #about::before {
        left: 2rem;
        width: 160px;
        font-size: 2.5rem;
        height: 68px;
        top: -64px;
    }

    #portfolio::before {
        width: 220px;
        font-size: 2.5rem;
        height: 68px;
        top: -64px;
    }

    #contact::before {
        right: 2rem;
        width: 160px;
        font-size: 2.5rem;
        height: 68px;
        top: -64px;
    }
}

@media (max-width: 768px) {
    .top-name-bar {
        height: 50px;
        font-size: 1.2rem;
        padding: 0 1rem;
    }

    .page {
        padding-top: 50px;
    }

    nav {
        top: 50px;
    }

    .scroll-to-top {
        right: 0.75rem;
        width: 34px;
        height: 34px;
    }

    .top-name-bar .open-resume-btn {
        width: 34px;
        height: 34px;
    }

    .nav-links a {
        font-size: 1.25rem;
    }

    .tagline {
        font-size: 1.25rem;
    }

    .hero {
        padding: 4rem 1.25rem;
    }

    .name-tag-image {
        width: min(75vw, 400px);
    }

    .page-header {
        padding: 2.5rem 0;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .about-text {
        order: 1;
    }

    .about-wide-paragraph {
        order: 2;
    }

    .about-image {
        order: 3;
    }

    .about-text-lower {
        order: 4;
    }

    .about-content {
        padding: 2.5rem 0;
    }

    .about-image {
        align-items: center;
    }

    .about-slideshow {
        max-width: 340px;
        margin: 0 auto;
    }

    /* Reposition resume tooltip so it doesn't clip on mobile */
    .open-resume-btn::before {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .about-text h2 {
        font-size: 1.5rem;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-content {
        padding: 2.5rem 0;
    }

    .contact-content {
        padding: 2.5rem 0;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .video-modal-dialog,
    .project-details-dialog {
        width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
        padding: 1rem;
    }

    .video-modal-title,
    .project-details-title {
        font-size: 1.15rem;
    }

    #projectVideoPlayer {
        max-height: calc(100vh - 12rem);
    }

    .project-part-item {
        flex-direction: column;
        align-items: stretch;
    }

    .project-gallery-grid {
        grid-template-columns: 1fr;
    }

    footer {
        margin-top: 2rem;
    }
}

@media (max-width: 480px) {
    .top-name-bar {
        height: 46px;
        font-size: 1rem;
        letter-spacing: 0.02em;
    }

    .top-name-bar-left {
        left: 0.45rem;
    }

    .page {
        padding-top: 46px;
    }

    nav {
        top: 46px;
    }

    .top-name-bar .open-resume-btn {
        width: 30px;
        height: 30px;
    }

    .top-name-bar .open-resume-btn svg {
        width: 16px;
        height: 16px;
    }

    .nav-container {
        padding: 0.6rem 1rem;
    }

    .nav-links {
        gap: 0.35rem 0.85rem;
        justify-content: center;
    }

    .nav-links a {
        font-size: 1.05rem;
    }

    .hero {
        padding: 3rem 1rem;
        min-height: 85vh;
    }

    .name-tag-image {
        width: min(88vw, 300px);
    }

    .tagline {
        font-size: 0.95rem;
    }

    /* Scale down and reposition hero overlay buttons */
    .video-pause-btn {
        width: 40px;
        height: 40px;
        top: 0.75rem;
        right: 0.75rem;
    }

    #toggleContentBtn {
        top: calc(0.75rem + 40px + 0.6rem);
    }

    #videoRestartBtn {
        top: calc(0.75rem + 80px + 1.2rem);
    }

    /* Further shrink folder tabs */
    #about::before,
    #portfolio::before,
    #contact::before {
        font-size: 1.85rem;
        height: 54px;
        top: -50px;
        width: 128px;
    }

    #about::before {
        left: 0.75rem;
    }

    #contact::before {
        right: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .about-text h2 {
        font-size: 1.3rem;
    }

    .contact-info h2,
    .contact-form h2 {
        font-size: 1.4rem;
    }

    .contact-grid {
        gap: 2rem;
    }

    .skills {
        padding: 0 0 3.5rem 0;
    }

    .skills h2 {
        font-size: 1.6rem;
    }

    .portfolio-content {
        padding: 2rem 0;
    }

    .contact-content {
        padding: 2rem 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
