:root {
    --background-color: #FFE8E8;
    --about-background-color: #e5e7ee;
    --text-color: #333333;
    --accent-color: #FF4444;
}

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

html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    transition: background-color 1.5s ease;
}

main {
    flex-grow: 1;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(2rem, 5vw, 12rem) clamp(1.5rem, 5vw, 12rem);
    z-index: 2;
}

.logo .circle {
    width: clamp(50px, 3.13vw, 120px);
    aspect-ratio: 1;
    background-color: var(--accent-color);
    --g: /25.486% 25.486% radial-gradient(#000 calc(71% - 1px), #0000 71%) no-repeat;
    mask: 93.126% 75.302% var(--g),
        66.773% 97.103% var(--g),
        32.571% 96.864% var(--g),
        6.525% 74.697% var(--g),
        0.821% 40.974% var(--g),
        18.129% 11.474% var(--g),
        50.349% 0.001% var(--g),
        82.406% 11.923% var(--g),
        99.3% 41.662% var(--g),
        radial-gradient(100% 100%, #000 35.01%, #0000 calc(35.01% + 1px));
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: clamp(1.5rem, 2.5vw, 6rem);
    font-weight: 400;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    min-height: calc(100vh - 300px);
    margin-bottom: 1rem;
    position: relative;
    padding: 0 clamp(1.5rem, 5vw, 12rem);
}

/* Make the home page fit a single viewport like the about page */
.home-page {
    height: 100vh;
    overflow: hidden;
}

.home-page .hero {
    min-height: 1;
    flex-grow: 1;
    margin-bottom: 0;
}

.home-page .hero-image {
    bottom: 1;
}

.intro-text {
    max-width: 55%;
    position: relative;
    z-index: 2;
    margin-bottom: 50px;
    margin-top: 50px;
}

h1 {
    font-size: clamp(1.5rem, 2.6vw, 6.25rem);
    font-weight: 350;
    line-height: 1.3;
    margin-bottom: clamp(2rem, 5vw, 10rem);
}

.cta {
    color: var(--text-color);
    text-decoration: none;
    font-size: clamp(1.25rem, 2vw, 4.8rem);
    font-weight: 200;
}

.hero-image {
    flex-shrink: 0;
    width: clamp(360px, 52vw, 2000px);
    position: absolute;
    right: clamp(-50px, -2vw, 0px);
    bottom: clamp(-150px, -10vw, -40px);
    z-index: 1;
    transition: transform 0.3s ease;
}

.hero-image:hover {
    transform: rotate(-5deg) translateY(-10px);
}

.hero-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

@media (max-width: 768px) {

    /* Let the home page grow with content instead of locking to one viewport */
    .home-page {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 2rem;
        padding: 0 2rem 4rem;
        min-height: 0;
    }

    .intro-text {
        max-width: 100%;
        margin-bottom: 1rem;
    }

    .hero-image {
        position: relative;
        width: min(80%, 420px);
        right: auto;
        bottom: auto;
    }

    nav,
    .projects {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .project-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0;
    }
}

.projects {
    margin: 0;
    padding: 8rem 6rem 8rem 6rem;
    background-color: white;
    position: relative;
    flex-grow: 1;
}

.projects::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2rem;
    /* Reduced to match footer height */
    background-color: white;
    height: 100%;
    /* Changed to 100% to match content */
    z-index: -1;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6rem;
    max-width: 1500px;
    margin: -40px auto;
}

.project-item {
    position: relative;
    transition: transform 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
    display: block;
}

.project-item:hover {
    transform: translateY(-10px);
}

.project-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 4/3;
}

.project-item h2 {
    margin-top: 1rem;
    font-size: 1.5rem;
    font-weight: 350;
}

@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    body {
        padding: 2rem;
    }
}

footer {
    padding: 2rem 0 4rem 0;
    /* Adjusted padding */
    margin: 0;
    background-color: white;
    border-top: 1px solid #E0E0E0;
    position: relative;
    /* Ensure footer is positioned correctly */
}

