/* ==========  GLOBAL VARS  ========== */
:root {
    --bg-main: #0A0F1E;
    --bg-panel: rgba(15, 25, 45, 0.88);
    --border-color: #00A8A8;
    --text-primary: #E0E0E0;
    --text-secondary: #00D0D0;
    --text-heading: #FFA500;
    --text-data: #39FF14;
    --accent-glow: rgba(0, 208, 208, 0.7);
    --accent-danger: #FF4136;

    --font-hud: 'Orbitron', sans-serif;
    --font-data: 'Roboto Mono', monospace;
    --font-body: 'Lato', sans-serif;

    --border-radius: 4px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-main);
    color: var(--text-primary);
    overflow:hidden;
    display:flex;
    justify-content:center;
    align-items:center;
    min-height:100vh;
    padding:15px;
}




/* ⇣   BACKGROUND CANVAS LAYER   ⇣ */
#bg-canvas {
    position: fixed;
    top:0; left:0;
    width:100%; height:100%;
    z-index:0;
}

/* --- HUD Container --- */
.hud-container {
    width: 100%;
    max-width: 1200px;
    height: 95vh;
    max-height: 800px; 
    background-color: var(--bg-panel);
    border: 2px solid var(--border-color);
    box-shadow: 0 0 25px var(--accent-glow), inset 0 0 15px rgba(0,0,0,0.5);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative; 
    z-index: 10; /* Increased z-index for HUD */
    transition: opacity 0.5s ease-out, transform 0.5s ease-out; /* For hide/show */
}

.hud-container.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}


/* Scanline effect for the HUD */
.hud-container::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    z-index: 2; 
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
    animation: scanlineAnim 12s linear infinite alternate;
}
@keyframes scanlineAnim {
    0% { transform: translateY(-2.5px); opacity: 0.7; }
    100% { transform: translateY(2.5px); opacity: 1; }
}

/* Active Scanning Line */
.active-scan-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-glow);
    box-shadow: 0 0 10px var(--accent-glow);
    opacity: 0.6;
    z-index: 3; 
    pointer-events: none;
    animation: activeScan 8s linear infinite;
}
@keyframes activeScan {
    0% { top: 5%; }
    50% { top: 95%; }
    100% { top: 5%; }
}

/* Animated Corner Brackets */
.hud-container::after, .hud-header::before, .hud-footer::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border-color: var(--text-secondary);
    opacity: 0.7;
    animation: pulseBracket 2s infinite alternate;
}
.hud-container::after { /* Top-left */
    top: 5px; left: 5px;
    border-top: 2px solid;
    border-left: 2px solid;
}
.hud-header::before { /* Top-right of header */
    top: 5px; right: 5px;
    border-top: 2px solid;
    border-right: 2px solid;
}
.hud-footer::after { /* Bottom-left of footer */
    bottom: 5px; left: 5px;
    border-bottom: 2px solid;
    border-left: 2px solid;
}
.hud-header::after { 
    content: '';
    position: absolute;
    width: 15px; height: 15px;
    border-color: var(--text-secondary);
    opacity: 0.7;
    animation: pulseBracket 2s infinite alternate;
    top: 5px; left: 5px;
    border-top: 2px solid;
    border-left: 2px solid;
}
.hud-footer::before { 
    content: '';
    position: absolute;
    width: 15px; height: 15px;
    border-color: var(--text-secondary);
    opacity: 0.7;
    animation: pulseBracket 2s infinite alternate;
    bottom: 5px; right: 5px;
    border-bottom: 2px solid;
    border-right: 2px solid;
}

@keyframes pulseBracket {
    from { opacity: 0.4; border-color: var(--text-secondary); }
    to { opacity: 0.9; border-color: var(--text-heading); }
}

/* --- HUD Header --- */
.hud-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(10,15,30,0.6); 
    position: relative; 
}

.hud-header h1 {
    font-family: var(--font-hud);
    font-size: 1.5rem;
    color: var(--text-heading);
    text-shadow: 0 0 5px var(--text-heading);
    letter-spacing: 1px;
    /* transition: transform 0.2s ease-out; // Removed for new effect */
    display: flex; /* For word separation */
}
/* .hud-header h1:hover {
    transform: scale(1.02) skewX(-2deg); // Removed for new effect
} */

