/**
 * ADIGO Theme — Global Responsive Fixes
 * Version: 5.3.0
 * Covers: desktop (>1024px), tablet (768–1024px), mobile (≤767px), small mobile (≤480px)
 */

/* =============================================
   BASE RESETS
   ============================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

html, body {
    max-width: 100vw;
}

section {
    overflow-x: hidden;
}

img, video, canvas, svg, iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =============================================
   CONTAINER
   ============================================= */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

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

@media (max-width: 480px) {
    .container {
        padding: 0 14px;
    }
}

/* =============================================
   PARALLAX / HERO BACKGROUNDS
   ============================================= */

.parallax-bg {
    position: absolute;
    top: -15%;
    left: 0;
    right: 0;
    bottom: -15%;
    width: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 0;
    will-change: transform;
    transform: translate3d(0,0,0);
    pointer-events: none;
    transition: background-image 0.4s ease-in-out;
}

@media (max-width: 1024px) {
    .parallax-bg {
        top: -8%;
        bottom: -8%;
    }
}

@media (max-width: 768px) {
    .parallax-bg {
        top: 0;
        bottom: 0;
        transform: none !important;
    }
}

.parallax-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* Content always above overlay */
.hero-section > .container,
.hero-section > div:not(.parallax-bg):not(.parallax-overlay),
section > .container[style*="z-index"] {
    position: relative;
    z-index: 2;
}

/* =============================================
   HERO HEIGHTS
   ============================================= */

@media (max-width: 1024px) {
    .hero-section {
        min-height: 420px !important;
    }
}

@media (max-width: 768px) {
    .hero-section {
        min-height: 360px !important;
        padding: 60px 0 !important;
    }
    .hero-section[style*="100vh"] {
        min-height: 500px !important;
        height: auto !important;
    }
}

@media (max-width: 480px) {
    .hero-section {
        min-height: 300px !important;
        padding: 40px 0 !important;
    }
}

/* =============================================
   TYPOGRAPHY — fluid scaling
   ============================================= */

@media (max-width: 768px) {
    h1[style*="font-size: 48px"],
    h1[style*="font-size: 52px"],
    h1[style*="font-size: 56px"],
    h2[style*="font-size: 48px"],
    h2[style*="font-size: 52px"] {
        font-size: 30px !important;
        line-height: 1.25 !important;
    }

    h2[style*="font-size: 42px"],
    h2[style*="font-size: 36px"],
    h3[style*="font-size: 36px"] {
        font-size: 24px !important;
        line-height: 1.3 !important;
    }

    h3[style*="font-size: 28px"],
    h3[style*="font-size: 24px"] {
        font-size: 20px !important;
    }

    p[style*="font-size: 20px"],
    p[style*="font-size: 18px"] {
        font-size: 16px !important;
        line-height: 1.7 !important;
    }

    p[style*="font-size: 16px"] {
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    h1[style*="font-size: 48px"],
    h1[style*="font-size: 52px"],
    h1[style*="font-size: 56px"] {
        font-size: 26px !important;
    }

    h2[style*="font-size: 42px"],
    h2[style*="font-size: 36px"],
    h3[style*="font-size: 36px"] {
        font-size: 22px !important;
    }
}

/* =============================================
   SECTION PADDING
   ============================================= */

@media (max-width: 768px) {
    section[style*="padding: 120px 0"] { padding: 60px 0 !important; }
    section[style*="padding: 100px 0"] { padding: 55px 0 !important; }
    section[style*="padding: 80px 0"]  { padding: 48px 0 !important; }
    section[style*="padding: 60px 0"]  { padding: 36px 0 !important; }
}

@media (max-width: 480px) {
    section[style*="padding: 120px 0"] { padding: 44px 0 !important; }
    section[style*="padding: 100px 0"] { padding: 40px 0 !important; }
    section[style*="padding: 80px 0"]  { padding: 36px 0 !important; }
    section[style*="padding: 60px 0"]  { padding: 30px 0 !important; }
}

/* =============================================
   MARGIN / GAP RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    [style*="margin-bottom: 80px"] { margin-bottom: 48px !important; }
    [style*="margin-bottom: 60px"] { margin-bottom: 36px !important; }
    [style*="gap: 80px"]           { gap: 40px !important; }
    [style*="gap: 60px"]           { gap: 28px !important; }
}

@media (max-width: 480px) {
    [style*="margin-bottom: 80px"] { margin-bottom: 32px !important; }
    [style*="margin-bottom: 60px"] { margin-bottom: 24px !important; }
    [style*="margin-bottom: 40px"] { margin-bottom: 20px !important; }
    [style*="gap: 80px"]           { gap: 24px !important; }
    [style*="gap: 60px"]           { gap: 20px !important; }
    [style*="gap: 40px"]           { gap: 16px !important; }
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #C3110D 0%, #ff4444 100%);
    color: white;
    box-shadow: 0 10px 30px rgba(195,17,13,0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid #C3110D;
    color: #C3110D;
}

.btn-white {
    background: white;
    color: #C3110D;
}

@media (max-width: 480px) {
    .btn {
        padding: 12px 22px;
        font-size: 14px;
    }

    /* CTA groups stack vertically */
    .hero-cta-group {
        flex-direction: column !important;
        align-items: center !important;
    }

    .hero-cta-group .btn {
        width: 100% !important;
        max-width: 300px !important;
        text-align: center !important;
    }

    /* Download buttons */
    .platform-intro-grid .btn {
        display: block !important;
        text-align: center !important;
        width: 100% !important;
    }
}

