/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --black: #000000;
    --white: #FFFFFF;
    --gray: #888888;
    --light-gray: #CCCCCC;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Arial', sans-serif;
    background: var(--white);
    color: var(--black);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Layout */
body {
    display: flex;
    height: 100vh;
    padding-top: 0;
}

/* Top Navigation Bar */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 60px;
    z-index: 100;
}

.nav-links {
    display: flex;
    gap: 30px;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.nav-link {
    color: var(--black);
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 400;
    transition: opacity 0.3s ease;
    position: relative;
    cursor: pointer;
}

.nav-link:hover {
    opacity: 0.6;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--black);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Brand Header - Collapsible */
.brand-header {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: 220px;
    background: var(--white);
    display: flex;
    align-items: flex-end;
    padding: 0 60px 20px 60px;
    z-index: 99;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

.brand-header.scrolled {
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.brand-title-main {
    font-size: clamp(120px, 18vw, 240px);
    font-weight: 900;
    line-height: 0.85;
    letter-spacing: -0.05em;
    margin: 0;
    text-transform: uppercase;
    position: relative;
    width: 100%;
}

.brand-title-main .letter-group {
    display: inline-block;
}

.brand-title-main .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(100px);
    animation: cascadeIn 0.5s ease-out forwards;
}

/* Group 1: M - all letters same timing */
.brand-title-main .group-1 .letter { animation-delay: 0.1s; }

/* Group 2: CAL - all letters same timing */
.brand-title-main .group-2 .letter { animation-delay: 0.4s; }

/* Group 3: BYRNE - all letters same timing */
.brand-title-main .group-3 .letter { animation-delay: 0.7s; }

@keyframes cascadeIn {
    0% {
        opacity: 0;
        transform: translateY(100px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.full-title {
    display: inline;
    transition: opacity 0.3s ease;
}

.short-title {
    display: none;
}

/* Left Panel - Fixed */
.left-panel {
    position: fixed;
    left: 0;
    top: 280px;
    width: 45%;
    height: calc(100vh - 280px);
    background: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 60px 40px 60px;
    z-index: 10;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.left-panel.scrolled {
    top: 60px;
    height: calc(100vh - 60px);
    padding-top: 80px;
}

.left-panel.scrolled .mcb-header {
    display: flex;
}

.left-panel.scrolled .career-path {
    display: block;
}

.mcb-header {
    display: none;
    align-items: center;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.career-path {
    display: none;
    margin-bottom: 40px;
}

.career-path pre {
    font-size: 0.85em;
    line-height: 1.4;
    font-family: 'Courier New', monospace;
    white-space: pre;
    color: var(--light-gray);
    margin: 0;
}

.mcb-title {
    font-size: clamp(60px, 10vw, 120px);
    font-weight: 900;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    line-height: 1;
    flex-shrink: 0;
}

.profile-squares {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 550px;
    flex: 1;
}

.profile-square {
    aspect-ratio: 1;
    background: #333333;
    border: 1px solid rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    border-radius: 24px;
}

.profile-square:nth-child(even) {
    background: #000000;
}

.profile-square img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    opacity: 0;
    transform: scale(1.2);
    filter: grayscale(100%) contrast(1.2);
    border-radius: 24px;
}

.profile-square.active img {
    display: block;
}

@keyframes fillSquare {
    0% {
        opacity: 0;
        transform: scale(1.2) rotate(0deg);
        filter: grayscale(100%) contrast(1.2);
    }
    20% {
        opacity: 1;
        transform: scale(1.05) rotate(2deg);
        filter: grayscale(0%) contrast(5) hue-rotate(180deg) invert(1);
    }
    40% {
        transform: scale(0.95) rotate(-3deg);
        filter: grayscale(100%) contrast(0.5) brightness(2);
    }
    60% {
        transform: scale(1.08) rotate(1deg);
        filter: grayscale(30%) contrast(3) saturate(5) hue-rotate(90deg);
    }
    80% {
        transform: scale(0.98) rotate(-1deg);
        filter: grayscale(60%) contrast(2) brightness(1.5);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: grayscale(100%) contrast(1.2);
    }
}

.profile-square img:hover {
    filter: grayscale(0%) contrast(1.1);
    transition: filter 0.3s ease;
}

/* Brand Container */
.brand-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-subtitle {
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--light-gray);
    font-weight: 300;
}

.brand-subtitle p {
    margin: 5px 0;
}

/* Description */
.description {
    max-width: 400px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--light-gray);
    font-weight: 300;
}

/* Counter */
.counter {
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--gray);
    font-weight: 300;
}

/* Right Panel - Scrollable */
.right-panel {
    margin-left: 45%;
    margin-top: 280px;
    width: 55%;
    height: calc(100vh - 280px);
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.right-panel.scrolled {
    margin-top: 60px;
    height: calc(100vh - 60px);
}

.right-panel::-webkit-scrollbar {
    display: none;
}

/* Scroll Indicator Panel */
.scroll-indicator-panel {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--white);
}

.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 1.2s;
}

.scroll-text {
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--black);
    font-weight: 400;
}

.scroll-arrow {
    font-size: 64px;
    color: var(--black);
    animation: bounce 2s ease-in-out infinite;
    animation-delay: 1.2s;
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

/* Project Panels */
.project-panel {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 60px;
    background: var(--white);
}

.project-link-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
}

.project-image-container {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    position: relative;
    margin-bottom: 0;
    border-radius: 24px;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
    filter: grayscale(100%) contrast(1.1);
}

.project-panel:hover .project-image {
    transform: scale(1.05);
    filter: grayscale(0%) contrast(1);
}

.project-info {
    width: 100%;
    text-align: left;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px;
    background: var(--black);
    z-index: 10;
}

.project-title {
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 900;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    text-transform: uppercase;
    color: var(--white);
}

.project-subtitle {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--light-gray);
    font-weight: 300;
}

