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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: #0D0221;
    color: #F5F5F5;
    font-family: "DM Sans", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    /* Color palette: #0D0221, #150538, #6C5CE7, #08F7FE, #09FBD3, #FED049, #FF2E63, #F5F5F5 */
}

/* CRT Boot Sequence */
.crt-boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: "Fira Code", monospace;
}

.crt-frame {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background-color: #150538;
}

.crt-scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 2px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
    z-index: 2;
    animation: scanline-drift 8s linear infinite;
}

@keyframes scanline-drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

.crt-cursor-line {
    position: relative;
    z-index: 1;
}

.crt-cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background-color: #00FF41;
    animation: crt-blink 0.7s step-start infinite;
}

@keyframes crt-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.boot-text {
    position: relative;
    z-index: 1;
    color: #00FF41;
    font-size: 13px;
    line-height: 1.8;
    max-width: 600px;
    min-height: 200px;
    text-align: left;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.skip-boot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: transparent;
    border: 1px solid #00FF41;
    color: #00FF41;
    padding: 8px 16px;
    font-family: "Fira Code", monospace;
    font-size: 12px;
    cursor: pointer;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
}

.skip-boot:hover {
    background-color: rgba(0, 255, 65, 0.1);
}

.skip-boot.visible {
    opacity: 1;
}

/* Main Content */
.main-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #0D0221;
    overflow: hidden;
    transition: opacity 0.6s ease-out;
}

.main-content.visible {
    opacity: 1 !important;
}

/* Header */
.site-header {
    padding: 20px 30px;
    border-bottom: 2px solid #FF2E63;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1) 0%, rgba(255, 46, 99, 0.05) 100%);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
}

.site-title {
    font-family: "Chakra Petch", sans-serif;
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 700;
    color: #FED049;
    letter-spacing: 3px;
    margin-bottom: 5px;
    text-transform: lowercase;
}

.site-subtitle {
    font-family: "Space Mono", monospace;
    font-size: 12px;
    color: #08F7FE;
    letter-spacing: 2px;
    font-weight: 400;
}

/* Bento Grid */
.bento-grid {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 30px 40px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 8px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Bento Cells */
.bento-cell {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(9, 251, 211, 0.05) 100%);
    border: 1px solid rgba(255, 46, 99, 0.3);
    border-radius: 4px;
    padding: 20px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 140px;
    animation: cell-power-on 0.6s ease-out forwards;
    opacity: 0;
}

.bento-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
}

@keyframes cell-power-on {
    0% {
        opacity: 0;
        background: rgba(255, 255, 255, 0.3);
    }
    30% {
        background: rgba(255, 255, 255, 0.3);
    }
    100% {
        opacity: 1;
        background: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(9, 251, 211, 0.05) 100%);
    }
}

/* Grid column spans */
.cell-1 { grid-column: span 3; }
.cell-2 { grid-column: span 4; }
.cell-3 { grid-column: span 5; }
.cell-4 { grid-column: span 4; grid-row: span 2; }
.cell-5 { grid-column: span 4; }
.cell-6 { grid-column: span 2; }
.cell-7 { grid-column: span 6; }
.cell-8 { grid-column: span 4; }
.cell-9 { grid-column: span 2; }

.cell-4.tall {
    grid-row: span 2;
}

.cell-7.wide {
    grid-column: span 6;
}

/* Staggered animation delays */
.cell-1 { animation-delay: 60ms; }
.cell-2 { animation-delay: 120ms; }
.cell-3 { animation-delay: 180ms; }
.cell-4 { animation-delay: 240ms; }
.cell-5 { animation-delay: 300ms; }
.cell-6 { animation-delay: 360ms; }
.cell-7 { animation-delay: 420ms; }
.cell-8 { animation-delay: 480ms; }
.cell-9 { animation-delay: 540ms; }

.cell-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.bento-cell h2 {
    font-family: "Chakra Petch", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #08F7FE;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 46, 99, 0.2);
    padding-bottom: 8px;
}

/* Glitch Effect */
.bento-cell[data-glitch-level="low"] {
    --glitch-distance: 2px;
}

.bento-cell[data-glitch-level="medium"] {
    --glitch-distance: 3px;
}

.bento-cell[data-glitch-level="high"] {
    --glitch-distance: 4px;
}

.bento-cell:hover {
    border-color: rgba(254, 208, 73, 0.6);
}

@keyframes glitch-shift {
    0%, 100% {
        clip-path: inset(0);
    }
    20% {
        clip-path: inset(20% 0 30% 0);
    }
    40% {
        clip-path: inset(0);
    }
    60% {
        clip-path: inset(10% 0 40% 0);
    }
    80% {
        clip-path: inset(0);
    }
}

