/* ============================================
   DESIGN ENGINEER PORTFOLIO
   Minimalist · Industrial · Modern
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #FAFAFA;
    --color-surface: #FFFFFF;
    --color-text: #1A1A1A;
    --color-text-secondary: #6B6B6B;
    --color-text-tertiary: #999999;
    --color-accent: #1A1A1A;
    --color-border: #E5E5E5;
    --color-border-light: #F0F0F0;
    --color-hover: #F5F5F5;
    --color-tag-bg: #F2F2F2;

    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;
    --space-2xl: 6rem;
    --space-3xl: 10rem;

    --nav-height: 80px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-medium: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: none;
}

/* --- Custom Cursor --- */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2.5px solid #1A1A1A;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                height 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                background-color 0.25s ease,
                border-color 0.25s ease,
                opacity 0.25s ease;
    background: transparent;
    will-change: transform;
}

.cursor--hover {
    width: 50px;
    height: 50px;
    background: rgba(26, 26, 26, 0.08);
    border-color: #1A1A1A;
}

.cursor--hidden {
    opacity: 0;
}

body.dark .cursor {
    border-color: #F0F0F0;
}

body.dark .cursor--hover {
    background: rgba(240, 240, 240, 0.1);
    border-color: #F0F0F0;
}

/* Hide default cursor on all interactive elements */
*, *::before, *::after {
    cursor: none;
}

a, button, [role="button"], input, select, textarea, label {
    cursor: none;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

body.body--project {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* --- Typography Scale --- */
h1 {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

h2 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

h3 {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text-secondary);
    max-width: 600px;
}

/* --- Navigation --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 1000;
    background: transparent;
    transition: background var(--transition-fast);
}

.nav__logo {
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1001;
}

.nav__back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: transform var(--transition-fast);
}

.nav__back:hover {
    transform: translateX(-3px);
}

.nav__icon {
    transition: transform var(--transition-spring);
}

.nav__icon .bar {
    stroke: var(--color-text);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav__indicator {
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.nav__section-label {
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

/* --- Full-screen Menu --- */
.menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--color-surface);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.menu.active {
    opacity: 1;
    visibility: visible;
}

.menu__inner {
    text-align: left;
    width: 100%;
    max-width: 800px;
    padding: 0 var(--space-lg);
}

.menu__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.menu__link {
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border-light);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--transition-medium), transform var(--transition-spring), color var(--transition-fast);
}

.menu.active .menu__link {
    opacity: 1;
    transform: translateY(0);
}

.menu.active .menu__link:nth-child(1) { transition-delay: 0.1s; }
.menu.active .menu__link:nth-child(2) { transition-delay: 0.15s; }
.menu.active .menu__link:nth-child(3) { transition-delay: 0.2s; }
.menu.active .menu__link:nth-child(4) { transition-delay: 0.25s; }
.menu.active .menu__link:nth-child(5) { transition-delay: 0.3s; }

.menu__link:hover {
    color: var(--color-text-tertiary);
}

.menu__link:hover .menu__text {
    transform: translateX(10px);
}

.menu__number {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-tertiary);
    letter-spacing: 0.05em;
    min-width: 30px;
}

.menu__text {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    transition: transform var(--transition-spring);
}

.menu__footer {
    margin-top: var(--space-2xl);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-medium) 0.3s, transform var(--transition-spring) 0.3s;
}

.menu.active .menu__footer {
    opacity: 1;
    transform: translateY(0);
}

