/*!
 * CSEC Design System v2.0 - Research Module (4-Column Layout & Fullscreen Projector)
 * Copyright (c) 2026 Civil and Structural Engineering Consultants (Pvt) Ltd.
 */

/* --- RESEARCH HERO --- */
.research-hero-section {
    position: relative;
    width: 100%;
    padding: 10rem 4rem 3.5rem 4rem;
    background-color: var(--fern-deep-forest);
}

.research-hero-container {
    max-width: 1720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.research-hero-title {
    font-size: 3.8rem;
    font-weight: 300;
    color: var(--text-warm-white);
}

.research-hero-tagline {
    font-size: 1.15rem;
    color: var(--text-warm-muted);
    font-weight: 300;
    max-width: 850px;
}

/* --- RESEARCH GRID SECTION (WARM WHITE BACKGROUND) --- */
.research-grid-section {
    position: relative;
    width: 100%;
    padding: 3.5rem 2rem 8rem 2rem;
    background-color: var(--warm-bay-bg, #f4f2ec);
    color: var(--fern-dark-green);
}

.research-container-wrapper {
    max-width: 1720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
}

/* Streamlined All-Caps Category Navigation (No Bulky Pills) */
.filter-bar {
    display: flex;
    gap: 1.8rem 1.4rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(55, 74, 56, 0.18);
}

.filter-link {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fern-dark-green);
    text-decoration: none;
    position: relative;
    padding: 0.4rem 0.2rem;
    transition: color 0.3s ease;
}

.filter-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--lime-green);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.77, 0, 0.175, 1);
}

.filter-link:hover, 
.filter-link.active {
    color: var(--fern-dark-green);
    font-weight: 600;
}

.filter-link:hover::after, 
.filter-link.active::after {
    transform: scaleX(1);
}

/* --- 4-COLUMN TILES GRID WITH AUTO-CENTERING ON LAST ROW --- */
.research-grid-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3.5rem 2.2rem;
    width: 100%;
}

.research-tile {
    flex: 0 1 calc(33.3% - 1.7rem);
    max-width: calc(33.3% - 1.7rem);
    min-width: 270px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: transparent;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.research-tile:hover {
    transform: translateY(-4px);
}

/* --- VERTICAL DIVIDERS: THIN CRISP CSEC GREEN LINE --- */
@media (min-width: 1201px) {
    .research-tile:not(:nth-child(4n))::after {
        content: '';
        position: absolute;
        top: 4%;
        right: -1.1rem;
        width: 1px; /* Razor-thin 1px line */
        height: 92%;
        background: linear-gradient(180deg, 
            transparent 0%, 
            var(--lime-green) 5%, 
            var(--lime-green) 95%, 
            transparent 100%
        );
        box-shadow: none; /* Removed blurry glow */
        pointer-events: none;
    }
}

@media (min-width: 601px) and (max-width: 1200px) {
    .research-tile:not(:nth-child(2n))::after {
        content: '';
        position: absolute;
        top: 4%;
        right: -1.1rem;
        width: 1px;
        height: 92%;
        background: linear-gradient(180deg, 
            transparent 0%, 
            var(--lime-green) 5%, 
            var(--lime-green) 95%, 
            transparent 100%
        );
        box-shadow: none;
        pointer-events: none;
    }
}
/* Image Focus Bay (Natural Scaled Fit, No Border Radius) */
.research-image-bay {
    position: relative;
    width: 100%;
    height: auto;
    background-color: rgba(55, 74, 56, 0.04);
    overflow: hidden;
    border-radius: 0 !important;
    display: block;
    cursor: pointer;
}

.research-image-bay img {
    width: 100% !important; /* Fills 100% column width edge-to-edge */
    height: auto !important; /* Natural aspect ratio without top/bottom/side gaps */
    display: block;
    border-radius: 0 !important;
    transition: transform 2s cubic-bezier(0.25, 1, 0.5, 1), filter 2s ease;
    filter: brightness(1);
}

.research-image-bay:hover img,
.research-image-bay.counting img {
    transform: scale(1.05);
    filter: brightness(0.85);
}

/* Center-Out Circular Ripple (0.85 Brightness Layer) */
.center-ripple-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.32) 0%, rgba(0, 0, 0, 0.15) 55%, transparent 75%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
    z-index: 4;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.research-image-bay:hover .center-ripple-overlay,
.research-image-bay.counting .center-ripple-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(35);
    transition: transform 2s cubic-bezier(0.1, 0.8, 0.3, 1), opacity 0.4s ease;
}

/* Trademark Lime Streak Divider */
.research-lime-streak {
    width: 32px;
    height: 3px;
    background-color: var(--lime-green);
    margin: 0.9rem 0 0.5rem 0;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.research-tile:hover .research-lime-streak {
    width: 55px;
}

/* Details Below Image */
.research-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    margin-top: 0.8rem;
}

.research-category-text {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--fern-sage-green);
    font-weight: 600;
}

.research-name {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--fern-dark-green);
    line-height: 1.3;
    margin: 0.2rem 0 0.4rem 0;
    position: relative;
    display: inline-block;
    width: fit-content;
    transition: color 0.3s ease;
}

.research-name::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--lime-green);
    box-shadow: 0 0 6px var(--lime-neon-glow);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s cubic-bezier(0.77, 0, 0.175, 1);
}

