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

:root {
    --primary-color: #1a73e8;
    --secondary-color: #34a853;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --border-color: #dadce0;
    --hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.6;
}

.clip-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Navigation */
.navbar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.9);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo h1 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 2rem 2rem 0rem;
    text-align: center;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.experiments-section .container {
    padding-top: 2rem;
}

/* Section Title */
.section-title {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 3rem;
    text-align: center;
    color: var(--text-primary);
}

/* Experiments Section */
.experiments-section {
    padding: 4rem 0;
}

.experiments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

@media (min-width: 768px) {
    .experiments-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2.5rem;
    }
}

/* Experiment Card */
.experiment-card {
    background: var(--theme-bg, #f8f9fa);
    border-radius: 44px;
    overflow: visible;
    transition: transform 0.3s ease, box-shadow 0.3s ease, z-index 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2rem;
    position: relative;
    /* Ensure card container can show scaled content */
    transform-style: preserve-3d;
}


.experiment-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--hover-shadow);
    z-index: 5;
}

.experiment-media {
    width: 100%;
    height: 320px;
    background: var(--theme-media-bg, rgba(255, 255, 255, 0.35));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 36px;
    border: none;
    padding: 1.25rem;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
    box-shadow: none;
}

.experiment-frame {
    position: absolute;
    inset: var(--frame-inset, 14px);
    pointer-events: none;
    border: var(--frame-border-width, 3px) solid rgba(0, 0, 0, 0.18);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* clip-path is set inline via JavaScript */
}

.experiment-card:hover .experiment-media {
    transform: scale(1.01);
    box-shadow: none;
}

@media (min-width: 768px) {
    .experiment-media {
        height: 340px;
    }
}

.experiment-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* border-radius or clip-path is set inline via JavaScript based on frame type */
}

.experiment-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* border-radius or clip-path is set inline via JavaScript based on frame type */
}

.experiment-content {
    padding: 1.5rem 0 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.experiment-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.experiment-description {
    color: rgba(32, 33, 36, 0.72);
    margin-bottom: 1.25rem;
    flex-grow: 1;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.experiment-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: rgba(32, 33, 36, 0.9);
    background-color: transparent;
    border: 1.5px solid rgba(32, 33, 36, 0.7);
    border-radius: 999px;
    padding: 0.65rem 1.6rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    margin-top: auto;
    width: fit-content;
}

.experiment-link:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(32, 33, 36, 0.85);
    transform: translateY(-1px);
}

/* About Section */
.about-section {
    background-color: var(--bg-secondary);
}

.about-text {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Footer */
.footer {
    background-color: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem;
}

.footer p {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }

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

    .nav-menu {
        gap: 1rem;
    }

    .nav-container {
        padding: 1rem;
    }
}

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

/* Shape transformation animations */
@keyframes shapeTransformRounded {
    0%, 100% {
        border-radius: 58% 42% 61% 39% / 49% 43% 57% 51%;
    }
    25% {
        border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%;
    }
    50% {
        border-radius: 40% 60% 35% 65% / 60% 40% 65% 35%;
    }
    75% {
        border-radius: 55% 45% 55% 45% / 45% 55% 45% 55%;
    }
}

