/* ===================================
   GIDE Paisagismo - Responsive Design
   =================================== */

/* Tablet (768px - 1024px) */
@media screen and (max-width: 1024px) {
    :root {
        --fs-h1: 3rem;
        --fs-h2: 2rem;
        --fs-h3: 1.5rem;
        --spacing-lg: 3rem;
        --spacing-xl: 4rem;
    }

    .nav-wrapper {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 0;
        padding: 0.55rem 0;
    }

    .nav-brand {
        font-size: 1.2rem;
        letter-spacing: 0.16em;
        position: static;
        transform: none;
        text-align: center;
        grid-column: 2;
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    /* Serviços Grid */
    .servicos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Blog */
    .blog-featured__overlay {
        padding: 1.75rem;
    }
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* ---- NAVEGAÇÃO MOBILE (hamburger a partir de 1024px) ---- */
    .mobile-menu-toggle {
        display: flex;
        grid-column: 3;
        justify-self: end;
        margin-left: 0;
        z-index: 1001;
        padding: 7px;
        transform: translateZ(0);                /* Força GPU compositing — fix para iOS Safari */
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;     /* Fix clássico iOS Safari — evita desaparecimento em GPU layer */
        backface-visibility: hidden;
        visibility: visible;                     /* Garante visibilidade explícita */
        opacity: 1;                              /* Garante opacidade explícita */
        animation: hamburger-init 0.001s ease-out forwards; /* Força compositing layer desde o 1º frame */
        background: rgba(45, 95, 63, 0.07);      /* Fundo verde brand translúcido */
        border: 1.5px solid rgba(45, 95, 63, 0.18); /* Borda verde sutil */
        border-radius: 8px;                      /* Cantos arredondados */
    }

    .mobile-menu-toggle span {
        display: block;                          /* Reforço explícito no contexto mobile */
        width: 20px;
        height: 2px;
        background-color: var(--color-primary);  /* Verde marca em vez de preto */
    }

    .nav-menu {
        position: fixed;
        top: var(--navbar-h, 44px);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-white);
        padding: 0.5rem 1.25rem 0.75rem;
        gap: 0.1rem;
        box-shadow: 0 8px 32px rgba(0,0,0,0.12);
        transform: translateY(-110%);
        visibility: hidden;
        pointer-events: none;
        transition: transform var(--transition-normal), visibility var(--transition-normal);
        max-height: calc(100vh - var(--navbar-h, 44px));
        overflow-y: auto;
        align-items: flex-start;
        border-top: 2px solid var(--bg-light);
    }

    .nav-menu.active {
        transform: translateY(0);
        visibility: visible;
        pointer-events: auto;
    }

}

/* ==========================================
   MOBILE (< 768px)
   ========================================== */
