/* Responsive images */
img { max-width: 100%; height: auto; }
/* ==========================================
   01 — TERMINAL CRAFT : DESIGN SYSTEM
   ========================================== */


:root {
    --bg-primary: #0D1117;
    --bg-secondary: #161B22;
    --bg-tertiary: #1C2128;
    --accent-primary: #58A6FF;
    --accent-secondary: #3FB950;
    --accent-warning: #D29922;
    --accent-error: #FF7B72;
    --text-primary: #E6EDF3;
    --text-secondary: #8B949E;
    --border-color: #30363D;

    --font-mono: 'Space Mono', 'Fira Code', 'Courier New', monospace;
    --font-body: 'Inter', -apple-system, sans-serif;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 8px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-base: 250ms;
    --glass-bg: rgba(22, 27, 34, 0.6);
    --glass-border: rgba(255, 255, 255, 0.05);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg-primary); background-image: radial-gradient(circle at 50% 10%, #161b22 0%, #0d1117 60%, #010409 100%); }

body {
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
}

/* NOISE GRAIN OVERLAY */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 99999;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* CRT SCANLINES OVERLAY */
body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 99998;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%);
    background-size: 100% 4px;
    opacity: 0.8;
}

a { color: var(--accent-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text-primary); }

/* ─── TERMINAL HEADER (WINDOW BAR) ─── */
.terminal-header {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 1000;
    width: 95%; max-width: 960px;
    background: rgba(5, 5, 5, 0.92);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid var(--accent-primary);
    padding: 0 20px;
    height: 52px;
    display: flex; align-items: center;
    justify-content: space-between;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.12), inset 0 0 10px rgba(0, 255, 0, 0.04);
}

