/* ==========================================================
   PORTFOLIO — MARCOS JOSHUA TORMES SALES
   style.css | HTML5 + CSS3 puro (sem frameworks)
   ========================================================== */

/* ----------------------------------------------------------
   1. VARIÁVEIS DE TEMA (CSS Custom Properties)
   Aplicadas ao :root em modo escuro (padrão).
   A classe .light-theme no <body> sobrescreve os valores.
---------------------------------------------------------- */
:root {
    /* Cores base — tema escuro */
    --bg:          #0d1117;
    --bg-alt:      #161b22;
    --bg-card:     #1c2128;
    --border:      #30363d;
    --text:        #e6edf3;
    --text-muted:  #8b949e;
    --accent:      #58a6ff;
    --accent-dark: #1f6feb;
    --tag-bg:      #21262d;
    --tag-text:    #79c0ff;
    --shadow:      rgba(0, 0, 0, 0.4);
    --nav-bg:      rgba(13, 17, 23, 0.92);
}

/* Tema claro — sobrescreve variáveis */
.light-theme {
    --bg:          #ffffff;
    --bg-alt:      #f6f8fa;
    --bg-card:     #ffffff;
    --border:      #d0d7de;
    --text:        #24292f;
    --text-muted:  #57606a;
    --accent:      #0969da;
    --accent-dark: #0550ae;
    --tag-bg:      #ddf4ff;
    --tag-text:    #0550ae;
    --shadow:      rgba(0, 0, 0, 0.12);
    --nav-bg:      rgba(255, 255, 255, 0.92);
}

/* ----------------------------------------------------------
   2. RESET E BASE
---------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    /* Scroll suave para navegação por âncoras */
    scroll-behavior: smooth;
    scroll-padding-top: 70px; /* compensa o navbar fixo */
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

a:hover { opacity: 0.8; }

ul { list-style: none; }

img { max-width: 100%; display: block; }

/* ----------------------------------------------------------
   3. UTILITÁRIOS DE LAYOUT
---------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 5rem 0;
}

/* Seções alternadas recebem fundo levemente diferente */
.section-alt {
    background-color: var(--bg-alt);
}

/* ----------------------------------------------------------
   4. TIPOGRAFIA DE SEÇÃO
---------------------------------------------------------- */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

/* Linha decorativa abaixo do título */
.section-title::after {
    content: '';
    display: block;
    width: 3rem;
    height: 3px;
    background: var(--accent);
    margin-top: 0.4rem;
    border-radius: 2px;
}

.section-subtitle {
    color: var(--text-muted);
    margin-bottom: 3rem;
    margin-top: 0.75rem;
}

/* ----------------------------------------------------------
   5. NAVBAR (menu fixo no topo)
---------------------------------------------------------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background 0.3s;
}

/* Sombra adicionada via JS ao rolar a página */
.navbar.scrolled {
    box-shadow: 0 2px 12px var(--shadow);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Logo / iniciais */
.nav-logo {
    font-family: 'Fira Code', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -1px;
}

.accent { color: var(--accent); }

/* Links do menu desktop */
.nav-menu {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: var(--tag-bg);
    opacity: 1;
}

/* Agrupa botão tema e hamburger */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Botão alternador de tema */
.theme-toggle {
    background: var(--tag-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text);
    transition: background 0.2s;
    line-height: 1;
}

.theme-toggle:hover { background: var(--border); }

/* Mostra/oculta ícone correto conforme tema */
.dark-theme  .sun-icon  { display: inline; }
.dark-theme  .moon-icon { display: none; }
.light-theme .sun-icon  { display: none; }
.light-theme .moon-icon { display: inline; }

/* Botão hamburger — visível apenas em mobile */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* Animação X quando menu está aberto */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ----------------------------------------------------------
   6. SEÇÃO SOBRE MIM
---------------------------------------------------------- */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 4rem;
    align-items: start;
    padding-top: 2rem;
}

