:root {
    --bg: #F8F7F4;
    --bg-alt: #EFEDE8;
    --text: #1A1A1A;
    --text-muted: #5C5C5C;
    --accent: #2D4A3E;
    --accent-light: #3D6B5A;
    --border: #D8D4CC;
    --card: #FFFFFF;
    --serif: 'Playfair Display', Georgia, serif;
    --sans: 'DM Sans', -apple-system, sans-serif;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: inherit;
    text-decoration: none;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1000;
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 48px;
    background: rgba(248, 247, 244, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, padding 0.3s;
}

.nav.scrolled {
    padding: 16px 48px;
    border-color: var(--border);
}

.nav-logo {
    font-family: var(--serif);
    font-size: 20px;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav-links a {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.2s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}

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

.nav-links a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 102;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav-links a.nav-cta {
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    margin-left: 8px;
}

.nav-links a.nav-cta:hover {
    background: var(--accent-light);
    color: white;
}

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 120px 48px 80px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(45, 74, 62, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards;
    animation-delay: 0.2s;
}

.hero-name {
    font-family: var(--serif);
    font-size: clamp(48px, 10vw, 120px);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 32px;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards;
    animation-delay: 0.4s;
}

.hero-tagline {
    font-size: 18px;
    font-weight: 300;
    color: var(--text-muted);
    max-width: 540px;
    line-height: 1.7;
    margin-bottom: 48px;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards;
    animation-delay: 0.6s;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: var(--accent);
    color: white;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards;
    animation-delay: 0.8s;
}

.hero-cta:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(45, 74, 62, 0.2);
}

.hero-cta svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.hero-cta:hover svg {
    transform: translateX(4px);
}

.hero-scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
    animation-delay: 1.2s;
}

.hero-scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, var(--border), transparent);
    animation: scrollPulse 2s ease infinite;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

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

.stats {
    background: var(--accent);
    color: white;
    padding: 80px 48px;
}

.stats-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
}

.stat {
    text-align: center;
    position: relative;
}

.stat:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
}

.stat-number {
    font-family: var(--serif);
    font-size: 64px;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.8;
}

.intro {
    padding: 100px 48px;
    max-width: 900px;
    margin: 0 auto;
}

.intro-text {
    font-family: var(--serif);
    font-size: clamp(24px, 3.5vw, 36px);
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--text);
}

.intro-text em {
    font-style: italic;
    color: var(--accent);
}

.work {
    padding: 80px 48px 120px;
    background: var(--bg-alt);
}

.section-header {
    max-width: 1200px;
    margin: 0 auto 60px;
}

.section-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
    display: block;
}

.section-title {
    font-family: var(--serif);
    font-size: clamp(36px, 5vw, 48px);
    letter-spacing: -0.02em;
}

.work-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

.work-card {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 40px;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.work-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0;
    background: var(--accent);
    transition: height 0.4s ease;
}

.work-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.work-card:hover::before {
    height: 100%;
}

.work-company {
    font-family: var(--serif);
    font-size: 28px;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.work-role {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.work-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-muted);
}