.header-left { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.window-dots { display: flex; gap: 7px; }
.window-dots .dot { width: 12px; height: 12px; border-radius: 50%; transition: filter 0.2s; }
.window-dots .dot:hover { filter: brightness(1.3); }
.dot.red { background: #FF5F56; }
.dot.yellow { background: #FFBD2E; }
.dot.green { background: #28C840; }

.nav-logo, .terminal-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-secondary);
    text-shadow: 0 0 8px var(--accent-secondary);
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.terminal-nav { 
    display: flex; gap: 4px;
    align-items: center;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover { color: var(--accent-primary); background: rgba(88, 166, 255, 0.08); }
.nav-link.active { color: var(--accent-primary); background: rgba(88, 166, 255, 0.12); }

/* ─── PAGE CONTENT ─── */
.page-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 130px 24px 80px 24px;
}

/* ─── HERO ─── */
.hero-section { margin-bottom: 56px; }

.terminal-prompt-line {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.prompt-symbol { color: var(--accent-secondary); margin-right: 8px; text-shadow: 0 0 10px rgba(63, 185, 80, 0.4); }
.cli-command { color: var(--accent-primary); text-shadow: 0 0 10px rgba(88, 166, 255, 0.4); }
.comment { color: var(--text-secondary); font-style: italic; }

.hero-name {
    font-family: var(--font-mono);
    font-size: clamp(2.4rem, 6vw, 3.8rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
    margin-bottom: 12px;
    letter-spacing: -0.04em;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.hero-subtitle-line {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    min-height: 1.8em;
}

.blinking-cursor {
    display: inline-block;
    color: var(--accent-secondary);
    animation: cursorBlink 0.75s steps(1) infinite;
}

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

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn-terminal {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-prefix { opacity: 0.5; }

.btn-terminal.primary {
    background: var(--accent-secondary);
    color: #000;
    box-shadow: 0 0 15px rgba(63, 185, 80, 0.3);
}
.btn-terminal.primary:hover {
    background: #4AE361;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(63, 185, 80, 0.6), inset 0 2px 5px rgba(255,255,255,0.3);
    color: #000;
}

.btn-terminal.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-terminal.secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ─── TERMINAL BLOCKS ─── */
.terminal-block {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
    margin-bottom: 32px;
    overflow: hidden;
}

.block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(28, 33, 40, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.block-icon { font-size: 1rem; }
.block-title { color: var(--accent-primary); }
.block-badge {
    margin-left: auto;
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-primary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
}

.block-body { padding: 20px; }

.code-line {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    padding: 4px 0;
    color: var(--text-secondary);
}

.line-num {
    display: inline-block;
    width: 32px;
    color: var(--text-secondary);
    opacity: 0.4;
    user-select: none;
}

/* ─── PROJECTS GRID ─── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.project-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

.project-title {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.project-desc { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 12px; }

.project-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
    padding: 3px 10px;
    border-radius: 4px;
}

.project-links { display: flex; gap: 12px; }
.project-links a {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent-secondary);
}

.view-all-link {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-primary);
    margin-top: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}

/* ─── SKILLS ─── */
.skill-category { margin-bottom: 20px; }
.skill-category h3 {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--accent-warning);
    margin-bottom: 12px;
}

.skill-item { margin-bottom: 10px; }
.skill-header {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.skill-bar-bg {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    border-radius: 3px;
    width: 0;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── EXPERIENCE ─── */
.experience-item {
    border-left: 2px solid var(--accent-primary);
    padding-left: 20px;
    margin-bottom: 24px;
    position: relative;
}

.experience-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-primary);
}

.exp-role { font-family: var(--font-mono); color: var(--accent-primary); font-size: 1rem; }
.exp-company { color: var(--text-primary); font-weight: 600; }
.exp-date { font-size: 0.82rem; color: var(--text-secondary); }
.exp-desc { font-size: 0.9rem; color: var(--text-secondary); margin-top: 6px; }

/* ─── CONTACT ─── */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.contact-card:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-2px);
}

.contact-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.contact-value { overflow-wrap: anywhere; word-break: break-all; white-space: normal;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--accent-primary);
    word-break: break-all;
}

/* ─── FOOTER ─── */
.terminal-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px 28px;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.footer-prompt { color: var(--accent-secondary); margin-right: 8px; }

/* ─── ADMIN MODAL THEMING (TERMINAL STYLE) ─── */
.admin-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.admin-modal-overlay.active { display: flex; }

.admin-modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.admin-title {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-secondary);
    font-size: 1rem;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.admin-body { padding: 20px 24px; }

.admin-form-group { margin-bottom: 16px; }
.admin-form-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.admin-input, .admin-textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    padding: 10px 14px;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.admin-input:focus, .admin-textarea:focus {
    border-color: var(--accent-primary);
}

.btn-admin-action {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-admin-action:hover { border-color: var(--accent-primary); }

.btn-admin-primary {
    background: var(--accent-secondary) !important;
    color: #000 !important;
    border-color: var(--accent-secondary) !important;
}
.btn-admin-primary:hover {
    background: #4AE361 !important;
}

.adm-tab-btn {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.adm-tab-btn:hover { color: var(--text-primary); }
.adm-tab-btn.active {
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-primary);
    border-color: rgba(88, 166, 255, 0.3);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .terminal-header {
        background: rgba(5, 5, 5, 0.95);
        backdrop-filter: blur(24px) saturate(150%);
        -webkit-backdrop-filter: blur(24px) saturate(150%);
        flex-wrap: wrap;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }
    .header-left { width: 100%; justify-content: space-between; }
    .terminal-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 4px;
        padding-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
    .terminal-nav.open { display: flex; }
    .nav-link { width: 100%; text-align: left; padding: 10px 14px; }
    .hamburger { margin-left: auto; }
    .hero-name { font-size: 2rem; }
    .projects-grid { grid-template-columns: 1fr; }
    .about-photo { display: none; width: 80px; height: 80px; }
}

/* HAMBURGER MENU MOBILE */
.hamburger {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer;
    padding: 8px; z-index: 200;
}
.hamburger span {
    display: block; width: 24px; height: 2px;
    background: var(--text-primary, #F4F4F5);
    border-radius: 2px; transition: transform 0.3s, opacity 0.3s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
    .hamburger { display: flex; }
    .nav-links {
        display: none !important;
        position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100vh !important;
        transform: none !important;
        background: var(--bg-primary, #08090A);
        flex-direction: column; align-items: center; justify-content: center;
        gap: 24px; z-index: 199;
    }
    .nav-links.open { display: flex !important; }
    .nav-link { font-size: 1.2rem; padding: 12px 24px; }
}
/* Small phones */
@media (max-width: 480px) {
    .page-content { padding: 24px 16px 60px; }
    .hero-name { font-size: 1.6rem; }
    .hero-subtitle { font-size: 0.9rem; }
    .contact-grid { grid-template-columns: 1fr; }
    .section-title { font-size: 1.2rem; }
    .hero-actions { flex-direction: column; align-items: center; }
}

/* Profile photo */
.about-photo { display: none;  width: 100px; height: 100px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--accent-primary); }
@media (max-width: 480px) { .about-photo { width: 80px; height: 80px; } }

/* Touch-friendly */
* { -webkit-tap-highlight-color: transparent; }

/* ─── SNAKE D-PAD (Mobile / Tactile) ─── */
.snake-dpad {
    display: none;
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(2, 52px);
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
    user-select: none;
    -webkit-user-select: none;
}
.snake-dpad-btn {
    width: 52px;
    height: 52px;
    background: var(--bg-secondary, #161B22);
    border: 1px solid var(--border-color, #30363D);
    border-radius: 6px;
    color: var(--accent-secondary, #58A6FF);
    font-size: 1.3rem;
    font-family: var(--font-mono, monospace);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}
.snake-dpad-btn:active {
    background: var(--accent-primary, #00F0FF);
    color: var(--bg-primary, #0D1117);
}
.snake-dpad-btn[data-snake-dir="up"] { grid-column: 2; grid-row: 1; }
.snake-dpad-btn[data-snake-dir="left"] { grid-column: 1; grid-row: 2; }
.snake-dpad-btn[data-snake-dir="down"] { grid-column: 2; grid-row: 2; }
.snake-dpad-btn[data-snake-dir="right"] { grid-column: 3; grid-row: 2; }
@media (pointer: coarse) {
    .snake-dpad { display: grid; }
}


/* ==========================================
   INVERTED THEME (LIGHT)
   ========================================== */
html[data-theme-mode="light"] {
    --bg-primary: #FAFAFA;
    --bg-secondary: #F4F4F5;
    --bg-tertiary: #E4E4E7;
    --text-primary: #09090B;
    --text-secondary: #71717A;
    --border-color: #E4E4E7;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
}

/* ==========================================
   THEME SWITCHER WIDGET
   ========================================== */
.kadre-theme-switcher {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(128, 128, 128, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(128, 128, 128, 0.2);
    padding: 0.25rem;
    border-radius: 2rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.kadre-theme-switcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.3);
}
.theme-btn {
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.3s ease;
}
.theme-btn svg {
    width: 1.2rem;
    height: 1.2rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-btn:hover { color: var(--text-primary); }
.theme-btn:hover svg { transform: scale(1.1); }
.theme-btn.active { color: var(--bg-primary); }
.theme-active-indicator {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--text-primary);
    border-radius: 50%;
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ==========================================
   TERMINAL MONSTER : CRT & ABERRATION
   ========================================== */
body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 9999;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    opacity: 0.6;
    animation: scanlines 10s linear infinite;
}

@keyframes scanlines {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 100%, 0 0; }
}

body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    z-index: 9998;
    background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
}

/* Subtle CRT curvature and chromatic aberration on edges */
.main-content {
    animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
    0% { opacity: 0.98; }
    50% { opacity: 1; }
    100% { opacity: 0.99; }
}


/* ==========================================
   LIQUID GLASS & METAL NAVBAR
   ========================================== */
.terminal-header, .navbar {
    background: rgba(13, 17, 23, 0.85) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border: none !important;
    position: relative;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.05), 0 10px 30px rgba(0,0,0,0.5) !important;
}

[data-theme-mode="light"] .terminal-header, .navbar {
    background: rgba(250, 250, 250, 0.85) !important;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.3), 0 10px 30px rgba(0,0,0,0.1) !important;
}

.terminal-header::before, .navbar::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), #ffffff, var(--accent-primary), #ffffff, var(--accent-primary));
    background-size: 300% 300%;
    animation: liquidMetalNav 3s infinite linear;
    z-index: -1;
    filter: blur(1px);
    opacity: 0.8;
}

@keyframes liquidMetalNav {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}


/* ==========================================
   AI LIQUID METAL COMPANION
   ========================================== */
.ai-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease-in-out, visibility 1s;
}

.ai-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.ai-skip-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    padding: 8px 16px;
    font-family: var(--font-family);
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: 0.3s;
}
.ai-skip-btn:hover { opacity: 1; background: var(--accent-primary); color: #000; }

.ai-container {
    position: fixed;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: all 1s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Center state (Intro) */
.ai-container.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Corner state (Persistent) */
.ai-container.corner {
    top: auto;
    left: auto;
    bottom: 30px;
    right: 30px;
    transform: none;
    flex-direction: row-reverse; /* Dialog on the left of orb */
    gap: 15px;
}

/* Liquid Metal Orb */
.ai-orb {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #ffffff, var(--accent-primary), var(--accent-secondary), #000000);
    background-size: 300% 300%;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    box-shadow: 
        inset 10px 0 20px rgba(255,255,255,0.8),
        inset -10px 0 20px rgba(0,0,0,0.8),
        0 0 30px var(--accent-primary);
    animation: liquidMorph 6s infinite alternate ease-in-out, liquidFlow 8s infinite linear;
    transition: all 1s ease;
    cursor: pointer;
}

.ai-container.corner .ai-orb {
    width: 60px;
    height: 60px;
    box-shadow: 
        inset 5px 0 10px rgba(255,255,255,0.8),
        inset -5px 0 10px rgba(0,0,0,0.8),
        0 0 15px var(--accent-primary);
}

/* AI Glitch / Hacked State */
.ai-orb.hacked {
    background: linear-gradient(135deg, #ffffff, #ff0000, #550000, #000000);
    box-shadow: 0 0 50px #ff0000, inset 0 0 20px #ff0000;
    animation: liquidMorph 0.5s infinite alternate ease-in-out, liquidFlow 2s infinite linear, orbShake 0.1s infinite;
}

@keyframes liquidMorph {
    0% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    50% { border-radius: 60% 40% 30% 70% / 50% 60% 50% 40%; }
    100% { border-radius: 50% 50% 60% 40% / 60% 40% 50% 60%; }
}

@keyframes liquidFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

@keyframes orbShake {
    0% { transform: translate(2px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(0px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(2px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* Dialog Box */
.ai-dialog {
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent-primary);
    padding: 15px 20px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    max-width: 300px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(10px);
    transition: 0.3s;
    pointer-events: none;
}
.ai-dialog.active {
    opacity: 1;
    transform: translateY(0);
}
.ai-orb.hacked + .ai-dialog, .ai-container:has(.ai-orb.hacked) .ai-dialog {
    border-color: #ff0000;
    color: #ff0000;
    text-shadow: 0 0 5px #ff0000;
    font-family: 'Courier New', monospace;
}
.ai-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background: var(--accent-primary);
    animation: blink 1s infinite;
    vertical-align: middle;
    margin-left: 4px;
}
.ai-orb.hacked + .ai-dialog .ai-cursor, .ai-container:has(.ai-orb.hacked) .ai-dialog .ai-cursor {
    background: #ff0000;
}

/* Global Glitch Mode for the whole page */
body.glitch-mode {
    animation: crt-flicker 0.05s infinite, screenShake 0.2s infinite;
    filter: invert(1) hue-rotate(90deg) contrast(200%);
}
@keyframes screenShake {
    0% { transform: translate(5px, 5px); }
    25% { transform: translate(-5px, -5px); }
    50% { transform: translate(5px, -5px); }
    75% { transform: translate(-5px, 5px); }
    100% { transform: translate(5px, 5px); }
}

/* ==========================================
   HACK GLITCH LAYER — red screen + skull assembling
   ========================================== */
.hack-glitch {
    position: fixed;
    inset: 0;
    z-index: 999999;
    overflow: hidden;
    pointer-events: none;
    background: rgba(120, 0, 0, 0.15);
    animation: hackPulseBg 0.4s steps(2) infinite;
}
@keyframes hackPulseBg {
    0% { background: rgba(140, 0, 0, 0.22); }
    50% { background: rgba(180, 0, 0, 0.08); }
    100% { background: rgba(120, 0, 0, 0.18); }
}

/* Red screen flashes */
.hack-red {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, rgba(255, 40, 40, 0.55), rgba(120, 0, 0, 0.2));
    mix-blend-mode: screen;
    animation: redFlash 0.3s steps(2) infinite;
}
@keyframes redFlash {
    0% { opacity: 0.25; }
    30% { opacity: 0.95; }
    60% { opacity: 0.4; }
    100% { opacity: 0.8; }
}

/* Scanlines overlay */
.hack-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.35) 3px,
        rgba(0, 0, 0, 0.35) 4px
    );
    animation: scanMove 0.12s linear infinite;
}
@keyframes scanMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Horizontal glitch slices that tear the image */
.hack-slice {
    position: absolute;
    left: 0;
    right: 0;
    height: 22px;
    background: linear-gradient(90deg,
        rgba(255, 0, 0, 0.35),
        rgba(0, 255, 255, 0.2),
        rgba(255, 255, 255, 0.15));
    filter: blur(0.5px);
    mix-blend-mode: screen;
}
.hack-slice:nth-child(1) { top: 11%; animation: sliceGlitch 0.35s steps(3) infinite; }
.hack-slice:nth-child(2) { top: 29%; animation: sliceGlitch 0.4s steps(4) infinite reverse; }
.hack-slice:nth-child(3) { top: 48%; animation: sliceGlitch 0.3s steps(3) infinite; }
.hack-slice:nth-child(4) { top: 66%; animation: sliceGlitch 0.45s steps(5) infinite reverse; }
.hack-slice:nth-child(5) { top: 84%; animation: sliceGlitch 0.38s steps(3) infinite; }
@keyframes sliceGlitch {
    0%   { transform: translateX(-8%); }
    20%  { transform: translateX(6%); }
    40%  { transform: translateX(-3%); }
    60%  { transform: translateX(9%); }
    80%  { transform: translateX(-5%); }
    100% { transform: translateX(7%); }
}

/* Assembling skull */
.hack-skull {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(38vw, 300px);
    height: auto;
    transform: translate(-50%, -50%);
    animation: skullMaterialize 1.6s steps(12) infinite;
}
.hack-skull svg {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(255, 0, 0, 0.8));
}
@keyframes skullMaterialize {
    0%   { opacity: 0; transform: translate(-50%, -50%) translateX(-40px) scale(1.15); clip-path: inset(0 100% 0 0); }
    10%  { opacity: 0.35; transform: translate(-50%, -50%) translateX(30px) scale(1.1); clip-path: inset(0 60% 0 0); }
    20%  { opacity: 1; transform: translate(-50%, -50%) translateX(-20px) scale(1.05); clip-path: inset(0 45% 0 0); }
    30%  { opacity: 0.6; transform: translate(-50%, -50%) translateX(18px) scale(1.08); clip-path: inset(0 30% 0 0); }
    40%  { opacity: 1; transform: translate(-50%, -50%) translateX(-10px) scale(1.02); clip-path: inset(0 18% 0 0); }
    55%  { opacity: 0.85; transform: translate(-50%, -50%) translateX(12px) scale(1.04); clip-path: inset(5% 8% 3% 6%); }
    70%  { opacity: 1; transform: translate(-50%, -50%) translateX(-6px) scale(1.01); clip-path: inset(2% 3% 1% 2%); }
    85%  { opacity: 0.9; transform: translate(-50%, -50%) translateX(8px) scale(1.02); clip-path: inset(8% 4% 6% 5%); }
    100% { opacity: 1; transform: translate(-50%, -50%) translateX(0) scale(1); clip-path: inset(0); }
}

/* Chromatic RGB ghost copies of the skull */
.hack-skull-ghost {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(38vw, 300px);
    transform: translate(-50%, -50%);
    opacity: 0.4;
    pointer-events: none;
}
.hack-skull-ghost.red {
    transform: translate(calc(-50% - 6px), -50%);
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.9));
    animation: ghostRed 0.25s steps(3) infinite;
}
.hack-skull-ghost.cyan {
    transform: translate(calc(-50% + 6px), -50%);
    filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.9));
    animation: ghostCyan 0.3s steps(4) infinite;
}
@keyframes ghostRed {
    0%   { clip-path: inset(0 0 60% 0); }
    33%  { clip-path: inset(35% 0 25% 0); }
    66%  { clip-path: inset(55% 0 10% 0); }
    100% { clip-path: inset(20% 0 45% 0); }
}
@keyframes ghostCyan {
    0%   { clip-path: inset(55% 0 15% 0); }
    33%  { clip-path: inset(10% 0 55% 0); }
    66%  { clip-path: inset(40% 0 25% 0); }
    100% { clip-path: inset(25% 0 40% 0); }
}

