/* ── Minimalist Portfolio Styles (Sofia Bodnar inspired) ─────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
    /* Dark Theme (Default) */
    --bg: #000000;
    --text: #ffffff;
    --text-muted: #888888;
    --text-dim: #555555;
    --accent: #ffffff;
    --border: #222222;
    --bg-glass: rgba(0, 0, 0, 0.7);
    --bg-glass-hover: rgba(25, 25, 25, 0.9);
    --bg-glass-expanded: rgba(0, 0, 0, 0.95);
    --bg-glass-min: rgba(0, 0, 0, 0.9);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-border-focus: rgba(255, 255, 255, 0.3);
    --send-bg: #fff;
    --send-color: #000;
    --msg-ai-bg: #333;
    --msg-user-bg: #555;
    --pill-bg: transparent;
    --pill-hover-bg: rgba(255, 255, 255, 0.1);
    --pill-active-bg: #fff;
    --pill-active-color: #000;
    --aura-color: rgba(255, 255, 255, 0.15);
    
    --font-sans: 'Inter', -apple-system, sans-serif;
    --transition: 0.2s ease;
}

[data-theme="light"] {
    --bg: #f8f9fa;
    --text: #1a1a1a;
    --text-muted: #666666;
    --text-dim: #888888;
    --accent: #000000;
    --border: #e0e0e0;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-hover: rgba(240, 240, 240, 0.9);
    --bg-glass-expanded: rgba(255, 255, 255, 0.95);
    --bg-glass-min: rgba(255, 255, 255, 0.9);
    --input-bg: rgba(0, 0, 0, 0.05);
    --input-border: rgba(0, 0, 0, 0.1);
    --input-border-focus: rgba(0, 0, 0, 0.3);
    --send-bg: #000;
    --send-color: #fff;
    --msg-ai-bg: #e0e0e0;
    --msg-user-bg: #d0d0d0;
    --pill-bg: transparent;
    --pill-hover-bg: rgba(0, 0, 0, 0.05);
    --pill-active-bg: #000;
    --pill-active-color: #fff;
    --aura-color: rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden; /* Prevent scrolling on body, scroll inside content */
    transition: background-color 0.4s ease, color 0.4s ease;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--text-muted); }



/* ── LAYOUT ── */
.layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    padding-bottom: 80px; /* Space for bottom chat bar */
}

/* ── LEFT: CONTENT ── */
.content {
    flex: 1;
    max-width: 600px;
    padding: 60px 40px;
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    position: relative;
    z-index: 10;
}
.content::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome */

/* Header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}
.name {
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.uw {
    color: var(--text-dim);
}

.socials {
    display: flex;
    gap: 16px;
    font-size: 1.2rem;
    align-items: center;
}

/* Theme Toggle & Buttons */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    padding: 4px;
}
.icon-btn:hover { 
    color: var(--text); 
    transform: scale(1.1);
}
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* Tabs */
.tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}
.tab {
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: color var(--transition);
}
.tab:hover {
    color: var(--text-muted);
}
.tab.active {
    color: var(--text);
}
.tab.active::before {
    content: "•";
    position: absolute;
    left: -12px;
    color: var(--text);
}

/* Tab Content */
.tab-content {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.tab-content.exiting {
    display: block;
    opacity: 0;
    transform: translateY(-10px);
}

/* Entries (Work, Projects, etc) */
.entry {
    margin-bottom: 32px;
}
.entry h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 4px;
}
.entry .date {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 8px;
}
.entry .desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Specific styling */
.badge {
    font-size: 0.75rem;
    background: var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: normal;
}
.entry-link:hover h3 {
    text-decoration: underline;
}
.pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.pills span, .filter-pill {
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 16px;
    background: var(--pill-bg);
    cursor: default;
}
.filter-pill {
    cursor: pointer;
    transition: all 0.2s;
}
.filter-pill:hover {
    background: var(--pill-hover-bg);
    color: var(--text);
}
.filter-pill.active {
    background: var(--pill-active-bg);
    color: var(--pill-active-color);
    border-color: var(--pill-active-bg);
}

