/* ============================================
   FAVERO ENGENHARIA - NAVY DREAM PALETTE
   ============================================ */

/* CSS Variables - Light Mode */
:root {
    --navy: #1E1E2A;
    --marine-blue: #24273A;
    --dark-blue: #2E3E58;
    --deep-teal: #4D7493;
    --stone-blue: #90ADC1;
    --light-gray: #D2D7DB;
    --medium-gray: #98A1AA;
    --steel-blue: #7F99B2;
    --off-white: #F7F7F7;
    --dark-navy: #2C4156;
    --dark-teal: #39586D;

    /* Semantic Colors - Light Mode */
    --background: #F7F7F7;
    --foreground: #1E1E2A;
    --card: #FFFFFF;
    --card-foreground: #1E1E2A;
    --primary: #4D7493;
    --primary-foreground: #F7F7F7;
    --secondary: #D2D7DB;
    --secondary-foreground: #1E1E2A;
    --muted: #D2D7DB;
    --muted-foreground: #98A1AA;
    --accent: #7F99B2;
    --accent-foreground: #F7F7F7;
    --border: #D2D7DB;
    --input: #D2D7DB;
    --ring: #4D7493;
    --hero-gradient-start: #2C4156;
    --hero-gradient-end: #39586D;
}

/* Dark Mode */
.dark {
    --background: #1E1E2A;
    --foreground: #F7F7F7;
    --card: #24273A;
    --card-foreground: #F7F7F7;
    --primary: #4D7493;
    --primary-foreground: #F7F7F7;
    --secondary: #24273A;
    --secondary-foreground: #F7F7F7;
    --muted: #2E3E58;
    --muted-foreground: #98A1AA;
    --accent: #90ADC1;
    --accent-foreground: #1E1E2A;
    --border: #2E3E58;
    --input: #2E3E58;
    --ring: #90ADC1;
    --hero-gradient-start: #1E1E2A;
    --hero-gradient-end: #2E3E58;
}

/* ============================================
   BASE STYLES
   ============================================ */

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--background);
    color: var(--foreground);
}

/* Dark mode overrides for Tailwind */
html.dark body {
    background-color: var(--background);
    color: var(--foreground);
}

html.dark .bg-card {
    background-color: var(--card);
    color: var(--card-foreground);
}

html.dark .bg-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

html.dark .bg-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

html.dark .bg-muted {
    background-color: var(--muted);
}

html.dark .text-muted-foreground {
    color: var(--muted-foreground);
}

html.dark .border-border {
    border-color: var(--border);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(77, 116, 147, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(77, 116, 147, 0.5);
    }
}

/* Animation Classes */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

.scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Scroll-triggered animations */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Animation direction variants */
.animate-on-scroll.fade-up {
    transform: translateY(30px);
}

.animate-on-scroll.fade-left {
    transform: translateX(-30px);
}

.animate-on-scroll.fade-right {
    transform: translateX(30px);
}

.animate-on-scroll.zoom-in {
    transform: scale(0.95);
}

/* Triggered states - both visible and animate-in work */
.animate-on-scroll.visible,
.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger delays for transitions */
.animate-on-scroll.delay-100 {
    transition-delay: 0.1s;
}

.animate-on-scroll.delay-200 {
    transition-delay: 0.2s;
}

.animate-on-scroll.delay-300 {
    transition-delay: 0.3s;
}

.animate-on-scroll.delay-400 {
    transition-delay: 0.4s;
}

.animate-on-scroll.delay-500 {
    transition-delay: 0.5s;
}

/* Fallback: show content if JS fails or file:// protocol */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}

/* Stagger delays for keyframe animations */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* ============================================
   SECTION STYLES
   ============================================ */

section {
    scroll-margin-top: 64px;
    /* Height of fixed header */
}

/* Hero Gradient */
.hero-gradient {
    background: linear-gradient(135deg, var(--hero-gradient-start) 0%, var(--hero-gradient-end) 100%);
}

/* Alternating sections */
.section-light {
    background-color: var(--background);
}

.section-muted {
    background-color: var(--secondary);
}

html.dark .section-muted {
    background-color: var(--muted);
}

/* ============================================
   NAVIGATION STYLES
   ============================================ */

.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
    left: 0;
}

.nav-link.active {
    color: var(--primary);
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(77, 116, 147, 0.3);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

/* ============================================
   CARD STYLES
   ============================================ */

.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(30, 30, 42, 0.15);
}

html.dark .card-hover:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ============================================
   PARTNER CAROUSEL
   ============================================ */

.partner-carousel {
    --animation-duration: 30s;
    overflow: hidden;
    position: relative;
}

.partner-carousel::before,
.partner-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    width: 100px;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.partner-carousel::before {
    left: 0;
    background: linear-gradient(to right, var(--background), transparent);
}

.partner-carousel::after {
    right: 0;
    background: linear-gradient(to left, var(--background), transparent);
}

html.dark .partner-carousel::before {
    background: linear-gradient(to right, var(--background), transparent);
}

html.dark .partner-carousel::after {
    background: linear-gradient(to left, var(--background), transparent);
}

