/* =========================
   VARIÁVEIS & TEMA
   ========================= */

:root {
    /* Light theme (default) */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #f1f5f9;
    --accent: #f59e42;
    --text: #22223b;
    --bg: #fff;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.07);
    --transition: 0.2s cubic-bezier(.4, 0, .2, 1);
    --card-bg: #fff;
    --hero-gradient: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* Dark theme */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-dark: #2563eb;
    --secondary: #1e293b;
    --accent: #fbbf24;
    --text: #f1f5f9;
    --bg: #18181b;
    --border: #334155;
    --shadow: 0 2px 16px 0 rgba(30, 58, 138, 0.18);
    --card-bg: #27272a;
    --hero-gradient: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
}

/* Auto dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #60a5fa;
        --primary-dark: #2563eb;
        --secondary: #1e293b;
        --accent: #fbbf24;
        --text: #f1f5f9;
        --bg: #18181b;
        --border: #334155;
        --shadow: 0 2px 16px 0 rgba(30, 58, 138, 0.18);
        --card-bg: #27272a;
        --hero-gradient: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
    }
}

/* =========================
   ESTILOS BASE (MOBILE FIRST)
   ========================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    line-height: 1.6;
    font-size: 16px;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
}

.container {
    width: 95%;
    max-width: 320px;
    margin: 0 auto;
    padding: 0 0.5rem;
}

/* =========================
   ACESSIBILIDADE
   ========================= */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    z-index: 1000;
    transition: left 0.2s, background var(--transition);
    font-weight: 600;
    font-size: 14px;
}

.skip-link:focus {
    left: 8px;
    background: var(--primary-dark);
}

/* =========================
   HEADER & NAVEGAÇÃO
   ========================= */

.main-header {
    background: var(--secondary);
    box-shadow: var(--shadow);
    padding: 0.4rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition);
    border-bottom: 2px solid var(--border);
}

.header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
}

.header-logo img {
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    background: var(--card-bg);
    width: 40px;
    height: 40px;
    max-width: 48px;
}

/* Menu Mobile */
.mobile-menu-button {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: inherit;
    z-index: 1001;
}

/* Navegação Desktop */
.main-nav .nav-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    z-index: 1000;
    list-style: none;
    gap: 2rem;
}

.main-nav .nav-list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 1.4rem;
    display: block;
    border-bottom: 2px solid transparent;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.main-nav .nav-list a:hover,
.main-nav .nav-list a:focus {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

/* =========================
   SEÇÃO HERO
   ========================= */

.hero-section {
    background: var(--hero-gradient);
    color: #fff;
    padding: 2rem 0 1.5rem 0;
    box-shadow: 0 4px 32px rgba(37, 99, 235, 0.08);
    transition: background var(--transition);
}

.hero-flex {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.hero-text {
    order: 2;
}

.hero-text h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.hero-text h1 span {
    color: var(--accent);
}

.hero-text p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    opacity: 0.95;
    line-height: 1.5;
}

.cta-button {
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    width: 100%;
    max-width: 280px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(245, 158, 66, 0.12);
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.cta-button:hover,
.cta-button:focus {
    background: #ffb86b;
    color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(245, 158, 66, 0.18);
}

.hero-image {
    order: 1;
}

.hero-image img {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 280px;
    height: auto;
    display: block;
    border: 3px solid var(--accent);
    background: var(--card-bg);
}

/* =========================
   SEÇÃO HABILIDADES
   ========================= */

.skills-section {
    background: var(--secondary);
    padding: 2rem 0;
    transition: background var(--transition);
}

.skills-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.skills-section h2 span {
    color: var(--primary);
}

.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.skill-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem 1rem;
    text-align: center;
    width: 100%;
    max-width: 280px;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    border: 1px solid var(--border);
}

.skill-card:hover,
.skill-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.15);
}

.skill-icon {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* =========================
   SEÇÃO SOBRE
   ========================= */

.about-section {
    padding: 2rem 0;
    background: var(--bg);
    transition: background var(--transition);
}

.about-flex {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 1.5rem;
}

.about-image img {
    border-radius: 8%;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 280px;
    height: auto;
    display: block;
    border: 2px solid var(--primary);
}

.about-text {
    text-align: center;
}

.about-text h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-weight: 700;
}

.about-text h3 {
    margin: 1rem 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 600;
}