.menu__footer-text {
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* --- Main Content --- */
.main {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* --- Sections --- */
.section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(var(--nav-height) + var(--space-md)) var(--space-lg) var(--space-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(40px);
    transition: opacity var(--transition-slow), transform var(--transition-spring), visibility var(--transition-slow);
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.section::-webkit-scrollbar {
    width: 4px;
}

.section::-webkit-scrollbar-track {
    background: transparent;
}

.section::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

.section.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    z-index: 1;
}

.section__container {
    max-width: 1200px;
    margin: 0 auto;
}

.section__header {
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.section__number {
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-tertiary);
    letter-spacing: 0.05em;
}

.section__title {
    opacity: 0;
    transform: translateY(20px);
    animation: none;
}

.section.active .section__title {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.section__footer-spacer {
    height: 15vh;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Hero Title Section --- */
.section--hero {
    padding: 0;
}

.hero {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--color-bg);
}

.hero__canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero__title {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    z-index: -1;
}

.hero__scroll-hint {
    position: absolute;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 3;
    opacity: 0.5;
    animation: hintBounce 2s ease-in-out infinite;
}

.hero__scroll-hint span {
    font-family: var(--font-primary);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.hero__scroll-hint svg {
    color: var(--color-text-tertiary);
}

@keyframes hintBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(6px); }
}

/* Hide nav and progress on hero */
body.hero-active .nav {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-medium);
}

body.hero-active .progress {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-medium);
}

body.hero-active .theme-switcher {
    z-index: 1001;
}

body:not(.hero-active) .nav,
body:not(.hero-active) .progress {
    opacity: 1;
    pointer-events: auto;
    transition: opacity var(--transition-medium);
}

/* --- Clickable Experience Items --- */
.experience__item--link {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--space-lg);
    align-items: start;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.experience__item--link:hover {
    opacity: 0.75;
}

.experience__item--link:hover .experience__company {
    color: var(--color-text-secondary);
}

/* --- About Section --- */
.about__grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: var(--space-2xl);
    align-items: stretch;
}

.about__portrait {
    position: relative;
    top: 0;
}

.about__image-wrapper {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--color-tag-bg);
    position: relative;
}

.about__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.about__image-wrapper:hover .about__image {
    transform: scale(1.03);
}

.about__image-wrapper.placeholder .about__image {
    display: none;
}

.about__image-placeholder,
.experience__image-placeholder,
.project__image-placeholder,
.extra__image-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--color-tag-bg);
    color: var(--color-text-tertiary);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.placeholder .about__image-placeholder,
.placeholder .experience__image-placeholder,
.placeholder .project__image-placeholder,
.placeholder .extra__image-placeholder {
    display: flex;
}

.about__content {
    padding-top: var(--space-sm);
    display: flex;
    flex-direction: column;
}

.about__headline {
    margin-bottom: var(--space-lg);
    opacity: 0;
    transform: translateY(20px);
}

.section.active .about__headline {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

/* About content fades in together (no internal stagger) for a cleaner reveal */
.section--about.section.active .section__title {
    animation-delay: 0.2s;
}

.about__bio {
    margin-bottom: var(--space-lg);
}

.about__bio p {
    margin-bottom: var(--space-xs);
    opacity: 0;
    transform: translateY(15px);
}

.section.active .about__bio p {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.about__details {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: auto;           /* sit on the bottom edge of the portrait */
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
}

.about__detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}

.about__detail:last-child {
    padding-bottom: 0;
}

.about__label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.about__value {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--color-text);
}

/* --- Experience Section --- */
.experience__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.experience__item {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--space-lg);
    align-items: start;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
    opacity: 0;
    transform: translateY(30px);
}

.section.active .experience__item {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.section.active .experience__item:nth-child(1) { animation-delay: 0.2s; }
.section.active .experience__item:nth-child(2) { animation-delay: 0.35s; }
.section.active .experience__item:nth-child(3) { animation-delay: 0.5s; }
.section.active .experience__item:nth-child(4) { animation-delay: 0.65s; }
.section.active .experience__item:nth-child(5) { animation-delay: 0.8s; }

.experience__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.experience__image-wrapper {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-tag-bg);
    position: relative;
}

.experience__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.experience__image-wrapper:hover .experience__image {
    transform: scale(1.05);
}

