/* ========================================
   Sergej Steinsiek - Portfolio
   ======================================== */

:root {
    --bg: #0a0a0f;
    --bg-alt: #0f0f17;
    --surface: #161622;
    --border: #1e1e2e;
    --text: #e4e4ef;
    --text-dim: #6b6b80;
    --text-muted: #44445a;
    --accent: #60a5fa;
    --accent-dim: rgba(96, 165, 250, 0.1);
    --accent-glow: rgba(96, 165, 250, 0.15);
    --green: #4ade80;
    --red: #f87171;
    --yellow: #fbbf24;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --max-width: 1080px;
    --nav-height: 60px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Navigation ---- */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    z-index: 100;
    transition: border-color 0.3s;
}

.nav.scrolled {
    border-bottom-color: var(--border);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-logo {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.nav-logo:hover {
    color: var(--accent);
    opacity: 1;
}

.nav-links {
    display: flex;
    gap: 32px;
    margin-left: auto;
}

.nav-links a {
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
    opacity: 1;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    overflow: hidden;
    flex-shrink: 0;
}

.lang-toggle span {
    padding: 5px 12px;
    color: var(--text-muted);
    transition: color 0.2s, background 0.2s;
}

.lang-toggle span:first-child {
    border-right: 1px solid var(--border);
}

.lang-toggle span.active {
    color: var(--bg);
    background: var(--accent);
}

.lang-toggle span:not(.active):hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.lang-toggle:hover {
    border-color: var(--text-dim);
}

/* ---- Hero ---- */

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    position: relative;
}

.hero-terminal {
    width: 100%;
    max-width: 620px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red { background: var(--red); }
.terminal-dot.yellow { background: var(--yellow); }
.terminal-dot.green { background: var(--green); }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-left: auto;
    margin-right: auto;
}

.terminal-body {
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 2;
    word-break: break-word;
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 1.8em;
}

.prompt {
    color: var(--green);
    font-weight: 700;
    user-select: none;
}

.typed {
    color: var(--text);
    font-weight: 500;
}

.cursor {
    color: var(--accent);
    animation: blink 1s step-end infinite;
    font-weight: 700;
}

@keyframes blink {
    50% { opacity: 0; }
}

.terminal-output {
    font-size: 0.875rem;
    padding-left: 22px;
}

.output-accent {
    color: var(--accent);
    font-weight: 600;
}

.output-dim {
    color: var(--text-dim);
}

.hero-scroll {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--text-muted), transparent);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
    50% { opacity: 1; transform: scaleY(1); }
}

/* ---- Sections ---- */

.section {
    padding: 100px 0;
}

.section-alt {
    background: var(--bg-alt);
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 40px;
    position: relative;
    padding-left: 20px;
}

.section-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 2px;
}

.section-subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-top: -24px;
    margin-bottom: 40px;
    max-width: 560px;
}

/* ---- About ---- */

.about-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 60px;
    align-items: start;
}

.about-text p {
    margin-bottom: 20px;
    color: var(--text);
    font-size: 0.95rem;
}

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

.about-text strong {
    color: var(--accent);
    font-weight: 600;
}

.about-facts {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid var(--border);
    padding-left: 24px;
}

.fact {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.fact:last-child {
    border-bottom: none;
}

.fact-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.fact-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

/* ---- Projects ---- */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    min-height: 200px;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.3s;
}

.project-card:hover {
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 8px 32px rgba(96, 165, 250, 0.06);
}

.project-card:hover::before {
    opacity: 1;
}

.project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-name {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.project-links {
    display: flex;
    gap: 10px;
}

.project-links a {
    color: var(--text-dim);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.project-links a:hover {
    color: var(--accent);
    opacity: 1;
}

.project-links svg {
    width: 18px;
    height: 18px;
}

.project-desc {
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.6;
    flex: 1;
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.project-lang {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}

.lang-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.project-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.project-stat svg {
    width: 14px;
    height: 14px;
}

.project-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.topic-pill {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 3px 10px;
    border-radius: 100px;
    letter-spacing: 0.02em;
}

.projects-loading {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 60px 0;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: loadBounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---- Tech Stack ---- */

.stack-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

.stack-group-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.stack-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stack-item {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    transition: border-color 0.2s, transform 0.2s;
    position: relative;
    padding-left: 28px;
}

.stack-item::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dot-color, var(--text-dim));
}

.stack-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ---- Contact ---- */

.contact-text {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 36px;
    max-width: 480px;
}

.contact-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 14px 24px;
    border-radius: 10px;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.contact-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.contact-link:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: translateY(-2px);
    opacity: 1;
}

/* ---- Footer ---- */

.footer {
    padding: 32px 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ---- Animations ---- */

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .nav-links {
        gap: 20px;
    }

    .nav-links a {
        font-size: 0.8rem;
    }

    .hero-terminal {
        max-width: 100%;
    }

    .terminal-body {
        font-size: 0.85rem;
        padding: 18px;
    }

    .section {
        padding: 70px 0;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .about-facts {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border);
        padding-top: 24px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .stack-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .contact-links {
        flex-direction: column;
    }

    .contact-link {
        justify-content: center;
    }

    .section-subtitle {
        max-width: 100%;
    }

    .project-card {
        padding: 20px;
    }

    .contact-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-links {
        display: none;
    }

    .lang-toggle {
        margin-left: auto;
    }

    .terminal-body {
        font-size: 0.78rem;
        padding: 14px;
    }

    .terminal-output {
        font-size: 0.75rem;
    }

    .section-label {
        font-size: 0.7rem;
        margin-bottom: 28px;
    }

    .container {
        padding: 0 16px;
    }

    .nav-inner {
        padding: 0 16px;
    }

    .hero {
        min-height: auto;
        padding: 100px 16px 60px;
    }

    .hero-scroll {
        display: none;
    }

    .section {
        padding: 50px 0;
    }

    .section-subtitle {
        font-size: 0.85rem;
        margin-bottom: 28px;
    }

    .about-text p {
        font-size: 0.9rem;
    }

    .project-card {
        padding: 18px;
        gap: 10px;
    }

    .project-name {
        font-size: 0.95rem;
    }

    .project-desc {
        font-size: 0.8rem;
    }

    .contact-text {
        font-size: 0.95rem;
    }

    .contact-link {
        padding: 12px 18px;
        font-size: 0.8rem;
    }

    .footer {
        padding: 24px 0;
    }
}