.about-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 16px;
    filter: grayscale(100%);
    transition: filter 0.3s;
}
.about-photo:hover {
    filter: grayscale(0%);
}

/* Work Experience */
.exp-entry {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
    align-items: flex-start;
}
.exp-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    background: #111;
    padding: 4px;
    flex-shrink: 0;
}
.exp-content h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.exp-content .date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
}
.exp-content .desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}
.sub-exp {
    margin-top: 16px;
    border-left: 1px solid var(--border);
    padding-left: 16px;
}
.sub-exp h4 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}
.sub-exp ul.desc {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 8px;
}
.sub-exp ul.desc li {
    margin-bottom: 4px;
}
.skills-used {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Project Filtering & Search */
.project-controls {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.search-wrapper {
    position: relative;
    width: 100%;
}
.search-input {
    width: 100%;
    padding: 10px 16px 10px 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: var(--input-border-focus);
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Projects Gallery - Single column, uniform height, hover overlay */
.project-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.project-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    display: block;
    height: 200px;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.project-card.hidden {
    display: none;
}
.project-card.tall,
.project-card.normal {
    height: 200px;
}
.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}
.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72); /* Always dark overlay for contrast against image */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 18px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.project-card:hover .project-img {
    transform: scale(1.04);
}
.project-card:hover .project-overlay {
    opacity: 1;
}
.project-overlay h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
}
.project-overlay .date {
    font-size: 0.74rem;
    color: #bbb;
    margin-bottom: 6px;
}
.project-overlay .desc {
    font-size: 0.82rem;
    color: #aaa;
    line-height: 1.45;
}

/* ── Blog Section ── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.blog-card {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: background 0.2s, transform 0.2s, opacity 0.2s;
    text-decoration: none;
    background: var(--input-bg);
    overflow: hidden;
}
.blog-card.hidden {
    display: none;
}
.blog-card:hover {
    background: var(--pill-hover-bg);
    transform: translateY(-2px);
}
.blog-image-wrap {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--border);
}
.blog-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.blog-card:hover .blog-image-wrap img {
    transform: scale(1.04);
}
.blog-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}
.blog-card .date {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.blog-card h3 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}
.blog-card .desc {
    font-size: 0.82rem;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── RIGHT: 3D CANVAS ── */
.tower-side {
    flex: 1.2;
    position: relative;
    border-left: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #111 0%, #000 70%);
    transition: background 0.4s ease;
    cursor: grab;
}
.tower-side:active {
    cursor: grabbing;
}

[data-theme="light"] .tower-side {
    background: radial-gradient(circle at center, #e8e8e8 0%, #d0d0d0 70%);
}

.tower-canvas {
    width: 100%;
    height: 100%;
    outline: none;
    position: relative;
    z-index: 1;
}

/* ── BOTTOM CHAT BAR (ChatGPT style, resizable) ── */
.chat-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.3s;
}

/* Resize Handle */
.resize-handle {
    width: 100%;
    height: 12px;
    cursor: ns-resize;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: -6px;
    z-index: 101;
}
.handle-bar {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    transition: background 0.2s;
}
.resize-handle:hover .handle-bar, .chat-bar.dragging .handle-bar {
    background: var(--text-muted);
}

