/* antigravity.css */
:root {
    --university-blue: #003366;
    --accent-gold: #D4AF37;
    --bg-dark: #050505;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body,
html {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    color: white;
}

/* Kiosk Mode Support */
body.kiosk-mode,
body.kiosk-mode * {
    cursor: none !important;
}

#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Above body background, below slides */
    pointer-events: none;
}

/* --- Shared Slide Styles --- */
.side-stripe {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: clamp(80px, 8vw, 120px);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 40px 0;
    z-index: 2000;
    /* Above slides */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    visibility: visible !important;
    opacity: 1 !important;
}

.side-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: clamp(0.9rem, 2vh, 1.2rem);
    text-transform: uppercase;
    letter-spacing: 4px;
    color: white;
    font-weight: 700;
    opacity: 0.9;
    white-space: normal;
    max-height: 40vh;
    text-align: left;
    margin-bottom: 20px;
    line-height: 1.4;
}

.side-logo {
    width: clamp(50px, 6vw, 80px);
    height: auto;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
    margin-bottom: 20px;
    transform: rotate(180deg);
}

.side-qr {
    width: clamp(50px, 6vw, 80px);
    height: auto;
    aspect-ratio: 1/1;
    background: white;
    padding: 5px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.side-qr img {
    width: 100%;
    height: 100%;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    text-align: center;
    padding-bottom: 8vh;
    padding-left: clamp(80px, 8vw, 120px);
    padding-right: clamp(80px, 8vw, 120px);
    /* Space for sidebar and balanced layout */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    z-index: 10;
    isolation: auto;
    /* Allow children to interact with global z-index if possible (though limited by parent z-index) */
    box-sizing: border-box;
}

.slide.is-animating {
    will-change: opacity, visibility;
}

/* FALLBACK: Make at least the first slide visible by default */
/* FALLBACK: Removed to preventing blinking on JS init */
/* .slide:first-of-type {
    visibility: visible;
    opacity: 1;
    z-index: 5;
} */

/* Fade Gradient Overlay */
.slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.95) 0%,
            rgba(0, 0, 0, 0.4) 50%,
            rgba(0, 0, 0, 0) 100%);
    z-index: 2;
    pointer-events: none;
}

/* --- Content Wrapper --- */
.slide-content {
    position: relative;
    z-index: 20;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Typography --- */
.slide[data-slide-type="gallery"] .title-large {
    padding-top: 4vh;
    padding-bottom: 2vh;
}

.title-large {
    /* Responsive font size: minimum 1.8rem, ideal 5vh, max 3.5rem */
    font-size: clamp(1.8rem, 5vh, 3.5rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
    color: white;
    line-height: 1.1;
}

.subtitle {
    /* Responsive font size: min 1rem, ideal 2.5vh, max 1.6rem */
    font-size: clamp(1rem, 2.5vh, 1.6rem);
    color: white;
    margin: 5px 0 0 0;
    font-weight: 300;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.content-text {
    /* Responsive font size: min 1.1rem, ideal 2.8vh, max 1.8rem */
    font-size: clamp(1.1rem, 2.8vh, 1.8rem);
    max-width: 900px;
    line-height: 1.4;
    margin-bottom: 20px;
}

/* --- Navigation --- */
.nav-arrow {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    z-index: 3000;
    /* Above sidebar */
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
    user-select: none;
}

body:hover .nav-arrow {
    opacity: 0.3;
}

.nav-arrow:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.05);
}

#nav-prev {
    left: 0;
}

#nav-next {
    right: 0;
}

/* Handle DjangoCMS Toolbar */
.cms-toolbar-expanded #nav-prev,
.cms-toolbar-expanded #nav-next {
    top: 46px;
    height: calc(100vh - 46px);
}

/* --- Plugin Specific Layouts --- */

/* Intro Slide */
.slide-intro {
    justify-content: center;
}

/* History / Alternating */
.slide-history {
    background-size: contain;
    justify-content: flex-end;
    padding-left: clamp(40px, 4vw, 60px);
    padding-right: clamp(120px, 12vw, 180px);
}

/* Modern Gallery - True Masonry */
.masonry-grid {
    column-count: 18;
    column-gap: 2px;
    width: 95vw;
    /* Slightly wider for 7 cols */
    height: auto;
    /* Allow full height */
    max-height: 80vh;
    overflow-y: auto;
    /* Scroll if needed */
    margin: auto;
    z-index: 5;
    /* Hide scrollbar for cleaner look */
    scrollbar-width: none;
}

.masonry-grid::-webkit-scrollbar {
    display: none;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 2px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

.gallery-photo {
    width: 100%;
    height: auto;
    /* No crop */
    display: block;
    border-radius: 2px;
}

.gallery-caption {
    margin-top: 10px;
    font-size: clamp(0.9rem, 2vh, 1.4rem);
    color: white;
    text-align: center;
}

/* Flying Gallery Elements */
.flying-gallery-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.flying-gallery-item {
    position: absolute;
    pointer-events: none;
}

.flying-gallery-photo {
    position: fixed;
    z-index: 100;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    visibility: hidden;
    opacity: 0;
}

/* People Grid */
.people-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(5, 1fr);
    /* Added for aspect ratio */
    gap: 5px;
    width: min(70vw, 70vh);
    /* Match #grid-container */
    height: min(70vw, 70vh);
    /* Match #grid-container */
    margin: auto;
    z-index: 5;
}

/* These slots act as the placeholders */
.slot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    width: 100%;
    height: 100%;
}


.person-photo {
    position: fixed;
    z-index: 100;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vh;
    height: 60vh;
    object-fit: cover;
    object-position: center 15%;
    border-radius: 4px;
    aspect-ratio: 1/1;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    visibility: hidden;
    opacity: 0;
}

