/* === Research Page === */

.research-page .research-intro {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.research-hint {
    font-size: 0.88rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 1.5rem;
}

/* === Theme Cards Grid === */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.25rem;
}

.theme-card {
    background: var(--bg-subtle);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
    outline: none;
    position: relative;
}

.theme-card:hover,
.theme-card:focus-visible {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--accent);
}

.theme-icon {
    width: 38px;
    height: 38px;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.theme-icon-wide {
    width: 100%;
    max-width: 160px;
    height: auto;
    aspect-ratio: 3 / 2;
}

.theme-icon svg {
    width: 100%;
    height: 100%;
}

.theme-card h4 {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.1rem;
    color: var(--navy);
    margin: 0 0 0.5rem;
}

.theme-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0 0 0.75rem;
}

.theme-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.theme-tags span {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.73rem;
    font-weight: 500;
    color: var(--accent);
    background: rgba(46, 80, 144, 0.08);
    border-radius: 20px;
    letter-spacing: 0.2px;
}

.theme-cta {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    transition: color 0.2s;
}

.theme-card:hover .theme-cta {
    color: var(--accent-hover);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 42, 74, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

/* Drag handle for mobile bottom-sheet feel */
.modal-drag-handle {
    display: none;
    justify-content: center;
    padding: 0.5rem 0 0.25rem;
    flex-shrink: 0;
    cursor: grab;
}

.modal-drag-handle span {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.35rem;
    color: var(--navy);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-subtle);
    border-radius: 50%;
    font-size: 1.3rem;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.modal-body {
    overflow-y: auto;
    padding: 1.25rem 1.75rem 1.75rem;
}

/* === Modal Paper Cards === */
.modal-paper {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: var(--bg-subtle);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.modal-paper:last-child {
    margin-bottom: 0;
}

.modal-paper:hover {
    border-color: var(--accent);
}

.modal-paper-year {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.modal-paper-content {
    flex: 1;
    min-width: 0;
}

.modal-paper-content h4 {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 0.3rem;
    line-height: 1.4;
}

.modal-paper-authors {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.15rem;
}

.modal-paper-venue {
    font-size: 0.82rem;
    font-style: italic;
    color: var(--text-light);
    margin: 0 0 0.6rem;
}

.modal-paper-abstract {
    font-size: 0.87rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0 0 0.6rem;
}

.modal-paper-doi {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.modal-paper-doi:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* === Scrollbar styling for modal === */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* === Responsive === */

/* Tablets */
@media (max-width: 768px) {
    .theme-grid {
        grid-template-columns: 1fr;
    }

    .theme-icon-wide {
        max-width: 140px;
    }

    .modal-overlay {
        padding: 0.75rem;
        align-items: flex-end;
    }

    .modal {
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
        width: 100%;
    }

    .modal-header {
        padding: 1rem 1.25rem;
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 2;
        border-radius: 14px 14px 0 0;
    }

    .modal-header h3 {
        font-size: 1.15rem;
        padding-right: 0.5rem;
    }

    .modal-drag-handle {
        display: flex;
    }

    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }

    .modal-body {
        padding: 0.75rem 1rem 1.25rem;
        -webkit-overflow-scrolling: touch;
    }

    .modal-paper {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }

    .modal-paper-year {
        width: 36px;
        height: 36px;
        font-size: 0.7rem;
    }

    .modal-paper-content h4 {
        font-size: 0.95rem;
    }

    .modal-paper-authors {
        font-size: 0.82rem;
    }

    .modal-paper-venue {
        font-size: 0.78rem;
    }

    .modal-paper-abstract {
        font-size: 0.83rem;
        line-height: 1.55;
    }

    .modal-paper-doi {
        padding: 0.4rem 1rem;
        font-size: 0.82rem;
    }
}

/* Small phones */
@media (max-width: 420px) {
    .modal-overlay {
        padding: 0;
    }

    .modal {
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
    }

    .modal-header {
        padding: 0.85rem 1rem;
    }

    .modal-header h3 {
        font-size: 1.05rem;
    }

    .modal-body {
        padding: 0.5rem 0.75rem 1rem;
    }

    .modal-paper {
        padding: 0.85rem;
    }

    .modal-paper-content h4 {
        font-size: 0.9rem;
    }

    .modal-paper-abstract {
        font-size: 0.8rem;
    }

    .theme-icon-wide {
        max-width: 120px;
    }

    .theme-card h4 {
        font-size: 1rem;
    }

    .theme-card p {
        font-size: 0.85rem;
    }
}
