:root {
    /* Color Palette - Based on Logo */
    --primary-color: #2D5BA3;
    --primary-light: #4A82D1;
    --primary-dark: #1E3F72;
    --accent-color: #5BC0EB;
    
    /* Neutral Colors - Laboratory Aesthetic */
    --bg-color: #FFFFFF;
    --section-bg: #F8FAFC;
    --text-color: #1E293B;
    --text-light: #64748B;
    --border-color: #E2E8F0;
    
    /* Typography */
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 8rem;
    
    /* Effects */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-color);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

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

ul {
    list-style: none;
}

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

/* Header & Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.lang-switcher button {
    font-size: 0.9rem;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.lang-switcher button:hover {
    background-color: var(--section-bg);
}

.logo img {
    height: 40px;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
}

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

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: radial-gradient(circle at center, #f0f7ff 0%, #ffffff 100%);
    padding-top: 80px;
}

.hero-content h1 {
    font-size: 4rem;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-dark);
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto var(--spacing-lg);
}

/* Sections General */
section {
    padding: var(--spacing-xl) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.section-title h2 {
    font-size: 2.5rem;
    color: var(--primary-dark);
    margin-bottom: var(--spacing-sm);
}

.section-title .underline {
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin: 0 auto;
}

/* History Section */
.history {
    background-color: var(--section-bg);
}

.history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.history-text h3 {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

.history-image {
    position: relative;
    border: 1px solid var(--border-color);
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Portfolio Section */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-lg);
}

.project-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-md);
}

.project-img {
    height: 250px;
    background-color: #f1f5f9;
    background-size: cover;
    background-position: center;
}

.project-info {
    padding: var(--spacing-md);
}

.project-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--section-bg);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

/* Contact Section */
.contact {
    background: var(--primary-dark);
    color: white;
    text-align: center;
}

.contact h2 {
    color: white;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.contact-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.contact-link i {
    font-size: 2rem;
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Email Popup */
.contact-link {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    color: white;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
    position: relative;
}

.contact-link:hover {
    opacity: 0.8;
}

.email-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    min-width: 180px;
    z-index: 100;
}

.email-popup.open {
    display: block;
    animation: popupFadeIn 0.2s ease;
}

@keyframes popupFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.email-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-main);
    background: white;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: background 0.2s;
}

.email-option:hover {
    background: var(--section-bg);
    color: var(--primary-color);
}

.email-option i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.contact-links {
    position: relative;
}

/* ─── Nav Right (wrapper) ─── */
.nav-right {
    display: flex;
    align-items: center;
    gap: 0;
}

/* ─── Hamburger Button ─── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: 16px;
    z-index: 1100;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger → X animation */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Tablet (max 1024px) ─── */
@media (max-width: 1024px) {
    .nav-links {
        gap: var(--spacing-md);
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-content h1 {
        font-size: 3rem;
    }
}

/* ─── Mobile (max 768px) ─── */
@media (max-width: 768px) {

    /* Container padding */
    .container {
        padding: 0 1.25rem;
    }

    /* ── Nav ── */
    .hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        background: rgba(255,255,255,0.97);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        gap: 0;
        padding: 1rem 0 2rem;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-md);
        z-index: 999;
    }

    .nav-links.open {
        display: flex;
        animation: slideDown 0.3s ease;
    }

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

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 1rem;
        font-size: 1.1rem;
        font-weight: 500;
        color: var(--text-color);
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links a:hover {
        background: var(--section-bg);
        color: var(--primary-color);
    }

    /* ── Hero ── */
    .hero-content h1 {
        font-size: 2.2rem;
    }

    .hero-content p {
        font-size: 1rem;
        padding: 0 1rem;
    }

    /* ── Sections ── */
    section {
        padding: 4rem 0;
    }

    .section-title {
        margin-bottom: 3rem;
    }

    .section-title h2 {
        font-size: 2rem;
    }

    /* ── History ── */
    .history-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .history-text h3 {
        font-size: 1.5rem;
    }

    /* ── Portfolio ── */
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .project-img {
        height: 200px;
    }

    /* ── Contact ── */
    .contact-links {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: center;
    }

    /* Email popup: abre para cima centralizado */
    .email-popup {
        left: 50%;
        transform: translateX(-50%);
        min-width: 200px;
    }

    /* ── Logo ── */
    .logo {
        font-size: 1.2rem;
        gap: 0.5rem;
    }
}

/* ─── Small Mobile (max 480px) ─── */
@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 0.95rem;
    }

    .section-title h2 {
        font-size: 1.6rem;
    }

    .history-text h3 {
        font-size: 1.3rem;
    }

    .project-info {
        padding: 1.25rem;
    }

    .logo span {
        font-size: 1.1rem;
    }
}