/* Frame transformation - morphs between different shapes */
@keyframes frameTransformHex {
    0%, 100% {
        clip-path: url(#frame-hex);
        -webkit-clip-path: url(#frame-hex);
        transform: scale(1) rotate(0deg);
    }
    33% {
        clip-path: url(#frame-rounded);
        -webkit-clip-path: url(#frame-rounded);
        transform: scale(1.05) rotate(5deg);
    }
    66% {
        clip-path: url(#frame-petal);
        -webkit-clip-path: url(#frame-petal);
        transform: scale(1.05) rotate(-5deg);
    }
}

@keyframes frameTransformPetal {
    0%, 100% {
        clip-path: url(#frame-petal);
        -webkit-clip-path: url(#frame-petal);
        transform: scale(1) rotate(0deg);
    }
    33% {
        clip-path: url(#frame-hex);
        -webkit-clip-path: url(#frame-hex);
        transform: scale(1.05) rotate(10deg);
    }
    66% {
        clip-path: url(#frame-rounded);
        -webkit-clip-path: url(#frame-rounded);
        transform: scale(1.05) rotate(-10deg);
    }
}

/* Media shape morphing for hex and petal */
@keyframes mediaMorphHex {
    0%, 100% {
        border-radius: 12px;
        transform: scale(1);
    }
    25% {
        border-radius: 20px;
        transform: scale(1.03);
    }
    50% {
        border-radius: 30px;
        transform: scale(1.05);
    }
    75% {
        border-radius: 20px;
        transform: scale(1.03);
    }
}

@keyframes mediaMorphPetal {
    0%, 100% {
        border-radius: 12px;
        transform: scale(1);
    }
    25% {
        border-radius: 25px;
        transform: scale(1.04);
    }
    50% {
        border-radius: 40px;
        transform: scale(1.08);
    }
    75% {
        border-radius: 25px;
        transform: scale(1.04);
    }
}

@keyframes frameGlow {
    0%, 100% {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 0 0 rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 0 20px rgba(255, 255, 255, 0.3);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.experiment-card {
    animation: fadeIn 0.6s ease-out;
    animation-delay: var(--animation-delay, 0s);
    animation-fill-mode: both;
}

/* Rounded (Ellipse) - transforms between different ellipse shapes */
.frame-rounded .media-shape {
    animation: shapeTransformRounded 8s ease-in-out infinite;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 0.4s ease;
}

.frame-rounded:hover .media-shape {
    animation: shapeTransformRounded 4s ease-in-out infinite;
    transform: scale(1.05);
}

.frame-rounded .experiment-frame {
    animation: frameGlow 3s ease-in-out infinite;
    transition: all 0.4s ease;
}

.frame-rounded:hover .experiment-frame {
    border-color: rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 0 30px rgba(255, 255, 255, 0.4);
    transform: scale(1.02);
}

/* Hexagon - morphs between hex and other shapes */
.frame-hex .media-shape {
    animation: mediaMorphHex 10s ease-in-out infinite;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.frame-hex:hover .media-shape {
    animation: mediaMorphHex 5s ease-in-out infinite;
}

.frame-hex .experiment-frame {
    transition: all 0.4s ease;
    animation: frameTransformHex 10s ease-in-out infinite;
}

.frame-hex:hover .experiment-frame {
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15), 0 0 40px rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.15);
    animation: frameTransformHex 5s ease-in-out infinite;
}

/* Petal - morphs between petal and other shapes */
.frame-petal .media-shape {
    animation: mediaMorphPetal 12s ease-in-out infinite;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.frame-petal:hover .media-shape {
    animation: mediaMorphPetal 6s ease-in-out infinite;
}

.frame-petal .experiment-frame {
    transition: all 0.4s ease;
    position: relative;
    animation: frameTransformPetal 12s ease-in-out infinite;
}

.frame-petal .experiment-frame::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    background-size: 200% 200%;
    animation: shimmer 3s linear infinite;
    clip-path: inherit;
    -webkit-clip-path: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.frame-petal:hover .experiment-frame {
    border-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), 0 0 50px rgba(255, 255, 255, 0.3);
    transform: scale(1.03);
    background: rgba(255, 255, 255, 0.12);
    animation: frameTransformPetal 6s ease-in-out infinite;
}

.frame-petal:hover .experiment-frame::before {
    opacity: 1;
}

/* Enhanced card hover effects */
.experiment-card:hover {
    transform: translateY(-8px) scale(1.03);
}

.experiment-card:hover .experiment-media {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Smooth transitions for all media shapes */
.media-shape {
    will-change: transform;
    backface-visibility: hidden;
    transform-origin: center center;
}

/* Add subtle parallax effect on scroll */
@media (prefers-reduced-motion: no-preference) {
    .experiment-card {
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    }
}

.footer-content {
    text-align: center;
}

/* Video Card Overlay */
.video-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    z-index: 50;
    border-radius: 44px;
    overflow: hidden;
    /* Ensure it covers the entire card including padding */
    inset: 0;
    transform: scale(1);
    transform-origin: center;
    transition: transform 0.3s ease;
}

.video-card-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1.1);
}

.video-card-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 44px;
}

.close-card-video {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 60;
}

.close-card-video:hover {
    background: rgba(255, 255, 255, 0.2);
}

