/*
Mobile Optimizations - SpeedLordVU-Clean (Versão Otimizada)
CSS para menu mobile dropdown funcional
*/

/* Menu Toggle Button - Sempre no canto direito */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    position: relative;
    z-index: 1001;
    order: 3; /* Força para a direita */
}

.menu-icon {
    display: block;
    width: 24px;
    height: 18px;
    position: relative;
}

.menu-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: #333;
    margin: 4px 0;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Animação do menu hamburger para X */
.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Menu Dropdown */
.mobile-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
}

.mobile-menu-dropdown.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    max-height: 500px;
}

/* Navegação Mobile */
.mobile-navigation {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-navigation li {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-navigation li:last-child {
    border-bottom: none;
}

.mobile-navigation a {
    display: block;
    padding: 15px 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mobile-navigation a:hover {
    color: #007cba;
}

/* Busca Mobile */
.mobile-search {
    padding: 20px;
}

.mobile-search .search-form {
    flex-direction: column;
    gap: 10px;
}

.mobile-search .search-form input[type="search"] {
    width: 100%;
    margin-bottom: 10px;
}

.mobile-search .search-form button {
    width: 100%;
    padding: 12px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #007cba;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    z-index: 100000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Posts Relacionados */
.related-posts {
    margin-top: 40px;
    padding: 30px 0;
    border-top: 2px solid #e5e5e5;
}

.related-posts h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.related-post {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-post:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.related-post img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.related-post-content {
    padding: 15px;
}

.related-post h4 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
}

.related-post h4 a {
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
}

.related-post h4 a:hover {
    color: #007cba;
}

.related-post .excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Aviso Legal */
.aviso-legal {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    margin-bottom: 30px;
    border-radius: 8px;
}

.aviso-legal-box {
    padding: 20px;
    text-align: left;
}

.aviso-legal-box span {
    display: block;
    font-weight: 700;
    font-size: 18px;
    color: #856404;
    margin-bottom: 10px;
}

.aviso-legal-box p {
    font-size: 14px;
    line-height: 1.5;
    color: #856404;
    margin: 0;
}

.aviso-legal-box strong {
    font-weight: 600;
}

/* Estados de Scroll */
.scrolled .site-header {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.scrolled .site-logo img {
    max-height: 50px;
    transition: max-height 0.3s ease;
}

/* Responsividade */
@media (max-width: 768px) {
    /* Mostrar elementos mobile */
    .menu-toggle {
        display: block;
    }

    /* Ocultar elementos desktop */
    .desktop-nav,
    .desktop-search {
        display: none;
    }

    /* Header mobile layout */
    .header-content {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .site-branding {
        order: 1;
        flex: 1;
    }

    .menu-toggle {
        order: 2;
    }

    /* Logo menor no mobile */
    .site-logo img {
        max-width: 200px;
        max-height: 50px;
    }

    /* Prevenir scroll quando menu aberto */
    .menu-open {
        overflow: hidden;
    }

    /* Cards móveis */
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0;
    }

    .post-card {
        margin: 0;
        border-radius: 8px;
    }

    .post-card img {
        height: 180px;
    }

    .post-card-content {
        padding: 15px;
    }

    .post-card h2 {
        font-size: 16px;
        line-height: 1.3;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* Posts relacionados móvel */
    .related-posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .related-post img {
        height: 120px;
    }

    .related-post-content {
        padding: 12px;
    }

    .related-post h4 {
        font-size: 15px;
    }

    .related-post .excerpt {
        font-size: 13px;
    }

    /* Aviso legal móvel */
    .aviso-legal-box {
        padding: 15px;
    }

    .aviso-legal-box span {
        font-size: 16px;
    }

    .aviso-legal-box p {
        font-size: 13px;
    }
}

@media (min-width: 769px) {
    /* Desktop: ocultar elementos mobile */
    .menu-toggle,
    .mobile-menu-dropdown {
        display: none !important;
    }

    /* Desktop: mostrar elementos desktop */
    .desktop-nav,
    .desktop-search {
        display: flex;
    }
}

@media (max-width: 480px) {
    /* Ajustes para telas muito pequenas */
    .site-container {
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }

    .header-content {
        padding: 10px 0;
    }

    .site-logo img {
        max-width: 160px;
        max-height: 40px;
    }

    .menu-toggle {
        padding: 8px;
    }

    .menu-icon {
        width: 20px;
        height: 15px;
    }

    .mobile-navigation,
    .mobile-search {
        padding: 15px;
    }

    .mobile-navigation a {
        padding: 12px 0;
        font-size: 15px;
    }

    .post-card img {
        height: 160px;
    }

    .post-card-content {
        padding: 12px;
    }

    .post-card h2 {
        font-size: 15px;
    }

    .post-card .excerpt {
        font-size: 13px;
    }

    .post-meta {
        font-size: 11px;
    }

    .post-category {
        padding: 3px 8px;
        font-size: 11px;
    }

    .related-posts h3 {
        font-size: 20px;
    }

    .aviso-legal-box span {
        font-size: 15px;
    }

    .aviso-legal-box p {
        font-size: 12px;
    }
}

/* Melhorias de Touch */
@media (hover: none) and (pointer: coarse) {
    /* Dispositivos touch */
    .post-card:hover {
        transform: none;
    }

    .post-card:active {
        transform: scale(0.98);
    }

    .mobile-navigation a,
    .mobile-search .search-form button,
    .post-category {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .menu-icon span {
        background: #333;
    }

    .mobile-menu-dropdown {
        background: #fff;
        border-color: #e5e5e5;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast */
@media (prefers-contrast: high) {
    .post-card,
    .related-post {
        border: 2px solid #000;
    }

    .mobile-navigation a:focus,
    .mobile-search input:focus,
    .mobile-search button:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .menu-toggle,
    .mobile-menu-dropdown,
    .related-posts,
    .aviso-legal {
        display: none;
    }

    .post-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .post-card img {
        max-height: 200px;
    }
}

/* MOBILE: Reduce top spacing of entry-content */
@media only screen and (max-width: 768px) {
  .entry-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
}


/* Footer Categories Mobile */
@media only screen and (max-width: 768px) {
  .footer-categories-list {
    flex-direction: column;
    gap: 0.75rem 0;
  }
  .footer-category-link {
    font-size: 1rem;
    padding: 0.5rem 0;
  }
}