.experience__content-col {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.experience__meta {
    display: flex;
    gap: var(--space-md);
    margin-bottom: 2px;
}

.experience__date,
.experience__role {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.experience__role::before {
    content: '-';
    margin-right: var(--space-xs);
}

.experience__company {
    margin-bottom: var(--space-xs);
}

.experience__description {
    margin-bottom: var(--space-xs);
}

.experience__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.tag {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--color-tag-bg);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    letter-spacing: 0.03em;
    border-radius: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.tag:hover {
    background: var(--color-text);
    color: var(--color-surface);
}

/* --- Projects Section --- */
.projects__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    align-items: start;
}

.project__card {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    transition: transform var(--transition-fast);
}

.project__image-col {
    width: 100%;
    margin-bottom: var(--space-sm);
}

.section.active .project__card {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.section.active .projects__grid .project__card:nth-child(1) { animation-delay: 0.15s; }
.section.active .projects__grid .project__card:nth-child(2) { animation-delay: 0.2s; }
.section.active .projects__grid .project__card:nth-child(3) { animation-delay: 0.3s; }
.section.active .projects__grid .project__card:nth-child(4) { animation-delay: 0.35s; }
.section.active .projects__grid .project__card:nth-child(5) { animation-delay: 0.45s; }
.section.active .projects__grid .project__card:nth-child(6) { animation-delay: 0.5s; }
.section.active .projects__grid .project__card:nth-child(7) { animation-delay: 0.6s; }
.section.active .projects__grid .project__card:nth-child(8) { animation-delay: 0.65s; }

.project__image-wrapper {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-tag-bg);
    position: relative;
}

.project__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.project__card:hover .project__image {
    transform: scale(1.05);
}

.project__info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.project__category {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 2px;
}

.project__title {
    margin-bottom: var(--space-xs);
    transition: color var(--transition-fast);
}

.project__card:hover .project__title {
    color: var(--color-text-secondary);
}

.project__summary {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
    max-width: none;
}

/* --- Extracurricular Section --- */
.extra__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl) var(--space-md);
    align-items: start;
}

.extra__item {
    opacity: 0;
    transform: translateY(20px);
}

.section.active .extra__item {
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.section.active .extra__item:nth-child(1) { animation-delay: 0.2s; }
.section.active .extra__item:nth-child(2) { animation-delay: 0.3s; }
.section.active .extra__item:nth-child(3) { animation-delay: 0.4s; }
.section.active .extra__item:nth-child(4) { animation-delay: 0.5s; }

.extra__image-wrapper {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--color-tag-bg);
    margin-bottom: var(--space-sm);
    position: relative;
}

.extra__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.extra__item:hover .extra__image {
    transform: scale(1.05);
}

.extra__title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.35;
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}

.extra__desc {
    font-size: 0.85rem;
    line-height: 1.75;
    color: var(--color-text-tertiary);
    max-width: none;
}

/* --- Contact Section (centered, no form) --- */
.contact__centered {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

.contact__headline {
    margin-bottom: var(--space-md);
    opacity: 0;
    transform: translateY(20px);
}

.section.active .contact__headline {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.contact__text {
    margin-bottom: var(--space-xl);
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translateY(15px);
}

.section.active .contact__text {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.contact__links {
    display: flex;
    flex-direction: column;
    gap: 0;
    text-align: left;
    opacity: 0;
    transform: translateY(15px);
}

.section.active .contact__links {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.contact__link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border-light);
    transition: padding-left var(--transition-medium);
}

.contact__link:first-child {
    border-top: 1px solid var(--color-border-light);
}

.contact__link:hover {
    padding-left: var(--space-sm);
}

.contact__link-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.contact__link-value {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--color-text);
    transition: color var(--transition-fast);
}

.contact__link:hover .contact__link-value {
    color: var(--color-text-secondary);
}

/* --- Progress Indicator --- */
.progress {
    position: fixed;
    right: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.progress__track {
    width: 2px;
    height: 60px;
    background: var(--color-border);
    position: relative;
    border-radius: 1px;
    overflow: hidden;
}

.progress__fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20%;
    background: var(--color-text);
    transition: top var(--transition-spring), height var(--transition-spring);
}

.progress__dots {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: var(--space-xs);
}

.progress__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    transition: background var(--transition-fast), transform var(--transition-fast);
    cursor: pointer;
}

.progress__dot.active {
    background: var(--color-text);
    transform: scale(1.3);
}

.progress__dot:hover {
    background: var(--color-text-secondary);
}

/* ============================================
   PROJECT DETAIL PAGE
   ============================================ */
