/* Terminal-Inspired Portfolio - Polished, Professional Design */

:root {
    --bg: #000000;
    --bg-alt: #0a0e14;
    --bg-hover: #141920;
    --terminal-bg: #0d1117;
    --text: #c9d1d9;
    --text-dim: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --green: #3fb950;
    --green-glow: #3fb950;
    --yellow: #d29922;
    --amber: #f0883e;
    --red: #f85149;
    --border: #21262d;
    --border-light: #161b22;
    
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
    
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

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

html, body {
    height: 100%;
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    background: #0a0e14;
    background-image: 
        /* Desktop wallpaper pattern - geometric shapes */
        radial-gradient(circle at 25% 25%, rgba(63, 185, 80, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(88, 166, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(240, 136, 62, 0.05) 0%, transparent 60%),
        /* Grid pattern overlay */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.01) 100px,
            rgba(255, 255, 255, 0.01) 101px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.01) 100px,
            rgba(255, 255, 255, 0.01) 101px
        ),
        /* Subtle noise texture */
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.02) 2px,
            rgba(0, 0, 0, 0.02) 4px
        );
    background-size: 100% 100%, 100% 100%, 100% 100%, 100px 100px, 100px 100px, 4px 4px;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 1.5rem;
    margin: 0;
    max-width: 100vw;
    position: relative;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

/* Terminal Window */
.terminal {
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 3rem);
    margin: 0 auto;
    background: var(--terminal-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(63, 185, 80, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
    overflow: hidden;
    position: relative;
    z-index: 1;
    opacity: 0.95;
    backdrop-filter: blur(1px);
    display: flex;
    flex-direction: column;
}

.terminal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(63, 185, 80, 0.2) 20%,
        rgba(88, 166, 255, 0.15) 50%,
        rgba(63, 185, 80, 0.2) 80%,
        transparent
    );
    pointer-events: none;
    z-index: 2;
}

.terminal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 1px,
            rgba(0, 0, 0, 0.03) 1px,
            rgba(0, 0, 0, 0.03) 2px
        );
    pointer-events: none;
    opacity: 0.3;
    z-index: 1;
}

.terminal-header {
    background: linear-gradient(to bottom, var(--bg-alt), var(--terminal-bg));
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    position: relative;
    z-index: 2;
}

.terminal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(63, 185, 80, 0.15),
        transparent
    );
}

.terminal-title {
    color: #ffffff;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    font-weight: 500;
    text-align: center;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

.terminal-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Menu Section (Fixed at top) */
.menu-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-alt);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    font-family: var(--font-mono);
}

.menu-prompt {
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-family: var(--font-mono);
}

.menu-options {
    margin-top: 0.5rem;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.menu-item {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-family: var(--font-mono);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border-radius: 3px;
}

.menu-item:hover {
    background: var(--bg-hover);
    border-color: var(--green);
    box-shadow: 0 2px 8px rgba(63, 185, 80, 0.1);
}

.menu-item:active {
    opacity: 0.8;
}

.menu-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-number {
    color: var(--green);
    font-weight: 600;
    min-width: 1.25rem;
    text-shadow: 0 0 4px rgba(63, 185, 80, 0.3);
    font-family: var(--font-mono);
}

.menu-label {
    color: var(--text);
    font-family: var(--font-mono);
}

.menu-item:hover .menu-label {
    color: var(--green);
}

/* Output Section (Scrollable) */
.output-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.75rem;
    padding-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    min-height: 0;
}

.output-section::-webkit-scrollbar {
    width: 8px;
}

.output-section::-webkit-scrollbar-track {
    background: var(--bg-alt);
}

