/* ==================== SUBTLE DEV / PROGRAMMER EFFECTS ==================== */

/* ---- Matrix Code Rain Canvas (very subtle) ---- */
#matrix-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
}

/* ---- Particle Network Canvas (very subtle) ---- */
#particle-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.25;
    pointer-events: none;
}

/* ---- Floating Code Snippets (barely visible) ---- */
#code-rain-container {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.floating-code {
    position: absolute;
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: rgba(16, 185, 129, 0.08);
    white-space: nowrap;
    animation: floatCode linear infinite;
    user-select: none;
}

@keyframes floatCode {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    15% { opacity: 0.06; }
    85% { opacity: 0.06; }
    100% { transform: translateY(-60px) translateX(10px); opacity: 0; }
}

/* ---- Glitch Text Effect (only on hover, not continuous) ---- */
.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%;
    opacity: 0;
}

.glitch-text.glitch-active::before {
    animation: glitch-1 0.3s ease-in-out;
    color: #f87171;
    left: 2px;
    opacity: 0.5;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch-text.glitch-active::after {
    animation: glitch-2 0.3s ease-in-out;
    color: #22d3ee;
    left: -2px;
    opacity: 0.5;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0% { clip-path: inset(20% 0 60% 0); transform: translate(-1px, 1px); opacity: 0.5; }
    25% { clip-path: inset(60% 0 10% 0); transform: translate(1px, -1px); }
    50% { clip-path: inset(40% 0 30% 0); transform: translate(-1px, 0); }
    75% { clip-path: inset(80% 0 5% 0); transform: translate(1px, 1px); }
    100% { clip-path: inset(10% 0 70% 0); transform: translate(0, 0); opacity: 0; }
}

@keyframes glitch-2 {
    0% { clip-path: inset(60% 0 20% 0); transform: translate(1px, -1px); opacity: 0.5; }
    25% { clip-path: inset(10% 0 60% 0); transform: translate(-1px, 1px); }
    50% { clip-path: inset(30% 0 40% 0); transform: translate(1px, 0); }
    75% { clip-path: inset(5% 0 80% 0); transform: translate(-1px, -1px); }
    100% { clip-path: inset(70% 0 10% 0); transform: translate(0, 0); opacity: 0; }
}

/* Name hover subtle shift (no continuous glitch) */
.name-shift {
    display: inline-block;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

.name-shift:hover {
    transform: translateX(2px);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* ---- Custom Cursor (clean and minimal) ---- */
.cursor-glow {
    position: fixed;
    width: 16px;
    height: 16px;
    border: 1.5px solid rgba(16, 185, 129, 0.7);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: width 0.15s, height 0.15s, border-color 0.15s, background 0.15s;
    background: rgba(16, 185, 129, 0.05);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.cursor-glow.clicking {
    width: 10px;
    height: 10px;
    background: rgba(16, 185, 129, 0.4);
    border-color: rgba(16, 185, 129, 0.8);
}

.cursor-trail {
    position: fixed;
    width: 4px;
    height: 4px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.2);
}

/* ---- CRT Scanline Effect (barely visible) ---- */
.crt-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.04) 50%);
    background-size: 100% 6px;
    opacity: 0.15;
}

/* ---- Soft Glow Utilities (not neon, just gentle) ---- */
.glow-green {
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.glow-blue {
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
}

.glow-cyan {
    text-shadow: 0 0 8px rgba(34, 211, 238, 0.35);
}

/* Box soft glow */
.soft-glow {
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.08), inset 0 0 12px rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.soft-glow-blue {
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.08), inset 0 0 12px rgba(59, 130, 246, 0.04);
    border-color: rgba(59, 130, 246, 0.3) !important;
}

/* ---- Terminal/IDE Styling ---- */
.terminal-block {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    position: relative;
    overflow: hidden;
}

.terminal-block::before {
    content: '● ● ●';
    position: absolute;
    top: 8px;
    left: 12px;
    font-size: 0.6rem;
    letter-spacing: 4px;
    color: rgba(255,255,255,0.15);
}

.terminal-prompt {
    color: #10b981;
    font-weight: bold;
}

.terminal-text {
    color: #e2e8f0;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background: #10b981;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink-cursor 1s step-end infinite;
}

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

.terminal-line {
    line-height: 1.8;
}