.about-text ul {
    margin: 0.5rem 0;
    padding-left: 1rem;
    list-style: disc;
    font-size: 0.95rem;
    opacity: 0.95;
    text-align: left;
}

/* =========================
   SEÇÃO PORTFÓLIO
   ========================= */

.portfolio-section {
    background: var(--secondary);
    padding: 2rem 0;
    transition: background var(--transition);
}

.portfolio-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.portfolio-section h2 span {
    color: var(--primary);
}

.portfolio-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.portfolio-item {
    width: 100%;
    max-width: 300px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--card-bg);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    border: 1px solid var(--border);
}

.portfolio-item:hover,
.portfolio-item:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.15);
}

.portfolio-link {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 100%;
}

.portfolio-item figure {
    margin: 0;
    height: 160px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    border-radius: var(--radius);
    position: relative;
}

.portfolio-item figcaption {
    background: rgb(14 14 14 / 68%);
    color: #fff;
    padding: 0.75rem;
    width: 100%;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    font-size: 0.9rem;
    position: absolute;
    bottom: 0;
    left: 0;
}

.portfolio-item h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 700;
}

/* =========================
   SEÇÃO CONTATO
   ========================= */

.contact-section {
    background: var(--bg);
    padding: 2rem 0;
    transition: background var(--transition);
}

.contact-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.contact-section h2 span {
    color: var(--primary);
}

.contact-form {
    background: var(--secondary);
    padding: 1.5rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--border);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-form label {
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 0.9rem;
}

.contact-form input,
.contact-form textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color var(--transition), background var(--transition);
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--primary);
    outline: none;
    background: var(--bg);
}

.submit-button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    margin-top: 0.5rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.10);
}

.submit-button:hover,
.submit-button:focus {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.18);
}

/* =========================
   FEEDBACK DE FORMULÁRIO
   ========================= */

.form-feedback {
    min-height: 1rem;
    font-size: 0.9rem;
    color: var(--primary-dark);
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-radius: 4px;
    display: none;
    font-weight: 500;
}

.form-feedback.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-feedback.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.form-feedback.loading {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* =========================
   FOOTER
   ========================= */

.main-footer {
    background: var(--primary-dark);
    color: #fff;
    padding: 1.5rem 0 1rem 0;
    margin-top: 2rem;
    transition: background var(--transition);
}

.footer-flex {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.footer-social a {
    color: #fff;
    font-size: 1.5rem;
    margin: 0 0.75rem;
    transition: color var(--transition), transform var(--transition);
}

.footer-social a:hover,
.footer-social a:focus {
    color: var(--accent);
    transform: scale(1.15);
}

.footer-contact a {
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition);
}

.footer-contact a:hover,
.footer-contact a:focus {
    color: var(--accent);
}

.main-footer p {
    text-align: center;
    font-size: 0.85rem;
    margin: 0.5rem 0 0 0;
    color: #cbd5e1;
}

/* =========================
   BOTÃO VOLTAR AO TOPO
   ========================= */

#backToTopBtn {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition), background var(--transition), box-shadow var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#backToTopBtn.show {
    opacity: 1;
    pointer-events: auto;
}

#backToTopBtn:hover,
#backToTopBtn:focus {
    background: var(--primary-dark);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.18);
}

/* =========================
   BOTÃO TOGGLE DE TEMA
   ========================= */

.theme-toggle {
    position: fixed;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background var(--transition), transform var(--transition);
    z-index: 999;
}

.theme-toggle:hover,
.theme-toggle:focus {
    background: var(--primary-dark);
    transform: translateY(-50%) scale(1.1);
}

/* =========================
   DESIGN RESPONSIVO - TABLET (min-width: 576px)
   ========================= */

