/* Full-screen dramatic visualization styles for the Delivery Crisis Cascade animation.
   This creates a cinematic, immersive experience that tells the story of how
   small problems cascade into major crises in software delivery systems. */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    position: relative;
    height: 100vh;
}

/* Full-screen visualization container */
#visualization-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #0a0e27 0%, #000 100%);
}

/* Ensure SVG uses full space with margins */
#main-svg {
    width: 100%;
    height: 100%;
    position: absolute;
}

#main-svg > g {
    transform: scale(0.85) translate(10%, 5%);
}

#main-svg {
    width: 100%;
    height: 100%;
    position: absolute;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.6;
}

/* Story overlay */
#story-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    pointer-events: none;
    z-index: 10;
}

.story-header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 600px;
}

#story-title {
    font-size: 2.5em;
    font-weight: 300;
    letter-spacing: -0.02em;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #64b5f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#story-subtitle {
    font-size: 1.2em;
    color: #90a4ae;
    margin: 5px 0 0 0;
}

.story-timeline {
    position: absolute;
    top: 150px;
    left: 20px;
    right: 20px;
    max-width: 600px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.story-timeline::-webkit-scrollbar {
    width: 6px;
}

.story-timeline::-webkit-scrollbar-track {
    background: transparent;
}

.story-timeline::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.week-narrative {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateX(-20px);
    animation: slideIn 0.5s ease forwards;
    transition: opacity 0.5s ease;
}

.week-narrative.intervention {
    background: rgba(0, 50, 30, 0.7);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.week-narrative.old {
    opacity: 0.4;
    background: rgba(0, 0, 0, 0.5);
}

.week-narrative h4 {
    margin: 0 0 8px 0;
    color: #64b5f6;
    font-size: 1em;
    font-weight: 600;
}

.week-narrative p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.5;
    color: #e0e6ed;
}

/* Control panel */
#control-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 30px;
    gap: 30px;
    z-index: 20;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Timeline scrubber */
.timeline-scrubber {
    flex: 1;
    padding: 0 20px;
}

.timeline-track {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, #64b5f6 0%, #f44336 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.timeline-markers {
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 24px;
}

.marker {
    position: absolute;
    width: 4px;
    height: 24px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.marker:hover {
    background: #fff;
    transform: scaleY(1.2);
}

.marker.week-4 { left: 33.33%; }
.marker.week-6 { left: 50%; }
.marker.week-8 { left: 66.66%; }
.marker.week-10 { left: 83.33%; }

/* Scenario toggle */
.scenario-toggle {
    display: flex;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 200px;
    height: 40px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: .4s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.label-no, .label-yes {
    font-size: 0.9em;
    transition: opacity 0.3s ease;
}

.label-no {
    color: #f44336;
}

.label-yes {
    color: #4caf50;
    opacity: 0.3;
}

input:checked + .slider .label-no {
    opacity: 0.3;
}

input:checked + .slider .label-yes {
    opacity: 1;
}

/* Project context panel */
#project-context {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    min-width: 280px;
}

#project-context h3 {
    margin: 0 0 15px 0;
    color: #64b5f6;
    font-size: 1.1em;
    font-weight: 600;
}

.context-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.context-item:last-child {
    margin-bottom: 0;
}

.context-label {
    color: #90a4ae;
}

.context-value {
    color: #fff;
    font-weight: 500;
    text-align: right;
}

/* Interventions display */
#interventions-display {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    min-width: 280px;
    max-width: 350px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#interventions-display.show {
    opacity: 1;
}

#interventions-display h3 {
    margin: 0 0 15px 0;
    color: #4caf50;
    font-size: 1.1em;
    font-weight: 600;
}

.intervention-item {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    font-size: 0.9em;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.intervention-week {
    color: #4caf50;
    font-weight: 600;
    margin-bottom: 4px;
}

.intervention-name {
    color: #fff;
    margin-bottom: 4px;
}

.intervention-cost {
    color: #90a4ae;
    font-size: 0.85em;
}


/* Variable detail panel */
#variable-detail {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 20px;
    min-width: 300px;
    z-index: 50;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.2s ease;
}

#variable-detail:not(.hidden) {
    opacity: 1;
    transform: scale(1);
}

.variable-name {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #64b5f6;
}

.variable-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.8em;
    color: #90a4ae;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.1em;
    font-weight: 600;
}

.stat-value.current {
    color: #64b5f6;
}

.stat-value.trend {
    color: #4caf50;
}

.stat-value.trend.negative {
    color: #f44336;
}

.stat-value.risk {
    color: #ff9800;
}

.variable-chart {
    width: 100%;
    height: 100px;
}

/* Loading screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h2 {
    font-size: 2em;
    font-weight: 300;
    margin-bottom: 30px;
    color: #64b5f6;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 20px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #64b5f6 0%, #4caf50 100%);
    width: 0%;
    animation: loading 2s ease-out forwards;
}

@keyframes loading {
    to { width: 100%; }
}

.loading-status {
    color: #90a4ae;
    font-size: 0.9em;
}

/* Visualization elements */
.pillar-group {
    cursor: pointer;
}

.pillar-label {
    font-size: 1.2em;
    font-weight: 600;
    fill: #fff;
    text-anchor: middle;
    pointer-events: none;
}

.metric-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.metric-node:hover {
    filter: brightness(1.2);
}

/* Blinking effect for metrics in focus */
.metric-node.focus-blink circle {
    animation: focus-blink 1.5s ease-in-out 3;
}

@keyframes focus-blink {
    0%, 100% { 
        opacity: 1;
        filter: brightness(1);
    }
    50% { 
        opacity: 0.6;
        filter: brightness(1.5) drop-shadow(0 0 15px currentColor);
    }
}

.metric-node.warning {
    animation: warning-pulse 2s infinite;
}

@keyframes warning-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.metric-node.critical {
    animation: critical-pulse 1s infinite;
}

@keyframes critical-pulse {
    0%, 100% { 
        opacity: 1;
        filter: drop-shadow(0 0 10px currentColor);
    }
    50% { 
        opacity: 0.7;
        filter: drop-shadow(0 0 20px currentColor);
    }
}

.relationship-link {
    fill: none;
    stroke-width: 2;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.relationship-link.active {
    opacity: 0.8;
    stroke-width: 3;
}

.relationship-link.critical-path {
    stroke: #f44336;
    opacity: 1;
    stroke-width: 4;
    filter: drop-shadow(0 0 5px #f44336);
}

/* Fullscreen styles */
body:fullscreen {
    background: #000;
}

body:-webkit-full-screen {
    background: #000;
}

body:-moz-full-screen {
    background: #000;
}

body:-ms-fullscreen {
    background: #000;
}

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