/* ============================================================================ NYT-Style Data Story: The Secret Life of Nutella ============================================================================ */

:root { --color-primary: #121212; --color-secondary: #666; --color-accent: #d84315; --color-highlight: #ff6f00; --color-bg: #ffffff; --color-bg-alt: #f5f5f5; --font-serif: 'Playfair Display', Georgia, serif; --font-sans: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif; --max-width: 680px; --max-width-wide: 1200px; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body { font-family: var(--font-sans); font-size: 18px; line-height: 1.7; color: var(--color-primary); background: var(--color-bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ============================================================================ Hero Section ============================================================================ */

.hero { height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; background: linear-gradient(135deg, #8B4513 0%, #D2691E 100%); color: white; text-align: center; padding: 2rem; position: relative; }
.hero-content { max-width: 900px; animation: fadeInUp 1s ease-out; }
.hero-title { font-family: var(--font-serif); font-size: clamp(2.5rem, 8vw, 5rem); font-weight: 900; line-height: 1.1; margin-bottom: 1.5rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }
.hero-subtitle { font-size: clamp(1.1rem, 2.5vw, 1.5rem); font-weight: 300; line-height: 1.5; margin-bottom: 2rem; opacity: 0.95; }
.hero-byline { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }
.scroll-indicator { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); text-align: center; opacity: 0.7; animation: bounce 2s infinite; }
.scroll-indicator span { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; }
.scroll-arrow { font-size: 1.5rem; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); } 40% { transform: translateX(-50%) translateY(-10px); } 60% { transform: translateX(-50%) translateY(-5px); } }

/* ============================================================================ Story Sections ============================================================================ */

.story-section { padding: 4rem 2rem; }
.container { max-width: var(--max-width); margin: 0 auto; }
.container-wide { max-width: var(--max-width-wide); margin: 0 auto; padding: 0 2rem; }
.story-text { font-size: 1.125rem; line-height: 1.8; }
.story-text p { margin-bottom: 1.5rem; }
.story-text h3 { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; margin: 3rem 0 1.5rem; color: var(--color-primary); }
.drop-cap::first-letter { font-family: var(--font-serif); font-size: 4.5rem; font-weight: 700; line-height: 0.8; float: left; margin: 0.1rem 0.1rem 0 0; color: var(--color-accent); }
.pullquote { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 700; line-height: 1.4; color: var(--color-accent); margin: 2.5rem 0; padding: 1.5rem 0; border-top: 3px solid var(--color-accent); border-bottom: 3px solid var(--color-accent); text-align: center; }
.story-text ul { margin: 1.5rem 0 1.5rem 2rem; }
.story-text li { margin-bottom: 0.75rem; }
.story-text strong { font-weight: 600; color: var(--color-primary); }
.story-text em { font-style: italic; }

/* ============================================================================ Visualization Sections ============================================================================ */

.visualization-section { padding: 5rem 2rem; background: var(--color-bg-alt); }
.section-title { font-family: var(--font-serif); font-size: 2.5rem; font-weight: 700; text-align: center; margin-bottom: 1rem; color: var(--color-primary); }
.section-intro { font-size: 1.2rem; text-align: center; max-width: 700px; margin: 0 auto 3rem; color: var(--color-secondary); }
.chart-container { background: white; border-radius: 8px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin-bottom: 2rem; }
.chart-caption { max-width: 700px; margin: 0 auto; font-size: 0.95rem; color: var(--color-secondary); line-height: 1.6; }
.chart-caption strong { color: var(--color-primary); }

/* ============================================================================ Ingredient Explorer ============================================================================ */

.ingredient-details { margin-top: 2rem; }
.ingredient-card { background: white; border-radius: 8px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.ingredient-card h4 { font-family: var(--font-serif); font-size: 1.5rem; margin-bottom: 1rem; color: var(--color-accent); }
.ingredient-card p { color: var(--color-secondary); line-height: 1.6; }

/* ============================================================================ Scrollytelling Section ============================================================================ */

.scrolly-section { position: relative; padding: 0; background: var(--color-bg); }
.scrolly-graphic { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--color-bg-alt); }
.sticky-viz { width: 100%; max-width: 800px; height: 500px; background: white; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--color-secondary); }
.scrolly-steps { position: relative; z-index: 2; pointer-events: none; }
.step { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.step-content { max-width: 500px; background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); pointer-events: auto; }
.step-content p { font-size: 1.2rem; line-height: 1.7; color: var(--color-primary); }
.step.active .step-content { animation: fadeInScale 0.5s ease-out; }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ============================================================================ Highlight Section ============================================================================ */

.highlight-section { background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); padding: 5rem 2rem; }
.stat-callout { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; text-align: center; margin: 2rem 0; color: var(--color-primary); }
.highlight-number { color: var(--color-accent); font-size: 2.5rem; display: inline-block; border-bottom: 4px solid var(--color-accent); }

/* ============================================================================ Hypothesis Grid ============================================================================ */