@media (min-width: 576px) {
    .container {
        max-width: 540px;
        padding: 0 1rem;
    }

    .hero-text h1 {
        font-size: 2.2rem;
    }

    .hero-text p {
        font-size: 1.1rem;
    }

    .cta-button {
        font-size: 1.1rem;
        padding: 0.875rem 2rem;
        width: auto;
    }

    .skills-grid {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .skill-card {
        flex: 1 1 250px;
        max-width: 280px;
    }

    .portfolio-grid {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .portfolio-item {
        flex: 1 1 280px;
        max-width: 320px;
    }

    .portfolio-item figure {
        height: 180px;
    }
}

/* =========================
   DESIGN RESPONSIVO - DESKTOP SMALL (min-width: 768px)
   ========================= */

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }

    .main-header {
        padding: 0.7rem 0;
    }

    .header-logo img {
        width: 48px;
        height: 48px;
    }

    /* Esconder botão menu mobile no desktop */
    .mobile-menu-button {
        display: none;
    }

    /* Mostrar navegação desktop */
    .main-nav .nav-list {
        display: flex;
        flex-direction: row;
        position: static;
        width: auto;
        box-shadow: none;
        background: transparent;
        padding: 0;
        gap: 2rem;
    }

    .hero-section {
        padding: 4rem 0 3rem 0;
    }

    .hero-flex {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .hero-text {
        order: 1;
        flex: 1 1 400px;
    }

    .hero-image {
        order: 2;
        flex: 0 0 auto;
    }

    .hero-text h1 {
        font-size: 2.8rem;
    }

    .hero-text p {
        font-size: 1.25rem;
        max-width: 520px;
    }

    .about-flex {
        flex-direction: row;
        align-items: flex-start;
        gap: 2rem;
    }

    .about-text {
        text-align: left;
        flex: 1 1 400px;
    }

    .about-image {
        flex: 0 0 auto;
    }

    .about-image img {
        max-width: 320px;
    }

    .contact-form {
        max-width: 500px;
        margin: 0 auto;
        padding: 2rem 1.5rem;
    }

    .footer-flex {
        flex-direction: row;
        justify-content: space-between;
    }

    .skills-section,
    .about-section,
    .portfolio-section,
    .contact-section {
        padding: 3rem 0;
    }

    .theme-toggle {
        position: static;
        transform: none;
        margin-left: 1rem;
    }

    .theme-toggle:hover {
        transform: scale(1.1);
    }
}

/* =========================
   DESIGN RESPONSIVO - DESKTOP LARGE (min-width: 992px)
   ========================= */

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }

    .hero-section {
        padding: 5rem 0 3rem 0;
    }

    .hero-text h1 {
        font-size: 3.2rem;
    }

    .skills-section h2,
    .about-text h2,
    .portfolio-section h2,
    .contact-section h2 {
        font-size: 2.2rem;
    }

    .skills-grid {
        gap: 2rem;
    }

    .skill-card {
        padding: 2rem 1.5rem;
        max-width: 300px;
    }

    .skill-card:hover,
    .skill-card:focus-within {
        transform: translateY(-8px) scale(1.02);
    }

    .portfolio-item:hover,
    .portfolio-item:focus-within {
        transform: translateY(-8px) scale(1.02);
    }

    .portfolio-item figure {
        height: 220px;
    }

    #backToTopBtn {
        bottom: 2rem;
        right: 2rem;
        width: 52px;
        height: 52px;
    }

    .skills-section,
    .about-section,
    .portfolio-section,
    .contact-section {
        padding: 4rem 0;
    }
}

/* =========================
   DESIGN RESPONSIVO - EXTRA LARGE (min-width: 1200px)
   ========================= */

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    .hero-text h1 {
        font-size: 3.5rem;
    }

    .skills-grid {
        gap: 2.5rem;
    }

    .portfolio-grid {
        gap: 2.5rem;
    }

    .portfolio-item {
        max-width: 350px;
    }

    .skills-section,
    .about-section,
    .portfolio-section,
    .contact-section {
        padding: 5rem 0;
    }
}

/* =========================
   ESTILOS PARA MENU MOBILE
   ========================= */

@media (max-width: 768px) {
    /* Mostrar botão do menu */
    .mobile-menu-button {
        display: block;
        font-size: 1.8rem;
        padding: 0.3rem 0.7rem;
    }

    /* Esconder navegação por padrão */
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--secondary);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 999;
        padding-top: 80px;
        overflow-y: auto;
        transition: right 0.3s ease;
    }

    /* Navegação aberta */
    .main-nav.nav-open {
        right: 0;
    }

    /* Lista de navegação */
    .nav-list {
        flex-direction: column;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .nav-list li {
        margin: 0;
        border-bottom: 1px solid var(--border);
    }

    .nav-list a {
        display: block;
        padding: 1rem 2rem;
        text-decoration: none;
        color: var(--text);
        font-weight: 500;
        transition: background-color 0.3s ease;
    }

    .nav-list a:hover {
        background-color: rgba(37, 99, 235, 0.07);
    }
}

/* =========================
   UTILITÁRIOS
   ========================= */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}