.project-detail {
    padding-top: var(--nav-height);
}

.project-detail__hero {
    padding: var(--space-2xl) var(--space-lg) var(--space-lg);
}

.project-detail__hero-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.project-detail__category {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-md);
}

.project-detail__title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: var(--space-xl);
}

.project-detail__meta {
    display: flex;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.project-detail__meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-detail__meta-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.project-detail__meta-value {
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text);
}

/* Hero Image */
.project-detail__hero-image {
    padding: 0 var(--space-lg) var(--space-lg);
}

.project-detail__image-full {
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--color-tag-bg);
}
.project-detail__image-full > .project-detail__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* detail image sizing handled in robust rules below */

/* Two-column content sections */
.project-detail__section {
    padding: var(--space-xl) var(--space-lg);
}

.project-detail__container {
    max-width: 1200px;
    margin: 0 auto;
}

.project-detail__two-col {
    display: grid;
    grid-template-columns: 0.35fr 0.65fr;
    gap: var(--space-xl);
}

.project-detail__heading {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-tertiary);
}

.project-detail__text {
    font-size: 1.05rem;
    line-height: 1.8;
    max-width: 100%;
}

.project-detail__text + .project-detail__text {
    margin-top: 1.2em;
}

.project-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

/* Gallery */
.project-detail__gallery {
    padding: var(--space-xl) var(--space-lg);
}

.project-detail__gallery-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: var(--space-md);
}

.project-detail__gallery-grid--two {
    grid-template-columns: 1fr 1fr;
}

.project-detail__gallery-grid--three {
    grid-template-columns: 1fr 1fr 1fr;
}

.project-detail__gallery-grid--full {
    grid-template-columns: 1fr;
}

.project-detail__gallery-item {
    display: flex;
    flex-direction: column;
}
/* Unwrapped gallery images (e.g. experience pages) keep their box sizing */
.project-detail__gallery-item > img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background: var(--color-tag-bg);
}

.project-detail__gallery-grid--three .project-detail__gallery-item > img {
    aspect-ratio: 1 / 1;
}

/* Wrapped gallery images (project pages) use a clipping frame for base zoom */
.project-detail__img-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--color-tag-bg);
}
.project-detail__img-frame > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-detail__gallery-grid--three .project-detail__img-frame {
    aspect-ratio: 1 / 1;
}

.project-detail__caption {
    display: block;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--color-text-secondary);
    padding: 8px 0 0;
    letter-spacing: 0.01em;
    line-height: 1.4;
}

.project-detail__gallery-item img {
    transition: transform var(--transition-slow);
}

.project-detail__gallery-item:hover img {
    transform: scale(1.03);
}

/* Images given an extra base zoom (cropping further in) keep their hover
   animation by multiplying the base scale on hover. */
.project-detail__img.has-base-scale {
    transform: scale(var(--base-scale, 1));
}

.project-detail__gallery-item:hover .project-detail__img.has-base-scale {
    transform: scale(calc(var(--base-scale, 1) * 1.03));
}

/* Portfolio Link */
.project-detail__portfolio-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-surface);
    background: var(--color-text);
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.project-detail__portfolio-link:hover {
    background: var(--color-text-secondary);
    transform: translateY(-1px);
}

.project-detail__portfolio-link svg {
    transition: transform var(--transition-fast);
}

.project-detail__portfolio-link:hover svg {
    transform: translateX(4px);
}

/* Prev / Next nav */
.project-detail__nav-section {
    padding: var(--space-2xl) var(--space-lg);
    border-top: 1px solid var(--color-border-light);
}

.project-detail__nav-links {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
}

.project-detail__nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: opacity var(--transition-fast);
}

.project-detail__nav-link:hover {
    opacity: 0.6;
}

.project-detail__nav-link--next {
    text-align: right;
}

