:root {
    --color-primary: #FF0000;
    --color-grid-line: #E0E0E0;
    --color-bg: #FFFFFF;
    --font-main: 'Instrument Sans', sans-serif;
    --font-size-title: 5vh;
    --font-size-text: 1.3vh;
}

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

@media (min-width: 1025px) {

    *,
    *::before,
    *::after {
        cursor: none !important;
    }
}

body {
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.cursor {
    position: fixed;
    top: -15px;
    left: -15px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.35);
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.3s ease, background-color 0.2s ease;
    will-change: transform;
}

.cursor.cursor-hover {
    background-color: rgba(255, 0, 0, 0.8) !important;
}

.projects-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Page routing */
.page {
    display: none;
}

.page.active {
    display: grid;
}

/* Content grid (shared by all pages) */
.content-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 1px;
    pointer-events: none;
    z-index: 1;
}

#page-projects.content-grid {
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(7, 1fr);
}

#page-about.content-grid {
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(8, 1fr);
}

#page-resume.content-grid {
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(12, 1fr);
}

/* Projects image tiles */
.projects-image {
    overflow: hidden;
    transition: filter 0.5s ease, opacity 0.5s ease;
}

.projects-image.dimmed,
.projects-title.dimmed {
    filter: grayscale(100%);
    opacity: 0.25;
}

/* Projects titles */
.projects-title {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    font-family: var(--font-main);
    font-weight: 200;
    font-size: var(--font-size-title);
    color: #000000;
    z-index: 2;
    transition: filter 0.5s ease, opacity 0.5s ease;
}

/* Projects info cells */
.projects-info {
    font-family: var(--font-main);
    color: #000000;
    line-height: 1.4;
    transition: filter 0.5s ease, opacity 0.5s ease;
}

.projects-info.dimmed {
    filter: grayscale(100%);
    opacity: 0.25;
}

.projects-tech {
    font-size: var(--font-size-text);
    font-weight: 300;
    display: flex;
    align-items: flex-start;
}

.projects-desc {
    font-size: var(--font-size-text);
    font-weight: 300;
    display: flex;
    align-items: flex-start;
}

.projects-date {
    font-size: var(--font-size-text);
    font-weight: 300;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
}

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

.content-item {
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

/* Header */
.header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    pointer-events: none;
}

.header-items {
    position: relative;
    height: calc(3 * (100vh - 3px) / 40);
    height: calc(3 * (100dvh - 3px) / 40);
}

.header-item {
    position: absolute;
    top: 0;
    height: calc(100vh / var(--active-rows, 4));
    height: calc(100dvh / var(--active-rows, 4));
    padding-top: calc((100vh - 3px) / 40);
    padding-top: calc((100dvh - 3px) / 40);
    display: flex;
    align-items: flex-start;
    font-family: var(--font-main);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 1.6vh;
    letter-spacing: 0.02em;
    text-decoration: none;
    pointer-events: auto;
    transition: left 1200ms cubic-bezier(0.4, 0, 0.2, 1),
        width 1200ms cubic-bezier(0.4, 0, 0.2, 1),
        padding-top 1200ms cubic-bezier(0.4, 0, 0.2, 1),
        height 1200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.header-item.active-nav {
    padding-top: calc(2 * (100vh - 3px) / 40);
    padding-top: calc(2 * (100dvh - 3px) / 40);
}

.header-items.nav-locked a.header-item {
    pointer-events: none;
}

.header-item-right {
    justify-content: flex-end;
}

.header-item span {
    transition: color 0.4s ease;
    white-space: nowrap;
}

/* Header cell hover — text turns white when grid cell is red */
.header-item.hovered span {
    color: #FFFFFF;
}

/* Grid utility classes */
.col-start-2 {
    grid-column-start: 2;
}

.col-start-3 {
    grid-column-start: 3;
}

.col-start-5 {
    grid-column-start: 5;
}

.col-span-2 {
    grid-column-end: span 2;
}

.col-span-3 {
    grid-column-end: span 3;
}

.row-start-2 {
    grid-row-start: 2;
}

.row-start-3 {
    grid-row-start: 3;
}

.row-start-4 {
    grid-row-start: 4;
}

.row-start-7 {
    grid-row-start: 7;
}

.row-start-10 {
    grid-row-start: 10;
}

.row-span-2 {
    grid-row-end: span 2;
}

.row-span-3 {
    grid-row-end: span 3;
}

/* Title Module */
.title-module {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    font-family: var(--font-main);
    line-height: 0.85;
}

.top-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 14cqi;
    overflow: visible;
}

.top-row span,
.bottom-row span {
    white-space: nowrap;
}

.bottom-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    font-size: 14cqi;
    overflow: visible;
}

/* Bio Module */
.bio-module {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    font-family: var(--font-main);
    line-height: 1.4;
}

.bio-module p {
    font-size: 3cqi;
    font-weight: 300;
    text-align: justify;
    hyphens: auto;
}

/* Portrait Module */
.portrait-module {
    grid-column: 5 / 7;
    grid-row: 1 / -1;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
}

.portrait-module img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

/* Contact grid */
#page-contact.content-grid {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

/* Contact Modules */
.contact-email-module,
.contact-phone-module,
.contact-address-module {
    container-type: inline-size;
    width: 100%;
    height: 100%;
    font-family: var(--font-main);
    display: flex;
}

.contact-email-module {
    align-items: flex-end;
    justify-content: flex-start;
}

.contact-email {
    font-size: 8.5cqi;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.5s ease;
}

.contact-email:hover {
    color: red;
}

.contact-copy-prompt {
    container-type: inline-size;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: red;
    font-family: var(--font-main);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.contact-copy-prompt.visible {
    opacity: 1;
}

.contact-copy-prompt span {
    color: white;
    font-size: 7cqi;
    font-weight: 400;
}

.contact-phone-module {
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
}

.contact-phone {
    font-size: 3.5cqi;
    font-weight: 300;
}


.contact-address {
    font-size: 3.5cqi;
    font-weight: 300;
}

/* About Heading */
.about-heading {
    container-type: inline-size;
    display: flex;
    align-items: flex-start;
    font-family: var(--font-main);
    font-size: 4cqi;
    font-weight: 400;
    color: #000000;
    white-space: nowrap;
    line-height: 1;
}

/* About Portrait Module */
.about-portrait-module {
    grid-column: 5 / 10;
    grid-row: 3 / 8;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    overflow: hidden;
}

.about-portrait-module img {
    height: 100%;
    width: auto;
    object-fit: contain;
    object-position: right bottom;
}

/* Resume headings */
.resume-heading {
    container-type: inline-size;
    display: flex;
    align-items: flex-start;
    font-family: var(--font-main);
    font-size: 2.8cqi;
    font-weight: 400;
    color: #000000;
}

/* Mobile nav + sections — hidden on desktop (overridden in mobile.css) */
.mobile-nav {
    display: none;
}

.mobile-project-section {
    display: none;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    background-color: var(--color-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    width: 50px;
    height: 50px;
    animation: spin-tick 5s steps(16, end) infinite;
}

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

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