/* ============================================================
   GM Engineering & Project — Global Stylesheet
   Supplements Tailwind CSS CDN
   ============================================================ */

/* --- Reset body padding set by default template --- */
body {
    padding: 0;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Smooth scrolling --- */
html {
    scroll-behavior: smooth;
}

/* --- Shared font helper for display headings --- */
.font-display {
    font-family: 'Playfair Display', serif;
}

/* --- Fix parallax on iOS (background-attachment: fixed breaks on mobile Safari) --- */
.parallax-bg {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    /* Fixed attachment only on desktop */
    background-attachment: scroll;
}
@media (min-width: 1024px) {
    .parallax-bg {
        background-attachment: fixed;
    }
}

/* --- Responsive images --- */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Touch target minimum size (WCAG 2.5.5) --- */
a, button {
    min-height: 44px;
    min-width: 44px;
}
/* Override for inline/icon-only elements that shouldn't be stretched */
nav a, footer a {
    min-height: unset;
    min-width: unset;
}

/* --- Navbar logo size --- */
#navbar img[alt*="Logo"] {
    height: 3.5rem; /* 56px — up from h-10 (40px) */
    width: auto;
}

/* --- Footer logo size --- */
footer img[alt*="Logo"] {
    height: 3rem; /* 48px — up from h-8 (32px) */
    width: auto;
}

/* --- Navbar: ensure visible on all backgrounds --- */
#navbar {
    background: transparent;
}
#navbar.nav-scrolled {
    background: rgba(17, 24, 39, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(249, 115, 22, 0.2);
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

/* --- Mobile menu smooth open/close --- */
#mobile-menu {
    transition: all 0.3s ease;
}
#mobile-menu a {
    padding: 0.75rem 0;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: block;
}
#mobile-menu a:last-child {
    border-bottom: none;
}

/* --- Shared reveal helpers --- */
.hero-text-reveal {
    overflow: hidden;
}

/* --- Hero: prevent text overflow on small screens --- */
.hero-text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    word-break: break-word;
}

.fade-up {
    opacity: 0;
    transform: translateY(40px);
}

/* --- Shared animation helpers --- */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotate-slow {
    animation: rotate 20s linear infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

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

/* --- Shared page-group styling --- */
body.client-page .gradient-overlay {
    background: linear-gradient(135deg, rgba(17,24,39,0.95) 0%, rgba(17,24,39,0.8) 50%, rgba(249,115,22,0.15) 100%);
}

body.client-page .service-item,
body.legal-page .policy-section,
body.project-case-page .scope-item {
    border-left: 3px solid #f97316;
}

body.project-case-page .gradient-overlay {
    background: linear-gradient(135deg, rgba(17,24,39,0.92) 0%, rgba(17,24,39,0.75) 50%, rgba(249,115,22,0.25) 100%);
}

body.project-case-page .challenge-card {
    border-top: 3px solid #f97316;
}

body.project-case-page .stat-pill {
    background: rgba(249,115,22,0.08);
    border: 1px solid rgba(249,115,22,0.2);
}

/* --- Responsive hero font scaling --- */
@media (max-width: 480px) {
    .font-display.text-5xl,
    .font-display.text-6xl,
    .font-display.text-7xl {
        font-size: 2.25rem !important;
        line-height: 1.2 !important;
    }
    .font-display.text-4xl {
        font-size: 1.875rem !important;
    }
    .font-display.text-3xl {
        font-size: 1.5rem !important;
    }
}
@media (max-width: 640px) {
    .font-display.text-7xl {
        font-size: 2.75rem !important;
    }
    .font-display.text-6xl {
        font-size: 2.5rem !important;
    }
    .font-display.text-5xl {
        font-size: 2.25rem !important;
    }
}

/* --- Section padding: tighter on mobile --- */
@media (max-width: 768px) {
    .py-20 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
    .py-32 { padding-top: 4rem !important; padding-bottom: 4rem !important; }
    .lg\:py-32 { padding-top: 3rem; padding-bottom: 3rem; }
    .mb-16 { margin-bottom: 2.5rem !important; }
    .gap-16 { gap: 2.5rem !important; }
    .gap-12 { gap: 2rem !important; }
}

/* --- Cards: prevent overflow on small screens --- */
.service-card,
.project-feat-card,
.stats-card,
.team-card {
    overflow: hidden;
}

/* --- Team card overlay: always visible on touch devices --- */
@media (hover: none) {
    .team-overlay {
        opacity: 1 !important;
        transform: translateY(0) !important;
        background: linear-gradient(to top, rgba(17,24,39,0.95) 0%, rgba(17,24,39,0.5) 60%, transparent 100%);
    }
}

/* --- Timeline: mobile single column --- */
@media (max-width: 767px) {
    .timeline-item .grid {
        grid-template-columns: 1fr !important;
    }
    .timeline-item .md\:text-right {
        text-align: left !important;
    }
    .timeline-item .md\:pr-12,
    .timeline-item .md\:pl-12 {
        padding: 0 !important;
    }
    .timeline-item .w-20.h-20 {
        margin: 0 auto;
    }
    /* Hide the vertical line on mobile */
    .timeline-line {
        display: none;
    }
}

/* --- Process steps connector line: hide on mobile/tablet --- */
@media (max-width: 1023px) {
    .process-connector {
        display: none !important;
    }
}

/* --- Stat counters: smaller on mobile --- */
@media (max-width: 480px) {
    .counter-value {
        font-size: 2rem !important;
    }
}

/* --- Buttons: full width on very small screens --- */
@media (max-width: 400px) {
    .hero-cta-wrap {
        flex-direction: column;
    }
    .hero-cta-wrap a {
        width: 100%;
        justify-content: center;
    }
}

/* --- WhatsApp button: smaller on mobile to avoid overlap --- */
@media (max-width: 480px) {
    .whatsapp-btn,
    a[aria-label="Chat on WhatsApp"] {
        width: 3rem !important;
        height: 3rem !important;
        bottom: 1rem !important;
        right: 1rem !important;
    }
    a[aria-label="Chat on WhatsApp"] svg {
        width: 1.4rem !important;
        height: 1.4rem !important;
    }
}

/* --- Contact form inputs: better mobile UX --- */
input, textarea, select {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    border-radius: 0.75rem;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
}

/* --- Map iframe responsive --- */
iframe {
    max-width: 100%;
}

/* --- Overflow fix for sections with decorative elements --- */
section {
    overflow-x: hidden;
}

/* --- Footer: stack on mobile --- */
@media (max-width: 767px) {
    footer .grid.md\:grid-cols-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
    }
}
@media (max-width: 480px) {
    footer .grid.md\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
}

/* --- Transitions: respect reduced motion preference --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .rotate-slow,
    .floating {
        animation: none !important;
    }
}

/* --- Shared WhatsApp floating button styling --- */
.whatsapp-btn,
a[aria-label="Chat on WhatsApp"] {
    box-shadow: 0 4px 20px rgba(37,211,102,0.4);
}

.whatsapp-btn:hover,
a[aria-label="Chat on WhatsApp"]:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(37,211,102,0.6);
}

/* --- Cross-browser focus styles --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

/* --- Utility: visually hidden (accessibility) --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