.partner-track {
    display: flex;
    animation: scroll var(--animation-duration) linear infinite;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-input {
    background-color: var(--card);
    border: 1px solid var(--border);
    color: var(--foreground);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(77, 116, 147, 0.2);
    outline: none;
}

.form-input::placeholder {
    color: var(--muted-foreground);
}

/* ============================================
   UTILITIES
   ============================================ */

.text-gradient {
    background: linear-gradient(135deg, var(--deep-teal), var(--stone-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--deep-teal), var(--dark-blue));
}

.glassmorphism {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

html.dark .glassmorphism {
    background: rgba(30, 30, 42, 0.8);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {

    .partner-carousel::before,
    .partner-carousel::after {
        width: 50px;
    }

    section {
        scroll-margin-top: 56px;
    }
}

/* ============================================
   PARTNERS CAROUSEL ANIMATION
   ============================================ */

.animate-partners-scroll {
    display: flex;
    animation: partners-scroll 30s linear infinite;
}

.animate-partners-scroll:hover {
    animation-play-state: paused;
}

@keyframes partners-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Faster scroll on mobile */
@media (max-width: 768px) {
    .animate-partners-scroll {
        animation-duration: 20s;
    }
}

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

/* Social icon animations */
.social-icon {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.social-icon:hover {
    transform: scale(1.15) rotate(6deg);
}

/* Footer link underline effect */
.footer-link {
    position: relative;
    display: inline-block;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.3s ease;
}

.footer-link:hover::after {
    width: 100%;
}

/* Details/Summary chevron rotation */
details[open] summary i.lucide-chevron-down {
    transform: rotate(180deg);
}

details summary i.lucide-chevron-down {
    transition: transform 0.3s ease;
}

/* Focus visible styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================
   MOBILE UX IMPROVEMENTS
   ============================================ */

/* Issue #8: Hover effects only on devices with hover capability */
@media (hover: hover) and (pointer: fine) {
    .card-hover:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(30, 30, 42, 0.15);
    }
    .social-icon:hover {
        transform: scale(1.15) rotate(6deg);
    }
}

/* Disable card lift/shadow on touch devices */
@media (hover: none) {
    .card-hover:hover {
        transform: none;
        box-shadow: none;
    }
    /* Active state for touch feedback instead of hover */
    .card-hover:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    /* Disable image zoom hover on project cards */
    .group:hover .group-hover\:scale-110 {
        transform: none !important;
    }
    /* Active press feedback for project cards */
    .group:active .group-hover\:scale-110 {
        transform: scale(1.03) !important;
        transition: transform 0.15s ease;
    }
    /* Social icons: no rotation on touch */
    .social-icon:hover {
        transform: none;
    }
    .social-icon:active {
        transform: scale(0.9);
    }
}

/* Issue #9: WhatsApp FAB bounce auto-stop */
@keyframes whatsapp-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
    60% {
        transform: translateY(-4px);
    }
}

.whatsapp-fab {
    animation: whatsapp-bounce 1s ease-in-out 3;
    animation-fill-mode: forwards;
}
.whatsapp-fab:hover {
    animation: none;
}

/* Issue #10: Footer legal links bigger touch targets on mobile */
@media (max-width: 768px) {
    .legal-links a,
    .legal-links button {
        padding: 0.5rem 0.25rem;
        font-size: 0.8125rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Issue #11: Partner carousel touch pause */
.animate-partners-scroll.touch-paused {
    animation-play-state: paused !important;
}

/* Issue #1: "10+ Anos" card responsive fix */
@media (max-width: 640px) {
    .about-stats-card {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        margin-top: 1rem;
        width: 100%;
        text-align: center;
    }
}

/* Issue #2: Map scroll trap overlay */
.map-touch-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: opacity 0.3s ease;
    border-radius: 1.5rem;
}
.map-touch-overlay span {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    pointer-events: none;
}
.map-touch-overlay.active {
    opacity: 0;
    pointer-events: none;
}

/* Only show map overlay on touch devices */
@media (hover: hover) {
    .map-touch-overlay {
        display: none;
    }
}

/* Issue #5: Projects show more button */
@media (max-width: 767px) {
    .projects-grid .project-card-item:nth-child(n+5) {
        display: none;
    }
    .projects-grid.show-all .project-card-item:nth-child(n+5) {
        display: block;
    }
    .projects-show-more {
        display: flex !important;
    }
}
@media (min-width: 768px) {
    .projects-show-more {
        display: none !important;
    }
}

/* Issue #4: Services horizontal scroll on mobile */
@media (max-width: 767px) {
    .services-grid-mobile {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 1rem;
        padding-bottom: 1rem;
        scrollbar-width: none;
        /* Firefox */
    }
    .services-grid-mobile::-webkit-scrollbar {
        display: none;
    }
    .services-grid-mobile > * {
        min-width: 280px;
        max-width: 300px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}

/* Services scroll indicator dots */
.services-scroll-hint {
    display: none;
}
@media (max-width: 767px) {
    .services-scroll-hint {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        padding-top: 0.75rem;
    }
    .services-scroll-hint span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--muted-foreground);
        opacity: 0.3;
    }
}
