/* ===== CSS RESET ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--void-black);
}

body {
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --void-black: #050505;
    --pure-white: #FFFFFF;
    --terminal-purple: #8A63D2;
    --security-green: #00FF9C;
    --grid-line: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Lockdown mode colors */
    --lockdown-red: #FF0000;
    --alert-bg: rgba(255, 0, 0, 0.1);

    --font-mono: 'JetBrains Mono', monospace;
    --transition-snap: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    /* Animation Timings */
    --boot-speed: 2s;
    --breach-red: #ff3e3e;
}

body.panic-mode {
    --terminal-purple: var(--lockdown-red);
    --security-green: var(--lockdown-red);
    --glass-bg: var(--alert-bg);
}

body.lockdown-mode {
    --terminal-purple: var(--lockdown-red);
    --security-green: var(--lockdown-red);
    animation: lockdown-pulse 0.2s infinite, screen-shake 0.15s infinite;
}

@keyframes lockdown-pulse {

    0%,
    100% {
        border-color: var(--lockdown-red);
        box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
    }

    50% {
        border-color: rgba(255, 0, 0, 0.3);
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
    }
}

@keyframes screen-shake {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    10% {
        transform: translate(-2px, 2px) rotate(-0.5deg);
    }

    20% {
        transform: translate(2px, -2px) rotate(0.5deg);
    }

    30% {
        transform: translate(-2px, -2px) rotate(-0.5deg);
    }

    40% {
        transform: translate(2px, 2px) rotate(0.5deg);
    }

    50% {
        transform: translate(-2px, 2px) rotate(-0.5deg);
    }

    60% {
        transform: translate(2px, -2px) rotate(0.5deg);
    }

    70% {
        transform: translate(-2px, -2px) rotate(-0.5deg);
    }

    80% {
        transform: translate(2px, 2px) rotate(0.5deg);
    }

    90% {
        transform: translate(-2px, 2px) rotate(-0.5deg);
    }
}

/* ===== GLOBAL STYLES ===== */
body {
    font-family: var(--font-mono);
    background-color: transparent;
    color: var(--pure-white);
    position: relative;
    overflow-x: hidden;
    border: 0px solid transparent;
    transition: border 0.3s;
}

body.lockdown-mode {
    border: 5px solid var(--lockdown-red);
}

#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== IMMERSIVE VISUALS ===== */

/* CRT Scanline Overlay */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%,
            rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg,
            rgba(255, 0, 0, 0.03),
            rgba(0, 255, 0, 0.01),
            rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 10000;
}

/* Screen Glitch Overlay */
.screen-glitch {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-black);
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
}

.glitch-flash {
    animation: glitch-flash-anim 0.2s ease-out;
}

@keyframes glitch-flash-anim {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 0.2;
        transform: translateX(-5px);
    }

    50% {
        opacity: 0.1;
        transform: translateX(5px);
    }

    100% {
        opacity: 0;
    }
}

/* Custom Cursor */
.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 1px solid var(--terminal-purple);
    pointer-events: none;
    z-index: 10002;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, border-color 0.2s;
}

.custom-cursor::before,
.custom-cursor::after {
    content: '';
    position: absolute;
    background: var(--terminal-purple);
}

.custom-cursor::before {
    top: 50%;
    left: -5px;
    width: 30px;
    height: 1px;
}

.custom-cursor::after {
    left: 50%;
    top: -5px;
    width: 1px;
    height: 30px;
}

.custom-cursor.hover {
    width: 40px;
    height: 40px;
    border-color: var(--security-green);
}

/* Boot Sequence */
.boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-black);
    z-index: 10003;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--security-green);
    font-size: 0.8rem;
    padding: 2rem;
}

.boot-log {
    width: 100%;
    max-width: 400px;
    height: 200px;
    overflow: hidden;
    line-height: 1.5;
}

.boot-line {
    opacity: 0;
    margin-bottom: 0.2rem;
}

.boot-line.active {
    animation: boot-type 0.1s forwards;
}

@keyframes boot-type {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== HEADER (STATUS BAR) ===== */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--void-black);
    border-bottom: 1px solid var(--grid-line);
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1000;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.status-left {
    color: var(--terminal-purple);
}

.status-right {
    display: flex;
    gap: 2rem;
    color: rgba(255, 255, 255, 0.6);
}

.status-right span {
    white-space: nowrap;
}

.price-ticker {
    display: flex;
    gap: 1.5rem;
}

