/* CSS Custom Properties */
:root {
    /* Modern system font stack that looks great on all devices */
    --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-heading: var(--font-system);
    --font-body: var(--font-system);
    --font-mono: 'Courier New', Consolas, Monaco, monospace;
    
    /* Phase 1: Satirical Calculator (Light, Accessible) */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent-red: #dc2626;
    --border-color: #e5e5e5;
    
    /* Phase 2: Reality Check (Dark for contrast) */
    --bg-reality: #1e293b;
    --text-reality: #f8fafc;
    --data-highlight: #ffd700;
    --warning-red: #dc2626;
    
    /* Phase 3: Timeline (Somber Reality) */
    --bg-timeline: #1e1e2e;
    --timeline-line: #4a4a5e;
    --milestone-dot: #ffffff;
    --casualty-red: #8b0000;
    --date-text: #b0b0c0;
    
    /* Phase 4: Memorial (Hope & Action) */
    --memorial-black: #000000;
    --memorial-white: #ffffff;
    --memorial-green: #007a3d;
    --memorial-red: #ce1126;
    --action-button: #007a3d;
    --action-hover: #005a2d;
    
    /* Easing functions */
    --ease-satirical: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-reality: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-memorial: cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography System */
h1 {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 4rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 2.5rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.01em;
}

.subtitle {
    font-weight: 300;
    font-size: 1.25rem;
    color: #666;
}

.card-label {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Accessibility - Skip to content */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--action-button);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 1000;
}

.skip-to-content:focus {
    top: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(1rem, 5vw, 3rem);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Content Sections */
.content-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s var(--ease-reality);
    margin: 2rem 0;
}

.content-section.active {
    opacity: 1;
    transform: translateY(0);
}

/* Phase 1: Satirical Opening */
.satirical-heading {
    font-family: var(--font-system);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    transform: rotate(-1deg);
    text-align: center;
    margin: 2rem 0;
    color: var(--accent-red);
}

.satirical-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    text-align: center;
    margin-bottom: 1rem;
    font-style: italic;
}

.satirical-disclaimer {
    background: #fff8dc;
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem auto;
    max-width: 600px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-style: italic;
    text-align: center;
    color: var(--text-primary);
}

/* Threshold Sliders */
.threshold-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.threshold-slider-container {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.threshold-slider-container:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
    border-color: #dc2626;
}

.slider-label {
    display: block;
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.slider-input {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #e5e5e5;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    margin: 1rem 0;
}

.slider-input::-webkit-slider-track {
    background: #e9ecef;
    height: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 4px;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent-red);
    border: 3px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.slider-input::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.2);
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-input::-moz-range-track {
    width: 100%;
    height: 8px;
    background: #e5e5e5;
    border-radius: 4px;
    border: none;
}

.slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--accent-red);
    border: 3px solid #ffffff;
    border-radius: 50%;
    border: none;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.slider-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-red);
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
}

.comparison-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    transition: opacity 0.3s ease;
}

/* Calculate Button */
.calculate-button {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 3rem auto;
    background: #dc2626;
    color: white;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.calculate-button:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
}

/* Reality Section Layout */
.reality-section {
    background: #ffffff;
    padding: 4rem 2rem;
    margin-top: 2rem;
}

.reality-title {
    text-align: center;
    margin-bottom: 4rem;
}

.reality-title h2 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.reality-comparison-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 3rem;
    align-items: stretch;
}

.comparison-side {
    background: #f8fafc;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    flex: 1;
}

.your-thresholds {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.current-reality {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #fca5a5;
}

.comparison-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    color: #1f2937;
}

.comparison-item {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.item-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.threshold-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: #374151;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.reality-number {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 900;
    color: #dc2626;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.number-with-indicator {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.excess-indicator {
    background: #dc2626;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc2626 0%, #991b1b 100%);
    width: var(--progress-width, 0%);
    transition: width 1s ease-out;
    border-radius: 4px;
}