.greeting {
    font-family: 'Fira Code', monospace;
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.hero-name {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.hero-role {
    font-family: 'Fira Code', monospace;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.about-bio {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.75rem;
    max-width: 560px;
    line-height: 1.75;
}

/* Contato rápido abaixo da bio */
.contact-quick {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.contact-item a { color: var(--accent); }

/* Botões de ação do hero */
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ----------------------------------------------------------
   7. BOTÕES
---------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    border: none;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
    opacity: 1;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-dark); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover { background: var(--tag-bg); }

/* Botão que ocupa a largura total do formulário */
.btn-full { width: 100%; justify-content: center; }

/* ----------------------------------------------------------
   8. SIDEBAR DE SKILLS (Sobre mim)
---------------------------------------------------------- */
.skills-sidebar {
    position: sticky;
    top: 80px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-block { margin-bottom: 0.5rem; }

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Tags de skills, idiomas e hobbies */
.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    white-space: nowrap;
}

/* ----------------------------------------------------------
   9. SEÇÃO FORMAÇÃO — TIMELINE
---------------------------------------------------------- */
.content-block {
    margin-bottom: 3.5rem;
}

.block-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
}

/* Linha vertical da timeline */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 2.5rem;
}

/* Ponto colorido na linha */
.timeline-dot {
    position: absolute;
    left: -1.6rem;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 2px solid var(--bg);
    border-radius: 50%;
}

.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.2s;
}

.timeline-content:hover { border-color: var(--accent); }

/* Cabeçalho do item de timeline */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.timeline-header h4 {
    font-size: 1rem;
    font-weight: 700;
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--accent);
    font-family: 'Fira Code', monospace;
    white-space: nowrap;
}

.timeline-company {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.timeline-list {
    list-style: disc;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.timeline-list li {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ----------------------------------------------------------
   10. CARDS DE EDUCAÇÃO
---------------------------------------------------------- */
.edu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.edu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.2s;
}

.edu-card:hover { border-color: var(--accent); }

.edu-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
}

.edu-card h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.edu-institution {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.edu-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'Fira Code', monospace;
}

/* ----------------------------------------------------------
   11. CARDS DE CERTIFICAÇÃO
---------------------------------------------------------- */
.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.cert-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.cert-card:hover { border-color: var(--accent); }

.cert-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.65rem;
}

.cert-card h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.cert-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ----------------------------------------------------------
   12. SEÇÃO PORTFÓLIO — CARDS DE PROJETO
---------------------------------------------------------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Card que ocupa toda a largura (artigos do blog) */
.project-card--wide {
    grid-column: 1 / -1;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s, transform 0.2s;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}

/* Cabeçalho do card: badge de tipo + link */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-type {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.project-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.project-title {
    font-size: 1.15rem;
    font-weight: 700;
}

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

/* Tags de stack dentro do card */
.project-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag-sm {
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
}

/* ----------------------------------------------------------
   13. SEÇÃO CONTATO
---------------------------------------------------------- */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 4rem;
    align-items: start;
}

.contact-info h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.contact-info p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-detail-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ----------------------------------------------------------
   14. FORMULÁRIO DE CONTATO
---------------------------------------------------------- */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

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

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

/* Estado de erro no campo */
.form-group input.error,
.form-group textarea.error {
    border-color: #f85149;
}

/* Mensagem de erro abaixo do campo */
.field-error {
    font-size: 0.8rem;
    color: #f85149;
    min-height: 1em;
    display: block;
}

/* ----------------------------------------------------------
   15. MODAL DE CONFIRMAÇÃO
---------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    /* Oculto por padrão — JS adiciona a classe .visible */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 380px;
    width: 90%;
    transform: translateY(20px);
    transition: transform 0.25s;
}

.modal-overlay.visible .modal { transform: translateY(0); }

.modal-icon {
    font-size: 2.5rem;
    color: #3fb950;
    margin-bottom: 1rem;
}

.modal h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.modal p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ----------------------------------------------------------
   16. RODAPÉ
---------------------------------------------------------- */
.footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ----------------------------------------------------------
   17. RESPONSIVIDADE (mobile-first breakpoints)
      Breakpoint principal: 768px (tablets e abaixo)
      Breakpoint secundário: 480px (smartphones)
---------------------------------------------------------- */
@media (max-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr;
    }

    .skills-sidebar {
        position: static;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {
    /* Exibe botão hamburger */
    .hamburger { display: flex; }

    /* Menu oculto em mobile por padrão */
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-alt);
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.5rem;
        gap: 0.5rem;
    }

    /* Menu exibido quando hamburger está ativo */
    .nav-menu.open { display: flex; }

    .nav-link {
        padding: 0.6rem 0.5rem;
        font-size: 1rem;
    }

    .section { padding: 3.5rem 0; }

    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; justify-content: center; }

    .projects-grid { grid-template-columns: 1fr; }
    .project-card--wide { grid-column: auto; }
}

@media (max-width: 480px) {
    .timeline-header { flex-direction: column; gap: 0.25rem; }

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

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