.hypothesis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; margin-top: 3rem; }
.hypothesis-card { background: white; border-radius: 8px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.hypothesis-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.hypothesis-icon { font-size: 3rem; margin-bottom: 1rem; }
.hypothesis-card h4 { font-family: var(--font-serif); font-size: 1.3rem; margin-bottom: 1rem; color: var(--color-primary); }
.hypothesis-card p { font-size: 1rem; line-height: 1.6; color: var(--color-secondary); margin-bottom: 1rem; }
.evidence { font-size: 0.9rem; padding: 1rem; background: var(--color-bg-alt); border-radius: 4px; border-left: 3px solid var(--color-accent); }
.evidence strong { color: var(--color-accent); }

/* ============================================================================ Methodology & Credits ============================================================================ */

.methodology-section { background: var(--color-bg-alt); }
.credits-section { background: var(--color-primary); color: white; padding: 3rem 2rem; }
.credits-section h4 { font-family: var(--font-serif); font-size: 1.5rem; margin: 2rem 0 1rem; color: var(--color-highlight); }
.credits-section h4:first-child { margin-top: 0; }
.credits-section p { font-size: 0.95rem; line-height: 1.7; color: rgba(255,255,255,0.8); margin-bottom: 1rem; }

/* ============================================================================ Closing Section ============================================================================ */

.closing-section { padding: 5rem 2rem; background: linear-gradient(to bottom, var(--color-bg) 0%, var(--color-bg-alt) 100%); }
.final-thought { font-family: var(--font-serif); font-size: 1.5rem; font-style: italic; text-align: center; margin: 3rem 0; color: var(--color-accent); }

/* ============================================================================ Responsive Design ============================================================================ */

@media (max-width: 768px) { .hero-title { font-size: 2.5rem; } .hero-subtitle { font-size: 1.1rem; } .story-text { font-size: 1rem; } .section-title { font-size: 2rem; } .hypothesis-grid { grid-template-columns: 1fr; } .chart-container { padding: 1rem; } .step-content { padding: 1.5rem; } .step-content p { font-size: 1rem; } }

/* ============================================================================ Chart Styles ============================================================================ */

.bar-chart { width: 100%; height: 400px; }
.country-card { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); transition: all 0.3s ease; cursor: pointer; }
.country-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.country-name { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--color-primary); }
.country-stat { font-size: 2rem; font-weight: 700; color: var(--color-accent); margin: 0.5rem 0; }
.country-detail { font-size: 0.9rem; color: var(--color-secondary); line-height: 1.5; }

/* ============================================================================ Animations ============================================================================ */

.fade-in { animation: fadeIn 0.8s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.slide-in-left { animation: slideInLeft 0.8s ease-out; }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }

/* ============================================================================ Utility Classes ============================================================================ */

.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.hidden { display: none; }

/* ============================================================================ New Sections: Insight Box, Regulatory Grid, Allergen Heatmap ============================================================================ */

.insight-box { background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); border-left: 4px solid #2196f3; border-radius: 8px; padding: 1.5rem; margin: 2rem 0; }
.insight-box h4 { font-family: var(--font-serif); font-size: 1.3rem; margin-bottom: 0.75rem; color: #1565c0; }
.insight-box p { font-size: 1rem; line-height: 1.6; color: var(--color-primary); margin-bottom: 0; }

.regulatory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; margin-top: 3rem; }
.regulatory-card { background: white; border-radius: 8px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); position: relative; transition: transform 0.3s ease; }
.regulatory-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.regulatory-flag { font-size: 3rem; margin-bottom: 1rem; text-align: center; }
.regulatory-card h4 { font-family: var(--font-serif); font-size: 1.5rem; text-align: center; margin-bottom: 1.5rem; color: var(--color-primary); }
.regulatory-detail { font-size: 0.95rem; line-height: 1.6; color: var(--color-secondary); }
.regulatory-detail p { margin-bottom: 0.75rem; }
.regulatory-detail strong { color: var(--color-primary); font-weight: 600; }
.regulatory-link { display: inline-block; margin-top: 1rem; padding: 0.5rem 1rem; background: var(--color-accent); color: white; text-decoration: none; border-radius: 4px; font-size: 0.9rem; transition: background 0.3s ease; }
.regulatory-link:hover { background: var(--color-highlight); }
.verdict { position: absolute; top: 1rem; right: 1rem; padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.85rem; font-weight: 600; text-transform: uppercase; }
.verdict.verified { background: #4caf50; color: white; }

#allergen-heatmap { overflow-x: auto; }
.heatmap-legend { display: flex; justify-content: center; gap: 2rem; margin-top: 1.5rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; }
.legend-color { width: 30px; height: 20px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.1); }
.legend-low { background: #4caf50; }
.legend-medium { background: #ffeb3b; }
.legend-high { background: #f44336; }
.legend-item span { font-size: 0.9rem; color: var(--color-secondary); }
.jitter-tooltip { position: absolute; background: rgba(0, 0, 0, 0.9); color: white; padding: 0.75rem; border-radius: 4px; font-size: 0.85rem; pointer-events: none; z-index: 1000; max-width: 250px; line-height: 1.4; }
.jitter-tooltip strong { color: var(--color-highlight); }
#reformulation-chart { min-height: 400px; }
