/**
 * Site-wide responsive UX — touch targets, anchor scroll, product pages, galleries.
 * Loaded after mobile-polish.css on all pages.
 */

:root {
  --sk-header-offset: 5.25rem;
  --sk-mobile-cta-height: 3.35rem;
  --sk-chatbot-offset: 4.85rem;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: clip;
}

/* Anchor targets clear sticky header */
[id] {
  scroll-margin-top: var(--sk-header-offset);
}

#products,
#book,
#explore,
#about,
#start,
#features,
#how-it-works,
#courses,
#screenshots,
#coming-soon,
#faq,
#download,
#availability,
#overview,
#screenshots-windows,
#screenshots-android,
#projects-products,
#projects-education,
#projects-ml,
#projects-security,
#projects-specialized,
#projects-book {
  scroll-margin-top: var(--sk-header-offset);
}

/* ——— Header ——— */
@media (max-width: 991.98px) {
  .site-header .container {
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
  }

  .site-header__mobile-toggle {
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem 0.85rem;
    font-size: 0.88rem;
  }

  .site-header__offcanvas .nav-link {
    min-height: 44px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.25rem;
    border-radius: 10px;
  }

  .site-header__offcanvas .btn {
    min-height: 44px;
    flex: 1 1 auto;
  }

  .site-brand__title {
    font-size: 1.05rem;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .site-header .nav-link {
    padding: 0.4rem 0.55rem;
    font-size: 0.84rem;
  }
}

/* ——— Footer ——— */
.site-footer .footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.75rem;
}