.bento-cell:hover .bento-cell h2 {
    animation: glitch-shift 0.4s ease-in-out;
}

/* Status Display */
.status-display,
.commit-display,
.deploy-bar,
.log-viewer,
.health-grid,
.incident-count,
.perf-metrics,
.session-indicator,
.about-text {
    color: #F5F5F5;
}

.status-line,
.log-line {
    font-family: "Space Mono", monospace;
    font-size: 12px;
    margin: 4px 0;
    display: flex;
    align-items: center;
}

.status-label,
.commit-time {
    color: #6C5CE7;
    margin-right: 8px;
}

.status-value {
    font-weight: 600;
    color: #09FBD3;
}

.status-value.online {
    color: #00FF41;
}

.commit-hash {
    font-family: "Space Mono", monospace;
    font-size: 13px;
    color: #FED049;
    font-weight: 700;
    margin-bottom: 4px;
}

.commit-msg {
    font-size: 12px;
    color: #F5F5F5;
    margin-bottom: 4px;
}

/* Progress Bar */
.deploy-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(108, 92, 231, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.deploy-progress {
    height: 100%;
    background: linear-gradient(90deg, #6C5CE7, #08F7FE);
    animation: pulse-progress 2s ease-in-out infinite;
}

@keyframes pulse-progress {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.deploy-text {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    color: #09FBD3;
}

/* Log Viewer */
.log-viewer {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 2px;
    max-height: 120px;
    overflow-y: auto;
}

.log-line {
    color: #00FF41;
    margin: 3px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-line.active {
    animation: text-pulse 1s ease-in-out infinite;
}

.cursor {
    display: inline-block;
    width: 8px;
    background-color: #00FF41;
    animation: crt-blink 0.7s step-start infinite;
}

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

/* Health Grid */
.health-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.health-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.health-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

.health-icon.healthy {
    background-color: rgba(0, 255, 65, 0.2);
    color: #00FF41;
    border: 1px solid #00FF41;
}

.health-label {
    font-size: 10px;
    color: #6C5CE7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Incident Counter */
.incident-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.count-value {
    font-family: "Chakra Petch", sans-serif;
    font-size: 48px;
    font-weight: 700;
    color: #FED049;
    line-height: 1;
}

.count-label {
    font-family: "Space Mono", monospace;
    font-size: 11px;
    color: #08F7FE;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Performance Metrics */
.perf-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 10px;
    color: #6C5CE7;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.metric-value {
    font-family: "Space Mono", monospace;
    font-size: 14px;
    color: #09FBD3;
    font-weight: 600;
}

/* Session Indicator */
.session-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex: 1;
}

.pulse-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #FF2E63;
    animation: pulse-ring 2s ease-in-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.session-count {
    font-family: "Chakra Petch", sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #FF2E63;
}

/* About Text */
.about-text {
    font-size: 13px;
    line-height: 1.5;
    color: #F5F5F5;
}

/* Footer */
.site-footer {
    border-top: 2px solid #FF2E63;
    padding: 15px 30px;
    text-align: center;
    font-family: "Space Mono", monospace;
    font-size: 11px;
    color: #6C5CE7;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1) 0%, rgba(255, 46, 99, 0.05) 100%);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .site-title {
        font-size: clamp(1.2rem, 3vw, 2.5rem);
    }

    .cell-1 { grid-column: span 4; }
    .cell-2 { grid-column: span 4; }
    .cell-3 { grid-column: span 4; }
    .cell-4 { grid-column: span 6; grid-row: span 1; }
    .cell-5 { grid-column: span 6; }
    .cell-6 { grid-column: span 3; }
    .cell-7 { grid-column: span 9; }
    .cell-8 { grid-column: span 6; }
    .cell-9 { grid-column: span 6; }
}

@media (max-width: 768px) {
    .bento-grid {
        padding: 15px;
        gap: 6px;
    }

    .site-header {
        padding: 15px;
    }

    .site-footer {
        padding: 10px 15px;
    }

    .cell-1, .cell-2, .cell-3, .cell-4, .cell-5, .cell-6, .cell-7, .cell-8, .cell-9 {
        grid-column: span 12 !important;
        grid-row: span 1 !important;
        min-height: 100px;
    }

    .site-title {
        font-size: clamp(1rem, 2.5vw, 1.8rem);
    }

    .perf-metrics,
    .health-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
.log-viewer::-webkit-scrollbar {
    width: 4px;
}

.log-viewer::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.log-viewer::-webkit-scrollbar-thumb {
    background: #6C5CE7;
    border-radius: 2px;
}

.log-viewer::-webkit-scrollbar-thumb:hover {
    background: #08F7FE;
}
