:root {
    /* Pinterest Design Variables */
    --color-red: #e60023;
    --color-text-main: #211922; /* Plum Black */
    --color-text-secondary: #62625b; /* Olive Gray */
    --color-text-warm-silver: #91918c;
    --color-bg-white: #ffffff;
    --color-bg-fog: #f6f6f3;
    --color-bg-sand: #e5e5e0;
    --color-bg-warm-light: #e0e0d9;
    --color-bg-dark: #33332e;
    
    --font-family: 'Pin Sans', -apple-system, system-ui, Segoe UI, Roboto, Oxygen-Sans, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif;
    
    --radius-btn: 16px;
    --radius-card: 20px;
    --radius-section: 32px;
    --radius-hero: 40px;
    
    /* Spatial */
    --spacing-base: 8px;
    --section-padding: 80px 24px;
}

body.dark-mode {
    --color-bg-fog: #211922;
    --color-bg-white: #33332e;
    --color-text-main: #ffffff;
    --color-text-secondary: #e5e5e0;
    --color-bg-sand: #62625b;
    --color-bg-dark: #120e13;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg-fog);
    color: var(--color-text-main);
    line-height: 1.4;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1 { font-size: 70px; font-weight: 600; line-height: 1.1; letter-spacing: -1.2px; }
h2 { font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -1.2px; margin-bottom: 24px; }
h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
p { font-size: 16px; font-weight: 400; color: var(--color-text-main); }
.text-secondary { color: var(--color-text-secondary); }
.caption { font-size: 14px; font-weight: 700; }
.subtext { font-size: 12px; font-weight: 400; line-height: 1.5; }

@media (max-width: 768px) {
    h1 { font-size: 48px; }
    --section-padding: 48px 16px;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

section {
    padding: var(--section-padding);
}

/* Header */
.pinterest-header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background-color: var(--color-bg-white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05); /* very subtle shadow to detach header */
}

.logo-icon {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-red);
    text-decoration: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-warm-light);
    margin-right: 24px;
}

.header-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
}

.nav-link {
    text-decoration: none;
    color: var(--color-text-main);
    font-weight: 600;
    padding: 12px 16px;
    border-radius: var(--radius-btn);
    transition: background-color 0.2s;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--color-bg-warm-light);
}

body.dark-mode .logo-icon { background-color: var(--color-bg-fog); }
body.dark-mode .nav-link:hover, body.dark-mode .nav-link.active {
    background-color: var(--color-bg-dark);
}

/* Hamburger Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--color-text-warm-silver);
    border-radius: 50%;
    cursor: pointer;
    padding: 10px;
    transition: background 0.3s;
}

.hamburger-line {
    display: block;
    width: 18px;
    height: 2px;
    background-color: var(--color-text-main);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger to X animation */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Responsive Header */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .header-nav {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background-color: var(--color-bg-white);
        flex-direction: column;
        align-items: stretch;
        padding: 16px 24px;
        gap: 4px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease, transform 0.3s ease;
        border-radius: 0 0 var(--radius-card) var(--radius-card);
        /* Override the centering for mobile */
        position: fixed;
        left: 0;
        right: 0;
        transform: translateY(-20px);
    }

    .header-nav.nav-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-link {
        text-align: center;
        padding: 14px 16px;
        font-size: 16px;
    }

    /* Hero buttons spacing */
    .hero-content > div {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .hero-content .btn {
        margin-right: 0 !important;
        width: 200px;
        text-align: center;
    }

    /* Featured project cards - prevent horizontal scroll */
    .projects-grid {
        grid-template-columns: 1fr !important;
    }

    .project-card {
        max-width: 100%;
    }

    /* Skills grid fix */
    .skills-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stat grid fix */
    .grid-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius-btn);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
    transform: scale(1.02);
    opacity: 0.95;
}

.btn-primary {
    background-color: var(--color-red);
    color: #ffffff;
}

.btn-secondary {
    background-color: var(--color-bg-sand);
    color: #000000;
}

body.dark-mode .btn-secondary {
    color: #ffffff;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: var(--color-bg-white);
    border-bottom-left-radius: var(--radius-hero);
    border-bottom-right-radius: var(--radius-hero);
    overflow: hidden;
    margin-bottom: 32px;
}

.hero-bg {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    pointer-events: none;
    background-image: url('imgs/header.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.1; /* Keeps it subtle */
    z-index: 0;
    transition: transform 0.1s ease-out;
}

body.dark-mode .hero-bg {
    opacity: 0.05;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 0 24px;
}

.hero p {
    font-size: 20px;
    color: var(--color-text-secondary);
    margin-top: 16px;
    margin-bottom: 32px;
}

/* Masonry Grid (Stats & Skills) */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background-color: var(--color-bg-white);
    border-radius: var(--radius-card);
    padding: 32px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

/* Stats Section */
.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    background-color: hsla(60, 20%, 98%, 0.5); /* Warm Wash */
}

body.dark-mode .stat-card {
    background-color: var(--color-bg-white);
}

.stat-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--color-red);
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.stat-punchline {
    color: var(--color-text-secondary);
    font-style: italic;
    font-size: 14px;
    margin-top: 8px;
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
}

.project-card {
    background-color: var(--color-bg-white);
    border-radius: var(--radius-card);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 0; /* Removing padding from parent so image can stretch */
}

.project-img-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

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

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

.project-content {
    padding: 32px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.project-card .punchline {
    margin-top: auto;
    padding-top: 24px;
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* About Section */
.about-section {
    background-color: var(--color-bg-white);
    border-radius: var(--radius-section);
    padding: 64px 48px;
    max-width: 1000px;
    margin: 0 auto 64px auto;
    display: flex;
    align-items: center;
    gap: 40px;
}

.about-image {
    flex: 1;
    border-radius: var(--radius-card);
    overflow: hidden;
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-card);
}

.about-content {
    flex: 1.5;
}

.about-content p {
    font-size: 20px;
    line-height: 1.6;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .about-section {
        flex-direction: column;
        padding: 32px 24px;
    }
}

/* Skills Section */
.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.skill-pill {
    background-color: var(--color-bg-white);
    padding: 16px 24px;
    border-radius: var(--radius-card);
    text-align: center;
    min-width: 200px;
}

.skill-pill h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Form */
.contact-section {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--color-bg-white);
    border-radius: var(--radius-section);
    padding: 48px;
}

.form-group {
    margin-bottom: 24px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--color-text-warm-silver);
    border-radius: var(--radius-btn);
    font-family: var(--font-family);
    font-size: 16px;
    background-color: var(--color-bg-white);
    color: var(--color-text-main);
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: #435ee5; /* Focus Blue */
    box-shadow: 0 0 0 4px rgba(67, 94, 229, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.success-msg {
    display: none;
    padding: 16px;
    background-color: #103c25; /* Green 700 */
    color: #ffffff;
    border-radius: var(--radius-btn);
    margin-top: 24px;
    text-align: center;
    font-weight: 500;
}

/* Footer */
footer {
    background-color: var(--color-bg-dark);
    color: var(--color-text-warm-silver);
    text-align: center;
    padding: 40px 24px;
    margin-top: 64px;
}

.footer-socials {
    margin-bottom: 24px;
}

.footer-socials a {
    color: var(--color-text-warm-silver);
    font-size: 24px;
    margin: 0 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-socials a:hover {
    color: var(--color-bg-fog);
}

footer p {
    color: var(--color-text-warm-silver);
    font-size: 14px;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #ffffff;
    color: #435ee5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.2s ease;
    z-index: 99;
}

.scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-to-top:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
