:root {
    --bg-color: #f4f4f0;
    --text-color: #111111;
    --accent-color: #0055ff;
    --border-color: #111111;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
}

h1,
h2 {
    text-transform: uppercase;
    letter-spacing: -1px;
}

/* --- Hero Section --- */
.latest-project-btn {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 1000;
    width: 156px;
    height: 48px;
    perspective: 1000px;
    text-decoration: none;
}

.latest-project-btn .flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    animation: flip-occasional 10s infinite;
}

.latest-project-btn:hover .flip-inner {
    animation: none;
    transform: rotateX(180deg);
}

.latest-project-btn .flip-front,
.latest-project-btn .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    box-shadow: 4px 4px 0px var(--border-color);
    border: 2px solid var(--border-color);
}

.latest-project-btn .flip-front {
    background-color: var(--accent-color);
}

.latest-project-btn .flip-back {
    background-color: #0033cc;
    /* Slightly darker theme blue */
    transform: rotateX(180deg);
}

@keyframes flip-occasional {

    0%,
    75% {
        transform: rotateX(0deg);
    }

    82%,
    93% {
        transform: rotateX(180deg);
    }

    100% {
        transform: rotateX(360deg);
    }
}

.hero {
    padding: 10vh 5vw;
    border-bottom: 2px solid var(--border-color);
}

.hero-header {
    display: flex;
    align-items: center;
    gap: 20px;
    overflow: hidden;
}

.profile-pic {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
    /* Prevent squashing on mobile */
    border-radius: 50%;
    border: 2px solid var(--border-color);
    object-fit: cover;
    position: relative;
    z-index: 2;
    /* Keeps picture above text during slide animation */
}

.hero h1 {
    font-size: 4rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    animation: slideOutName 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes slideOutName {
    from {
        transform: translateX(-150px);
        opacity: 0;
    }

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

.hero .subtitle {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-top: 10px;
}

/* --- Timeline Section --- */
.timeline-section {
    padding: 5vh 0;
    border-bottom: 2px solid var(--border-color);
}

.timeline-section h2 {
    padding: 0 5vw;
    margin-bottom: 40px;
}

.timeline-container {
    position: relative;
    display: flex;
    align-items: center;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 150px 5vw;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

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

/* Add padding blocks so scrolling hits the center on wide screens */
.timeline-container::before,
.timeline-container::after {
    content: '';
    flex: 0 0 30vw;
}

.timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: max-content;
    min-width: 500vw;
    /* Extended width for mobile scrolling */
    height: 3px;
    background-color: var(--border-color);
    z-index: 0;
}

.timeline-item {
    scroll-snap-align: center;
    position: relative;
    min-width: 350px;
    margin-right: 50px;
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    opacity: 0.4;
    /* Dimmed by default */
}

/* Active centered item scaling */
.timeline-item.active {
    transform: scale(1.15);
    opacity: 1;
}

.timeline-item .year-marker {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.timeline-item .content {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    padding: 20px;
    font-size: 0.9rem;
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 1);
    transition: all 0.3s ease;
}

.timeline-item .company-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    max-height: 80px;
    z-index: -1;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    object-fit: contain;
    pointer-events: none;
}

.timeline-item.top .company-logo {
    top: 20px;
}

.timeline-item.bottom .company-logo {
    bottom: 20px;
}

.timeline-item.top.active .company-logo {
    top: -90px;
    opacity: 1;
}

.timeline-item.bottom.active .company-logo {
    bottom: -90px;
    opacity: 1;
}

.timeline-item.industry .content {
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    /* Less prominent */
    background: #e8e8e4;
    /* slightly darker to distinguish */
}

/* Alternating above and below the line */
.timeline-item.top {
    transform-origin: bottom center;
    margin-bottom: 180px;
}

.timeline-item.bottom {
    transform-origin: top center;
    margin-top: 180px;
}

.timeline-item.top.active {
    transform: translateY(10px) scale(1.15);
}

.timeline-item.bottom.active {
    transform: translateY(-10px) scale(1.15);
}

/* --- Jumbled Pipeline Section --- */
.research-section {
    padding: 5vh 5vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#physics-canvas-container {
    position: relative;
    flex-grow: 1;
    min-height: 500px;
    border: 2px solid var(--border-color);
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
    margin-top: 20px;
}

/* The invisible canvas captures mouse events for Matter.js */
#physics-canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* The actual visual boxes rendered over the physics engine */
.physics-box {
    position: absolute;
    width: max-content;
    max-width: 480px;
    /* Allow long titles but still wrap eventually */
    background: white;
    border: 2px solid var(--border-color);
    padding: 20px;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    /* Shift text to left for readability */
    box-shadow: 4px 4px 0px var(--accent-color);

    /* Bring above the canvas (z-index 10) but let physics drag events pass through */
    pointer-events: none;
    z-index: 15;

    transform: translate(-50%, -50%);
    /* Center origin for Matter.js rotation sync */
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: width 0.3s ease, height 0.3s ease;
    /* smooth resize for expansion */
}

/* Let the canvas catch drags underneath the box spacing */
.physics-box * {
    pointer-events: none;
}

.physics-box .title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
}

.physics-box .hook {
    font-style: italic;
    font-weight: 400;
    font-size: 0.95rem;
    color: #444;
    position: relative;
    padding-right: 36px;
}

.pulse-arrow {
    position: absolute;
    right: 0;
    bottom: -4px;
    cursor: pointer;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: rotate 0.3s ease;
    pointer-events: auto;
}

.triangle-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    animation: pulse-shadow 3s ease-in-out infinite;
}

.triangle-solid {
    fill: var(--accent-color);
}

@keyframes pulse-shadow {
    0% {
        filter: drop-shadow(0 0 2px rgba(0, 51, 204, 0.4));
    }

    50% {
        filter: drop-shadow(0 0 8px rgba(0, 51, 204, 0.9));
    }

    100% {
        filter: drop-shadow(0 0 2px rgba(0, 51, 204, 0.4));
    }
}

/* When expanded, flip the arrow independently of transform scale */
.physics-box.expanded .pulse-arrow {
    rotate: 180deg;
}

.physics-box .summary {
    display: none;
    /* Hidden by default */
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.4;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.physics-box.expanded .summary {
    display: block;
    /* Show when expanded */
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* --- Interests Section --- */
.interests-section {
    padding: 10vh 5vw;
}

.interests-section h2 {
    margin-bottom: 40px;
}

.interests-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    padding: 20px 0;
    max-width: 1400px;
    margin: 0 auto;
}

.interest-circle {
    position: relative;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    border: 2px solid var(--border-color);
    box-shadow: 4px 4px 0px var(--border-color);
}

.interest-circle:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 6px 8px 0px var(--border-color);
}

.interest-circle.active {
    transform: scale(1.55);
    box-shadow: 6px 6px 0px var(--border-color);
    z-index: 10;
}

.interest-circle .label {
    position: relative;
    z-index: 2;
    padding: 20px;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    /* text readable over images */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.interest-circle.active .label {
    opacity: 1;
}

.interest-circle .reveal-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.interest-circle.active .reveal-img {
    opacity: 0.6;
    /* darkens image so text remains readable */
}

.interest-circle.active {
    background-color: var(--border-color);
    /* darker backing */
}

.size-lg {
    width: 359px;
    height: 359px;
    font-size: 2.15rem;
}

.size-md {
    width: 287.5px;
    height: 287.5px;
    font-size: 1.725rem;
}

.size-sm {
    width: 215.5px;
    height: 215.5px;
    font-size: 1.43rem;
}