.work-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.work-tag {
    padding: 8px 16px;
    background: var(--bg-alt);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.ai {
    padding: 120px 48px;
    background: var(--card);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    scroll-margin-top: -80px;
}

.ai-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.ai-title {
    font-family: var(--serif);
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.ai-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.chat-window {
    background: var(--bg);
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    height: 500px;
    text-align: left;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-welcome p {
    margin-bottom: 24px;
    font-size: 15px;
}

.prompt-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.prompt-chip {
    padding: 10px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.prompt-chip:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar {
    background: var(--accent);
    color: white;
}

.chat-message.assistant .chat-avatar {
    background: var(--border);
    color: var(--text);
}

.chat-bubble {
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.6;
    border-radius: 12px;
}

.chat-bubble p {
    margin: 0 0 12px 0;
}

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

.chat-bubble strong {
    font-weight: 600;
}

.chat-bubble ol,
.chat-bubble ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-bubble li {
    margin-bottom: 6px;
}

.chat-bubble h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.chat-bubble h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0 8px 0;
    color: var(--text-muted);
}

.chat-bubble h4:first-child {
    margin-top: 0;
}

.chat-bubble code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
}

.chat-message.user .chat-bubble {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-message.assistant.error .chat-bubble {
    border-color: #c53030;
    color: #c53030;
}

.chat-message.typing .chat-bubble {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.chat-input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    background: var(--card);
    height: 52px;
    overflow-y: auto;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-submit {
    width: 52px;
    height: 52px;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-submit:hover {
    background: var(--accent-light);
}

.chat-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-submit svg {
    width: 20px;
    height: 20px;
    color: white;
}

.chat-new {
    width: 52px;
    height: 52px;
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.chat-new:hover {
    background: var(--surface);
    border-color: var(--text-muted);
}

.chat-new svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.chat-new,
.chat-submit {
    position: relative;
}

.chat-new::after,
.chat-submit::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #FFFFFF;
    border: 1px solid #D8D4CC;
    border-radius: 4px;
    color: #1A1A1A;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-new:hover::after,
.chat-submit:hover::after,
.chat-new:focus::after,
.chat-submit:focus::after {
    opacity: 1;
    visibility: visible;
}

.tech {
    padding: 100px 48px;
    background: var(--bg);
}

.tech-container {
    max-width: 1200px;
    margin: 0 auto;
}

.tech-header {
    margin-bottom: 60px;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
}

.tech-category h3 {
    font-family: var(--serif);
    font-size: 24px;
    letter-spacing: -0.01em;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tech-tag {
    padding: 10px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.contact {
    padding: 120px 48px;
    background: var(--text);
    color: white;
    text-align: center;
}

.contact-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
}

.contact-title {
    font-family: var(--serif);
    font-size: clamp(36px, 6vw, 64px);
    letter-spacing: -0.02em;
    margin-bottom: 48px;
}

.contact-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 48px;
    flex-wrap: wrap;
}

.contact-email {
    font-size: 16px;
    color: white;
    transition: color 0.3s;
}

.contact-email:hover {
    color: white;
}

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

.contact-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid white;
    color: white;
    transition: all 0.3s ease;
}

.contact-icon:hover {
    background: white;
    color: var(--text);
    border-color: white;
}

.contact-icon svg {
    width: 20px;
    height: 20px;
}

.contact-cv {
    padding: 16px 32px;
    background: transparent;
    color: white;
    border: 1px solid white;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact-cv:hover {
    background: white;
    color: var(--text);
    border-color: white;
}

.footer {
    padding: 24px 48px;
    background: var(--text);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    font-size: 13px;
    color: white;
}

.footer-location {
    font-size: 13px;
    color: white;
}

@media (max-width: 680px) {
    .nav {
        padding: 16px 24px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        max-width: 320px;
        height: 100vh;
        background: var(--bg);
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 0;
        padding: 80px 48px;
        transform: translateX(100%);
        transition: transform 0.4s ease;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
        z-index: 101;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-links a {
        font-size: 32px;
        font-family: var(--serif);
        text-transform: none;
        letter-spacing: 0;
        padding: 16px 0;
        color: var(--text);
    }

    .nav-links a::after {
        bottom: 12px;
    }

    .nav-links a.nav-cta {
        margin-left: 0;
        padding: 16px 0 28px;
        background: none;
        font-family: var(--serif);
        font-size: 32px;
        font-style: normal;
        text-transform: none;
        letter-spacing: 0;
        color: var(--accent);
    }

    .nav-links a.nav-cta::after {
        width: 100%;
        bottom: 20px;
        background: var(--accent);
    }

    .nav-links a.nav-cta:hover {
        background: none;
        color: var(--text);
    }

    .hero {
        padding: 100px 24px 60px;
    }

    .stats {
        padding: 60px 24px;
    }

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

    .stat:not(:last-child)::after {
        display: none;
    }

    .intro {
        padding: 60px 24px;
    }

    .work {
        padding: 60px 24px 80px;
    }

    .section-header {
        margin-bottom: 40px;
    }

    .work-card {
        padding: 28px;
    }

    .ai {
        padding: 80px 24px 32px;
    }

    .chat-window {
        height: 55vh;
        min-height: 400px;
    }

    .chat-message {
        max-width: 100%;
        gap: 0;
    }

    .chat-avatar {
        display: none;
    }

    .chat-input-area {
        padding: 12px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .chat-input {
        order: -1;
        width: 100%;
        flex: none;
        font-size: 16px;
        height: 48px;
    }

    .chat-new,
    .chat-submit {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }

    .chat-new::after,
    .chat-submit::after {
        display: none;
    }

    .tech {
        padding: 60px 24px;
    }

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

    .contact {
        padding: 80px 24px;
    }

    .contact-row {
        flex-direction: column;
        gap: 32px;
    }

    .footer {
        flex-direction: column;
        gap: 12px;
        padding: 24px;
        text-align: center;
    }
}

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

    .stat-number {
        font-size: 48px;
    }

    .work-company {
        font-size: 22px;
    }

    .prompt-chips {
        gap: 8px;
    }

    .prompt-chip {
        padding: 8px 12px;
        font-size: 12px;
    }

    .chat-window {
        height: 50vh;
        min-height: 350px;
    }
}
