/* Research page — hairline + whitespace separated sections, alternating media */

.menu-section {
    position: relative;
    background:
        radial-gradient(200px 200px at 40% 120px, rgba(117, 131, 255, 0.1), transparent 60%);
}

#algo, #bio, #graph, #security {
    scroll-margin-top: 20vh;
}

.research-list {
    display: flex;
    flex-direction: column;
}

.research-card + .research-card {
    border-top: 1px solid #e5e7eb;
    margin-top: 30px;
    padding-top: 40px;
}

.research-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #222;
}

.research-body {
    display: flex;
    flex-direction: row;
    gap: 36px;
    align-items: center;
    padding: 15px;
}

.research-card:nth-child(even) .research-body {
    flex-direction: row-reverse;
}

.research-card.no-media .research-body {
    display: block;
}

.research-card.no-media .research-img-container {
    display: none;
}

.research-text {
    flex: 7 1 0;
    min-width: 0;
}

.research-img-container {
    flex: 3 1 0;
}

.research-desc p {
    margin: 0;
    font-size: clamp(14px, 2.2vw, 15px);
    line-height: 1.8;
    /* color: #4b5563; */
    word-break: keep-all;
}

.research-topic {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.research-topic li {
    position: relative;
    padding-left: 14px;
    font-size: clamp(14px, 2.2vw, 15px);
    color: #374151;
}

.research-topic li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #9ca3af;
}

.research-desc-detail {
    margin-top: 24px;
}

.research-desc-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.research-desc-desc {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.65;
    color: #4b5563;
}

.research-desc-topic {
    margin: 8px 0 12px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.research-desc-topic li {
    position: relative;
    padding-left: 14px;
    font-size: 13.5px;
    color: #4b5563;
}

.research-desc-topic li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #b0b6bf;
}

/* ===== image gallery ===== */
.research-img-container {
    height: 100%;
    display: flex;
}

.research-gallery {
    display: grid;
    gap: 10px;
    height: 100%;
    width: 100%;
}

.research-gallery.count-1 {
    grid-template-columns: 1fr;
}

.research-gallery.count-2,
.research-gallery.count-3 {
    grid-template-columns: 1fr 1fr;
}

.research-gallery.count-3 .research-thumb:nth-child(3) {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
}

.research-thumb {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
    background: #eef0f3;
}

.research-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (hover: hover) {
    .research-thumb img {
        transition: transform 0.25s ease;
    }

    .research-thumb:hover img {
        transform: scale(1.03);
    }
}

/* ===== modal ===== */
.img-modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 40px;
    background: rgba(15, 23, 42, 0.78);
    z-index: 9999;
    touch-action: manipulation;
}

.img-modal.open {
    display: grid;
}

.img-modal img {
    max-width: min(1200px, 90vw);
    max-height: 85vh;
    background: #ffffff;
    object-fit: contain;
}

.img-modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #111827;
    font-size: 28px;
    line-height: 46px;
    cursor: pointer;
}

.scroll-lock {
    overflow: hidden;
    touch-action: none;
    width: 100%;
}

/* ===== responsive ===== */
@media (max-width: 900px) {
    .research-body {
        flex-direction: column;
        gap: 20px;
    }

    .research-card:nth-child(even) .research-body {
        flex-direction: column;
    }

    .research-card.no-media .research-body {
        display: block;
    }
}

@media (max-width: 768px) {
    
    #algo, #bio, #graph, #security {
        scroll-margin-top: 10vh;
    }
    .img-modal {
        padding: 16px;
    }

    .img-modal img {
        max-width: 100%;
        max-height: 75vh;
    }

    .img-modal-close {
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
        font-size: 24px;
        line-height: 42px;
    }
}