/* --- Global Variables --- */
:root {
    --bg-dark: #040b16; /* Deep blackish blue */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #ffffff;
    --line-active: #ffffff;
    --line-faint: rgba(255, 255, 255, 0.1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
    
    /* Subtle Tensor Matrix Grid + Radial Depth */
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(0, 123, 255, 0.06) 0%, transparent 80%),
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 100vw 100vh, 40px 40px, 40px 40px;
    background-attachment: fixed;
}

/* Semantic DOM Network Canvas */
#dom-network-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1; /* Behind content */
    pointer-events: none;
}

/* Navigation */
.nav-bar {
    position: fixed;
    top: 0; width: 100%;
    padding: 2rem 4rem;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}
.nav-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: 0.1em;
    font-size: 1.2rem;
}
.nav-socials {
    pointer-events: auto;
}
.nav-socials a:hover {
    opacity: 1 !important;
}

/* Main Story Timeline */
.story-timeline {
    position: relative;
    z-index: 2; /* Above canvas */
    display: flex;
    flex-direction: column;
    padding-top: 15rem; /* Start after nav */
    padding-bottom: 35rem; /* Allows scrolling fully to the bottom nodes */
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 3.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #888888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
h2 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #aaaaaa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
h3 { font-size: 1.5rem; }

/* --- Network DOM Boxes --- */
.network-box {
    background-color: var(--bg-dark); /* Solid background to obscure canvas lines passing behind */
    background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.04) 0%, transparent 60%);
    border: 1.5px dashed rgba(255, 255, 255, 0.4);
    border-radius: 255px 25px 225px 25px / 25px 225px 25px 255px; /* Organic hand-drawn cloud/box shape */
    padding: 2.5rem 3rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 450px;
    margin: 15rem auto; /* Huge margins to stretch the neural network lines */
    text-align: center;
    position: relative;
    z-index: 5;
    /* Subtle cloud floating effect */
    animation: floatAndMorph 8s ease-in-out infinite alternate;
}

/* Progressive Activation Border */
.network-box::before {
    content: "";
    position: absolute;
    top: -1.5px; left: -1.5px; right: -1.5px; bottom: -1.5px;
    border-radius: inherit;
    border: 1.5px solid rgba(255, 255, 255, 0.8); /* Solid white/gray line without the blurry glow */
    pointer-events: none;
    z-index: 6;
    /* Draws downwards perfectly in sync with the canvas lines */
    clip-path: inset(0 0 calc(100% - var(--progress, 0%)) 0);
    transition: clip-path 0.1s linear;
}

@keyframes floatAndMorph {
    0% {
        transform: translateY(0) rotate(0deg);
        border-radius: 255px 25px 225px 25px / 25px 225px 25px 255px;
    }
    100% {
        transform: translateY(-10px) rotate(0.5deg);
        border-radius: 25px 225px 25px 255px / 255px 25px 225px 25px;
    }
}

/* Typography Inside Boxes */
.layer-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.name-title {
    margin-bottom: 0.5rem;
}

.degree-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.05em;
}

.layer-heading {
    margin-bottom: 1.5rem;
}

.manifesto-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #e0e0e0;
    font-weight: 300;
}

.tech-stack {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

/* Make tech stack items look like sleek pill badges */
.tech-stack span {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}
.tech-stack span:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.portfolio-hero-title {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    text-align: center;
    font-family: 'Anton', 'Bebas Neue', sans-serif;
    font-size: min(19vw, 18vh);
    font-weight: 400; /* Anton is inherently very bold */
    color: rgba(255, 255, 255, 0.05);
    letter-spacing: 0.02em;
    line-height: 1.05;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

.impact-flashcards {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 4rem;
    margin-bottom: 8rem;
    position: relative;
    z-index: 2;
}

.impact-flashcards.network-box {
    background: transparent;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    max-width: 100%;
    animation: none;
}

.impact-flashcards.network-box::before {
    display: none;
}

.flip-card {
    background-color: transparent;
    width: 220px;
    height: 140px;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background: #0d121f; /* Solid dark background to prevent line bleed */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.flip-card-back {
    transform: rotateY(180deg);
    border-color: rgba(255, 255, 255, 0.2);
    background: #111827;
}

.clickable-box {
    cursor: pointer;
    transition: filter 0.3s ease;
}

.clickable-box:hover {
    filter: brightness(1.3) drop-shadow(0 0 20px rgba(255,255,255,0.1));
}

.click-hint {
    display: inline-block;
    margin-top: 1.5rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.clickable-box:hover .click-hint {
    opacity: 1;
    transform: translateX(5px);
}

.flip-card-front .metric {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.flip-card-front .label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.flip-card-back p {
    font-size: 0.9rem;
    color: #ddd;
    line-height: 1.5;
    margin: 0;
}

/* Lists */
.data-bullets {
    list-style: none;
    text-align: left;
    margin-top: 1rem;
}
.data-bullets li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    color: #ccc;
    font-weight: 300;
}
.data-bullets li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
    opacity: 0.5;
}

/* Achievements */
.ach-icon {
    font-size: 2.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.ach-desc {
    color: #ccc;
    font-size: 0.95rem;
    font-weight: 300;
}

/* Output Connect */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--line-faint);
    border-radius: 50px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.02);
}
.pulse-dot {
    width: 8px; height: 8px; background-color: #fff; border-radius: 50%;
    box-shadow: 0 0 10px #fff; animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.social-links-row {
    display: flex;
    gap: 3rem;
    margin-top: 2rem;
}
.social-links-row a {
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}
.social-links-row a:hover { opacity: 0.7; }
.footer { margin-top: 4rem; color: var(--text-secondary); font-size: 0.8rem;}