.output-section::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.output-section::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Terminal Output */
.output {
    font-family: var(--font-mono);
    position: relative;
    z-index: 2;
    min-height: 100%;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

.line {
    margin-bottom: 1.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

.prompt {
    color: var(--green);
    font-weight: 500;
    user-select: none;
    text-shadow: 0 0 6px rgba(63, 185, 80, 0.4);
    position: relative;
}

.command {
    color: var(--amber);
    font-weight: 400;
    text-shadow: 0 0 4px rgba(240, 136, 62, 0.2);
}

.cursor {
    color: var(--green);
    animation: blink 1s infinite;
    display: inline-block;
    margin-left: 2px;
    font-weight: 400;
    text-shadow: 0 0 8px rgba(63, 185, 80, 0.6);
    opacity: 1;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.3; }
}

.response {
    margin-left: 0;
    margin-top: 0.75rem;
    margin-bottom: 2.25rem;
    padding-left: 0;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    animation: fadeIn 0.4s ease-out;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* About Section */
.avatar-container {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-start;
    animation: fadeIn 0.4s ease-out;
}

.avatar-image {
    width: 120px;
    height: 120px;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    background: var(--bg-alt);
    transition: all 0.2s ease;
}

.avatar-image:hover {
    border-color: var(--green);
    box-shadow: 0 4px 12px rgba(63, 185, 80, 0.2);
}

.intro {
    color: var(--text);
    margin-bottom: 1.25rem;
    font-weight: 500;
    line-height: 1.6;
    font-family: var(--font-mono);
}

.response p {
    margin-bottom: 1rem;
    line-height: 1.75;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.response p:last-child {
    margin-bottom: 0;
}

.response p:first-of-type {
    color: var(--text);
}

.response a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
    text-shadow: 0 0 4px rgba(88, 166, 255, 0.2);
}

.response a:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
    text-shadow: 0 0 8px rgba(88, 166, 255, 0.4);
}

/* Projects List (ls -lh style) */
.projects-list {
    margin-top: 0.75rem;
    width: 100%;
    max-width: 100%;
    font-family: var(--font-mono);
}

.ls-line {
    margin-bottom: 0.5rem;
}

.ls-link {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.5rem 0;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    font-family: var(--font-mono);
}

.ls-link:hover {
    color: var(--accent);
}

.ls-perms {
    color: var(--text-dim);
    min-width: 10ch;
    font-family: var(--font-mono);
}

.ls-size {
    color: var(--text-dim);
    min-width: 5ch;
    text-align: right;
    font-family: var(--font-mono);
}

.ls-date {
    color: var(--text-dim);
    min-width: 12ch;
    font-family: var(--font-mono);
}

.ls-name {
    color: var(--accent);
    font-weight: 500;
    min-width: 0;
    flex: 1 1 auto;
    word-break: break-word;
    font-family: var(--font-mono);
    transition: color 0.2s ease;
}

.ls-link:hover .ls-name {
    color: var(--accent-hover);
    text-shadow: 0 0 4px rgba(88, 166, 255, 0.3);
}

.ls-desc {
    color: var(--text-dim);
    margin-left: 1rem;
    font-family: var(--font-mono);
}

/* Blog */
.blog-content {
    margin-top: 1rem;
    margin-left: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.blog-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    margin: 1.25rem 0;
    display: block;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.blog-image:hover {
    opacity: 0.9;
}

.blog-title {
    color: var(--text);
    font-weight: 400;
    font-size: 1em;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    font-family: var(--font-mono);
}

.blog-date {
    color: var(--text-dim);
    margin-bottom: 0;
    opacity: 0.8;
    font-family: var(--font-mono);
}

.blog-description {
    color: var(--text-dim);
    line-height: 1.75;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

.blog-read-more {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-mono);
    transition: color 0.2s ease;
}

.blog-read-more:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.blog-post-content {
    color: var(--text);
    line-height: 1.85;
    margin-top: 1.25rem;
    font-family: var(--font-mono);
}

.blog-post-content h3 {
    color: var(--text);
    font-weight: 400;
    margin: 2rem 0 1rem 0;
    font-size: 1em;
    font-family: var(--font-mono);
}

.blog-post-content h3:first-child {
    margin-top: 0;
}

.blog-post-content p {
    margin-bottom: 1.25rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.blog-post-content video {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    display: block;
}


.no-posts {
    color: var(--text-dim);
    font-style: italic;
    padding: 2rem 0;
}

/* Contact */
.copy-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-family: var(--font-mono);
    border-radius: 3px;
    margin-left: 0.75rem;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--bg-alt);
}

/* Active Prompt Section (Fixed at bottom) */
.prompt-section {
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border-light);
    background: var(--terminal-bg);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.line.active {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Responsive */

@media (max-width: 768px) {
    body {
        padding: 0.75rem 0.5rem;
    }
    
    .terminal-body {
        height: calc(100vh - 80px);
        min-height: 600px;
        max-height: 90vh;
    }
    
    .menu-section {
        padding: 1rem;
    }
    
    .output-section {
        padding: 1.25rem;
        padding-bottom: 0.5rem;
    }
    
    .prompt-section {
        padding: 0.75rem 1.25rem;
    }
    
    .blog-image {
        max-width: 100%;
    }
    
    .ls-link {
        gap: 0.5rem;
        flex-direction: row;
    }
    
    .ls-perms,
    .ls-size,
    .ls-date {
        min-width: auto;
        flex-shrink: 0;
        flex-grow: 0;
    }
    
    .ls-name {
        width: 100%;
        flex: 0 0 100%;
        margin-top: 0.5rem;
        order: 10;
    }
    
    .ls-desc {
        margin-left: 0;
        width: 100%;
        flex: 0 0 100%;
        margin-top: 0.25rem;
        order: 20;
    }
    
    .line {
        margin-bottom: 1.5rem;
    }
    
    .response {
        margin-bottom: 2rem;
    }
    
    .menu-item {
        padding: 0.6rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .terminal-body {
        padding: 1rem;
    }
}

/* Focus states */
*:focus-visible {
    outline: 1px solid var(--border);
    outline-offset: 1px;
    border-radius: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 1px;
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease-out;
}

.image-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
}

.image-modal-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.image-modal-content > * {
    pointer-events: auto;
}

.image-modal-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: var(--font-mono);
}

.image-modal-close:hover {
    background: var(--bg-alt);
    border-color: var(--accent);
    color: var(--accent);
}

.image-modal-img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-modal-caption {
    margin-top: 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
    text-align: center;
    max-width: 600px;
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--bg);
}

::-moz-selection {
    background: var(--accent);
    color: var(--bg);
}