.price-item {
    transition: color 0.3s;
}

.price-item.encrypted {
    color: var(--terminal-purple);
}

.price-item.decrypted {
    color: var(--security-green);
}

/* ===== PACKET SNIFFER ===== */
.packet-sniffer {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 350px;
    height: 180px;
    background: rgba(5, 5, 5, 0.9);
    border: 1px solid var(--grid-line);
    padding: 0.75rem;
    font-size: 0.7rem;
    overflow: hidden;
    z-index: 999;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.packet-sniffer-title {
    color: var(--security-green);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.packet-log {
    height: calc(100% - 25px);
    overflow-y: auto;
    line-height: 1.4;
}

.packet-log::-webkit-scrollbar {
    width: 4px;
}

.packet-log::-webkit-scrollbar-thumb {
    background: var(--terminal-purple);
}

.log-entry {
    margin-bottom: 0.25rem;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.log-entry.net {
    color: rgba(255, 255, 255, 0.8);
}

.log-entry.trd {
    color: var(--terminal-purple);
}

.log-entry.sec {
    color: var(--security-green);
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding-top: 4rem;
}

.hero h1 {
    font-size: clamp(2rem, 8vw, 4.5rem);
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--terminal-purple);
    margin-left: 0.25rem;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

.hero-badge {
    display: inline-block;
    border: 1px solid var(--security-green);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--security-green);
}

/* ===== SECTION HEADERS ===== */
.section {
    padding: 6rem 0;
    border-top: 1px solid var(--grid-line);
}

.section-header {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 3rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ===== PROJECTS TABLE ===== */
.projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.projects-table thead {
    border-bottom: 1px solid var(--grid-line);
}

.projects-table th {
    text-align: left;
    padding: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.projects-table tbody tr {
    border-bottom: 1px solid var(--grid-line);
    cursor: pointer;
    transition: all var(--transition-snap);
    position: relative;
}

.projects-table tbody tr:hover {
    background: var(--terminal-purple);
    color: var(--void-black);
    transform: translateX(1rem);
}

.projects-table tbody tr.flash {
    background: var(--pure-white);
    color: var(--void-black);
}

.projects-table td {
    padding: 1.25rem 1rem;
    position: relative;
}

.projects-table .action-cell {
    color: var(--terminal-purple);
    text-transform: uppercase;
    font-size: 0.75rem;
}

.projects-table tbody tr:hover .action-cell {
    color: var(--void-black);
}

.security-progress {
    position: absolute;
    bottom: 5px;
    left: 1rem;
    right: 1rem;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    display: none;
    overflow: hidden;
}

.security-progress.active {
    display: block;
}

.security-progress-bar {
    height: 100%;
    background: var(--security-green);
    width: 0%;
    transition: width 1.5s linear;
}

/* ===== ABOUT (NEOFETCH) ===== */
.neofetch {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--grid-line);
    padding: 2rem;
}

.ascii-art {
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--security-green);
    white-space: pre;
    font-weight: 700;
}

.neofetch-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.neofetch-line {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
}

.neofetch-key {
    color: var(--terminal-purple);
    text-transform: uppercase;
    font-weight: 500;
}

.neofetch-value {
    color: rgba(255, 255, 255, 0.9);
}

/* ===== CONTACT (COMMAND LINE) ===== */
.command-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 998;
}

.command-bar.docked {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    background: var(--void-black);
    border: 1px solid var(--grid-line);
    border-left: none;
    border-right: none;
}

.command-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.command-prompt {
    color: var(--terminal-purple);
    font-size: 0.875rem;
    white-space: nowrap;
}

.command-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--pure-white);
    font-size: 0.875rem;
    font-family: var(--font-mono);
}

.command-output {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--grid-line);
    font-size: 0.875rem;
    line-height: 1.8;
    display: none;
}

.command-output.show {
    display: block;
}

/* ===== LOCKDOWN GATES ===== */
.lockdown-gates {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.lockdown-gates.active {
    display: block;
}

/* Red glitch overlay */
.lockdown-gates::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 0, 0, 0.15);
    opacity: 0;
    animation: glitch-overlay 0.3s infinite;
}

.lockdown-gates.active::before {
    opacity: 1;
}

@keyframes glitch-overlay {

    0%,
    100% {
        opacity: 0.05;
    }

    50% {
        opacity: 0.25;
    }
}