/* Glitch label */
.hack-label {
    position: absolute;
    left: 50%;
    bottom: 18%;
    transform: translateX(-50%);
    font-family: 'Courier New', monospace;
    font-size: clamp(0.9rem, 2.4vw, 1.3rem);
    font-weight: 700;
    letter-spacing: 0.18em;
    color: #ff2b2b;
    text-shadow: 0 0 12px rgba(255, 0, 0, 0.9), 2px 0 0 rgba(0, 255, 255, 0.7);
    white-space: nowrap;
    animation: labelGlitch 0.5s steps(4) infinite;
}
@keyframes labelGlitch {
    0%   { transform: translateX(calc(-50% - 4px)); opacity: 0.8; }
    25%  { transform: translateX(calc(-50% + 5px)); opacity: 1; }
    50%  { transform: translateX(calc(-50% - 2px)); opacity: 0.9; }
    75%  { transform: translateX(calc(-50% + 3px)); opacity: 1; }
    100% { transform: translateX(calc(-50% - 4px)); opacity: 0.85; }
}

/* Corner status text during hack */
.hack-status {
    position: absolute;
    top: 20px;
    left: 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #ff4040;
    line-height: 1.9;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.7);
    white-space: pre;
    opacity: 0.9;
}

/* ===================================================================
   KADRE RESPONSIVE SYSTEM — Enhanced Mobile & Tablet Support
   ================================================================= */