.hud-header h1 span,
.content-section h2 span,
.content-section h3 span {
    display: inline-block; /* Needed for individual transform */
    transition: transform 0.2s ease-out, margin 0.2s ease-out;
    padding: 0 0.05em; /* Minimal padding to ensure separation looks natural */
}


.status-indicator-container {
    display: flex;
    align-items: center;
    gap: 15px;
}
.status-indicator {
    font-family: var(--font-data);
    font-size: 0.9rem;
    color: var(--text-data);
    animation: blink 1.5s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.dynamic-readout {
    font-family: var(--font-data);
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 120px; 
    text-align: right;
}

/* --- HUD Main Content Area --- */
.hud-main {
    display: flex;
    flex-grow: 1;
    overflow: hidden; 
}

/* --- Navigation Panel --- */
.hud-nav {
    width: 200px;
    min-width: 180px; 
    padding: 20px 15px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: rgba(10,15,30,0.4); 
    overflow-y: auto; 
}

.nav-button {
    font-family: var(--font-hud);
    font-size: 1rem;
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid var(--text-secondary);
    padding: 10px;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-speed) ease, transform 0.1s ease-out;
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden; 
    display: flex; 
    align-items: center;
}
.nav-button::before { 
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
    transition: left var(--transition-speed) ease-out;
    z-index: -1; 
}
.nav-button:hover, .nav-button.active {
    background-color: var(--border-color);
    color: var(--bg-main);
    box-shadow: 0 0 12px var(--accent-glow), 0 0 5px var(--text-heading) inset; 
    transform: translateY(-2px) scale(1.01); 
}
.nav-button:hover::before {
    left: 0; 
}
.nav-button.active {
    font-weight: bold; 
    border-color: var(--text-heading); 
}
.nav-button .icon { margin-right: 8px; display: inline-block; }


/* Container for the marquee text */
.nav-button .marquee-wrapper {
  position: relative;
  overflow: hidden;
  width: calc(100% - 30px); /* Make room for the icon */
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 5%,
    black 95%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 5%,
    black 95%,
    transparent 100%
  );
}

/* The text element - static by default */
.nav-button .marquee-text {
  display: inline-block;
  white-space: nowrap;
  position: relative;
  /* No animation initially */
}

/* Activate marquee only on hover */
.nav-button:hover .marquee-text {
  animation: marquee 4s linear infinite;
  padding-left: 10px; /* Small padding to start */
}

/* Animation keyframes for the scrolling effect */
@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}



/* --- Content Display Panel --- */
.hud-content-display {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    position: relative; 
}
.hud-content-display::-webkit-scrollbar { width: 8px; }
.hud-content-display::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: var(--border-radius); }
.hud-content-display::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--bg-panel);
}
.hud-content-display::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-heading);
}

.content-section {
    display: none;
    animation: fadeIn 0.5s ease-out forwards; 
}
.content-section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px) scale(0.98); } 
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.content-section h2 {
    font-family: var(--font-hud);
    font-size: 1.8rem;
    color: var(--text-heading);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    letter-spacing: 1px;
    position: relative; 
    display: flex; /* For word separation */
}
.content-section h3 {
    font-family: var(--font-hud);
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-top: 20px;
    margin-bottom: 10px;
    position: relative; 
    display: flex; /* For word separation */
}
/* Glitch Effect Styling */
.glitch {
    position: relative;
    display: inline-flex; /* Changed to inline-flex for span children */
}
.glitch span { /* Ensure spans within glitch also behave for separation */
    display: inline-block;
    transition: transform 0.2s ease-out, margin 0.2s ease-out;
    padding: 0 0.05em;
}

.glitch::before, .glitch::after {
    content: attr(data-text); 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-panel); 
    color: inherit; 
}
.glitch.glitch-active::before { 
    left: 2px;
    text-shadow: -1px 0 var(--accent-danger);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitchAnimBefore 0.6s infinite alternate-reverse;
}
.glitch.glitch-active::after { 
    left: -2px;
    text-shadow: -1px 0 var(--text-data), 1px 1px var(--text-secondary);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitchAnimAfter 0.4s infinite alternate-reverse;
}