/* --- Chatbot --- */
.chatbot-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 1000; }
.chatbot-toggle { 
    width: 65px; height: 65px; 
    border-radius: 50%; 
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    backdrop-filter: blur(10px);
    color: #fff; 
    cursor: pointer; 
    font-size: 1.5rem; 
    transition: all 0.3s ease;
}
.chatbot-toggle:hover { 
    transform: scale(1.05); 
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(4, 11, 22, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.quick-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Space Grotesk', sans-serif;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}
.chatbot-container.closed .chatbot-window { opacity: 0; transform: scale(0.95) translateY(10px); pointer-events: none; }
.chatbot-header { padding: 1.2rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); display: flex; justify-content: space-between; align-items: center;}
.chatbot-title {font-family: 'Space Grotesk', sans-serif; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem;}
.status-dot { width: 6px; height: 6px; background-color: #00ff88; border-radius: 50%; box-shadow: 0 0 8px #00ff88;}
.chatbot-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1.2rem; transition: color 0.2s;}
.chatbot-close:hover { color: #fff; }
.chatbot-messages { flex: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.message { max-width: 85%; padding: 0.8rem 1rem; border-radius: 8px; font-size: 0.9rem; line-height: 1.5; font-weight: 300;}
.ai-message { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.05); align-self: flex-start; border-bottom-left-radius: 2px;}
.user-message { background: #fff; color: #111; align-self: flex-end; border-bottom-right-radius: 2px; font-weight: 500;}
.chatbot-input-area { padding: 1rem; display: flex; gap: 0.8rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
#chatbot-input { flex: 1; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 6px; padding: 0.8rem 1rem; color: white; outline: none; font-size: 0.9rem; transition: border-color 0.2s;}
#chatbot-input:focus { border-color: rgba(255, 255, 255, 0.3); }
#chatbot-send { width: 40px; height: 40px; border-radius: 6px; background: #fff; border: none; color: #111; cursor: pointer; transition: transform 0.2s;}
#chatbot-send:hover { transform: scale(1.05); }

/* --- HORIZONTAL GRID LAYERS (For Projects / Achievements) --- */
.horizontal-layer {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    margin: 15rem auto; /* Huge margins to stretch the neural network lines */
    width: 100%;
    max-width: 1000px;
}

.horizontal-layer .network-box {
    margin: 0 auto; 
    width: 100%;
    max-width: 100%;
}

/* --- Interactive Boxes --- */
.clickable-box {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.clickable-box:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
}
.clickable-box:hover::before {
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.modal-content {
    background: var(--bg-dark);
    background-image: radial-gradient(circle at top right, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    padding: 4rem;
    position: relative;
    transform: translateY(0) scale(1);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
}
.modal-overlay.hidden .modal-content {
    transform: translateY(30px) scale(0.95);
}
.modal-close {
    position: absolute;
    top: 2rem; right: 2rem;
    background: none; border: none;
    color: var(--text-secondary);
    font-size: 2.5rem; cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}
.modal-close:hover { 
    color: #fff; 
    transform: rotate(90deg);
}
.modal-body {
    color: #ddd;
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.8;
}

/* --- Scroll Navigation Bar --- */
.scroll-nav {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 100;
}
.scroll-dash-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    cursor: pointer;
}
.scroll-dash-label {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}
.scroll-dash-container:hover .scroll-dash-label,
.scroll-dash-container.active .scroll-dash-label {
    opacity: 1;
    transform: translateX(0);
}
.scroll-dash-container.active .scroll-dash-label {
    color: #fff;
    font-weight: 700;
}
.scroll-dash {
    width: 25px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.scroll-dash.active {
    width: 30px;
    background: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

/* --- Mobile Responsiveness (Standard View) --- */
.mobile-banner {
    display: none;
}

@media (max-width: 768px) {
    .mobile-banner {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
        background: rgba(255, 71, 87, 0.1);
        border: 1px solid rgba(255, 71, 87, 0.3);
        color: #ff4757;
        padding: 1rem;
        font-family: 'Space Grotesk', sans-serif;
        font-size: 0.85rem;
        text-align: center;
        margin: 1rem;
        border-radius: 8px;
    }

    #dom-network-canvas {
        display: none !important;
    }
    
    .portfolio-hero-title {
        display: none !important;
    }
    
    .story-timeline {
        padding: 20px 1rem 100px 1rem;
    }
    
    .network-box {
        padding: 2rem 1.5rem;
        width: 100%;
        margin-bottom: 3rem;
        background: rgba(20, 20, 20, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }
    
    .impact-flashcards {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .flip-card {
        width: 100%;
        height: 120px;
    }
    
    .modal-content {
        padding: 2rem;
        width: 95%;
    }
    
    .scroll-nav {
        display: none;
    }
    
    .layer-heading {
        font-size: 2rem;
    }
    
    .name-title {
        font-size: 1.8rem !important;
    }
}
.scroll-dash-container:hover .scroll-dash:not(.active) {
    background-color: rgba(255, 255, 255, 0.6);
    width: 35px;
}
@media (max-width: 768px) {
    .scroll-nav {
        right: 1rem;
        gap: 1rem;
    }
    .scroll-dash { width: 15px; }
    .scroll-dash.active { width: 25px; }
    .scroll-dash:hover:not(.active) { width: 20px; }
}
.modal-body p {
    margin-bottom: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .horizontal-layer {
        grid-template-columns: 1fr;
        gap: 15rem; /* Turn gap into the vertical margin on mobile */
    }
}
@media (max-width: 768px) {
    .modal-content {
        padding: 2rem;
    }
}