.footer-content {
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.copyright {
    font-size: 1.5rem;
    font-weight: 200;
}

.social-links {
    display: flex;
    gap: 3.5rem;
}

.social-icon img {
    width: 32px;
    height: 32px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.social-icon:hover img {
    opacity: 1;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
}

/* About Page Styles */
.about-page {
    min-height: 100vh;
    width: 100%;
    background-color: var(--about-background-color);
}

.about-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    /* Adjusted column widths */
    gap: clamp(3rem, 8vw, 19rem) clamp(2rem, 4vw, 9.6rem);
    /* First value for row gap, second for column gap */
    padding: clamp(2rem, 5vw, 12rem) clamp(1.5rem, 5vw, 12rem);
}

.intro-section {
    grid-column: 1;
}

.intro-section h1 {
    font-size: clamp(1.75rem, 2.6vw, 6.25rem);
    /* Increased font size */
    font-weight: 350;
    /* Lighter weight to match main page */
    margin-bottom: 2rem;
    position: relative;
}

.intro-section h1 span {
    position: relative;
    cursor: pointer;
}

.intro-section h1 span:hover::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background-image: url('images/profile-placeholder.jpg');
    background-size: cover;
    top: -100px;
    left: 220%;
    transform: translateX(-50%);
    z-index: -1;
}

.intro-section p {
    font-size: clamp(1.35rem, 2vw, 4.8rem);
    /* Increased font size */
    font-weight: 350;
    /* Lighter weight */
    line-height: 1.3;
    /* Adjusted line height */
    margin-bottom: 2rem;
}

.contact-section p {
    font-size: clamp(1.35rem, 2vw, 4.8rem);
    /* Match other text sizes */
    font-weight: 350;
    /* Lighter weight */
    line-height: 1.3;
    /* Match other line heights */
    margin-bottom: 2rem;
}

.experience-section,
.education-section {
    padding-top: 1rem;
    /* Add some top padding to align with content */
}

.experience-section h2,
.education-section h2 {
    font-size: clamp(1.5rem, 2vw, 4.8rem);
    font-weight: 350;
    margin-bottom: clamp(1.5rem, 3vw, 7.2rem);
}

.experience-item,
.education-item {
    margin-bottom: 3rem;
    /* Increased spacing between items */
}

.experience-item h3,
.education-item h3 {
    font-size: clamp(1.25rem, 1.25vw, 2.5rem);
    /* Increased font size */
    font-weight: 300;
    /* Match weight */
    margin-bottom: 0.5rem;
}

.experience-item p,
.education-item p {
    font-size: clamp(1.1rem, 1.05vw, 2.5rem);
    /* Adjusted font size */
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.5;
    font-weight: 300;
    /* Lighter weight */
}

.social-links {
    display: flex;
    gap: 3.5rem;
    align-items: center;
}

.social-icon img {
    width: clamp(30px, 1.85vw, 60px);
    /* Increased icon size */
    height: clamp(30px, 1.85vw, 60px);
    opacity: 0.8;
    transition: opacity 0.3s ease;
    vertical-align: middle;
}

.social-icon:hover img {
    opacity: 1;
}

/* Add responsive styles for about page */
@media (max-width: 768px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 4rem;
    }

    .intro-section h1 {
        font-size: 2.5rem;
    }

    .intro-section p,
    .contact-section p {
        font-size: 1.5rem;
    }
}

html {
    scroll-behavior: smooth;
    /* Add smooth scrolling */
}

/* Work Page (PDF viewer) Styles */
.work-page {
    height: 100vh;
    overflow: hidden;
}

/* Same nav position as every other page; only the space *below* the nav
   is trimmed so the PDF stays large. */
.work-page nav {
    padding-bottom: clamp(1.5rem, 3vw, 6rem);
}

.viewer {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: 1fr auto;
    align-items: center;
    column-gap: clamp(0.4rem, 0.6vw, 1rem);
    row-gap: 0.25rem;
    padding: 0 clamp(0.75rem, 1.5vw, 3rem) clamp(0.5rem, 0.8vw, 1.25rem);
    min-height: 0;
    background-color: var(--background-color);
}

