/* ═══════════════════════════════════════════════════════════
   IoTFIY — Layout, Spacing & Responsive Brand System
   ═══════════════════════════════════════════════════════════ */

:root {
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --section-y: clamp(3.5rem, 8vw, 6rem);
  --section-y-lg: clamp(4rem, 10vw, 7rem);
  --container-px: clamp(1.25rem, 4vw, 2rem);
  --text-max: 42rem;
  --card-radius: 16px;
  --card-pad: clamp(1.25rem, 3vw, 2rem);
}

/* ── Global page rhythm ── */
.index-page .main > section,
.index-page .main > .section-wave {
  scroll-margin-top: 88px;
}

.index-page .main > section {
  padding-top: var(--section-y) !important;
  padding-bottom: var(--section-y) !important;
}

.index-page .container {
  padding-left: var(--container-px);
  padding-right: var(--container-px);
}

/* Hide duplicate / legacy sections */
.index-page .section-redundant {
  display: none !important;
}

/* ── Unified section headers ── */
.index-page .section-badge {
  margin-bottom: var(--space-md) !important;
  padding: 6px 16px !important;
}

.index-page .main h2 {
  font-family: 'Space Grotesk', sans-serif !important;
  font-size: clamp(1.75rem, 4vw, 2.75rem) !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  letter-spacing: -0.02em !important;
  margin-bottom: var(--space-md) !important;
}

.index-page .main section .row.text-center.mb-5,
.index-page .main section .container.section-title {
  margin-bottom: var(--space-xl) !important;
}

.index-page .main section .row.text-center p,
.index-page .main section .container.section-title p {
  font-size: clamp(1rem, 2vw, 1.125rem) !important;
  line-height: 1.65 !important;
  max-width: var(--text-max);
  margin-left: auto;
  margin-right: auto;
  color: #64748b !important;
}

/* ── Cards — consistent spacing ── */
.index-page .service-card,
.index-page .product-card,
.index-page .feature-card,
.index-page .tech-card,
.index-page .tech-item,
.index-page .service-item,
.index-page .ai-control-panel,
.index-page .computer-vision-display,
.index-page .ai-chat-interface {
  padding: var(--card-pad) !important;
  border-radius: var(--card-radius) !important;
}

.index-page .service-card h3,
.index-page .product-card h3,
.index-page .feature-card h3,
.index-page .tech-card h3 {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem) !important;
  margin-bottom: var(--space-sm) !important;
}

.index-page .service-card p,
.index-page .product-card p,
.index-page .feature-card p,
.index-page .tech-card p {
  font-size: 0.9375rem !important;
  line-height: 1.65 !important;
  margin-bottom: var(--space-md) !important;
}

.index-page .row.gy-4 {
  --bs-gutter-y: clamp(1.25rem, 3vw, 2rem);
}

.index-page .row.gy-5 {
  --bs-gutter-y: clamp(1.5rem, 4vw, 2.5rem);
}

/* ── Desktop nav — less crowded ── */
@media (min-width: 1200px) {
  .index-page .header .navmenu > ul {
    gap: 0.15rem;
  }

  .index-page .header .navmenu > ul > li > a,
  .index-page .header .navmenu > ul > li > a span {
    font-size: 0.875rem;
    padding: 8px 10px;
  }

  .index-page .header .btn-getstarted {
    padding: 8px 18px;
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  .index-page .header .logo img {
    height: 34px;
    width: auto;
  }
}

@media (min-width: 1200px) and (max-width: 1399px) {
  .index-page .header .navmenu > ul > li > a,
  .index-page .header .navmenu > ul > li > a span {
    font-size: 0.8125rem;
    padding: 8px 8px;
  }
}

/* ── Hero — desktop layout ── */
.index-page .hero-premium {
  min-height: auto !important;
  padding-top: clamp(5.5rem, 10vw, 7.5rem) !important;
  padding-bottom: clamp(3rem, 6vw, 5rem) !important;
}

.index-page .hero-premium .row {
  --bs-gutter-x: clamp(2rem, 5vw, 4rem);
  --bs-gutter-y: clamp(2rem, 4vw, 3rem);
}

.index-page .hero-premium .hero-subtitle {
  max-width: 34rem;
}

.index-page .hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.index-page .hero-stats .stat-item {
  text-align: left;
}

.index-page .hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: 0;
}

