/**
 * TDDWorks - Cyberpunk Theme Stylesheet
 * Modular CSS for Test-Driven Development showcase
 */

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: #050a0f;
    color: #ffffff;
    overflow-x: hidden;
}

/* ============================================
   VISUAL EFFECTS
   ============================================ */

/* Matrix Rain Canvas */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.15;
    pointer-events: none;
}

/* Scanline Effect */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 255, 157, 0.02) 51%, transparent 52%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
    animation: scanline 6s linear infinite;
}

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

/* Noise Overlay */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    z-index: 1000;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii43NSIgbnVtT2N0YXZlcz0iMTAiLz48ZmVDb2xvck1hdHJpeCB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDEgMCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNhKSIgb3BhY2l0eT0iMSIvPjwvc3ZnPg==');
}

/* ============================================
   3D TILT CARD EFFECT
   ============================================ */
.tilt-card {
    perspective: 1000px;
    transition: transform 0.3s ease;
}

.tilt-card-inner {
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
    backface-visibility: hidden;
}

.tilt-card:hover .tilt-card-inner {
    box-shadow: 0 0 25px rgba(0, 255, 157, 0.15);
}

/* ============================================
   GLITCH TEXT EFFECT
   ============================================ */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 #bd00ff;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 #00f3ff;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip: rect(20px, 9999px, 15px, 0); }
    20% { clip: rect(55px, 9999px, 68px, 0); }
    40% { clip: rect(12px, 9999px, 5px, 0); }
    60% { clip: rect(44px, 9999px, 88px, 0); }
    80% { clip: rect(90px, 9999px, 5px, 0); }
    100% { clip: rect(22px, 9999px, 80px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(10px, 9999px, 85px, 0); }
    20% { clip: rect(75px, 9999px, 5px, 0); }
    40% { clip: rect(22px, 9999px, 15px, 0); }
    60% { clip: rect(64px, 9999px, 98px, 0); }
    80% { clip: rect(30px, 9999px, 25px, 0); }
    100% { clip: rect(82px, 9999px, 5px, 0); }
}

/* ============================================
   ELECTRIC BORDER EFFECT
   ============================================ */
.electric-border {
    position: relative;
    overflow: visible;
}

.electric-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 12px;
    border: 2px solid #00ff9d;
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(1px);
}

.electric-border:hover::before {
    opacity: 1;
    animation: electric-pulse 1.5s ease-in-out infinite;
}

@keyframes electric-pulse {
    0%, 100% { opacity: 0.3; filter: blur(1px); }
    50% { opacity: 1; filter: blur(2px); }
}

/* ============================================
   TEXT SCRAMBLE EFFECT
   ============================================ */
.scramble-text {
    display: inline-block;
    font-family: 'Fira Code', monospace;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

#logo-container:hover .scramble-text {
    filter: drop-shadow(0 0 8px currentColor);
}

/* ============================================
   TDD CYCLE NODE ANIMATIONS
   ============================================ */
.tdd-node {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tdd-node:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 20px currentColor);
}

.tdd-node:active {
    transform: scale(1.05);
}

.tdd-node.active .node-circle {
    stroke-width: 5;
    filter: drop-shadow(0 0 15px currentColor);
}

.tdd-node.active .node-glow {
    opacity: 0.8 !important;
}

.tdd-node.active .node-text {
    filter: drop-shadow(0 0 8px currentColor);
}

#phase-details {
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-left: 1px solid #333;
}

::-webkit-scrollbar-thumb {
    background: #00ff9d;
    border-radius: 4px;
    border: 1px solid #00f3ff;
}

::-webkit-scrollbar-thumb:hover {
    background: #00f3ff;
}

/* ============================================
   LOADING SCREEN
   ============================================ */
#loading-screen {
    position: fixed;
    inset: 0;
    background: #050a0f;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Prevent text resize during font load */
#loading-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 48px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: loading-glow 2s ease-in-out infinite;
}

#loading-screen .font-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace !important;
}

/* Loading title glow animation */
@keyframes loading-glow {
    0%, 100% {
        filter: drop-shadow(0 0 8px #00ff9d);
        opacity: 1;
    }
    50% {
        filter: drop-shadow(0 0 20px #00ff9d) drop-shadow(0 0 30px #00f3ff);
        opacity: 0.9;
    }
}

/* Glitch effect on letters */
.loading-letter {
    display: inline-block;
    animation: letter-glitch 3s infinite;
}

.loading-letter:nth-child(1) { animation-delay: 0.1s; }
.loading-letter:nth-child(2) { animation-delay: 0.2s; }
.loading-letter:nth-child(3) { animation-delay: 0.3s; }
.loading-letter:nth-child(4) { animation-delay: 0.5s; }
.loading-letter:nth-child(5) { animation-delay: 0.7s; }
.loading-letter:nth-child(6) { animation-delay: 0.9s; }
.loading-letter:nth-child(7) { animation-delay: 1.1s; }
.loading-letter:nth-child(8) { animation-delay: 1.3s; }

@keyframes letter-glitch {
    0%, 90%, 100% {
        transform: translate(0, 0);
        opacity: 1;
    }
    92% {
        transform: translate(-2px, 2px);
        opacity: 0.8;
    }
    94% {
        transform: translate(2px, -2px);
        opacity: 0.8;
    }
    96% {
        transform: translate(-1px, -1px);
        opacity: 0.9;
    }
}

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

.loader-bar {
    height: 8px;
    background: #0a1117;
    border: 1px solid #00ff9d;
    border-radius: 4px;
    overflow: hidden;
    width: 300px;
    max-width: 80vw;
}

.loader-progress {
    height: 100%;
    background: linear-gradient(90deg, #00ff9d, #00f3ff);
    box-shadow: 0 0 10px #00ff9d;
    transition: width 0.3s ease;
}

/* ============================================
   HUD STATUS INDICATORS
   ============================================ */
.hud-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.hud-indicator:hover {
    transform: scale(1.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: ping-slow 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ============================================
   TERMINAL CURSOR
   ============================================ */
.cursor::after {
    content: '█';
    animation: blink 1s infinite;
    color: #00ff9d;
}

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

/* ============================================
   RIPPLE ANIMATION
   ============================================ */
@keyframes ripple-animation {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.perspective-1000 {
    perspective: 1000px;
}

.backface-hidden {
    backface-visibility: hidden;
}

.select-none {
    user-select: none;
}