/* Fullscreen: the page fills the screen, controls float on top */
.viewer:fullscreen {
    position: relative;
    display: block;
    padding: 0;
}

.viewer:fullscreen .viewer-stage {
    width: 100%;
    height: 100%;
}

.viewer:fullscreen .viewer-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    padding: 1rem;
}

.viewer:fullscreen .viewer-arrow:hover:not(:disabled) {
    transform: translateY(calc(-50% - 6px));
}

.viewer:fullscreen #prev-page {
    left: clamp(0.5rem, 1.5vw, 2rem);
}

.viewer:fullscreen #next-page {
    right: clamp(0.5rem, 1.5vw, 2rem);
}

.viewer:fullscreen .viewer-counter {
    position: absolute;
    bottom: clamp(0.75rem, 1.5vw, 2rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.viewer:fullscreen .viewer-fullscreen {
    position: absolute;
    bottom: clamp(0.75rem, 1.5vw, 2rem);
    right: clamp(0.75rem, 2vw, 2.5rem);
    z-index: 2;
}

.viewer-stage {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 0;
    min-width: 0;
}

.viewer-stage canvas {
    background-color: white;
    box-shadow: 0 12px 40px rgba(51, 51, 51, 0.15);
    max-width: 100%;
    max-height: 100%;
}

.viewer-arrow {
    grid-row: 1;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-family: inherit;
    font-size: clamp(1.5rem, 2.5vw, 6rem);
    font-weight: 200;
    padding: 1rem 0.25rem;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.viewer-arrow:hover:not(:disabled) {
    transform: translateY(-6px);
}

.viewer-arrow:disabled {
    opacity: 0.25;
    cursor: default;
}

.viewer-status {
    font-size: clamp(1.25rem, 2vw, 4.8rem);
    font-weight: 200;
    text-align: center;
}

.viewer-counter {
    grid-column: 2;
    grid-row: 2;
    text-align: center;
    font-size: clamp(0.9rem, 1vw, 2rem);
    font-weight: 200;
}

.viewer-fullscreen {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-family: inherit;
    font-size: clamp(0.9rem, 1vw, 2rem);
    font-weight: 200;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.viewer-fullscreen:hover {
    opacity: 1;
    text-decoration: underline;
}

.password-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.password-form[hidden] {
    display: none;
}

.password-form p {
    font-size: clamp(1.25rem, 2vw, 4.8rem);
    font-weight: 200;
}

.password-form input {
    background: none;
    border: none;
    border-bottom: 1px solid var(--text-color);
    font-family: inherit;
    font-size: clamp(1.1rem, 1.25vw, 2.5rem);
    font-weight: 200;
    color: var(--text-color);
    text-align: center;
    padding: 0.5rem 1rem;
    outline: none;
    width: min(60vw, 320px);
}

.password-form input:focus {
    border-bottom-color: var(--accent-color);
}

.password-form button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-family: inherit;
    font-size: clamp(1.1rem, 1.5vw, 3rem);
    font-weight: 200;
}

.password-form button:hover {
    color: var(--accent-color);
}

.password-error {
    color: var(--accent-color);
}

.password-form .password-error {
    font-size: clamp(0.9rem, 1vw, 2rem);
}

@media (max-width: 768px) {
    .viewer {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr auto;
        padding: 0 1.5rem 2rem;
        gap: 0.5rem;
    }

    .viewer-stage {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .viewer-arrow {
        grid-row: 2;
        font-size: 2rem;
    }

    .viewer-arrow#prev-page {
        grid-column: 1;
        justify-self: start;
    }

    .viewer-arrow#next-page {
        grid-column: 2;
        justify-self: end;
    }

    .viewer-counter {
        grid-column: 1 / -1;
        grid-row: 2;
        align-self: center;
    }

    .viewer-fullscreen {
        grid-column: 1 / -1;
        grid-row: 3;
        justify-self: center;
        padding: 0.5rem;
    }
}