.index-page .hero-buttons .btn-primary-custom,
.index-page .hero-buttons .btn-secondary-custom {
  margin-right: 0 !important;
  margin-bottom: 0 !important;
}

/* Hero IoT card — centered & aligned to top of hero content */
@media (min-width: 992px) {
  .index-page .hero-premium > .container > .row {
    align-items: flex-start !important;
  }

  .index-page .hero-premium .hero-image {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 0;
  }

  .index-page .hero-visual-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    transform: translateY(-0.5rem);
  }
}

.index-page .iot-control-center {
  padding: clamp(1.25rem, 2.5vw, 1.75rem) !important;
  margin: 0 auto;
}

.index-page .quick-controls {
  gap: 10px !important;
}

.index-page .control-item {
  padding: 12px !important;
}

.index-page .emergency-controls {
  display: none; /* declutter — not needed on marketing page */
}

/* ── AI Controller — breathing room ── */
.index-page #ai-controller {
  padding-top: var(--section-y-lg) !important;
  padding-bottom: var(--section-y-lg) !important;
}

.index-page #ai-controller .row.gy-5 > [class*="col-"] {
  margin-bottom: var(--space-md);
}

/* ── About — fix overlapping badges on mobile ── */
.index-page .about-image {
  margin-top: var(--space-lg);
}

.index-page .about-image [style*="position: absolute"] {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  display: inline-block;
  margin: var(--space-sm) var(--space-sm) 0 0;
}

@media (min-width: 992px) {
  .index-page .about-image [style*="position: absolute"]:first-of-type {
    position: absolute !important;
    top: -20px !important;
    right: -20px !important;
  }

  .index-page .about-image [style*="position: absolute"]:last-of-type {
    position: absolute !important;
    bottom: -20px !important;
    left: -20px !important;
  }
}

/* ── Services / Products — clean white sections ── */
.index-page #services,
.index-page #products {
  background: #f8fafc !important;
}

.index-page #portfolio.portfolio-premium {
  background: #f8fafc;
  padding: 0 !important;
}

/* ── Mobile nav group labels (global) ── */
.index-page .mobile-menu .menu-group-label {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: none;
  padding: 16px 16px 6px !important;
  margin-top: 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6366f1 !important;
  list-style: none;
}

.index-page .mobile-menu .menu-group-label:first-of-type {
  margin-top: 0;
}

/* ── Mobile-first overrides ── */
@media (max-width: 991px) {
  /* Hide heavy interactive sections on tablet/mobile */
  .index-page .iot-analytics-section {
    display: none !important;
  }

  .index-page #ai-controller .col-lg-3 {
    display: none !important;
  }

  .index-page #ai-controller .col-lg-4,
  .index-page #ai-controller .col-lg-5 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .index-page .vision-canvas-container {
    min-height: 200px !important;
  }

  .index-page #vision-canvas {
    max-width: 100%;
    height: auto !important;
  }
}