/* ── Tablet ── */
@media (max-width: 1024px) {
    .projects-grid,
    .skills-grid,
    .experience-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-layout,
    .hero-section > * {
        text-align: center;
    }
    .about-layout {
        flex-direction: column;
        align-items: center;
    }
}

/* ── Mobile ── */
@media (max-width: 768px) {
    /* Typography scale */
    :root {
        font-size: 15px;
    }
    .hero-name,
    .page-title,
    h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem) !important;
    }
    .hero-subtitle,
    .section-subtitle,
    p {
        font-size: clamp(0.88rem, 4vw, 1rem);
    }

    /* Layout */
    .projects-grid,
    .skills-grid,
    .experience-grid,
    .cards-grid,
    .contact-grid {
        grid-template-columns: 1fr !important;
    }
    .hero-layout,
    .hero-section {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 24px !important;
    }
    .hero-3d-col {
        width: 220px !important;
        height: 220px !important;
        flex: 0 0 220px !important;
    }
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    .about-photo {
        width: 80px;
        height: 80px;
    }

    /* Spacing */
    .section,
    section,
    .page-section {
        padding: 48px 16px !important;
    }
    .page-content {
        padding: 20px 16px 60px !important;
    }
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* Nav */
    .navbar,
    .terminal-header,
    header {
        padding: 12px 16px !important;
    }
    .nav-logo {
        font-size: 0.9rem !important;
    }

    /* Misc */
    .tags-list { flex-wrap: wrap; gap: 6px; }
    .tag { font-size: 0.72rem !important; }
}