.chat-inner {
    width: 100%;
    max-width: 800px;
    padding: 16px 40px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.chat-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.chat-controls .icon-btn svg {
    fill: none;
}

/* Status */
.chat-status {
    display: flex;
    align-items: center;
    gap: 12px;
}
.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.status-badge.loading { color: #d97706; }
.status-badge.ready { color: #16a34a; }
.status-badge.error { color: #dc2626; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dot.pulse { animation: blink 1s infinite; }

.progress-bar-container {
    width: 100%;
    height: 2px;
    background: var(--border);
    margin-bottom: 12px;
    display: none;
    position: relative;
}
.progress-bar-container.visible { display: block; }
.prog-fill { height: 100%; width: 0%; background: currentColor; transition: width 0.2s; }
.prog-pct {
    position: absolute;
    right: 0;
    top: -16px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Model Loading Overlay — replaces input while downloading */
.model-loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 0 4px;
}
.model-loading-overlay .load-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}
.model-loading-bar-wrap {
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.model-loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--text-dim), var(--text-muted));
    border-radius: 99px;
    transition: width 0.3s ease;
}
.model-loading-pct {
    font-size: 0.7rem;
    font-family: monospace;
    color: var(--text-dim);
}

/* Chat Messages Area - This takes up available height when expanded */
.chat-messages {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    margin-bottom: 16px;
    display: none; /* Hidden until first message */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding-right: 10px;
}
.chat-messages.has-content { display: block; }
#messages { display: flex; flex-direction: column; gap: 16px; }

/* State Modifiers */
.chat-bar.expanded {
    background: var(--bg-glass-expanded);
    height: 85vh !important;
}

.chat-bar.minimized {
    height: 48px !important;
    overflow: hidden;
    background: var(--bg-glass-min);
    cursor: pointer;
}
.chat-bar.minimized .chat-inner {
    padding: 0 40px;
    justify-content: center;
}
.chat-bar.minimized .chat-bar-header {
    margin-bottom: 0;
    height: 100%;
}
.chat-bar.minimized .chat-messages,
.chat-bar.minimized .chat-input-wrap,
.chat-bar.minimized .chat-meta,
.chat-bar.minimized .progress-bar-container,
.chat-bar.minimized #chat-min-btn {
    display: none !important;
}
.chat-bar.minimized:hover {
    background: var(--bg-glass-hover);
}

/* Messages */
.msg {
    display: flex;
    gap: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: msgIn 0.2s ease;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }
.msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background: var(--msg-ai-bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: bold;
    flex-shrink: 0;
}
[data-theme="light"] .msg-avatar { color: #000; }
.msg.user .msg-avatar { background: var(--msg-user-bg); }
.msg-bubble {
    max-width: 80%;
    color: var(--text);
    white-space: pre-wrap;
}

.thinking-dots { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.thinking-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); animation: bounce 0.6s infinite alternate; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { from { transform: translateY(0); opacity: 0.5; } to { transform: translateY(-4px); opacity: 1; } }

/* Input */
.chat-input-wrap {
    width: 100%;
    max-width: 800px;
    position: relative;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    display: flex;
    align-items: flex-end;
    padding: 8px 12px;
    transition: border-color 0.2s;
}
.chat-input-wrap:focus-within {
    border-color: var(--input-border-focus);
}

#msg-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 4px 8px;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 24px;
}
#msg-input::placeholder {
    color: var(--text-muted);
}
#send-btn {
    background: var(--send-bg);
    color: var(--send-color);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-left: 8px;
    margin-bottom: 2px;
}
#send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
#send-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

/* Status */
.chat-status {
    width: 100%;
    max-width: 800px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.chat-meta {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 8px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        overflow-y: auto;
        padding-bottom: 40px;
    }
    .tower-side {
        min-height: 280px;
        max-height: 280px;
        border-left: none;
        border-bottom: 1px solid var(--border);
        order: -1;
    }
    body { overflow: auto; }
    .content { padding: 30px 20px; overflow-y: visible; }
    .chat-bar { display: none !important; }
    body { padding-bottom: 0 !important; }
    .blog-grid {
        grid-template-columns: 1fr;
    }
    .project-card.tall,
    .project-card.normal {
        aspect-ratio: 4 / 3;
        height: auto;
    }
    .site-header {
        flex-direction: column;
        gap: 16px;
    }
    .tabs {
        gap: 12px;
    }
    .socials {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .tower-side {
        min-height: 220px;
        max-height: 220px;
    }
    .blog-grid {
        grid-template-columns: 1fr;
    }
}