@keyframes glitchAnimBefore {
    0% { clip: rect(24px, 550px, 90px, 0); transform: skewX(0.03deg); }
    25% { clip: rect(10px, 550px, 100px, 0); }
    50% { clip: rect(50px, 550px, 70px, 0); transform: skewX(0); }
    75% { clip: rect(30px, 550px, 90px, 0); }
    100% { clip: rect(60px, 550px, 110px, 0); transform: skewX(-0.02deg); }
}
@keyframes glitchAnimAfter {
    0% { clip: rect(85px, 550px, 140px, 0); transform: skewX(-0.03deg); }
    25% { clip: rect(100px, 550px, 120px, 0); }
    50% { clip: rect(70px, 550px, 100px, 0); transform: skewX(0); }
    75% { clip: rect(110px, 550px, 130px, 0); }
    100% { clip: rect(90px, 550px, 150px, 0); transform: skewX(0.02deg); }
}

.content-section p, .content-section li {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.content-section strong { color: var(--text-secondary); font-weight: 700; } 
.content-section a {
    color: var(--text-data);
    text-decoration: none;
    transition: color var(--transition-speed), text-shadow 0.2s;
    font-weight: bold; 
}
.content-section a:hover {
    color: var(--text-heading);
    text-decoration: underline;
    text-shadow: 0 0 5px var(--text-heading);
}
.content-section ul { list-style: none; padding-left: 0; }
.content-section ul li { padding-left: 20px; position: relative; margin-bottom: 8px; }
.content-section ul li::before {
    content: '»';
    position: absolute;
    left: 0;
    color: var(--border-color);
    font-weight: bold;
    transition: transform 0.2s ease-out, color 0.2s ease-out;
}
.content-section ul li:hover::before {
    transform: translateX(3px) scale(1.2);
    color: var(--text-heading);
}

#skills .skill-category { margin-bottom: 20px; }
#skills .skill-category h3 { 
    margin-bottom: 10px; 
    color: var(--text-secondary); 
    font-size: 1.1rem;
    /* display: flex; // Already applied to .content-section h3 */
}
#skills ul { display: flex; flex-wrap: wrap; gap: 10px; padding-left: 0; }
#skills li {
    background-color: rgba(0, 168, 168, 0.1);
    border: 1px solid rgba(0, 168, 168, 0.3);
    padding: 6px 12px; 
    border-radius: var(--border-radius);
    font-family: var(--font-data);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    list-style-type: none; 
    margin-bottom: 0; 
}
#skills li::before { display: none; } 
#skills li:hover {
    background-color: rgba(0, 168, 168, 0.3);
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 208, 208, 0.3);
    color: var(--text-heading);
}

.job, .project-item, .education-item { 
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed rgba(0, 168, 168, 0.3);
}
.job:last-child, .project-item:last-child, .education-item:last-child { border-bottom: none; }

.job .company-date, .project-item .tech-stack, .education-item p:first-of-type { 
    font-family: var(--font-data);
    font-size: 0.9rem;
    color: var(--text-data);
    margin-bottom: 8px;
}
.education-item h3 { 
    font-family: var(--font-hud);
    font-size: 1.1rem; 
    color: var(--text-primary); 
    margin-bottom: 5px;
    /* display: flex; // Already applied to .content-section h3 */
}

/* =========   CURSOR GLOW  ========= */
.cursor-glow {
    position: fixed;
    width:22px; height:22px;
    background: var(--accent-glow);
    border-radius:50%;
    mix-blend-mode:screen;
    pointer-events:none;
    opacity:0;
    transform:translate(-50%,-50%) scale(.2);
    transition:opacity .3s ease, transform .25s ease;
    z-index: 10000; 
}

body:hover .cursor-glow{opacity:.35; transform:translate(-50%,-50%) scale(1);}

/* --- HUD Footer --- */
.hud-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    font-family: var(--font-data);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background-color: rgba(10,15,30,0.6);
    position: relative; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
}
.hud-footer p { margin: 0; line-height: 1.4; }