/* ── Small Phones ── */
@media (max-width: 480px) {
    h1, .hero-name { font-size: clamp(1.5rem, 7vw, 2rem) !important; }
    .btn-terminal, .btn-primary, .btn-secondary {
        font-size: 0.82rem;
        padding: 10px 20px;
    }
}

/* ===================================================================
   KADRE LIQUID GLASS MOBILE MENU — Premium Frosted Metal Dropdown
   ================================================================= */
@media (max-width: 768px) {
    .nav-links {
        /* Reset any override to fullscreen */
        position: absolute !important;
        top: calc(100% + 12px) !important;
        right: 16px !important;
        left: auto !important;
        width: 260px !important;
        height: auto !important;
        transform: translateY(-10px) scale(0.97) !important;
        /* Liquid Glass core */
        background: rgba(13, 17, 23, 0.97) !important;
        backdrop-filter: blur(40px) saturate(1.8) brightness(1.1) !important;
        -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.3) !important;
        border-radius: 18px !important;
        padding: 18px 20px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 4px !important;
        /* Metal sheen shadow */
        box-shadow: 
            0 32px 64px rgba(0, 0, 0, 0.5),
            0 0 0 0.5px rgba(255, 255, 255, 0.06) inset,
            0 1px 0 0 rgba(255, 255, 255, 0.15) inset !important;
        /* Animation */
        opacity: 0 !important;
        visibility: hidden !important;
        transition:
            opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
            transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
            visibility 0.25s ease !important;
        z-index: 999 !important;
    }
    .nav-links.open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) scale(1) !important;
    }
    .nav-links a,
    .nav-link {
        width: 100% !important;
        padding: 10px 12px !important;
        border-radius: 10px !important;
        font-size: 0.92rem !important;
        letter-spacing: 0.02em !important;
        border-bottom: none !important;
        transition: background 0.15s ease, color 0.15s ease !important;
    }
    .nav-links a:hover,
    .nav-link:hover {
        background: rgba(255, 255, 255, 0.07) !important;
    }
}