/* =============================================
   FORMS
   ============================================= */

input, textarea, select {
    font-family: inherit;
    font-size: 16px; /* prevents iOS zoom */
}

/* =============================================
   SECTION HEADERS
   ============================================= */

.section-subtitle {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #C3110D;
    margin-bottom: 12px;
}

.section-title {
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 800;
    color: #0a0a0a;
    line-height: 1.2;
}

/* =============================================
   CARDS
   ============================================= */

@media (max-width: 768px) {
    .card[style*="padding: 40px"],
    [class*="-card"][style*="padding: 40px"] {
        padding: 24px !important;
    }
    .card[style*="padding: 50px"],
    [class*="-card"][style*="padding: 50px"] {
        padding: 28px !important;
    }
}

@media (max-width: 480px) {
    .card[style*="padding: 40px"],
    .card[style*="padding: 32px"],
    [class*="-card"][style*="padding: 40px"],
    [class*="-card"][style*="padding: 32px"] {
        padding: 18px !important;
    }
}

/* =============================================
   IMAGES — fluid everywhere
   ============================================= */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.post-content img,
.entry-content img,
.wp-post-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.service-image,
img.service-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: cover;
    display: block;
}

.blog-thumbnail,
.blog-card-thumb,
.related-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.blog-thumbnail img,
.blog-card-thumb img,
.related-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.partner-logo-img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Post hero fluid height */
.post-hero {
    min-height: clamp(220px, 40vw, 500px) !important;
    max-height: 600px !important;
}

/* =============================================
   ANIMATION ADJUSTMENTS ON MOBILE
   ============================================= */

@media (max-width: 768px) {
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .parallax-bg {
        transform: none !important;
        top: 0;
        bottom: 0;
    }
}

/* =============================================
   OVERFLOW PREVENTION
   ============================================= */

@media (max-width: 768px) {
    .container,
    section > div {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Hide purely decorative blur blobs on mobile */
    [style*="filter: blur"][style*="border-radius: 50%"][style*="position: absolute"] {
        display: none !important;
    }
}

/* =============================================
   HIDE / SHOW UTILITIES
   ============================================= */

@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
    .show-mobile-only { display: none !important; }
}

/* =============================================
   ICON / BADGE SCALING
   ============================================= */

