/* =========================================================
   Samparkasetu — Responsive (Mobile-first)
   ========================================================= */

/* ---- Large tablet / small desktop (≤ 1080px) ---- */
@media (max-width: 1080px) {
  :root { --maxw: 960px; }
  .card-grid, .ai-grid { grid-template-columns: repeat(3, 1fr); }
  .industry-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Tablet (≤ 900px) ---- */
@media (max-width: 900px) {
  .nav-links, .nav-actions { display: none; }
  .nav-toggle { display: flex; }

  .section { padding: 80px 0; }

  .hero { padding: 120px 0 64px; }
  .hero-grid-layout { grid-template-columns: 1fr; gap: 48px; text-align: center; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-sub { max-width: 600px; }
  .hero-cta { justify-content: center; }
  .hero-stats { justify-content: center; gap: 32px; }
  .hero-visual { max-width: 500px; margin: 0 auto; width: 100%; }

  .footer-top { grid-template-columns: 1fr; gap: 36px; }
  .testimonial-grid { grid-template-columns: repeat(2, 1fr); }
  .benefit-grid { grid-template-columns: repeat(2, 1fr); }

  /* hide custom cursor on touch */
  .cursor-dot, .cursor-ring, .mouse-glow { display: none; }
}

/* ---- Small tablet (≤ 760px) ---- */
@media (max-width: 760px) {
  .card-grid, .ai-grid { grid-template-columns: repeat(2, 1fr); }
  .industry-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid .stat-box:last-child { grid-column: span 2; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

/* ---- Touch devices ---- */
@media (hover: none) {
  /* always show video controls on touch */
  .video-frame.playing .video-controls { opacity: 1; transform: none; }
  /* comfortable 44px tap targets */
  .nav-links a, .mobile-menu a, .footer-col a, .faq-q { min-height: 44px; }
}

/* =========================================================
   MOBILE (≤ 640px)
   ========================================================= */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .container { padding: 0 16px; }
  .section { padding: 56px 0; }
  .section-head { margin-bottom: 32px; }
  .section-lead { font-size: 15.5px; }
  .section-title { font-size: clamp(24px, 7vw, 32px); }

  /* ---- Navbar ---- */
  .navbar { padding: 12px 0; }
  .navbar.scrolled { padding: 8px 0; }
  .nav-logo span { font-size: 16px; }
  .nav-inner { padding: 0 16px; }

  /* ---- Mobile menu ---- */
  .mobile-menu {
    width: 100%;
    max-width: none;
    padding: 88px 20px 32px;
    gap: 0;
  }
  .mobile-menu ul { gap: 0; }
  .mobile-menu a {
    font-size: 18px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-menu .btn { margin-top: 6px; }

  /* ---- Hero ---- */
  .hero { padding: 100px 0 48px; }
  .hero-grid-layout { gap: 36px; text-align: center; }
  .hero-copy { align-items: center; }
  .hero-title {
    font-size: clamp(28px, 9vw, 38px);
    line-height: 1.1;
    letter-spacing: -0.025em;
  }
  .hero-sub {
    font-size: 15.5px;
    margin-top: 14px;
    line-height: 1.65;
  }
  .eyebrow { font-size: 12px; padding: 6px 12px; }
  .tw-text { min-width: 0; }

  /* Full-width stacked CTAs */
  .hero-cta {
    margin-top: 24px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  .hero-cta .btn { width: 100%; padding: 15px 20px; font-size: 15.5px; justify-content: center; }

  /* Hero stats — 3-up row */
  .hero-stats { margin-top: 28px; gap: 0; justify-content: space-between; padding: 0 4px; }
  .hero-stat { flex: 1; text-align: center; padding: 0 4px; }
  .hero-stat strong { font-size: 22px; }
  .hero-stat span { font-size: 11px; line-height: 1.3; }

  /* Dashboard mockup */
  .dash-card { padding: 16px; border-radius: 18px; }
  .dash-head { margin-bottom: 14px; }
  .dash-brand { font-size: 13px; }
  .dash-kpis { gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 10px 10px; }
  .kpi strong { font-size: 18px; }
  .kpi-label { font-size: 10px; }
  .kpi em { font-size: 10px; }
  .dash-chart { margin-bottom: 12px; }
  .dash-chart svg { height: 60px; }
  .hc-row { padding: 10px 10px; gap: 10px; }
  .hc-row .hc-ic { font-size: 18px; }
  .hc-row b { font-size: 12.5px; }
  .hc-row small { font-size: 11px; }
  .hc-score { font-size: 13px; }
  .feed-label { font-size: 11.5px; }

  /* ---- Trusted marquee ---- */
  .logo-chip { font-size: 14px; padding: 10px 18px; }

  /* ---- Video showcase ---- */
  .showcase { padding-top: 48px; }
  .video-controls { padding: 10px 12px; gap: 8px; }
  .vc-btn { width: 36px; height: 36px; }
  .vp-ring { width: 68px; height: 68px; }

  /* ---- About chips ---- */
  .chip-grid { gap: 8px; }
  .eco-chip { font-size: 13px; padding: 8px 14px; }

  /* ---- Swipe track: turn grids into horizontal scroll carousels ---- */
  .card-grid,
  .ai-grid,
  .industry-grid,
  .benefit-grid {
    display: block;         /* remove grid context so track takes over */
    overflow: hidden;
  }

  .swipe-track {
    display: flex !important;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px 12px;
    /* pull flush to container edge for peek effect */
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .swipe-track::-webkit-scrollbar { display: none; }

  /* each swipe card: fixed width so one (or 1.1) shows at a time */
  .swipe-card {
    flex: 0 0 78vw;
    max-width: 300px;
    scroll-snap-align: start;
    min-width: 0;
  }

  /* Module cards */
  .card.swipe-card { padding: 22px 18px; }
  .card.swipe-card h3 { font-size: 16px; }
  .card-ic { width: 44px; height: 44px; font-size: 20px; margin-bottom: 12px; }

  /* AI cards */
  .ai-card.swipe-card { padding: 22px 18px; }
  .ai-card.swipe-card h3 { font-size: 15px; }
  .ai-ic { width: 42px; height: 42px; margin-bottom: 12px; }

  /* Industry cards — slightly narrower, 2 semi-visible */
  .industry-card.swipe-card {
    flex: 0 0 56vw;
    max-width: 220px;
    padding: 16px 14px;
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .industry-card.swipe-card .ind-ic { font-size: 28px; }
  .industry-card.swipe-card span { font-size: 14px; }

  /* Benefit cards */
  .benefit-card.swipe-card { padding: 22px 18px; }
  .benefit-card.swipe-card h3 { font-size: 16px; }

  /* Testimonials — also swipe */
  .testimonial-grid {
    display: block;
    overflow: hidden;
  }
  .testimonial.swipe-card { flex: 0 0 82vw; max-width: 320px; padding: 22px 18px; }
  .t-quote { font-size: 14.5px; }

  /* Dot indicators */
  .swipe-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    padding-bottom: 4px;
  }
  .swipe-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--line);
    border: none;
    cursor: pointer;
    transition: background .2s, transform .2s, width .25s;
    padding: 0;
  }
  .swipe-dot.active {
    background: var(--green);
    width: 22px;
    border-radius: 4px;
    transform: none;
  }

  /* ---- Stats ---- */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-grid .stat-box:last-child { grid-column: 1 / -1; }
  .stat-box { padding: 20px 12px; border-radius: var(--radius-sm); }
  .stat-box strong { font-size: clamp(26px, 7vw, 36px); }
  .stat-box span { font-size: 12.5px; }

  /* ---- Timeline ---- */
  .timeline { padding-left: 0; }
  .timeline::before { left: 19px; top: 8px; bottom: 8px; }
  .timeline li { padding: 0 0 28px 56px; }
  .tl-num { width: 40px; height: 40px; font-size: 15px; border-radius: 12px; }
  .tl-body { padding: 14px 16px; }
  .tl-body h3 { font-size: 16px; }
  .tl-body p { font-size: 13.5px; }

  /* ---- FAQ ---- */
  .faq-q { font-size: 15px; padding: 18px 18px; }
  .faq-a p { padding: 0 18px 18px; font-size: 14px; }

  /* ---- CTA ---- */
  .cta-section { padding: 32px 0 80px; }
  .cta-card { padding: 44px 18px; border-radius: var(--radius); }
  .cta-title { font-size: clamp(24px, 7vw, 32px); }
  .cta-sub { font-size: 15.5px; margin-bottom: 24px; }
  .cta-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .cta-actions .btn { width: 100%; justify-content: center; }

  /* ---- Footer ---- */
  .footer { padding: 48px 0 28px; }
  .footer-top { gap: 28px; padding-bottom: 32px; }
  .footer-brand p { font-size: 14px; margin: 12px 0 16px; }
  .footer-cols { grid-template-columns: 1fr 1fr; gap: 20px 16px; }
  .footer-col h3 { font-size: 13px; margin-bottom: 10px; }
  .footer-col a { font-size: 13.5px; padding: 5px 0; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding-top: 20px;
  }
  .footer-bottom p { font-size: 13px; }
  .footer-legal { gap: 4px 14px; }
  .footer-legal a { font-size: 12.5px; }
  .footer-social { gap: 8px; }
  .social-link { width: 36px; height: 36px; font-size: 13px; }
  .footer-contact { font-size: 12.5px; }
  .newsletter { flex-direction: column; max-width: none; gap: 8px; }
  .newsletter input { border-radius: 14px; }
  .newsletter .btn { width: 100%; border-radius: 14px; }

  /* ---- Floating buttons ---- */
  .fab { width: 52px; height: 52px; right: 14px; }
  .fab-whatsapp { bottom: 16px; }
  .fab-contact { bottom: 78px; }
  .back-to-top { left: 14px; bottom: 16px; width: 44px; height: 44px; }

  /* ---- Page loader ---- */
  .loader-mark img { width: 48px; height: 48px; }
}

/* ---- Small phones (≤ 400px) ---- */
@media (max-width: 400px) {
  .container { padding: 0 14px; }
  .hero-title { font-size: clamp(25px, 8.5vw, 30px); }
  .section-title { font-size: clamp(22px, 7.5vw, 28px); }

  .hero-stats { flex-wrap: wrap; gap: 12px 0; }
  .hero-stat { flex: 1 0 33%; }

  .dash-kpis { grid-template-columns: 1fr; gap: 6px; }
  .kpi { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .kpi strong { margin-top: 0; }

  .industry-grid { grid-template-columns: 1fr; }

  .footer-cols { grid-template-columns: 1fr; gap: 20px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid .stat-box:last-child { grid-column: auto; }

  .mobile-menu a { font-size: 17px; }
  .cta-card { padding: 36px 14px; }
}

/* =========================================================
   MOBILE POLISH LAYER  (≤ 640px)
   Premium touches: ergonomics, depth, motion, affordances
   ========================================================= */
@media (max-width: 640px) {

  /* ---- Crisper navbar: frosted + hairline when scrolled ---- */
  .navbar.scrolled {
    background: rgba(248, 250, 252, .82);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .06), 0 8px 24px -16px rgba(15, 23, 42, .2);
  }

  /* ---- Section heading rhythm ---- */
  .kicker { font-size: 11.5px; padding: 6px 12px; margin-bottom: 14px; letter-spacing: .1em; }
  .section-head { padding: 0 4px; }
  .section-lead { margin-top: 12px; line-height: 1.6; }

  /* Tighten the gap between heading block and the swipe rail */
  .section-head + .swipe-track,
  .section-head ~ .card-grid,
  .section-head ~ .ai-grid,
  .section-head ~ .industry-grid,
  .section-head ~ .benefit-grid { margin-top: 4px; }

  /* ---- Premium swipe cards: lift, depth & active-press feel ---- */
  .swipe-card {
    box-shadow: 0 8px 24px -14px rgba(15, 23, 42, .25);
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  }
  .swipe-card:active {
    transform: scale(.98);
    box-shadow: 0 4px 14px -10px rgba(15, 23, 42, .3);
  }

  /* Subtle scroll padding so first/last card breathe at the edges */
  .swipe-track {
    scroll-padding-left: 16px;
    padding-bottom: 10px;
  }
  /* trailing spacer so the last card can fully snap into view */
  .swipe-track::after {
    content: "";
    flex: 0 0 2px;
  }

  /* ---- "Swipe" affordance hint under each rail's first paint ---- */
  .swipe-dots { margin-top: 14px; }
  .swipe-dot { width: 7px; height: 7px; }
  .swipe-dot.active { width: 20px; }

  /* ---- Industry cards: give the icon a soft tile for hierarchy ---- */
  .industry-card.swipe-card { box-shadow: 0 8px 24px -14px rgba(15, 23, 42, .22); }
  .industry-card.swipe-card .ind-ic {
    display: grid; place-items: center;
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--grad-soft);
  }

  /* ---- Hero: tighten eyebrow + add gentle entrance feel ---- */
  .hero-stats {
    background: rgba(255, 255, 255, .6);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px 8px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .hero-stat:not(:last-child) { border-right: 1px solid var(--line); }
  .hero-stat strong { background: var(--grad); -webkit-background-clip: text;
    background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }

  /* ---- Primary CTA: more presence on small screens ---- */
  .hero-cta .btn-primary { box-shadow: 0 14px 30px -10px rgba(22, 163, 74, .5); }

  /* ---- FAQ: snappier tap target + clearer open state ---- */
  .faq-item { margin-bottom: 10px; border-radius: 14px; }
  .faq-item:active { transform: scale(.995); }
  .faq-q { padding: 16px 16px; gap: 12px; }

  /* ---- Timeline: card depth ---- */
  .tl-body { box-shadow: 0 8px 22px -16px rgba(15, 23, 42, .3); }

  /* ---- Stat boxes: subtle inner glow ---- */
  .stat-box { background: rgba(255, 255, 255, .06); }

  /* ---- Footer: cleaner divider + centered brand ---- */
  .footer-legal { width: 100%; }
  .footer-bottom { border-top: 1px solid var(--line); }

  /* ---- Buttons: consistent comfy height everywhere ---- */
  .btn { min-height: 46px; }
  .btn-lg { min-height: 52px; }

  /* ---- Prevent iOS zoom on input focus (16px min font) ---- */
  input, select, textarea { font-size: 16px !important; }
}

/* ---- Landscape phones: reclaim vertical space ---- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .hero { padding: 92px 0 40px; }
  .section { padding: 48px 0; }
  .mobile-menu { padding-top: 72px; gap: 0; }
}