/* ---- Code Highlight Colors ---- */
.code-keyword { color: #c084fc; }
.code-string { color: #34d399; }
.code-function { color: #60a5fa; }
.code-comment { color: #64748b; font-style: italic; }
.code-number { color: #fbbf24; }

/* ---- Subtle Pulse Animation ---- */
@keyframes subtle-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(16, 185, 129, 0.15); }
    50% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.25); }
}

.subtle-pulse {
    animation: subtle-pulse 3s ease-in-out infinite;
}

/* ---- Section Separator - Soft Digital Line ---- */
.digital-line {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(16, 185, 129, 0.3) 20%, rgba(59, 130, 246, 0.3) 50%, rgba(16, 185, 129, 0.3) 80%, transparent 100%);
    position: relative;
    overflow: visible;
}

.digital-line::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -2px;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    animation: line-pulse 3s ease-in-out infinite;
}

@keyframes line-pulse {
    0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.15); }
}

/* ---- Noise Texture Overlay (very subtle) ---- */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ---- Section Entrance - Decode ---- */
.decode-reveal {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(15px);
    transition: opacity 0.7s ease, filter 0.7s ease, transform 0.7s ease;
}

.decode-reveal.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

/* ==================== INTERACTIVE TERMINAL ==================== */
.terminal-window {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(16, 185, 129, 0.08);
    font-family: 'Fira Code', 'Consolas', monospace;
    transition: box-shadow 0.3s ease;
}

.terminal-window:focus-within {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.terminal-header {
    background: rgba(30, 41, 59, 0.9);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
}

.terminal-dots {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot-red { background: #f87171; }
.terminal-dot-yellow { background: #fbbf24; }
.terminal-dot-green { background: #34d399; }

.terminal-title {
    flex: 1;
    text-align: center;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
}

.terminal-spacer { width: 40px; flex-shrink: 0; }

.terminal-body {
    padding: 16px 20px;
    min-height: 280px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #e2e8f0;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.3) transparent;
}

.terminal-body::-webkit-scrollbar { width: 4px; }
.terminal-body::-webkit-scrollbar-thumb { background: rgba(16, 185, 129, 0.3); border-radius: 2px; }

.terminal-output {
    margin-bottom: 8px;
}

.terminal-line-output {
    margin-bottom: 4px;
    word-break: break-word;
}

.terminal-line-output .cmd { color: #10b981; font-weight: 600; }
.terminal-line-output .error { color: #f87171; }
.terminal-line-output .success { color: #34d399; }
.terminal-line-output .info { color: #60a5fa; }
.terminal-line-output .warning { color: #fbbf24; }
.terminal-line-output .label { color: #94a3b8; }

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-prompt {
    color: #10b981;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    flex: 1;
    caret-color: #10b981;
    padding: 0;
    margin: 0;
    width: 100%;
}

.terminal-input::placeholder { color: #475569; }

.terminal-ascii {
    color: #34d399;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: pre;
    margin: 8px 0;
}

.terminal-cmd-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #94a3b8;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'Fira Code', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal-cmd-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
    transform: translateY(-1px);
}

.terminal-cmd-btn:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* ---- Responsive ---- */
@media (pointer: coarse) {
    .cursor-glow, .cursor-trail { display: none !important; }
    body, a, button, input, textarea { cursor: auto !important; }
}

@media (max-width: 768px) {
    .crt-overlay { opacity: 0.08; }
    #matrix-canvas { opacity: 0.08; }
    .floating-code { display: none; }
    .terminal-body { min-height: 220px; max-height: 320px; }
}

/* ==================== 3D EFFECTS ==================== */

/* ---- 3D Tilt Cards ---- */
.project-card, .skill-category, .card[data-tilt] {
    transform-style: preserve-3d;
    will-change: transform;
}

.tilt-glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
    z-index: 10;
}

/* ---- 3D Hero Name ---- */
.hero-3d-name {
    display: inline-block;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.03, 0.98, 0.52, 0.99);
}

.hero-3d-name .depth-layer {
    position: absolute;
    inset: 0;
    color: inherit;
    opacity: 0.3;
    transform: translateZ(-8px);
    filter: blur(1px);
}

/* ---- Floating 3D Elements ---- */
.float-3d {
    transform-style: preserve-3d;
    will-change: transform;
}

/* ---- 3D Perspective Container ---- */
.perspective-container {
    perspective: 1200px;
    perspective-origin: 50% 50%;
}

/* ---- 3D Flip Card ---- */
.flip-card {
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flip-card:hover {
    transform: rotateY(5deg) rotateX(2deg);
}

/* ---- 3D Section Depth ---- */
.section-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Disable 3D tilt on touch devices for performance */
@media (pointer: coarse) {
    .project-card, .skill-category, .card[data-tilt] {
        transform: none !important;
    }
    .tilt-glare { display: none !important; }
}