@media (max-width: 768px) {
    [style*="width: 80px"][style*="height: 80px"] {
        width: 60px !important;
        height: 60px !important;
    }

    [style*="width: 70px"][style*="height: 70px"] {
        width: 54px !important;
        height: 54px !important;
    }
}

/* =============================================
   ░░░  PER-PAGE GRIDS — TABLET & MOBILE  ░░░
   ============================================= */

/* ---- HOME PAGE ---- */
@media (max-width: 968px) {
    .who-we-are-grid    { grid-template-columns: 1fr !important; gap: 40px !important; }
    .platforms-home-grid{ grid-template-columns: 1fr !important; }
    .why-adigo-grid     { grid-template-columns: repeat(2, 1fr) !important; }
    .intel-home-grid    { grid-template-columns: 1fr !important; }
}

@media (max-width: 576px) {
    .why-adigo-grid     { grid-template-columns: 1fr !important; }
    .domain-tags-grid   { grid-template-columns: 1fr !important; }
}

/* ---- PRODUCTS PAGE — ADIGO App + StockVentory ---- */
@media (max-width: 968px) {
    /* Stack the 2-col intro grid */
    .platform-intro-grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }

    /* ★ ALWAYS SHOW the phone mockup — just scale it down and put it on top */
    .platform-intro-grid > div:last-child {
        display: block !important;
        order: -1;
    }

    /* Scale the outer card wrapper */
    .platform-intro-grid > div:last-child > div[style*="border-radius: 24px"] {
        min-height: 240px !important;
        padding: 20px !important;
    }

    /* Scale the phone body */
    .platform-intro-grid > div:last-child div[style*="width: 180px"][style*="height: 320px"] {
        width: 130px !important;
        height: 230px !important;
        padding: 14px 12px !important;
    }

    /* Notch */
    .platform-intro-grid > div:last-child div[style*="width: 60px"][style*="height: 4px"] {
        width: 44px !important;
    }

    /* Icon grid cells inside phone */
    .platform-intro-grid > div:last-child div[style*="grid-template-columns: 1fr 1fr"] > div {
        padding: 7px 0 !important;
    }

    /* Modules: 2 columns on tablet */
    .modules-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 576px) {
    /* Modules: 1 column on mobile */
    .modules-grid { grid-template-columns: 1fr !important; }

    /* StockVentory feature cards */
    .sv-features-grid { grid-template-columns: 1fr !important; }

    /* Scale phone even smaller on tiny screens */
    .platform-intro-grid > div:last-child div[style*="width: 180px"][style*="height: 320px"] {
        width: 110px !important;
        height: 190px !important;
        padding: 10px !important;
    }
}

/* ---- BLOG PAGE ---- */
@media (max-width: 968px) {
    .blog-hero-grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    /* Hide decorative right side on tablet */
    .blog-hero-grid > div:last-child {
        display: none;
    }
    .blog-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 576px) {
    .blog-grid { grid-template-columns: 1fr !important; }
}