.person-label {
    position: fixed;
    z-index: 110;
    top: calc(50% + 32vh);
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 25px;
    border-radius: 5px;
    visibility: hidden;
    opacity: 0;
    width: auto;
}

.person-label h3 {
    margin: 0;
    font-size: 2rem;
}

.person-label p {
    display: none;
}


/* YouTube Embed */
/* YouTube Embed */
.video-container {
    position: relative;
    width: 80vw;
    /* Basic 16:9 fallback for browsers that don't support aspect-ratio */
    height: 45vw;
    /* 80 * 9 / 16 = 45 */
    aspect-ratio: 16/9;
    background: #000;
    z-index: 5;
    margin: auto;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

#player,
#local-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: cover;
    /* Ensure local video fills the 16:9 box nicely */
}

/* Shared video slide specifics */
.slide-video-shared-container {
    padding: 0 !important;
    padding-left: 0 !important;
    justify-content: center !important;
    align-items: center !important;
}

#slide-video-shared::before {
    display: none !important;
}

/* --- Modern Grid (3x3) --- */
.modern-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2vh;
    width: 135vh;
    height: 90vh;
    margin: 1vh auto 0;
    z-index: 10;
}

.modern-slot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    width: 100%;
    height: 100%;
}

.modern-photo {
    position: fixed;
    z-index: 100;
    top: 50%;
    left: 50%;
    object-fit: cover;
    width: 90vh;
    height: 60vh;
    aspect-ratio: 3 / 2;
    border-radius: 8px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.9);
    visibility: hidden;
    opacity: 0;
}

.modern-animations-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.name-label {
    position: fixed;
    z-index: 110;
    top: calc(50% + 32vh);
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 25px;
    border-radius: 5px;
    visibility: hidden;
    opacity: 0;
    white-space: nowrap;
    width: auto;
    max-width: 66vw;
}

.slide-modern {
    padding-top: 2vh;
}

/* Admin/Edit Mode Adjustments */
/* Only force stack layout in structure mode or when explicitly editing */
.cms-structure-mode .slide,
.cms-edit-mode .slide {
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 40vh;
    margin-bottom: 20px;
    z-index: 10 !important;
}

.cms-edit-mode body {
    overflow: auto !important;
}

.cms-structure-mode .nav-arrow,
.cms-edit-mode .nav-arrow {
    display: none !important;
}

/* Scientific Group Slide */
.slide-scientific {
    justify-content: center;
    padding-top: 1vh;
    padding-bottom: 1vh;
}

.scientific-content {
    width: 85vw;
    /* Much wider to accommodate single-row layout */
    margin: 0 auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.members-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 1vh;
    margin-bottom: 2vh;
}

.member-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 14vh;
    /* Slightly smaller than before to balance the narrower grid */
}

.member-photo-container {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 2px solid var(--glass-border);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.member-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-name {
    font-size: clamp(0.8rem, 1.8vh, 1.2rem);
    font-weight: 500;
    color: white;
    text-align: center;
}

.research-grid {
    display: flex;
    /* Switch to flex for easier single-row auto-sizing */
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.research-card {
    flex: 1;
    /* All cards take equal width */
    min-width: 0;
    /* Allow cards to shrink below content width */
    max-width: 400px;
    /* Prevent cards from becoming too wide if there are only 1-2 */
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Removed max-height to let aspect-ratio drive image size */
}

.research-image-container {
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    flex-shrink: 0;
    /* Important: prevents text from squeezing the image */
}

.research-image,
.research-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.research-info {
    padding: 8px 12px;
    text-align: left;
    overflow: hidden;
}

.research-title {
    font-size: clamp(0.9rem, 2vh, 1.3rem);
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--accent-gold);
    line-height: 1.2;
}

.research-text {
    font-size: clamp(0.7rem, 1.6vh, 1rem);
    line-height: 1.3;
    opacity: 0.9;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Awards Slide */
.slide-awards {
    justify-content: center;
    /* Put everything in the middle vertically */
    padding-top: 2vh;
    padding-bottom: 2vh;
}

.awards-content {
    width: 70vw;
    /* Slightly wider to give cards breathing room while centered */
    margin: 0 auto;
    z-index: 10;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.awards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2vh 30px;
    width: 100%;
    margin-top: 2.5vh;
    perspective: 1000px;
}

.award-card {
    background: rgba(25, 25, 25, 0.9);
    /* More solid background */
    backdrop-filter: blur(2px);
    /* Much lighter blur */
    -webkit-backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    /* No max-height here, let flex-center handle it */
}

.award-image-container {
    width: 100%;
    aspect-ratio: 3/2;
    /* Strict 3:2 ratio */
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.2);
}

.award-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.award-info {
    text-align: center;
    padding: 0 5px;
}

.award-title {
    font-size: clamp(1rem, 2.2vh, 1.4rem);
    color: var(--accent-gold);
    margin: 5px 0 3px 0;
    font-weight: 700;
    line-height: 1.2;
}

.award-recipient {
    font-size: clamp(0.8rem, 1.8vh, 1.2rem);
    color: white;
    font-weight: 400;
    opacity: 0.95;
    margin-bottom: 5px;
}

/* Video Overlay Subtitle */
.video-overlay-title {
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 1000;
    width: 100%;
    text-align: center;
    /* Soft gradient background from bottom to top */
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.9) 0%,
            rgba(0, 0, 0, 0.6) 40%,
            rgba(0, 0, 0, 0) 100%);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    padding: 6vh 20px 4vh;
    /* Large padding at bottom to lift text while keeping gradient contact */
    border-radius: 0;
    color: white;
    font-size: clamp(1.4rem, 4vh, 2.5rem);
    font-weight: 700;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

}

.video-overlay-title.is-animating {
    will-change: opacity, transform;
}