/* Warning banner */
.lockdown-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.95);
    color: white;
    padding: 2rem 4rem;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.2em;
    border: 3px solid white;
    box-shadow: 0 0 50px rgba(255, 0, 0, 1);
    animation: strobe 0.1s infinite;
    opacity: 0;
}

.lockdown-gates.active .lockdown-warning {
    opacity: 1;
}

@keyframes strobe {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.gate {
    position: absolute;
    background: linear-gradient(90deg,
            rgba(255, 0, 0, 0) 0%,
            rgba(255, 0, 0, 1) 10%,
            rgba(255, 0, 0, 1) 90%,
            rgba(255, 0, 0, 0) 100%);
    height: 25px;
    width: 0%;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gate.gate-1 {
    top: 80px;
    left: 0;
}

.gate.gate-2 {
    top: 25%;
    left: 0;
}

.gate.gate-3 {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.gate.gate-4 {
    top: 75%;
    left: 0;
}

.gate.gate-5 {
    bottom: 80px;
    left: 0;
}

.lockdown-gates.active .gate {
    width: 100%;
}

/* Scan Pulse Decoration */
.scan-pulse {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border: 2px solid var(--security-green);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 10005;
}

body.scan-active .scan-pulse {
    animation: scan-pulse-anim 0.8s ease-out forwards;
}

@keyframes scan-pulse-anim {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        width: 200vw;
        height: 200vw;
        opacity: 0;
    }
}

/* Global Threat Map */
.threat-map-container {
    margin-top: 4rem;
    opacity: 0.6;
    pointer-events: none;
}

.threat-map-title {
    font-size: 0.75rem;
    color: var(--terminal-purple);
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.threat-map-pre {
    font-size: 0.5rem;
    line-height: 1.1;
    color: var(--security-green);
    letter-spacing: 1px;
}

/* ===== DIAGNOSTICS HUD ===== */
.diag-hud {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 240px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 1rem;
    font-size: 0.65rem;
    color: var(--security-green);
    z-index: 997;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.3s;
}

.diag-header {
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--grid-line);
    padding-bottom: 0.25rem;
}

.diag-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.diag-label {
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
}

.diag-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    width: 100%;
}

.diag-bar {
    height: 100%;
    background: var(--security-green);
    width: 40%;
    transition: width 0.5s ease-out;
}

.diag-bar.warning {
    background: #FFCC00;
}

.diag-bar.critical {
    background: var(--lockdown-red);
}

.diag-bar.temp {
    background: #FFCC00;
}

.diag-stat-temp {
    color: #FFCC00;
}

/* Matrix Effect Overlay */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10004;
    display: none;
    background: rgba(0, 0, 0, 0.9);
}

/* System Breach Alert */
.breach-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--breach-red);
    color: white;
    padding: 3rem;
    font-weight: 800;
    font-size: 2.5rem;
    z-index: 10010;
    display: none;
    text-align: center;
    box-shadow: 0 0 100px var(--breach-red);
    animation: breach-pulse 0.4s infinite;
}

@keyframes breach-pulse {

    0%,
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Draggable Handle */
.command-bar-handle {
    height: 8px;
    width: 40px;
    background: var(--glass-border);
    margin: -0.5rem auto 0.5rem auto;
    border-radius: 4px;
    cursor: grab;
}

.command-bar-handle:active {
    cursor: grabbing;
}

/* ===== FOOTER ===== */
.footer {
    padding: 2rem;
    border-top: 1px solid var(--grid-line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    position: relative;
}

.footer-stats {
    display: flex;
    gap: 2rem;
}

#radar-canvas {
    position: fixed;
    bottom: 200px;
    right: 1rem;
    width: 100px;
    height: 100px;
    opacity: 0.3;
    z-index: 10;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
    .neofetch {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .ascii-art {
        font-size: 0.6rem;
    }

    .projects-table {
        font-size: 0.75rem;
    }

    .projects-table th,
    .projects-table td {
        padding: 0.75rem 0.5rem;
    }

    .projects-table .hide-mobile {
        display: none;
    }

    .status-right {
        gap: 1rem;
        font-size: 0.65rem;
    }

    .packet-sniffer {
        width: 280px;
        height: 150px;
        font-size: 0.65rem;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }

    .status-bar {
        padding: 0.75rem 1rem;
        font-size: 0.65rem;
    }

    .section {
        padding: 4rem 0;
    }

    .packet-sniffer {
        width: calc(100% - 2rem);
    }
}