.project-detail__nav-direction {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.project-detail__nav-title {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 500;
    color: var(--color-text);
}

/* Fade-in for project detail page */
.fade-in {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Theme Switcher --- */
.theme-switcher {
    position: fixed;
    top: calc(var(--nav-height) + var(--space-sm));
    right: var(--space-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-switcher__btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.theme-switcher__btn:hover {
    transform: scale(1.15);
}

.theme-switcher__btn.active {
    border-color: var(--color-text);
    box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-text);
}

.theme-switcher__btn--light {
    background: #FAFAFA;
}

.theme-switcher__btn--dark {
    background: #111111;
}

/* --- Dark Theme --- */
body.dark {
    --color-bg: #111111;
    --color-surface: #1A1A1A;
    --color-text: #F0F0F0;
    --color-text-secondary: #A0A0A0;
    --color-text-tertiary: #707070;
    --color-accent: #F0F0F0;
    --color-border: #333333;
    --color-border-light: #252525;
    --color-hover: #222222;
    --color-tag-bg: #222222;
}

body.dark .menu {
    background: var(--color-bg);
}

body.dark .nav__icon .bar {
    stroke: var(--color-text);
}

body.dark .theme-switcher__btn {
    border-color: #444444;
}

body.dark .theme-switcher__btn.active {
    border-color: #F0F0F0;
    box-shadow: 0 0 0 2px #111111, 0 0 0 4px #F0F0F0;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .about__grid {
        grid-template-columns: 1fr 1.2fr;
        gap: var(--space-xl);
    }

    .experience__item,
    .experience__item--link {
        grid-template-columns: 240px 1fr;
        gap: var(--space-md);
    }

    .project-detail__two-col {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .project-detail__gallery-grid--three {
        grid-template-columns: 1fr 1fr;
    }

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

@media (max-width: 768px) {
    :root {
        --nav-height: 64px;
    }

    .nav {
        padding: 0 var(--space-md);
    }

    .section {
        padding: calc(var(--nav-height) + var(--space-lg)) var(--space-md) var(--space-xl);
    }

    .about__grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .about__portrait {
        position: relative;
        top: 0;
        max-width: 320px;
    }

    /* Shorter on phones: square crop that trims the empty wall above */
    .about__image-wrapper {
        aspect-ratio: 1 / 1;
    }

    .about__image {
        object-position: center 75%;
    }

    .about__details {
        gap: var(--space-xs);
    }

    .experience__item,
    .experience__item--link {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .experience__image-wrapper {
        aspect-ratio: 16 / 9;
    }

    .projects__grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

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

    .menu__text {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .progress {
        right: var(--space-sm);
    }

    .theme-switcher {
        right: var(--space-md);
    }

    .section__header {
        margin-bottom: var(--space-xl);
    }

    .project-detail__hero {
        padding: var(--space-xl) var(--space-md) var(--space-lg);
    }

    .project-detail__hero-image,
    .project-detail__section,
    .project-detail__gallery,
    .project-detail__nav-section {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }

    .project-detail__meta {
        gap: var(--space-lg);
    }

    .project-detail__gallery-grid--two {
        grid-template-columns: 1fr;
    }

    .project-detail__gallery-grid--three {
        grid-template-columns: 1fr;
    }

    .project-detail__nav-links {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .project-detail__nav-link--next {
        text-align: left;
    }

    .section__footer-spacer {
        height: 20vh;
    }
}

@media (max-width: 480px) {
    .section {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }

    .nav {
        padding: 0 var(--space-sm);
    }

    .experience__meta {
        flex-direction: column;
        gap: 2px;
    }

    .experience__role::before {
        display: none;
    }

    .about__detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .section__footer-spacer {
        height: 15vh;
    }

    .theme-switcher {
        right: var(--space-sm);
    }
}

/* --- Utility --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ============================================
   EXPERIENCE INDEX
   Typographic rows. On desktop a preview card (image, summary, tags)
   follows the cursor; on touch screens a row expands in place.
   ============================================ */
.xp {
    border-top: 1px solid var(--color-border);
}

.xp__row {
    position: relative;
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr) minmax(0, 18rem) 10rem 2rem;
    align-items: baseline;
    column-gap: var(--space-md);
    padding: 1.35rem 0;
    border-bottom: 1px solid var(--color-border);
    color: inherit;
    text-decoration: none;
    outline: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.35s ease;
}

/* Underline that sweeps across the hovered row */
.xp__row::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--color-text);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.section.active .xp__row {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.section.active .xp__row:nth-child(1) { animation-delay: 0.15s; }
.section.active .xp__row:nth-child(2) { animation-delay: 0.22s; }
.section.active .xp__row:nth-child(3) { animation-delay: 0.29s; }
.section.active .xp__row:nth-child(4) { animation-delay: 0.36s; }
.section.active .xp__row:nth-child(5) { animation-delay: 0.43s; }
.section.active .xp__row:nth-child(6) { animation-delay: 0.5s; }
.section.active .xp__row:nth-child(7) { animation-delay: 0.57s; }

.xp__role {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xp__num,
.xp__role,
.xp__date {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.xp__company {
    justify-self: start;        /* box hugs the text, so lists.js can measure it */
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.6rem);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.xp__arrow {
    justify-self: end;
    font-size: 1.1rem;
    color: var(--color-text-tertiary);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
}

.xp__detail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.xp__detail-inner {
    overflow: hidden;
    min-height: 0;
}

.xp__thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin-top: var(--space-sm);
    background: var(--color-tag-bg);
}

.xp__desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin: var(--space-sm) 0 var(--space-xs);
}

.xp__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.xp__cta {
    display: inline-block;
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text);
}

.xp__row.is-open .xp__detail {
    grid-template-rows: 1fr;
}

.xp__row.is-open .xp__arrow {
    transform: rotate(45deg);
}

.xp__row--link.is-open .xp__arrow {
    transform: translate(3px, -3px);
}

/* Entries with their own page link straight to it, so never expand */
.xp__row--link .xp__detail {
    display: none;
}

@media (hover: hover) and (pointer: fine) and (min-width: 769px) {
    /* The photo already shows in the row; clicking an entry without its
       own page opens just the description and tags. */
    .xp__thumb {
        display: none;
    }

    .xp__detail-inner {
        max-width: 42rem;
        padding-left: calc(3rem + var(--space-md));
    }

    /* Dim the rest of the list around the row being looked at */
    /* Children rather than the row itself: the row's opacity is held by
       its entrance animation. */
    .xp__row > * {
        transition: opacity 0.35s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s ease;
    }

    .xp:hover .xp__row > * {
        opacity: 0.25;
    }

    .xp .xp__row:hover > * {
        opacity: 1;
    }

    .xp__row:hover::after {
        transform: scaleX(1);
    }

    .xp__row:hover .xp__company {
        transform: translateX(1.25rem);
    }

    .xp__row:hover .xp__arrow {
        color: var(--color-text);
        transform: rotate(45deg);
    }

    .xp__row--link:hover .xp__arrow {
        transform: translate(4px, -4px);
    }
}

/* Photo that glides along the hovered row, in the gap between the
   company name and the role (desktop only; positioned by lists.js) */
.xp__float {
    position: absolute;
    top: 50%;
    left: 0;
    width: 150px;
    aspect-ratio: 4 / 3;
    pointer-events: none;
    overflow: hidden;
    background: var(--color-tag-bg);
    transform: translate3d(var(--fx, 0px), -50%, 0) rotate(var(--fr, 0deg));
    clip-path: inset(50% 0 50% 0);
    transition: clip-path 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.xp__float img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.2);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.xp__row.is-floating {
    z-index: 5;
}

/* Position is driven every frame by lists.js, so never ease the transform */
.xp__row > .xp__float {
    transition: clip-path 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.xp__row.is-floating .xp__float {
    clip-path: inset(0 0 0 0);
}

.xp__row.is-open .xp__float {
    display: none;
}

.xp__row.is-floating .xp__float img {
    transform: scale(1);
}

@media (max-width: 1024px) {
    .xp__row {
        grid-template-columns: 2.5rem minmax(0, 1fr) 9rem 1.5rem;
    }

    .xp__role {
        display: none;
    }
}

@media (max-width: 600px) {
    .xp__row {
        grid-template-columns: 2rem minmax(0, 1fr) 1.25rem;
        row-gap: 4px;
    }

    .xp__num { grid-row: 1; grid-column: 1; }
    .xp__company { grid-row: 1; grid-column: 2; }
    .xp__arrow { grid-row: 1; grid-column: 3; }
    .xp__date { grid-row: 2; grid-column: 2; }
    .xp__role { display: none; }
}

/* ============================================
   PROJECTS BENTO
   Asymmetric grid of cards that tilt towards the cursor, with a glare
   highlight and the image drifting against the tilt.
   ============================================ */
.projects__grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: clamp(200px, 21vw, 290px);
    gap: var(--space-md);
    align-items: stretch;
}

.project__card {
    height: 100%;
    perspective: 1100px;
}

.projects__grid .project__card:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.project__inner {
    position: relative;
    height: 100%;
    overflow: hidden;
    background: var(--color-tag-bg);
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.project__card.is-tilting .project__inner {
    transition: transform 0.12s linear;
}

.project__inner .project__image-wrapper {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    height: 100%;
}

.project__inner .project__image {
    transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1.08);
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.project__card:hover .project__inner .project__image {
    transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1.14);
}

.project__glare {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.28), transparent 55%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project__card:hover .project__glare {
    opacity: 1;
}

.project__inner .project__info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 3.5rem 1.25rem 1.1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.35) 55%, transparent);
    color: #FFFFFF;
}

.project__inner .project__category {
    display: flex;
    gap: 0.6rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.68rem;
}

.project__num {
    color: rgba(255, 255, 255, 0.95);
}

.project__inner .project__title,
.project__card:hover .project__inner .project__title {
    color: #FFFFFF;
    margin-bottom: 0;
}

.projects__grid .project__card:first-child .project__title {
    font-size: clamp(1.6rem, 2.6vw, 2.4rem);
}

.project__summary-wrap {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.project__summary-wrap > .project__summary {
    overflow: hidden;
    min-height: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project__card:hover .project__summary-wrap,
.project__card:focus-visible .project__summary-wrap {
    grid-template-rows: 1fr;
}

.project__card:hover .project__summary,
.project__card:focus-visible .project__summary {
    opacity: 1;
    padding-top: 0.35rem;
}

@media (max-width: 1024px) {
    .projects__grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: clamp(200px, 30vw, 280px);
    }

    .projects__grid .project__card:first-child {
        grid-column: span 2;
        grid-row: span 1;
    }
}

/* Touch screens and phones: no hover, so always show the summary */
@media (hover: none), (max-width: 768px) {
    .projects__grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 260px;
    }

    .projects__grid .project__card:first-child {
        grid-column: auto;
    }

    .project__summary-wrap {
        grid-template-rows: 1fr;
    }

    .project__summary-wrap > .project__summary {
        opacity: 1;
        padding-top: 0.35rem;
    }
}

/* Cursor eye icon over cards and rows */
.cursor--label {
    width: 40px;
    height: 40px;
    background: var(--color-text);
    border-color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-bg);
}

body.dark .cursor--label {
    background: var(--color-text);
    border-color: var(--color-text);
}

.cursor__label {
    display: flex;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cursor--label .cursor__label {
    opacity: 1;
}

/* ============================================
   PHONES (iPhone and similar)
   ============================================ */
@media (max-width: 768px) {
    /* The opening screen fills the visible screen exactly; the generic
       section padding above would otherwise make it scroll. */
    .section.section--hero {
        padding: 0;
    }

    /* Solid bar so content scrolls cleanly underneath the menu button */
    .nav {
        background: var(--color-bg);
    }

    /* The section dots sat on top of text at this width */
    .progress {
        display: none;
    }

    /* Theme toggle moves into the top bar, replacing the section label
       (the big page title already says where you are). */
    .nav__indicator {
        display: none;
    }

    .theme-switcher,
    body.hero-active .theme-switcher {
        top: calc(var(--nav-height) / 2);
        right: var(--space-md);
        transform: translateY(-50%);
        flex-direction: row;
        gap: 12px;
    }

    .theme-switcher__btn {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .theme-switcher,
    body.hero-active .theme-switcher {
        right: var(--space-sm);
    }
}