.research-tile:hover .research-name::after,
.research-image-bay.counting ~ .research-details .research-name::after {
    transform: scaleX(1);
}

.research-desc {
    font-size: 0.86rem;
    line-height: 1.6;
    color: rgba(55, 74, 56, 0.78);
    font-weight: 300;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-research-msg {
    text-align: center;
    font-size: 1.15rem;
    color: var(--fern-dark-green);
    padding: 3rem 0;
    width: 100%;
}

/* ==========================================================================
   FULLSCREEN PROJECTOR OVERLAY MODAL (100vw x 100vh)
   ========================================================================== */
.projector-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 11, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    overscroll-behavior: contain !important;
}

.projector-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.mini-projector-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    background-color: var(--card-dark-brown, #28211b);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 3.5rem 5rem;
    z-index: 350;
    color: var(--text-warm-white);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
    overscroll-behavior: contain !important;
    transform: translate3d(0, 100%, 0);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.4s ease,
                visibility 0.5s step-end;
}

.mini-projector-modal.active {
    transform: translate3d(0, 0, 0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.4s ease,
                visibility 0s;
}

.mini-projector-modal .big-x-btn {
    position: fixed;
    top: 2rem;
    right: 2.5rem;
    z-index: 400;
}

.projector-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}

.projector-location {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--lime-green);
    font-weight: 600;
}

.projector-title {
    font-size: 2.4rem;
    font-weight: 300;
    color: var(--text-warm-white);
    margin-top: 0.3rem;
    margin-bottom: 0.8rem;
}

/* Fullscreen Projector Viewport */
.projector-viewport {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 1.5rem auto;
    flex: 1;
    overflow-y: auto;
    padding-right: 0.8rem;
    overscroll-behavior: contain !important;
}

.projector-viewport::-webkit-scrollbar {
    width: 4px;
}
.projector-viewport::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}
.projector-viewport::-webkit-scrollbar-thumb {
    background: rgba(55, 74, 56, 0.85);
    border-radius: 2px;
}
.projector-viewport::-webkit-scrollbar-thumb:hover {
    background: var(--lime-green);
}

.projector-body {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-warm-muted);
    font-weight: 300;
    white-space: pre-line;
}

/* --- THINGSPEAK IOT EMBED STYLING --- */
.iot-slide-container {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    width: 100%;
}

.iot-slide-title {
    font-size: 1.4rem;
    color: var(--lime-green);
    font-weight: 500;
}

.iot-slide-text {
    font-size: 1.15rem;
    line-height: 1.85;
    color: var(--text-warm-muted);
}

/* Dual Gauge Grid */
.iot-gauges-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
}

.iot-iframe-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--lime-green);
    width: 100%;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.iot-iframe-card iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Chart & Windrose Full Cards */
.iot-full-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--lime-green);
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.iot-full-card iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Projector Controls Bar */
.projector-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    flex-shrink: 0;
}

.projector-dots {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.p-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.p-dot.active {
    background: var(--lime-green);
    transform: scale(1.4);
    box-shadow: 0 0 8px var(--lime-neon-glow);
}

.p-nav-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-warm-white);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.p-nav-btn:hover {
    border-color: var(--lime-green);
    color: var(--lime-green);
}

.projector-play-pause {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--lime-green);
    cursor: pointer;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
}

/* --- FULLY STYLED PAGINATION CONTROLS --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.8rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(55, 74, 56, 0.2);
    width: 100%;
}

.page-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--fern-dark-green);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.3s ease;
}

.page-nav-btn:hover {
    color: var(--lime-green);
    transform: translateX(3px);
}

.page-numbers {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.page-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(55, 74, 56, 0.3);
    color: var(--fern-dark-green);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.page-num.active,
.page-num:hover {
    background-color: var(--lime-green);
    border-color: var(--lime-green);
    color: var(--fern-dark-green);
    box-shadow: 0 0 10px var(--lime-neon-glow);
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 1200px) {
    .research-grid-container {
        gap: 2.5rem 1.4rem;
    }
    .research-tile {
        flex: 0 1 calc(50% - 0.7rem);
        max-width: calc(50% - 0.7rem);
    }
    .research-hero-title { font-size: 2.8rem; }
    .research-grid-section { padding: 3rem 2.5rem 5rem 2.5rem; }
    .mini-projector-modal { padding: 2.5rem 2rem; }
    .iot-gauges-grid { grid-template-columns: 1fr; }
    .iot-full-card { height: 320px; }
}

@media (max-width: 600px) {
    .research-grid-section { padding: 2.5rem 1.2rem 5rem 1.2rem; }
    .research-grid-container { gap: 2rem; }
    .research-tile {
        flex: 0 1 100%;
        max-width: 100%;
    }
    .research-image-bay { height: 240px; }
    .research-name { font-size: 1.2rem; line-height: 1.35; }
    .filter-bar { gap: 1.2rem 0.9rem; }
    .filter-link { font-size: 0.76rem; }
    .mini-projector-modal { padding: 2rem 1.5rem; }
    
    .pagination-container {
        gap: 0.5rem;
        padding-top: 1.5rem;
        margin-top: 1.5rem;
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
    }
    .page-nav-btn { font-size: 0.75rem; letter-spacing: 0.05em; gap: 0.25rem; }
    .page-numbers { gap: 0.35rem; }
    .page-num { width: 32px; height: 32px; font-size: 0.82rem; }
}