/* Publications Panel */
.publications-panel {
    height: auto;
    min-height: 100vh;
    padding: 100px 60px;
    align-items: flex-start;
    justify-content: flex-start;
}

.publications-container {
    width: 100%;
}

.publications-panel .project-title {
    margin-bottom: 60px;
}

.publication-item {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 40px 0;
    transition: all 0.3s ease;
}

.publication-item:hover {
    padding-left: 20px;
    background: rgba(0, 0, 0, 0.02);
}

.publication-item h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
}

.pub-meta {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gray);
    margin-bottom: 8px;
    font-weight: 400;
}

.pub-authors {
    font-size: 13px;
    color: var(--light-gray);
    line-height: 1.6;
    font-weight: 300;
}

.pub-link {
    color: var(--black);
    text-decoration: none;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 400;
    display: inline-block;
    margin-top: 10px;
    transition: opacity 0.3s ease;
}

.pub-link:hover {
    opacity: 0.6;
}

/* Contact Panel */
.contact-panel {
    align-items: flex-start;
    justify-content: flex-start;
}

.contact-container {
    width: 100%;
}

.contact-panel .project-title {
    margin-bottom: 60px;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.contact-link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    color: var(--black);
    transition: all 0.3s ease;
    padding: 20px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.contact-link:hover {
    padding-left: 20px;
    border-bottom-color: var(--black);
}

.link-label {
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gray);
    font-weight: 400;
}

.link-value {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .top-header {
        padding: 0 40px;
    }

    .top-header.scrolled {
        width: 40%;
    }

    .left-panel {
        width: 40%;
        padding: 30px 40px;
    }

    .right-panel {
        margin-left: 40%;
        width: 60%;
    }

    .brand-title-top {
        font-size: clamp(50px, 7vw, 80px);
    }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .top-header {
        position: relative;
        width: 100%;
        height: 80px;
        padding: 0 20px;
    }

    .top-header.scrolled {
        width: 100%;
        height: 60px;
    }

    .brand-title-top {
        font-size: clamp(32px, 10vw, 60px);
    }

    .top-header.scrolled .short-title {
        font-size: 28px;
    }

    .left-panel {
        position: relative;
        width: 100%;
        top: 0;
        height: auto;
        min-height: 40vh;
        padding: 30px 20px;
    }

    .left-panel.scrolled {
        top: 0;
        height: auto;
    }

    .right-panel {
        margin-left: 0;
        margin-top: 0;
        width: 100%;
        height: auto;
    }

    .right-panel.scrolled {
        margin-top: 0;
    }

    .counter {
        font-size: 11px;
    }

    .project-panel {
        height: auto;
        min-height: 80vh;
        padding: 60px 20px;
    }

    .project-image-container {
        aspect-ratio: 1;
    }

    .publications-panel,
    .contact-panel {
        padding: 60px 20px;
    }

    .nav {
        gap: 20px;
        font-size: 12px;
    }
}

/* Smooth Animations */
@media (prefers-reduced-motion: no-preference) {
    .project-panel {
        animation: fadeIn 0.6s ease-out;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State */
.project-image {
    background: rgba(0, 0, 0, 0.05);
}

/* Selection Styling */
::selection {
    background: var(--black);
    color: var(--white);
}

::-moz-selection {
    background: var(--black);
    color: var(--white);
}