/* ---- CAREERS PAGE — job listing cards ---- */
@media (max-width: 768px) {
    .culture-grid {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }

    .job-card {
        flex-direction: column !important;
        gap: 20px !important;
        text-align: center !important;
    }

    /* The 2-col grid inside job cards */
    div[style*="grid-template-columns: repeat(2, 1fr)"][style*="gap: 40px"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* ---- PARTNERS PAGE ---- */
@media (max-width: 768px) {
    .dev-zone-grid {
        grid-template-columns: 1fr !important;
        gap: 40px !important;
    }

    /* The 2-col feature list inside partner zone */
    div[style*="grid-template-columns: repeat(2, 1fr)"][style*="gap: 20px"] {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }
}

/* ---- ABOUT PAGE ---- */
@media (max-width: 768px) {
    .domain-card {
        padding: 30px 20px !important;
    }
}

/* ---- CONTACT PAGE ---- */
@media (max-width: 768px) {
    .contact-hero      { min-height: 280px !important; }
    .contact-section   { padding: 50px 0 !important; }
    .contact-cards     { gap: 16px !important; margin-bottom: 40px !important; }
    .contact-card      { padding: 24px !important; }
    .contact-form-wrapper {
        padding: 28px 20px !important;
        border-radius: 16px !important;
    }
    .modern-contact-form input,
    .modern-contact-form textarea,
    .modern-contact-form select {
        padding: 12px 16px !important;
        font-size: 16px !important;
    }
    .submit-btn {
        width: 100% !important;
        padding: 14px 32px !important;
    }
}

@media (max-width: 480px) {
    .contact-card         { padding: 20px !important; }
    .contact-form-wrapper { padding: 20px 14px !important; }
}

/* ---- SERVICES PAGE ---- */
@media (max-width: 992px) {
    .services-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .service-detail-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
}

/* ---- INTELLIGENCE PAGE ---- */
@media (max-width: 768px) {
    /* Cards already use auto-fit — just ensure padding is comfortable */
    .intel-card { padding: 24px !important; }
}

/* =============================================
   PARTNER CAROUSEL — keeps working on all sizes
   ============================================= */

.partner-logo-item {
    flex-shrink: 0;
    width: calc(100vw / var(--partner-visible, 5));
    max-width: 220px;
    min-width: 150px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 30px;
    text-decoration: none;
    transition: transform 0.3s ease;
}

@media (max-width: 968px) {
    .partner-logo-item {
        min-width: 130px;
        padding: 12px 20px;
    }

    .partner-logo-img {
        max-height: 50px;
        max-width: 130px;
    }
}

@media (max-width: 576px) {
    .partner-logo-item {
        min-width: 110px;
        padding: 10px 16px;
    }

    .partner-logo-img {
        max-height: 40px;
        max-width: 110px;
    }

    .partners-carousel-section {
        padding: 50px 0 40px !important;
    }
}

/* =============================================
   STATS GRID — 2×2 on mobile
   ============================================= */

@media (max-width: 768px) {
    .stats-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 20px !important;
        max-width: 400px;
        margin: 0 auto;
    }

    .stat-number {
        font-size: 36px !important;
        margin-bottom: 8px !important;
    }

    .stat-label { font-size: 12px !important; }
}

/* =============================================
   ARCHIVE / BLOG LISTING
   ============================================= */

@media (max-width: 768px) {
    .blog-grid { grid-template-columns: 1fr !important; }
}

/* =============================================
   PRODUCTS SPACING (Home page old grid)
   ============================================= */

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

    .products-grid-full {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    .product-card { padding: 20px 12px !important; }

    .card-icon-wrapper {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 12px !important;
    }

    .card-title       { font-size: 14px !important; }
    .card-description { font-size: 12px !important; line-height: 1.4 !important; }
    .btn-sm           { font-size: 11px !important; padding: 8px 14px !important; }
}

@media (max-width: 480px) {
    .card-title       { font-size: 13px !important; }
    .card-description { font-size: 11px !important; }
    .btn-sm           { font-size: 10px !important; padding: 7px 12px !important; }
}

/* =============================================
   FOOTER MAP — fluid height
   ============================================= */

/* Already uses clamp() — just ensure iframe doesn't overflow */
.footer-map-container iframe {
    max-width: 100% !important;
}

/* =============================================
   AUTO-FIT GRIDS — prevent overflowing on xs
   ============================================= */

@media (max-width: 480px) {
    [style*="grid-template-columns: repeat(auto-fit, minmax(400px"],
    [style*="grid-template-columns: repeat(auto-fit, minmax(340px"],
    [style*="grid-template-columns: repeat(auto-fit, minmax(320px"],
    [style*="grid-template-columns: repeat(auto-fit, minmax(300px"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    [style*="grid-template-columns: repeat(auto-fit, minmax(400px"] {
        grid-template-columns: 1fr !important;
    }
}