/* ── Header: anchor for absolute mobile dropdown ── */
header,
.navbar,
.terminal-header,
.bp-header,
.site-header {
    position: relative;
}

/* ==========================================================================
   ACCESSIBILITY: REDUCED MOTION (WCAG)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  canvas {
    opacity: 0.1 !important;
    pointer-events: none !important;
  }
}

/* ==========================================================================
   MOBILE NAV & PERFORMANCE FIXES
   ========================================================================== */
@media (max-width: 768px) {
    .nav-links {
        background: rgba(10, 10, 15, 0.98) !important;
        backdrop-filter: blur(12px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
        box-shadow: 0 20px 40px rgba(0,0,0,0.8) !important;
        border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    }
    [data-theme-mode="light"] .nav-links,
    body[data-theme="light"] .nav-links {
        background: rgba(250, 250, 250, 0.98) !important;
        box-shadow: 0 20px 40px rgba(0,0,0,0.1) !important;
        border-bottom: 1px solid rgba(0,0,0,0.1) !important;
    }
}

/* ==========================================================================
   MOBILE CURSOR FIX
   ========================================================================== */
@media (pointer: coarse), (hover: none) {
    #cursor-dot, #cursor-outline, #liquid-cursor, #custom-cursor, #gallery-cursor, .cursor-glow {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
    body, a, button, input, textarea, select {
        cursor: auto !important;
    }
}

/* MOBILE NAV BLUR FIX */
@media (max-width: 768px) {
    .terminal-header, .navbar, .header, .glass-header {
        background: rgba(10, 10, 10, 0.95) !important;
        backdrop-filter: blur(12px) saturate(200%) !important;
        -webkit-backdrop-filter: blur(12px) saturate(200%) !important;
    }
}
