/*
 * Research Articles — Isolated Stylesheet
 *
 * All styles scoped under .research-article so they never leak into
 * the main site and are immune to tailwind.min.css rebuilds.
 *
 * Loaded by research.php for every /research/{slug}/ page.
 */

/* ── Layout Utilities (replicated from Tailwind so articles are self-contained) ── */

.research-article *, .research-article *::before, .research-article *::after { box-sizing: border-box; }

@media (max-width: 639px) {
    .research-article #table-search-wrap { max-width: 100% !important; }
}

/* ── Hero ──────────────────────────────────────────────────────────── */

.research-article .research-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}
.research-article .research-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(99,102,241,0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(6,182,212,0.1) 0%, transparent 50%);
    pointer-events: none;
}
.research-article .research-hero-pattern {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

/* ── Grade Badges ─────────────────────────────────────────────────── */

.research-article .grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.25rem 0.625rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border: 1px solid;
    letter-spacing: 0.02em;
}

/* ── Cards ────────────────────────────────────────────────────────── */

.research-article .content-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
}

.research-article .stat-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s;
}
.research-article .stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.2);
}

/* ── Sections ─────────────────────────────────────────────────────── */

.research-article .research-section { scroll-margin-top: 5rem; }

/* ── Map ──────────────────────────────────────────────────────────── */

.research-article #research-map {
    width: 100%;
    height: 500px;
    border-radius: 0 0 1rem 1rem;
    background: #f1f5f9;
}
@media (max-width: 768px) {
    .research-article #research-map { height: 340px; }
}

/* ── Rankings Table ───────────────────────────────────────────────── */

.research-article .ranking-row { transition: background-color 0.15s; }
.research-article .ranking-row:hover { background-color: #f9fafb; }
.research-article .ranking-row td { padding: 0.875rem 1rem; }

.research-article .sort-th {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.research-article .sort-th:hover { background: #f3f4f6; }

.research-article .sort-arrow {
    opacity: 0.25;
    transition: opacity 0.15s;
    margin-left: 0.25rem;
    font-size: 0.7rem;
}
.research-article .sort-arrow.active { opacity: 1; }

/* ── Rank Number Badges ───────────────────────────────────────────── */

.research-article .rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.75rem;
}
.research-article .rank-gold   { background: #fef3c7; color: #92400e; }
.research-article .rank-silver { background: #fef3c7; color: #92400e; }
.research-article .rank-bronze { background: #fef3c7; color: #92400e; }
.research-article .rank-default { background: #f3f4f6; color: #6b7280; }

/* Dangerous cities rank badges */
.research-article .rank-danger-1 { background: #fecaca; color: #991b1b; }
.research-article .rank-danger-2 { background: #fed7aa; color: #9a3412; }
.research-article .rank-danger-3 { background: #fed7aa; color: #9a3412; }

/* ── Spotlight Cards ──────────────────────────────────────────────── */

.research-article .spotlight-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.research-article .spotlight-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* ── FAQ Accordion ────────────────────────────────────────────────── */

.research-article .faq-item { border-bottom: 1px solid #f3f4f6; }
.research-article .faq-item:last-child { border-bottom: none; }
.research-article .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
.research-article .faq-answer.open { max-height: 500px; }

/* ── Prose (article body text) ────────────────────────────────────── */

.research-article .prose p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: #4b5563;
}
.research-article .prose p:last-child { margin-bottom: 0; }

/* ── Region Cards ─────────────────────────────────────────────────── */

.research-article .region-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.research-article .region-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}
