/* ============================================
   RESET E VARIÁVEIS
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a2744;
    --secondary-color: #8a9ab8;
    --accent-color: #a8b8cc;
    --text-dark: #1a1a1a;
    --text-light: #f0ece4;
    --bg-light: #f0f3f8;
    --bg-white: #ffffff;
    --border-color: #d0d8e8;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.18);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-white);
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   NAVEGAÇÃO
   ============================================ */
.navbar {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    letter-spacing: 0.5px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.nav-menu a:hover {
    color: var(--accent-color);
}

/* Hamburguer */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
    background: none;
    border: none;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-light);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    .nav-menu {
        display: none;
        flex-direction: column;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--primary-color);
        padding: 0.5rem 0 1rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        z-index: 99;
    }
    .nav-menu.open {
        display: flex;
    }
    .nav-menu li a {
        display: block;
        padding: 0.65rem 1.5rem;
        font-size: 1rem;
    }
    .navbar .container {
        position: relative;
    }
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url('./img/Antonio-Carlos-Ribeiro-de-Andrada-(IV)-2.png');
    background-size: 40%;
    background-position: center 10%;
    background-attachment: fixed;
    color: var(--text-light);
    padding: 150px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(168, 184, 204, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(44, 62, 107, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-weight: 500;
}

.hero-dates {
    font-size: 1.1rem;
    color: rgba(240, 236, 228, 0.9);
}

@media (max-width: 768px) {
    .hero {
        padding: 80px 20px;
    }

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

    .hero-subtitle {
        font-size: 1.2rem;
    }
}

/* ============================================
   SEÇÕES
   ============================================ */
.section {
    padding: 80px 0;
    border-bottom: 1px solid var(--border-color);
}

.section:last-of-type {
    border-bottom: none;
}

.section-header {
    margin-bottom: 3rem;
    text-align: center;
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--accent-color);
}

/* ============================================
   CONTEÚDO DE TEXTO
   ============================================ */
.content-text {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

.content-text p {
    margin-bottom: 1.5rem;
    text-align: justify;
    color: var(--text-dark);
}

.content-text h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-color);
    padding-left: 0.75rem;
}

.content-text h3:first-child {
    margin-top: 0;
}

/* ============================================
   GRID DE CARGOS
   ============================================ */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.company-card {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.company-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.company-card p {
    color: #444;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ============================================
   LINHA DO TEMPO
   ============================================ */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 2rem auto;
    padding-left: 2rem;
}

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

.timeline-item {
    position: relative;
    margin-bottom: 1.75rem;
    padding-left: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.35rem;
    top: 0.4rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid var(--primary-color);
}

.timeline-year {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.timeline-item p {
    color: #444;
    font-size: 0.95rem;
    margin: 0;
    text-align: left;
}

/* ============================================
   GALERIA
   ============================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: var(--bg-light);
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.gallery-item img {
    width: 100%;
    flex: 1;
    min-height: 0;
    object-fit: cover;
    object-position: top;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-caption {
    font-size: 0.45rem;
    color: rgba(0, 0, 0, 0.15);
    text-align: center;
    padding: 2px 4px 4px;
    background: transparent;
    letter-spacing: 0.2px;
    font-style: italic;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

/* ============================================
   MODAL
   ============================================ */
.modal-caption {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.15);
    text-align: center;
    margin-top: 5px;
    font-style: italic;
    letter-spacing: 0.2px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 3rem 0;
    text-align: center;
    margin-top: 4rem;
    border-top: 3px solid var(--accent-color);
}

.footer p {
    margin: 0.5rem 0;
}

.footer-text {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ============================================
   RESPONSIVO
   ============================================ */


/* ============================================
   ANIMAÇÕES
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   ACESSIBILIDADE
   ============================================ */
a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

button:focus,
input:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ============================================
   MELHORIAS MOBILE
   ============================================ */

@media (max-width: 768px) {
    .section {
        padding: 40px 0;
    }

    .section-header h2 {
        font-size: 1.8rem;
    }

    .content-text p {
        text-align: left;
        font-size: 0.95rem;
    }

    /* Desfaz o float da foto do Cândido Tostes e similares */
    figure[style*="float"] {
        float: none !important;
        margin: 0 auto 1.5rem !important;
        display: block;
        text-align: center;
    }

    /* Accordion mais confortável */
    .accordion-body {
        padding: 1rem 1.1rem;
    }

    /* Modal mobile */
    #modal-img {
        max-height: 60vh !important;
    }
    #modal-legend {
        font-size: 0.82rem !important;
        max-width: 92% !important;
    }
}

@media (max-width: 480px) {
    .nav-brand {
        font-size: 1.1rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

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

    .container {
        padding: 0 14px;
    }

    /* Fotos inline empilham em coluna */
    .inline-photos {
        flex-direction: column;
        align-items: center;
    }

    .inline-photo,
    .inline-photo.wide {
        max-width: 100% !important;
        width: 100%;
    }

    .inline-photo img,
    .inline-photo.wide img {
        height: 220px !important;
    }

    /* Galeria 2 colunas em mobile pequeno */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
}