@media screen and (max-width: 768px) {
    :root {
        --fs-h1: 2.2rem;
        --fs-h2: 1.75rem;
        --fs-h3: 1.2rem;
        --fs-body: 0.95rem;
        --spacing-xs: 0.5rem;
        --spacing-sm: 0.875rem;
        --spacing-md: 1.5rem;
        --spacing-lg: 2.5rem;
        --spacing-xl: 3rem;
    }

    /* Container com padding generoso e simétrico */
    .container {
        padding: 0 1.25rem;
    }

    /* ---- NAVEGAÇÃO ---- */

    .nav-brand {
        font-size: 0.95rem;
        letter-spacing: 0.06em;
    }

    .nav-link {
        padding: 0.5rem 0.5rem;
        border-bottom: 1px solid rgba(42, 82, 64, 0.08);
        width: 100%;
        font-size: 0.875rem;
        letter-spacing: 0.01em;
    }

    /* Ícones de contato no menu mobile — linha separada */
    .nav-menu li:last-child .nav-link,
    .nav-menu li:nth-last-child(2) .nav-link,
    .nav-menu li:nth-last-child(3) .nav-link {
        border-bottom: none;
    }

    .btn-nav-contact {
        width: 40px;
        height: 40px;
        border-bottom: none !important;
    }

    /* ---- HERO ---- */
    .scroll-expansion-hero {
        height: 100svh;
        min-height: 100svh;
    }

    .hero-title-first,
    .hero-title-rest {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
        line-height: 1.15;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        padding: 0 1.5rem;
        margin-top: 0.75rem;
        line-height: 1.6;
    }

    .hero-scroll-indicator {
        bottom: 1.75rem;
        font-size: 0.8rem;
    }

    .hero-scroll-indicator i {
        font-size: 1.25rem;
    }

    /* ---- SECTION HEADERS ---- */
    section {
        padding: 1.5rem 0 !important;
    }

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

    .section-title {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .section-subtitle {
        font-size: 0.95rem;
        padding: 0 0.5rem;
        line-height: 1.6;
    }

    /* ---- SOBRE ---- */
    .sobre-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }

    .sobre-content {
        padding-right: 0;
    }

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

    /* Oculta imagem dentro do grid; exibe bloco externo */
    .sobre-grid > .sobre-image {
        display: none;
    }

    .sobre-image-mobile {
        display: block;
        padding: 0.5rem 0 1rem;
        border-radius: var(--radius-lg);
        overflow: hidden;
    }

    /* Stats — mantém 3 colunas horizontais */
    .sobre-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-top: 1.25rem;
    }

    .stat-item {
        padding: 0.875rem 0.375rem;
        border-radius: var(--radius-md);
    }

    .stat-number {
        font-size: 1.85rem;
        line-height: 1;
    }

    .stat-label {
        font-size: 0.7rem;
        margin-top: 0.3rem;
        line-height: 1.3;
    }

    /* ---- SERVIÇOS ---- */
    .servicos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .service-card {
        padding: 1.25rem 0.75rem;
        aspect-ratio: unset;
        min-height: unset;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        border-top-width: 3px;
    }

    .service-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        margin: 0;
        flex-shrink: 0;
    }

    .service-title {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
        line-height: 1.3;
        text-align: center;
    }

    .service-description {
        display: block;
        font-size: 0.78rem;
        line-height: 1.45;
        text-align: center;
        color: var(--color-secondary);
        margin: 0;
    }

    .service-link {
        display: inline-flex;
        font-size: 0.78rem;
        margin-top: 0.25rem;
    }

    /* ---- PORTFOLIO ---- */
    .portfolio-filters {
        gap: 0.4rem;
        padding: 0 0.25rem;
        justify-content: center;
    }

    .filter-btn {
        padding: 0.45rem 0.9rem;
        font-size: 0.8rem;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    /* ---- BLOG ---- */
    .blog-featured__inner {
        aspect-ratio: unset;
        min-height: 400px;
    }
    .blog-featured__overlay {
        padding: 1.25rem 1.25rem 1.5rem;
    }
    .blog-featured__title {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    .blog-featured__excerpt {
        font-size: 0.85rem;
        line-height: 1.55;
        margin-bottom: 0.9rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .blog-card__image {
        height: 220px;
    }

    /* ---- DEPOIMENTOS ---- */
    .depoimentos-carousel {
        padding: 0 0.25rem;
        max-width: 100%;
    }

    .depoimento-card {
        padding: 1.5rem 1.25rem;
        border-radius: var(--radius-md);
    }

    .depoimento-text {
        font-size: 0.95rem;
        line-height: 1.75;
    }

    .depoimento-author {
        gap: 0.875rem;
    }

    .depoimento-author img {
        width: 52px;
        height: 52px;
    }

    .swiper-button-prev,
    .swiper-button-next {
        display: none;
    }

    /* ---- CONTATO ---- */
    .section-contato {
        padding: var(--spacing-lg) 0 0 !important;
    }

    .contato-top {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }

    .contato-map {
        min-height: 280px;
    }

    .contato-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .contato-info {
        padding: 1.75rem 1.5rem;
        grid-template-columns: 1fr;
        text-align: center;
    }

    .contato-info .social-links {
        grid-column: 1;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .info-item {
        justify-content: flex-start;
        margin-bottom: 0.75rem;
        text-align: left;
        gap: 0.75rem;
    }

    .info-content p,
    .info-content h3 {
        text-align: left;
    }

    .contato-bottom {
        padding: 2rem 1rem;
    }

    .contato-form {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .contato-form .form-group:has(textarea),
    .contato-form .btn-submit,
    .contato-form .form-success-message {
        grid-column: 1;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* ---- FOOTER ---- */
    .footer {
        padding: var(--spacing-lg) 0 var(--spacing-md);
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }

    .footer-col {
        text-align: center;
    }

    .footer-social,
    .social-links {
        justify-content: center;
    }

    .footer-links,
    .footer-contact {
        text-align: center;
    }

    .footer-contact li {
        justify-content: center;
    }

    /* ---- BOTÕES ---- */
    .btn-primary {
        padding: 0.875rem 2.25rem;
        font-size: 0.95rem;
        width: auto;
        display: inline-block;
        text-align: center;
    }

    .btn-outline {
        padding: 0.75rem 2rem;
        font-size: 0.85rem;
    }

    /* ---- FLOATING BUTTONS ---- */
    .whatsapp-float {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
        bottom: 1.25rem;
        left: 1.25rem;
    }

    .scroll-top-btn {
        width: 46px;
        height: 46px;
        font-size: 1.125rem;
        bottom: 1.25rem;
        right: 1.25rem;
    }
}

/* ==========================================
   SMALL MOBILE (< 480px)
   ========================================== */
@media screen and (max-width: 480px) {
    :root {
        --fs-h1: 1.9rem;
        --fs-h2: 1.5rem;
        --fs-h3: 1.1rem;
        --fs-body: 0.9rem;
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
        --spacing-lg: 2rem;
        --spacing-xl: 2.5rem;
    }

    .container {
        padding: 0 1rem;
    }

    section {
        padding: 1.25rem 0 !important;
    }

    /* Logo */
    .logo img {
        height: 68px;
    }

    /* Hero */
    .hero-title-first,
    .hero-title-rest {
        font-size: clamp(1.4rem, 7vw, 1.85rem);
    }

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

    /* Section titles */
    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.88rem;
    }

    /* Stats — 3 colunas compactas */
    .sobre-stats {
        gap: 0.35rem;
    }

    .stat-item {
        padding: 0.6rem 0.2rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.62rem;
    }

    /* Service Cards */
    .service-card {
        min-height: unset;
        padding: 1rem 0.5rem;
    }

    .service-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .service-title {
        font-size: 0.8rem;
    }

    .service-description {
        font-size: 0.72rem;
    }

    /* Portfolio */
    .portfolio-grid {
        gap: 0.3rem;
    }

    /* Blog */
    .blog-featured__title {
        font-size: 1.1rem;
    }
    .blog-card__image {
        height: 180px;
    }

    /* Depoimentos */
    .depoimento-card {
        padding: 1.25rem 1rem;
    }

    .depoimento-author img {
        width: 46px;
        height: 46px;
    }

    /* Info Items */
    .info-icon {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    /* Social Links */
    .social-links a {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    /* Footer */
    .footer-content {
        gap: 1.5rem;
    }

    .footer-col h3 {
        font-size: 1.1rem;
        margin-bottom: 0.875rem;
    }

    .footer-bottom {
        font-size: 0.8rem;
    }

    /* Botões */
    .btn-primary {
        padding: 0.75rem 2rem;
        font-size: 0.9rem;
    }

    /* Floating Buttons */
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 1.375rem;
        bottom: 1rem;
        left: 1rem;
    }

    .scroll-top-btn {
        width: 42px;
        height: 42px;
        font-size: 1rem;
        bottom: 1rem;
        right: 1rem;
    }
}

/* ==========================================
   EXTRA SMALL (< 375px — iPhone SE, etc.)
   ========================================== */
@media screen and (max-width: 375px) {
    .container {
        padding: 0 0.875rem;
    }

    .hero-title-first,
    .hero-title-rest {
        font-size: 1.35rem;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .stat-number {
        font-size: 1.35rem;
    }

    .stat-label {
        font-size: 0.58rem;
    }

    .service-title {
        font-size: 0.7rem;
    }

    .btn-primary {
        padding: 0.75rem 1.75rem;
        font-size: 0.875rem;
    }
}

/* ==========================================
   LANDSCAPE MOBILE
   ========================================== */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .scroll-expansion-hero {
        height: 100vh;
        min-height: 500px;
    }

    .hero-title-first,
    .hero-title-rest {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }

    .hero-scroll-indicator {
        display: none;
    }
}

/* ==========================================
   TABLET (min 768px e max 1024px)
   ========================================== */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .hero {
        height: 90vh;
    }

    .sobre-grid {
        gap: var(--spacing-xl);
    }

    .contato-wrapper {
        gap: var(--spacing-md);
    }
}

/* ==========================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================== */
@media (hover: none) and (pointer: coarse) {
    /* Aumenta área de toque */
    .nav-link,
    .btn-primary,
    .filter-btn,
    .social-links a {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Remove hover effects em touch */
    .service-card:hover,
    .portfolio-item:hover {
        transform: none;
    }

    /* Desabilita parallax em touch */
    .hero,
    .parallax {
        background-attachment: scroll;
    }

    /* Portfolio overlay sempre visível em touch */
    .portfolio-overlay {
        opacity: 0.85;
    }
}

/* ==========================================
   LARGE DESKTOPS (> 1400px)
   ========================================== */
@media screen and (min-width: 1400px) {
    :root {
        --container-width: 1320px;
        --fs-h1: 4rem;
        --fs-h2: 3rem;
    }

    .servicos-grid {
        gap: var(--spacing-xl);
    }

    .portfolio-grid {
        gap: var(--spacing-xl);
    }

}

/* ==========================================
   ULTRA-WIDE (> 1920px)
   ========================================== */
@media screen and (min-width: 1920px) {
    :root {
        --container-width: 1600px;
    }

    .hero-title {
        font-size: 4.5rem;
    }

    .section-title {
        font-size: 3.5rem;
    }
}

/* ==========================================
   PRINT
   ========================================== */
@media print {
    .navbar,
    .scroll-indicator,
    .scroll-top-btn,
    .whatsapp-float,
    .mobile-menu-toggle,
    .portfolio-filters,
    .swiper-button-prev,
    .swiper-button-next,
    .swiper-pagination {
        display: none !important;
    }

    body {
        color: #000;
        background: #fff;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    section {
        page-break-inside: avoid;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }
}

/* ==========================================
   HIGH DPI
   ========================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img,
    .service-icon,
    .portfolio-item img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ==========================================
   REDUCED MOTION
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .parallax {
        background-attachment: scroll;
    }
}

/* ==========================================
   DARK MODE (opcional — descomente para ativar)
   ========================================== */
@media (prefers-color-scheme: dark) {
    /*
    :root {
        --color-white: #1a1a1a;
        --color-dark: #f5f5f5;
        --bg-white: #1a1a1a;
        --bg-light: #2a2a2a;
        --bg-dark: #f5f5f5;
    }
    */
}
