/* Storytelling Module CSS
   Purpose: Modular, narrative-driven research showcase with side-by-side layout
   Features: Responsive grid, collapsible details, practitioner-focused design */

/* Story Block - Main Container */
.story-block {
    width: 100%;
    padding: 60px 40px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.story-block:nth-child(even) {
    background: #fafbfc;
}

.story-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

/* Text Column */
.story-text {
    font-size: 1.05em;
    line-height: 1.8;
    color: #333;
}

.story-text h2 {
    color: var(--primary);
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 700;
}

.story-text h3 {
    color: var(--accent);
    font-size: 18px;
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
}

.story-text p {
    margin-bottom: 16px;
    color: #444;
}

.story-text strong {
    color: var(--primary);
    font-weight: 600;
}

.story-text ul, .story-text ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.story-text li {
    margin-bottom: 8px;
    color: #444;
}

.story-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.25s;
}

.story-text a:hover {
    border-bottom-color: var(--primary);
}

/* Figure/Map Column */
.story-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.map-container {
    height: 500px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: #e8eef7;
    position: relative;
}

.map-container-small {
    height: 350px;
}

.map-container-large {
    height: 600px;
}

/* Map - ensure Leaflet maps fill container */
.map-container .leaflet-container,
.map-container .viewer-container,
.map-container #trainingMap {
    width: 100%;
    height: 100%;
}

/* Figcaption */
figcaption {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    padding: 12px 0;
    border-top: 1px solid #e0e0e0;
    line-height: 1.6;
}

figcaption strong {
    color: var(--primary);
    font-weight: 600;
}

/* Collapsible Details Section */
.story-details {
    max-width: 1400px;
    margin: 40px auto 0;
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    font-size: 0.95em;
}

.story-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    transition: color 0.25s;
}

.story-details summary:hover {
    color: var(--accent);
}

.story-details summary::marker {
    color: var(--primary);
}

.findings-content {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding-top: 24px;
    border-top: 1px solid #ddd;
}

.findings-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.findings-content table {
    width: 100%;
    font-size: 0.9em;
    border-collapse: collapse;
}

.findings-content th {
    background: #e8eef7;
    color: var(--primary);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
}

.findings-content td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.findings-content tr:last-child td {
    border-bottom: none;
}

.findings-box {
    background: #fff;
    padding: 16px;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.findings-box h4 {
    color: var(--primary);
    font-size: 0.95em;
    margin-bottom: 8px;
}

.findings-box p {
    font-size: 0.9em;
    color: #555;
    line-height: 1.6;
    margin-bottom: 8px;
}

.findings-box p:last-child {
    margin-bottom: 0;
}

/* Conclusions Section */
.story-conclusions {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 8px;
}

.story-conclusions h2 {
    color: var(--primary);
    font-size: 32px;
    margin-bottom: 30px;
    text-align: center;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.recommendation-card {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    border-top: 4px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.recommendation-card h3 {
    color: var(--primary);
    font-size: 18px;
    margin-bottom: 12px;
}

.recommendation-card p {
    color: #555;
    font-size: 0.95em;
    line-height: 1.6;
}

.story-footer {
    max-width: 1400px;
    margin: 60px auto 0;
    padding: 40px;
    background: #fff;
    border-top: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
}

.story-footer h3 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 16px;
}

.story-footer p {
    color: #666;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 12px;
}

.story-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin: 0 12px;
    transition: all 0.25s;
}

.story-footer a:hover {
    text-decoration: underline;
}

.phd-badge {
    display: inline-block;
    background: linear-gradient(135deg, #1e5090 0%, #2a6cb0 100%);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .story-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .map-container {
        height: 400px;
    }

    .story-block {
        padding: 40px 24px;
    }

    .findings-content {
        grid-template-columns: 1fr;
    }

    .story-text h2 {
        font-size: 24px;
    }

    .story-text {
        font-size: 1em;
    }
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .story-content {
        gap: 30px;
    }

    .story-block {
        padding: 30px 16px;
    }

    .story-conclusions {
        padding: 40px 16px;
    }

    .story-footer {
        padding: 30px 16px;
    }

    .map-container {
        height: 300px;
    }

    .story-text h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .story-text {
        font-size: 0.95em;
        line-height: 1.6;
    }

    .story-text h3 {
        font-size: 16px;
    }

    .story-text p {
        margin-bottom: 12px;
    }

    .story-details {
        margin-left: 0;
        margin-right: 0;
        padding: 16px;
    }

    .findings-content {
        gap: 20px;
        padding-top: 16px;
    }

    .recommendations-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    figcaption {
        font-size: 0.85em;
    }
}

/* Animation for details expand/collapse */
details {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print styles */
@media print {
    .story-details {
        page-break-inside: avoid;
    }

    .map-container {
        page-break-inside: avoid;
    }
}
