/* ═══════════════════════════════════════════════════════════
   Mobile Premium — index only (≤767px), desktop unchanged
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  :root {
    --mob-header-h: 56px;
    --mob-safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Anchor scroll offset under fixed header */
  body.index-page .main > section[id] {
    scroll-margin-top: calc(var(--mob-header-h) + 10px);
  }

  /* ── Hide desktop chrome ── */
  body.index-page .header,
  body.index-page .scroll-progress,
  body.index-page .motion-mesh,
  body.index-page .motion-cursor,
  body.index-page .scroll-top,
  body.index-page .hero-scroll-hint {
    display: none !important;
  }

  body.index-page.mobile-menu-open {
    overflow: hidden;
  }

  /* ── Top bar ── */
  body.index-page .mobile-navbar {
    display: block !important;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10050;
    padding: 0 !important;
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.22) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2) !important;
  }

  body.index-page .mobile-nav-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: var(--mob-header-h) !important;
    padding: 0 14px !important;
    gap: 10px;
  }

  body.index-page .mobile-logo {
    flex-shrink: 0;
  }

  body.index-page .mobile-logo img {
    height: 30px !important;
    width: auto !important;
    filter: brightness(0) invert(1) !important;
  }

  body.index-page .mobile-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  body.index-page .mobile-nav-cta {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 100px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff !important;
    font-size: 0.6875rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  }

  body.index-page .mobile-menu-toggle {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 11px !important;
    background: rgba(99, 102, 241, 0.2) !important;
    color: #fff !important;
    font-size: 1.125rem !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none !important;
    padding: 0 !important;
  }

  body.index-page .mobile-menu-toggle:active {
    transform: scale(0.94);
  }

  /* ── Drawer backdrop ── */
  body.index-page .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border: none;
    padding: 0;
    cursor: pointer;
  }

  body.index-page.mobile-menu-open .mobile-menu-backdrop {
    opacity: 1;
    visibility: visible;
  }

  /* ── Side drawer menu ── */
  body.index-page .mobile-menu {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    bottom: auto !important;
    width: min(300px, 86vw) !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%) !important;
    border-left: 1px solid rgba(99, 102, 241, 0.2) !important;
    box-shadow: -12px 0 48px rgba(0, 0, 0, 0.35) !important;
    z-index: 10045 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transform: translateX(100%) !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  body.index-page .mobile-menu.active {
    transform: translateX(0) !important;
  }

  body.index-page .mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--mob-header-h) + 4px) 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  body.index-page .mobile-menu-header span {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
  }

  body.index-page .mobile-menu-header small {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #818cf8;
  }

  body.index-page .mobile-menu ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 12px 12px 0 !important;
  }

  body.index-page .mobile-menu ul li {
    margin-bottom: 4px !important;
  }

  body.index-page .mobile-menu ul li.menu-group-label {
    padding: 16px 12px 6px !important;
    margin: 0 !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    color: #818cf8 !important;
    background: none !important;
    border: none !important;
    pointer-events: none;
  }

  body.index-page .mobile-menu ul li a {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px;
    padding: 13px 14px !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 12px !important;
    color: #e2e8f0 !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transform: none !important;
  }

  body.index-page .mobile-menu ul li a:active {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #fff !important;
  }

  body.index-page .mobile-menu-footer {
    padding: 16px 16px calc(16px + var(--mob-safe-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 12px;
  }

  body.index-page .mobile-menu-footer-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff !important;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
  }

  /* ── App shell ── */
  body.index-page {
    background: #eef2f7 !important;
    padding-bottom: calc(var(--mob-safe-bottom) + 20px) !important;
    overflow-x: clip;
  }

  body.index-page .main {
    background: #eef2f7 !important;
  }

  /* Hero — single padding source */
  body.index-page .hero-premium,
  body.index-page .hero.hero-premium {
    padding-top: calc(var(--mob-header-h) + 1.25rem) !important;
    padding-bottom: 1.5rem !important;
    min-height: auto !important;
  }

  /* Section cards — full bleed exceptions */
  body.index-page .main > section {
    margin-left: 10px !important;
    margin-right: 10px !important;
    margin-bottom: 10px !important;
    border-radius: 20px !important;
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05) !important;
    overflow: hidden;
  }

  body.index-page .main > section.hero-premium,
  body.index-page .main > section#ai-controller,
  body.index-page .main > section#ecosystem,
  body.index-page .main > section#portfolio {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.index-page .hero-premium {
    border-radius: 0 0 24px 24px !important;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%) !important;
  }

  body.index-page .hero-premium .hero-content {
    text-align: center !important;
  }

  body.index-page .hero-premium .hero-title {
    font-size: clamp(1.625rem, 7vw, 2.125rem) !important;
    line-height: 1.15 !important;
  }

  body.index-page .hero-premium .hero-subtitle {
    font-size: 0.9375rem !important;
    color: rgba(226, 232, 240, 0.85) !important;
  }

  body.index-page .hero-premium .hero-badge {
    font-size: 0.6875rem !important;
    padding: 8px 14px !important;
  }

  body.index-page .hero-buttons {
    flex-direction: column !important;
    gap: 10px !important;
  }

  body.index-page .hero-buttons a {
    width: 100% !important;
    justify-content: center !important;
  }

  body.index-page .hero-stats {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-top: 1.25rem !important;
  }

  body.index-page .hero-stats .stat-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 6px !important;
  }

  body.index-page .hero-stats .stat-number {
    font-size: 1.25rem !important;
    color: #fff !important;
  }

  body.index-page .hero-stats .stat-label {
    font-size: 0.625rem !important;
    color: rgba(226, 232, 240, 0.7) !important;
  }

  /* Quick nav chips */
  body.index-page .app-quick-nav {
    background: #eef2f7 !important;
    padding: 0.75rem 0 0.25rem !important;
  }

  body.index-page .app-quick-chip {
    background: #fff !important;
    border-color: rgba(99, 102, 241, 0.15) !important;
    font-size: 0.75rem !important;
    padding: 9px 14px !important;
  }

  body.index-page .app-quick-chip.active {
    background: linear-gradient(135deg, #6366f1, #7c3aed) !important;
    color: #fff !important;
    border-color: transparent !important;
  }

  body.index-page .app-quick-chip.active i {
    color: #fff !important;
  }

  /* AI controller — override inline padding */
  body.index-page #ai-controller {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    padding: 2rem 0 !important;
  }

  body.index-page #ai-controller .row.text-center.mb-5 h2 {
    font-size: 1.375rem !important;
    line-height: 1.2 !important;
  }

  body.index-page #ai-controller .row.text-center.mb-5 p {
    font-size: 0.875rem !important;
  }

  /* About — stack content then visual */
  body.index-page #about .row.align-items-center {
    flex-direction: column;
  }

  body.index-page #about .about-content {
    order: 1;
  }

  body.index-page #about .col-lg-6:last-child {
    order: 2;
    width: 100%;
  }

  body.index-page #about .about-features {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  body.index-page #about .feature-item span {
    font-size: 0.8125rem !important;
  }

  /* Ecosystem horizontal flow on small screens */
  body.index-page .eco-flow {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 12px !important;
    padding-bottom: 8px;
  }

  body.index-page .eco-flow::-webkit-scrollbar {
    display: none;
  }

  body.index-page .eco-step {
    flex: 0 0 72vw !important;
    max-width: 72vw !important;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
  }

  /* Ecosystem — dark theme (mobile card shell was forcing white bg + white text) */
  body.index-page #ecosystem.iot-ecosystem {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%) !important;
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  body.index-page #ecosystem .section-badge {
    background: rgba(99, 102, 241, 0.22) !important;
    color: #c7d2fe !important;
    border: 1px solid rgba(99, 102, 241, 0.35) !important;
  }

  body.index-page #ecosystem h2 {
    color: #fff !important;
    text-align: center !important;
  }

  body.index-page #ecosystem h2 span {
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
  }

  body.index-page #ecosystem .lead-text {
    color: rgba(255, 255, 255, 0.78) !important;
    text-align: center !important;
  }

  body.index-page #ecosystem .eco-step h4 {
    color: #fff !important;
  }

  body.index-page #ecosystem .eco-step p {
    color: rgba(255, 255, 255, 0.62) !important;
  }

  body.index-page #ecosystem .eco-stat {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
  }

  body.index-page #ecosystem .eco-stat .val {
    color: #a5b4fc !important;
  }

  body.index-page #ecosystem .eco-stat .lbl {
    color: rgba(255, 255, 255, 0.55) !important;
  }

  /* Portfolio mobile */
  body.index-page #portfolio.portfolio-premium {
    background: #eef2f7 !important;
    padding: 0 !important;
  }

  body.index-page #portfolio .portfolio-premium__top {
    border-radius: 0 0 20px 20px;
    margin-bottom: 10px;
    padding-top: 2rem !important;
    padding-bottom: 1.5rem !important;
  }

  body.index-page #portfolio .section-head {
    margin-bottom: 1.25rem !important;
  }

  body.index-page #portfolio .section-head h2 {
    font-size: 1.5rem !important;
  }

  body.index-page #portfolio .section-head p {
    font-size: 0.875rem !important;
  }

  body.index-page #portfolio .portfolio-premium__body {
    padding: 0 10px 1.5rem !important;
  }

  body.index-page #portfolio .portfolio-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  body.index-page #portfolio .portfolio-stat {
    padding: 0.625rem 0.375rem;
  }

  body.index-page #portfolio .portfolio-stat .val {
    font-size: 1.125rem;
  }

  /* Portfolio project cards — equal height in horizontal swipe */
  body.index-page #portfolio .isotope-layout {
    height: auto !important;
  }

  body.index-page #portfolio .isotope-container.app-h-scroll {
    height: auto !important;
  }

  body.index-page #portfolio .isotope-container.app-h-scroll .portfolio-card {
    min-height: 400px !important;
    height: 100% !important;
    padding: 0 !important;
  }

  body.index-page #portfolio .portfolio-image {
    height: 168px !important;
  }

  body.index-page #portfolio .portfolio-content {
    flex: 1 !important;
  }

  body.index-page #portfolio .portfolio-content p {
    -webkit-line-clamp: 3 !important;
  }

  body.index-page #portfolio .portfolio-tech {
    margin-top: auto !important;
  }

  body.index-page #portfolio .portfolio-cta {
    padding: 0 10px 1.5rem !important;
  }

  /* Testimonials */
  body.index-page #testimonials {
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%) !important;
  }

  body.index-page #testimonials .section-head h2 {
    font-size: 1.375rem !important;
  }

  body.index-page #testimonials .section-head p {
    font-size: 0.875rem !important;
  }

  body.index-page #testimonials .testimonials-swiper-wrap {
    padding: 0 8px !important;
  }

  body.index-page #testimonials .testimonial-card-v2 {
    padding: 1.25rem !important;
  }

  /* FAQ */
  body.index-page #faq {
    background: #fff !important;
  }

  body.index-page #faq .accordion-button {
    font-size: 0.875rem !important;
    padding: 0.875rem 1rem !important;
  }

  /* Recent posts */
  body.index-page #recent-posts {
    background: #fff !important;
  }

  body.index-page #recent-posts .post-item {
    border-radius: 16px !important;
    overflow: hidden;
  }

  /* Footer & contact CTA */
  body.index-page .footer {
    margin: 0 10px 10px !important;
    border-radius: 20px !important;
    overflow: hidden;
    margin-bottom: calc(var(--mob-safe-bottom) + 16px) !important;
  }

  body.index-page .contact-mobile-banner {
    margin: 0 10px calc(var(--mob-safe-bottom) + 12px) !important;
    border-radius: 20px !important;
  }

  /* Chatbot — bottom safe area only */
  body.index-page .chatbot-fab {
    bottom: calc(var(--mob-safe-bottom) + 16px) !important;
    width: 50px !important;
    height: 50px !important;
    z-index: 9990 !important;
  }

  body.index-page .chatbot-frame-container {
    bottom: calc(var(--mob-safe-bottom) + 12px) !important;
    max-height: min(72dvh, 540px);
  }

  /* No bottom tab bar */
  body.index-page .app-bottom-nav {
    display: none !important;
  }

  /* Section headers from app-section-head */
  body.index-page .app-section-head .head-text h2 {
    font-size: 1.25rem !important;
  }

  /* About section — light card on mobile */
  body.index-page #about {
    background: #fff !important;
  }

  body.index-page #services,
  body.index-page #products {
    background: #fff !important;
  }

  body.index-page #tech-stack {
    background: #fff !important;
  }

  /* IoT visual cards in horizontal scroll */
  body.index-page .app-h-scroll .iot-v-card {
    min-height: auto !important;
    height: 100%;
  }

  body.index-page .app-h-scroll .iot-v-card__visual {
    height: 140px;
  }

  body.index-page .app-h-scroll .iot-v-card__visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  body.index-page .app-h-scroll .iot-v-card__body {
    padding: 1rem !important;
  }

  body.index-page .app-h-scroll .iot-v-card__body p {
    -webkit-line-clamp: 3;
    font-size: 0.8125rem !important;
  }

  body.index-page .app-h-scroll .iot-v-card__chips {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  /* Trust marquee */
  body.index-page .trust-strip-marquee {
    overflow: hidden;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
  }

  body.index-page .section-wave {
    overflow: hidden;
    line-height: 0;
  }

  /* AI panels — readable on narrow screens */
  body.index-page #ai-controller .ai-panel {
    min-height: auto !important;
  }

  /* Portfolio filters — horizontal swipe */
  body.index-page #portfolio .portfolio-filters {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
    padding-bottom: 6px;
  }

  body.index-page #portfolio .portfolio-filters::-webkit-scrollbar {
    display: none;
  }

  body.index-page #portfolio .portfolio-filters .nav-item {
    flex-shrink: 0;
  }

  /* Testimonials featured quote */
  body.index-page #testimonials .testimonials-featured {
    padding: 1.25rem !important;
    font-size: 0.9375rem !important;
  }

  body.index-page #testimonials .testimonials-featured blockquote {
    font-size: 1rem !important;
    line-height: 1.45 !important;
  }

  body.index-page .marquee-item {
    font-size: 0.75rem !important;
  }

  /* Inline section titles — left align on mobile */
  body.index-page .main section .row.text-center.mb-5 h2,
  body.index-page .main section .container.section-title h2 {
    font-size: 1.375rem !important;
    text-align: left !important;
  }

  body.index-page .main section .row.text-center.mb-5 p,
  body.index-page .main section .container.section-title p {
    font-size: 0.875rem !important;
    text-align: left !important;
  }

  body.index-page .main section .row.text-center.mb-5,
  body.index-page .main section .container.section-title {
    text-align: left !important;
  }

  body.index-page .main section .section-badge,
  body.index-page .main section .badge {
    font-size: 0.6875rem !important;
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--mob-header-h) + 8px);
  }
}
