/* --- RESET & VARS --- */
:root {
    --bg: #f5f5dc;
    --text: #000;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Courier New', monospace;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    /* Hide main body scrollbar, we scroll the container instead */
    overflow: hidden;
    overflow-x: hidden;
    width: 100vw;
    height: 100vh;
}

/* --- GLOBAL LINK STYLES --- */
a {
    color: #000;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: opacity 0.3s ease;
}

a:hover {
    opacity: 0.6;
}

a:visited {
    color: #000;
}

/* --- CANVAS --- */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- SCROLL CONTAINER (The Snapper) --- */
.scroll-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    z-index: 10;

    /* Hide Scrollbar for clean look */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.scroll-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* --- SECTIONS --- */
section {
    position: relative;
    width: 100%;
    height: 100vh;
    /* Full Screen */
    scroll-snap-align: start;

    /* GRID LAYOUT */
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Split 50/50 */
    align-items: center;
    padding: 0 5vw;
    overflow-x: hidden;
}

/* Text positioning classes */
section.layout-left .text-wrapper {
    grid-column: 1;
}

section.layout-right .text-wrapper {
    grid-column: 2;
}

/* --- TEXT CONTENT --- */
/* --- TEXT CONTENT --- */
.text-wrapper {
    padding: 2rem;
    max-width: 100%;
}

.text-wrapper > h1,
.text-wrapper > h2,
.text-wrapper > h3,
.text-wrapper > h4,
.text-wrapper > p {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Active State (Triggered by Observer) */
section.active-section .text-wrapper>* {
    opacity: 1;
    transform: translateY(0);
}

/* Fix for nested elements in Research section */
section.active-section .feature h4 {
    opacity: 1;
    transform: translateY(0);
    color: #000;
}

section.active-section .text-wrapper>*:nth-child(1) {
    transition-delay: 0.1s;
}

section.active-section .text-wrapper>*:nth-child(2) {
    transition-delay: 0.2s;
}

section.active-section .text-wrapper>*:nth-child(3) {
    transition-delay: 0.3s;
}

section.active-section .text-wrapper>*:nth-child(4) {
    transition-delay: 0.4s;
}

section.active-section .text-wrapper>*:nth-child(5) {
    transition-delay: 0.5s;
}

/* --- TYPOGRAPHY --- */
h1 {
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1.5rem;
}

.subtitle {
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: block;
}

h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #000;
    margin-bottom: 1.5rem;
    max-width: 50ch;
}

.mono-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #000;
    border-bottom: 1px solid #000;
    padding-bottom: 5px;
    margin-bottom: 1.5rem;
    display: inline-block;
}

/* --- COMPONENT STYLES --- */
.logo {
    width: 50px;
    margin-bottom: 20px;
    display: block;
}

.logo img {
    width: 100%;
    display: block;
    filter: brightness(0) saturate(0);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: 1px solid #000;
    background: #f5f5dc;
    color: #000;
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-top: 1rem;
    transition: background 0.3s, color 0.3s;
}

.btn:hover {
    background: #000;
    color: #fff;
}

.grid-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.feature h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease, color 0.3s ease;
    cursor: default;
}

.feature h4:hover {
    transform: translateX(10px);
    color: #555;
}

.feature p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

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

/* --- TIMELINE GRID --- */
.timeline-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.timeline-section {
    position: relative;
}

.timeline-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #000;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.timeline-desc {
    font-size: 0.95rem;
    color: #444;
    margin-top: 0.5rem;
    max-width: 45ch;
}

/* --- TEAM GRID --- */
.team-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem 2rem;
    margin-top: 2rem;
}

.team-member {
    position: relative;
    cursor: pointer;
    padding: 0.5rem 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: fadeInUp 0.6s ease-out backwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.team-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 2px solid #000;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.team-member:nth-child(1) {
    animation-delay: 0.1s;
}

.team-member:nth-child(2) {
    animation-delay: 0.2s;
}

.team-member:nth-child(3) {
    animation-delay: 0.3s;
}

.team-member:nth-child(4) {
    animation-delay: 0.4s;
}

.team-member:nth-child(5) {
    animation-delay: 0.5s;
}

.team-member:nth-child(6) {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.team-member::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: #000;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.team-member:hover {
    transform: scale(1.05) translateY(-4px);
}

.team-member:hover::before {
    opacity: 0.03;
}

.team-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
    position: relative;
    display: inline-block;
    transition: letter-spacing 0.3s ease;
}

.team-member:hover .team-name {
    letter-spacing: 0.05em;
    animation: glitch 0.3s ease-in-out;
}

/* Glitch effect with pseudo-elements */
.team-name::before,
.team-name::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.team-member:hover .team-name::before {
    color: #000;
    animation: glitch-top 0.3s ease-in-out;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    transform: translate(-2px, -2px);
}

.team-member:hover .team-name::after {
    color: #000;
    animation: glitch-bottom 0.3s ease-in-out;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    transform: translate(2px, 2px);
}

@keyframes glitch {

    0%,
    100% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }
}

@keyframes glitch-top {

    0%,
    100% {
        opacity: 0;
        transform: translate(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        opacity: 0.8;
        transform: translate(-3px, -1px);
    }

    20%,
    40%,
    60%,
    80% {
        opacity: 0.6;
        transform: translate(3px, 1px);
    }
}

@keyframes glitch-bottom {

    0%,
    100% {
        opacity: 0;
        transform: translate(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        opacity: 0.7;
        transform: translate(2px, 2px);
    }

    20%,
    40%,
    60%,
    80% {
        opacity: 0.5;
        transform: translate(-2px, -2px);
    }
}

.team-title {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: #666;
    opacity: 1;
}

/* --- MOBILE OVERRIDE --- */
@media (max-width: 768px) {
    section {
        grid-template-columns: 1fr;
        padding: 20px;
        text-align: center;
        background: linear-gradient(to bottom, rgba(245, 245, 220, 0.95) 0%, rgba(245, 245, 220, 0.85) 100%);
    }

    section.layout-left .text-wrapper,
    section.layout-right .text-wrapper {
        grid-column: 1;
    }

    .text-wrapper {
        padding: 1rem;
    }

    .logo {
        margin-left: auto;
        margin-right: auto;
    }

    h1 {
        font-size: 3rem;
    }

    p {
        margin-left: auto;
        margin-right: auto;
    }

    .team-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.75rem 0.75rem !important;
        margin: 0 auto;
        max-width: 100%;
    }

    .team-photo {
        width: 70px;
        height: 70px;
        margin-bottom: 0.4rem;
        border-width: 1.5px;
    }

    .team-member {
        padding: 0.25rem 0;
    }

    .team-name {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .team-title {
        font-size: 0.6rem;
        margin-top: 0.15rem;
    }

    /* On mobile, we don't shift camera, we just fade bg */
}