/* =========================================================
   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(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Nav collapse (≤ 1100px, wider than tablet breakpoint to fit all nav items) ---- */
@media (max-width: 1100px) {
  .nav-links, .nav-actions { display: none; }
  .nav-toggle { display: flex; }
}

/* ---- Tablet (≤ 900px) ---- */
@media (max-width: 900px) {
  :root { --section-y: 48px; --section-head-gap: 28px; }

  .hero { padding: 120px 0 var(--section-y); }
  .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%; }

  .about-collage { max-width: 600px; }

  .footer-top { grid-template-columns: 1fr; gap: 36px; }
  .footer-brand p { max-width: none; }
  .newsletter { max-width: 480px; }
  .footer-cols { gap: 20px; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .testimonial-grid { grid-template-columns: repeat(2, 1fr); }
  .benefit-grid { grid-template-columns: repeat(3, 1fr); }
  .industry-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(3, minmax(0, 1fr)); gap: 16px 12px; }
  .footer-col h3 { font-size: 13px; }
  .footer-col a { font-size: 13.5px; word-break: break-word; }
  .newsletter { max-width: none; width: 100%; }
}

/* ---- 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; }
  :root { --section-y: 40px; --section-head-gap: 24px; }

  .container { padding: 0 16px; }
  .section-lead { font-size: 15.5px; }
  .section-title { font-size: clamp(24px, 7vw, 32px); }
  .section-title.one-line {
    white-space: nowrap;
    font-size: clamp(11px, calc((100vw - 40px) / 22), 22px);
    letter-spacing: -0.03em;
    line-height: 1.2;
  }

  /* ---- 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 ul a {
    font-size: 18px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-menu .btn { margin-top: 6px; }

  /* ---- Hero ---- */
  .hero { padding: 100px 0 var(--section-y); }
  .hero-grid-layout { gap: 36px; text-align: center; }
  .hero-copy { align-items: center; }
  .hero-title {
    font-size: clamp(24px, 6.5vw, 32px);
    line-height: 1.22;
    letter-spacing: -0.02em;
    max-width: none;
  }
  .hero-sub {
    font-size: 15px;
    margin-top: 12px;
    line-height: 1.6;
  }
  .eyebrow {
    font-size: 12px;
    padding: 8px 14px;
    max-width: 100%;
    width: 100%;
    min-height: 52px;
    justify-content: center;
    text-align: center;
    line-height: 1.45;
    flex-wrap: wrap;
    gap: 6px 8px;
    align-content: center;
  }
  .tw-text {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  /* Lock page to vertical scroll only */
  html, body, main { overflow-x: clip; touch-action: pan-y; }
  .container, .section, .hero, .hero-copy, .hero-grid-layout { max-width: 100%; }

  .about-collage { grid-template-columns: 1fr; grid-template-rows: none; gap: 12px; }
  .ap-1, .ap-2, .ap-3 { grid-column: 1; grid-row: auto; }
  .about-collage .ap-1 img, .about-collage .ap-1,
  .about-collage .ap-2 img, .about-collage .ap-2,
  .about-collage .ap-3 img, .about-collage .ap-3 { min-height: 200px; }

  /* 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 — balanced 3-up grid */
  .hero-stats {
    margin-top: 28px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 8px;
    padding: 18px 14px;
    background: rgba(255, 255, 255, .6);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .hero-stat {
    min-width: 0;
    text-align: center;
    padding: 0 4px;
  }
  .hero-stat:not(:last-child) { border-right: 1px solid var(--line); }
  .hero-stat strong {
    font-size: 22px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
  .hero-stat span { font-size: 11.5px; line-height: 1.35; display: block; }

  /* 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-track { gap: 48px; animation-duration: 22s; }
  .logo-chip { height: 52px; }
  .logo-chip img { height: 52px !important; max-height: 52px !important; max-width: 150px !important; }
  .logo-chip--boost img { height: 60px !important; max-height: 60px !important; max-width: 170px !important; }

  /* ---- Video showcase ---- */
  .video-badge { font-size: 12px; padding: 7px 14px; margin-bottom: 14px; }
  .video-frame-wrap { padding: 3px; border-radius: calc(var(--radius-lg) + 4px); }
  .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; }

  /* ---- Content cards: stack into tidy grids on mobile (no horizontal slide) ---- */
  .card-grid,
  .ai-grid,
  .benefit-grid,
  .testimonial-grid {
    display: block;
    overflow: visible;
  }

  /* the track becomes a wrapping grid so every card is visible at once */
  .card-grid > .swipe-track,
  .ai-grid > .swipe-track,
  .benefit-grid > .swipe-track,
  .testimonial-grid > .swipe-track {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .card-grid > .swipe-track > .swipe-card,
  .ai-grid > .swipe-track > .swipe-card,
  .benefit-grid > .swipe-track > .swipe-card,
  .testimonial-grid > .swipe-track > .swipe-card {
    width: auto;
    max-width: none;
    min-width: 0;
  }

  /* Module cards */
  .card.swipe-card { padding: 20px 16px; }
  .card.swipe-card h3 { font-size: 15px; }
  .card.swipe-card p { font-size: 13px; }
  .card-ic { width: 42px; height: 42px; font-size: 20px; margin-bottom: 10px; }

  /* AI cards */
  .ai-card.swipe-card { padding: 20px 16px; }
  .ai-card.swipe-card h3 { font-size: 14.5px; }
  .ai-card.swipe-card p { font-size: 12.5px; }

  /* Benefit cards — 3 cards, one per row on mobile */
  .benefit-grid > .swipe-track { grid-template-columns: 1fr; }
  .benefit-card.swipe-card { padding: 20px 16px; }
  .benefit-card.swipe-card h3 { font-size: 15px; }
  .benefit-card.swipe-card p { font-size: 13px; }

  /* Testimonials — full width, one per row; show first 3 only on mobile */
  .testimonial-grid > .swipe-track { grid-template-columns: 1fr; }
  .testimonial.swipe-card { padding: 22px 18px; }
  .testimonial-grid > .swipe-track > .testimonial.swipe-card:nth-child(n+4) { display: none; }
  .t-quote { font-size: 14.5px; }

  /* ---- Industries: 2×2 grid (4 items, no horizontal swipe) ---- */
  .industry-grid {
    display: block;
    overflow: visible;
  }
  .industry-grid > .swipe-track {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  .industry-card.swipe-card {
    width: auto;
    max-width: none;
    min-width: 0;
    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; }

  /* Hide carousel dots — static grids on mobile */
  #modulesDots, #aiDots, #benefitDots, #testimonialDots, #industryDots { display: none !important; }

  /* Kill leftover swipe-carousel behavior */
  .swipe-track,
  .card-grid > .swipe-track,
  .ai-grid > .swipe-track,
  .benefit-grid > .swipe-track,
  .testimonial-grid > .swipe-track,
  .industry-grid > .swipe-track {
    overflow: visible !important;
    scroll-snap-type: none !important;
    -webkit-overflow-scrolling: auto;
    touch-action: auto;
  }
  .swipe-track::after { display: none !important; content: none !important; }
  .swipe-dots { display: none !important; }

  /* ---- 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-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: 28px; }
  .footer-brand .nav-logo { justify-content: flex-start; }
  .footer-brand p { font-size: 14px; margin: 12px 0 16px; max-width: none; }
  .footer-cols {
    grid-template-columns: 1fr 1fr;
    gap: 24px 20px;
  }
  .footer-col:last-child { grid-column: 1 / -1; }
  .footer-col h3 { font-size: 13px; margin-bottom: 10px; }
  .footer-col a {
    font-size: 14px;
    padding: 8px 0;
    min-height: 40px;
    display: flex;
    align-items: center;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding-top: 20px;
  }
  .footer-bottom > p:first-child { order: 1; }
  .footer-legal { order: 2; width: 100%; gap: 8px 16px; }
  .footer-social { order: 3; }
  .footer-contact {
    order: 4;
    width: 100%;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
  }
  .footer-bottom p { font-size: 13px; }
  .footer-legal a { font-size: 13px; padding: 4px 0; }
  .footer-social { gap: 8px; }
  .social-link { width: 40px; height: 40px; font-size: 13px; }
  .newsletter {
    flex-direction: column;
    max-width: none;
    width: 100%;
    gap: 10px;
  }
  .newsletter input {
    width: 100%;
    border-radius: 14px;
    min-height: 48px;
    font-size: 16px;
  }
  .newsletter .btn {
    width: 100%;
    border-radius: 14px;
    min-height: 48px;
    justify-content: center;
  }

  /* ---- 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(22px, 6.2vw, 28px); }
  .section-title { font-size: clamp(22px, 7.5vw, 28px); }
  .section-title.one-line {
    font-size: clamp(10px, calc((100vw - 32px) / 22), 18px);
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 16px;
  }
  .hero-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding: 12px 0;
    border-right: none !important;
    border-bottom: 1px solid var(--line);
  }
  .hero-stat:last-child { border-bottom: none; padding-bottom: 0; }
  .hero-stat:first-child { padding-top: 0; }
  .hero-stat strong {
    flex: 0 0 72px;
    font-size: 24px;
    text-align: left;
  }
  .hero-stat span { font-size: 13px; line-height: 1.4; }

  .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; }

  .footer-cols { grid-template-columns: 1fr; gap: 22px; }
  .footer-col:last-child { grid-column: auto; }
  .footer { padding: 40px 0 24px; }
  .footer-contact { font-size: 12.5px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-grid .stat-box:last-child { grid-column: 1 / -1; }

  .mobile-menu ul 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-head:has(.section-title.one-line) { padding: 0; }
  .section-lead { margin-top: 12px; line-height: 1.6; max-width: 36em; margin-left: auto; margin-right: auto; }

  /* 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);
  }

  /* ---- 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: stable layout, no floating dashboard on touch ---- */
  .float-soft { animation: none; }
  .reveal[data-anim="fade-left"],
  .reveal[data-anim="fade-right"] { transform: translateY(34px); }

  /* ---- Hero: tighten eyebrow + add gentle entrance feel ---- */
  .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(37, 99, 235, .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 + readable legal row ---- */
  .footer-legal {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
  }
  .footer-bottom {
    border-top: none;
    width: 100%;
  }
  .footer-top { border-bottom-color: 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) {
  :root { --section-y: 36px; }
  .hero { padding: 92px 0 var(--section-y); }
  .mobile-menu { padding-top: 72px; gap: 0; }
}