/* Incoming Data Ticker */
.data-ticker {
    min-width: 200px; 
    flex-basis: 250px; 
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-data);
    text-align: right; 
}
.data-ticker span {
    display: inline-block;
    animation: tickerScroll 25s linear infinite; 
    padding-left: 100%; 
}
@keyframes tickerScroll {
    0% { transform: translateX(0%); } 
    100% { transform: translateX(-200%); } 
}

/* --- Initial Boot Sequence --- */
.boot-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-main);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-family: var(--font-data);
    color: var(--text-data);
    font-size: 1.2rem;
    transition: opacity 0.8s ease-out 1.5s; 
    padding: 20px; 
}
.boot-overlay.hidden { opacity: 0; pointer-events: none; }

.boot-text-container { width: 90%; max-width: 600px; }
.boot-text {
    white-space: pre-wrap; 
    text-align: left;
    overflow: hidden; 
    max-width: 100%;
    line-height: 1.6;
}
.typing-cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.2em;
    background-color: var(--text-data);
    animation: blink-caret .75s step-end infinite;
    margin-left: 2px;
    vertical-align: bottom;
}
@keyframes blink-caret {
    from, to { background-color: transparent }
    50% { background-color: var(--text-data); }
}
.progress-bar-container {
    width: 90%;
    max-width: 400px;
    height: 15px;
    border: 1px solid var(--text-data);
    margin-top: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: rgba(0,0,0,0.3); 
}
.progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--text-data);
    box-shadow: 0 0 8px var(--text-data); 
    transition: width 0.25s ease-out; 
}

/* --- HUD Toggle Button --- */
.hud-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 15px;
    font-family: var(--font-hud);
    font-size: 0.9rem;
    background-color: var(--border-color);
    color: var(--bg-main);
    border: 1px solid var(--text-heading);
    border-radius: var(--border-radius);
    cursor: pointer;
    z-index: 1000; /* Above HUD scanlines, below cursor glow */
    transition: background-color var(--transition-speed), color var(--transition-speed), transform 0.2s ease-out;
    box-shadow: 0 0 10px var(--accent-glow);
}
.hud-toggle-btn:hover {
    background-color: var(--text-heading);
    color: var(--bg-main);
    transform: scale(1.05);
}


/* Responsive adjustments */
@media (max-width: 900px) {
    body { padding: 10px; align-items: flex-start; overflow-y: auto; }
    .hud-container {
        height: auto; 
        min-height: calc(100vh - 20px); 
        max-height: none;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    .hud-main { flex-direction: column; }
    .hud-nav {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-y: visible; 
    }
    .nav-button { font-size: 0.9rem; padding: 8px 10px; flex-grow: 1; text-align: center; min-width: 130px; margin: 3px;}
    .hud-content-display { padding: 20px 15px; } 
    .content-section h2 { font-size: 1.6rem; flex-wrap: wrap; /* Allow words to wrap if needed */ }
    .content-section h3 { font-size: 1.2rem; flex-wrap: wrap; }
    .hud-header h1 { font-size: 1.3rem; text-align: center; width: 100%; margin-bottom: 10px; flex-wrap: wrap; justify-content: center;}
    .hud-header { flex-direction: column; align-items: center; }
    .status-indicator-container {
        width: 100%; justify-content: space-around;
    }
    .dynamic-readout { font-size: 0.7rem; min-width: auto; text-align: center; }
    .hud-footer { flex-direction: column; gap: 8px; text-align: center; padding: 10px 15px;}
    .data-ticker { width: 100%; text-align: center; flex-basis: auto; }
    .data-ticker span { animation-duration: 20s; }
    .hud-toggle-btn { font-size: 0.8rem; padding: 8px 12px; bottom:10px; right: 10px;}
}
@media (max-width: 480px) {
    .nav-button { min-width: 90px; font-size: 0.75rem; padding: 6px; } /* Adjusted min-width */
    .content-section p, .content-section li { font-size: 0.9rem; }
    .content-section h2 { font-size: 1.4rem; }
    .content-section h3 { font-size: 1.1rem; }
    .boot-text { font-size: 1rem; }
    .hud-header h1 { font-size: 1.1rem; }
    .status-indicator { font-size: 0.8rem; }
    .dynamic-readout { font-size: 0.65rem; }
}