@media (min-width: 576px) {
  .site-footer .footer-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .site-footer .footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

.site-footer .footer-link {
  min-height: 44px;
  padding: 0.35rem 0.15rem;
  align-items: center;
}

/* ——— Home ——— */
@media (max-width: 767.98px) {
  .home-hero {
    padding: 1.75rem 0 1.25rem;
  }

  .home-hero-hook {
    font-size: 0.98rem;
  }

  .home-hero-aside {
    border-left-width: 2px;
    padding-left: 0.65rem;
    font-size: 0.88rem;
  }

  .home-strip__quick .btn {
    flex: 1 1 calc(50% - 0.45rem);
    min-width: 0;
    justify-content: center;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .home-strip__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-stat__label {
    font-size: 0.76rem;
  }
}

@media (max-width: 575.98px) {
  .home-hero-product {
    padding: 0.75rem 0.85rem;
  }

  .home-hero-product__line {
    font-size: 0.76rem;
  }

  .home-cluster-links .section-surface {
    padding: 1rem !important;
  }
}

@media (max-width: 767.98px) {
  .about-intro__layout {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .about-intro__layout .col-auto {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .about-pullquote {
    padding: 0.85rem 1rem;
  }

  .about-pullquote .blockquote {
    font-size: 0.98rem;
  }
}

/* ——— Product pages (shared) ——— */
@media (max-width: 767.98px) {
  .yonah-hero-row,
  .samaya-hero-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
  }

  .yonah-hero-row > div:last-child,
  .samaya-hero-row > div:last-child {
    width: 100%;
  }

  .yonah-mark--hero,
  .samaya-mark--hero {
    height: 4.5rem;
    width: 4.5rem;
  }

  .yonah-card,
  .samaya-card {
    padding: 1rem;
  }

  .yonah-card--hero .d-flex.flex-wrap.gap-2,
  .samaya-card--hero .d-flex.flex-wrap.gap-2 {
    justify-content: center;
  }

  .product-wrap {
    padding-bottom: calc(var(--sk-mobile-cta-height) + var(--sk-chatbot-offset) + 1rem) !important;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .yonah-gallery,
  .samaya-desktop-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .samaya-android-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Quick-nav: horizontal scroll on small screens */
@media (max-width: 767.98px) {
  .yonah-quick-nav,
  .samaya-quick-nav,
  .quick-nav .d-flex.flex-wrap {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.15rem;
  }

  .yonah-quick-nav .btn,
  .samaya-quick-nav .btn,
  .quick-nav .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    margin-bottom: 0 !important;
    margin-right: 0 !important;
  }
}

@media (max-width: 767.98px) {
  .yonah-stat-grid,
  .samaya-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .yonah-feature-card,
  .samaya-feature-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .yonah-gallery {
    grid-template-columns: 1fr;
  }

  .samaya-screenshot,
  .samaya-shot {
    max-width: 100%;
  }

  .product-showcase .samaya-phone-frame {
    max-width: 100%;
    width: min(100%, 11.5rem);
    margin-inline: auto;
  }
}

@media (min-width: 768px) {
  .yonah-stat-grid,
  .samaya-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Mobile sticky CTA — shared Samaya + Yonah */
@media (max-width: 767.98px) {
  .yonah-mobile-cta,
  .samaya-mobile-cta {
    position: fixed;
    left: max(0.75rem, env(safe-area-inset-left, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    z-index: 1080;
    border-radius: 12px;
    padding: 0.55rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 28px rgba(2, 6, 18, 0.48);
  }

  .yonah-mobile-cta {
    background: rgba(13, 13, 20, 0.96);
    border: 1px solid rgba(124, 92, 255, 0.4);
  }

  .samaya-mobile-cta {
    background: rgba(11, 16, 32, 0.96);
    border: 1px solid rgba(13, 148, 136, 0.45);
  }

  .yonah-mobile-cta__actions,
  .samaya-mobile-cta__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .yonah-mobile-cta .btn,
  .samaya-mobile-cta .btn {
    min-height: 44px;
    font-size: 0.82rem;
    padding: 0.5rem 0.65rem;
    justify-content: center;
  }

  /* Lift chatbot above product CTA bar */
  body.product-page .sk-chatbot {
    bottom: calc(var(--sk-chatbot-offset) + env(safe-area-inset-bottom, 0px));
    right: max(1rem, env(safe-area-inset-right, 0px));
  }

  body.product-page .sk-chatbot__panel {
    bottom: calc(var(--sk-chatbot-offset) + 3.35rem);
    max-height: min(58vh, 520px);
  }
}

/* ——— Projects page ——— */
@media (max-width: 767.98px) {
  .hero-card {
    padding: 1.15rem !important;
  }

  .hero-card .d-flex.flex-wrap.gap-2 .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
    justify-content: center;
  }

  .stat-tile {
    padding: 0.85rem 0.95rem;
  }

  .stat-tile .num {
    font-size: 1.35rem;
  }

  .stat-tile .lbl {
    font-size: 0.8rem;
  }

  .quick-nav,
  .stack-bar {
    padding: 0.9rem 1rem;
  }

  .project-card {
    padding: 1rem !important;
  }

  .book-cover {
    max-width: min(100%, 200px);
    display: block;
    margin-inline: auto;
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .hero-card .row.g-3 > [class*="col-"] {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* ——— Typography & touch (refine mobile-polish) ——— */
@media (max-width: 991.98px) {
  .page-lead {
    font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  }

  .btn,
  .btn-sm,
  .btn-portfolio-outline,
  .btn-portfolio-primary {
    min-height: 44px;
  }

  .chip,
  .accent-chip {
    font-size: 0.8rem;
    padding: 0.2rem 0.65rem;
  }

  .container.py-5 {
    padding-top: clamp(1.5rem, 4vw, 2.5rem) !important;
    padding-bottom: clamp(1.5rem, 4vw, 2.5rem) !important;
  }
}

@media (max-width: 575.98px) {
  .section-surface.p-4,
  .section-muted.p-4 {
    padding: 1rem !important;
  }

  .section-surface.p-4.p-md-5,
  .section-muted.p-4.p-md-5,
  .about-strip.p-4.p-md-5 {
    padding: 1.15rem !important;
  }
}

/* Prevent wide tables/code from breaking layout */
.table-responsive,
pre,
code {
  max-width: 100%;
}

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