@media (max-width: 767px) {
  .index-page {
    overflow-x: hidden;
  }

  /* No custom cursor on mobile */
  body.index-page.cursor-ready {
    cursor: auto;
  }

  /* Softer scroll reveals — no blur (performance + readability) */
  .index-page .motion-reveal,
  .index-page .motion-reveal-left,
  .index-page .motion-reveal-right {
    filter: none !important;
    transform: translateY(32px) !important;
  }

  .index-page .motion-reveal.is-visible,
  .index-page .motion-reveal-left.is-visible,
  .index-page .motion-reveal-right.is-visible {
    transform: translateY(0) !important;
  }

  /* Hero mobile — content first, hide heavy card */
  .index-page .hero-premium {
    min-height: auto !important;
    padding-top: 6.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .index-page .hero-premium .hero-content {
    order: 1;
    text-align: center;
  }

  .index-page .hero-premium .hero-image {
    display: none !important;
  }

  .index-page .hero-premium .hero-subtitle {
    max-width: 100%;
    font-size: 1rem !important;
    margin-left: auto;
    margin-right: auto;
  }

  .index-page .hero-premium .hero-title {
    font-size: clamp(1.875rem, 8vw, 2.5rem) !important;
  }

  .index-page .hero-premium .hero-title .word {
    margin-right: 0.18em;
  }

  .index-page .hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .index-page .hero-buttons a {
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .index-page .hero-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    text-align: center;
  }

  .index-page .hero-stats .stat-item {
    text-align: center;
  }

  .index-page .hero-premium .stat-number {
    font-size: 1.5rem !important;
  }

  .index-page .hero-premium .stat-label {
    font-size: 0.75rem !important;
  }

  .index-page .hero-scroll-hint {
    display: none;
  }

  /* Marquee — smaller on mobile */
  .index-page .marquee-item {
    font-size: 0.8125rem;
    gap: 8px;
  }

  .index-page .marquee-content {
    gap: 2rem;
    padding-right: 2rem;
  }

  .index-page .trust-strip-marquee {
    padding: 0;
  }

  .index-page .section-wave {
    height: 40px;
  }

  .index-page .section-wave svg {
    height: 40px;
  }

  /* Section spacing tighter on mobile */
  .index-page .main > section {
    padding-top: clamp(2.5rem, 8vw, 3.5rem) !important;
    padding-bottom: clamp(2.5rem, 8vw, 3.5rem) !important;
  }

  .index-page .main section .row.text-center.mb-5 {
    margin-bottom: var(--space-lg) !important;
  }

  /* Mobile nav — grouped, less overwhelming */
  .index-page .mobile-menu {
    top: 70px;
    max-height: calc(100dvh - 70px);
    padding: var(--space-md) !important;
  }

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

  .index-page .mobile-menu ul li a {
    padding: 12px 16px !important;
    font-size: 0.9375rem !important;
  }

  .index-page .mobile-menu .dropdown-menu a {
    font-size: 0.875rem !important;
    padding: 10px 16px !important;
  }

  /* Cards full width feel */
  .index-page .service-card,
  .index-page .product-card {
    text-align: left !important;
  }

  .index-page .service-icon,
  .index-page .product-card [class*="icon"] {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Portfolio grid — single column feel */
  .index-page #portfolio .portfolio-item {
    margin-bottom: var(--space-md);
  }

  /* Footer stack */
  .index-page .footer-top .col-lg-4,
  .index-page .footer-top .col-lg-2 {
    margin-bottom: var(--space-lg);
  }

  /* Chatbot — mobile-premium.css handles position on small screens */
  .index-page .chatbot-fab {
    right: 16px;
  }
}

@media (max-width: 576px) {
  .index-page .hero-stats {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    border-top: none;
    padding-top: var(--space-md);
  }

  .index-page .hero-stats .stat-item {
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* ── Desktop content width — prevent wall of text ── */
@media (min-width: 992px) {
  .index-page .hero-premium .col-lg-6.hero-content {
    padding-right: var(--space-lg);
  }

  .index-page #services .col-lg-4,
  .index-page #products .col-lg-4 {
    display: flex;
  }

  .index-page #services .service-card,
  .index-page #products .product-card {
    width: 100%;
  }

  .index-page .main > section:nth-child(even):not(.hero-premium):not(#ai-controller) {
    background-color: #fafbfc;
  }
}

/* ── Brand section dividers ── */
.index-page .brand-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.15), transparent);
  margin: 0 auto;
  max-width: 600px;
}

/* ── Footer brand fix ── */
.index-page .footer-links a {
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.2s;
}

.index-page .footer-links a:hover {
  color: #a5b4fc;
}