.impact-text {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

/* Memorial Section */
.memorial-section {
    background: linear-gradient(135deg, var(--memorial-black) 0%, #1f2937 100%);
    color: var(--memorial-white);
    padding: 4rem 2rem;
    text-align: center;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memorial-content {
    max-width: 800px;
    margin: 0 auto;
}

.memorial-quote {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 300;
    font-style: italic;
    margin: 2rem 0;
    padding: 2rem;
    border-left: 4px solid var(--memorial-green);
    background: rgba(255,255,255,0.05);
    border-radius: 0 8px 8px 0;
}

.memorial-text {
    font-size: 1.125rem;
    line-height: 1.8;
    margin: 2rem 0;
    opacity: 0.9;
}

.memorial-text p {
    margin-bottom: 1.5rem;
}

/* Call to Action Buttons */
.cta-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 3rem 0;
}

.cta-button {
    background: var(--action-button);
    color: white;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 122, 61, 0.3);
}

.cta-button:hover {
    background: var(--action-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 61, 0.4);
}

/* Data Attribution */
.data-attribution {
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    margin-top: 2rem;
    border: 1px solid #e5e7eb;
}

.data-attribution p {
    font-size: 0.875rem;
    color: #4b5563;
    margin: 0.25rem 0;
}

.data-attribution a {
    color: #dc2626;
    font-weight: 600;
    text-decoration: none;
}

.data-attribution a:hover {
    text-decoration: underline;
}

.last-updated {
    font-weight: 500;
    color: #1f2937;
}

/* Date Range Display */
.date-range-display {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.date-range-display h3 {
    color: var(--accent-red);
    margin-bottom: 1rem;
}

/* Loading States */
.data-loading {
    position: relative;
    min-height: auto;
}

.loading-indicator {
    display: inline-block;
    color: #6b7280;
    font-size: 0.75rem;
    font-style: italic;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: 9999px;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

/* Error States */
.error-message {
    background: rgba(220, 20, 60, 0.1);
    border: 1px solid var(--warning-red);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
}

/* Content Warning Modal */
.content-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.warning-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    text-align: center;
}

.warning-content h2 {
    color: var(--warning-red);
    margin-bottom: 1rem;
}

.warning-content p {
    margin: 1rem 0;
    line-height: 1.6;
}

.warning-button {
    background: var(--action-button);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin: 0.5rem;
}

.warning-button:hover {
    background: var(--action-hover);
}

/* Hidden class for modal */
.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* Threshold section styling */
.threshold-title {
    text-align: center;
    margin: 2rem 0;
    font-size: 1.75rem;
}

.threshold-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.threshold-description {
    font-size: 0.875rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Memorial section styling */
.memorial-main-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: 300;
    color: #f8fafc;
}

.memorial-action-title {
    margin: 3rem 0 1rem 0;
    font-size: 1.75rem;
    color: #f8fafc;
}

.memorial-support-text {
    margin-top: 3rem;
    font-size: 0.875rem;
    opacity: 0.8;
}

.support-link {
    color: #94a3b8;
    font-weight: 500;
}

/* Section Transitions */
.section-transition {
    position: relative;
    padding: 1rem 0;
}

.section-transition::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(to bottom, #f5f5f5 0%, #1e293b 100%);
    z-index: -1;
}

/* Responsive Adjustments for New Layout */
@media (max-width: 768px) {
    .reality-comparison-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    .comparison-side {
        padding: 2rem;
    }
    
    .reality-number {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
    
    .threshold-number {
        font-size: 2rem;
    }

    .number-with-indicator {
        flex-wrap: wrap;
        align-items: center;
    }
}

@media (max-width: 640px) {
    .reality-section {
        padding: 2rem 1rem;
    }
    
    .reality-title h2 {
        font-size: 2rem;
    }
    
    .memorial-section {
        padding: 2rem;
    }
    
    .memorial-quote {
        font-size: 1.25rem;
        padding: 1.5rem;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .threshold-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .calculate-button {
        width: 100%;
        padding: 1.25rem;
    }
    
    .threshold-slider-container {
        padding: 1.5rem;
    }
    
    .cta-container {
        grid-template-columns: 1fr;
    }
}

/* Accessibility - Focus States */
*:focus {
    outline: 3px solid var(--data-highlight);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --bg-primary: #000000;
        --text-primary: #ffffff;
        --accent-satire: #ff0000;
        --data-highlight: #ffff00;
    }
}

/* Date range message styling */
.date-range-message {
    margin-top: 1rem;
    color: var(--text-secondary);
}