/* =========================================================================
   Responsive layer (loaded last). Phones, tablets and small laptops.
   Below 961px the scroll-pinned zoom effects (hero, demo) turn into plain
   stacked sections so there is no empty scroll space and nothing overflows.
   Desktop (961px and up) is unchanged.
   ========================================================================= */

html, body { overflow-x: clip; }
img, video { max-width: 100%; }

/* ---------- Nav: hamburger menu up to 960px (was 760px) ---------- */
@media (max-width: 960px) {
  .nav__links { display: none; }
  .nav__burger { display: flex; }
  .nav.menu-open .nav__links {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 0; margin: 0;
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    padding: 8px 18px 16px;
    background: var(--canvas);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 22px 40px rgba(0, 0, 0, .28);
  }
  .nav.menu-open .nav__links a {
    padding: 14px 6px; font-size: 15.5px;
    border-bottom: 1px solid var(--line);
  }
  .nav.menu-open .nav__links a:last-child { border-bottom: none; }
  .nav__in { gap: 10px; padding-inline: 16px; }
  .nav__actions { margin-left: auto; flex: none; }
}
@media (max-width: 380px) {
  .nav__actions { gap: 6px; }
  .nav__actions .icon-btn { width: 34px; height: 34px; }
  .nav__actions .btn--primary { padding: 8px 12px; font-size: 13px; }
}

/* ---------- Hero: no pinned zoom below 961px ---------- */
@media (max-width: 960px) {
  .hero { height: auto !important; }
  .hero__sticky {
    position: relative !important;
    height: auto !important;
    overflow: visible !important;
    padding-bottom: 56px !important;
  }
  #heroHeader { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }
  .hero__showcase { flex: none !important; padding-inline: 16px !important; box-sizing: border-box !important; margin-top: 8px !important; }
  .showcase-window {
    width: 100% !important;
    max-width: 980px !important;
    height: auto !important;
    transform: none !important;
  }
}

/* Hero buttons fit the screen */
@media (max-width: 560px) {
  .hero__cta {
    flex-wrap: wrap !important;
    padding-inline: 16px !important;
    gap: 10px !important;
  }
  .btn--hero-download,
  .btn--hero-promo {
    flex: 1 1 140px !important;
    max-width: 240px !important;
    height: 48px !important;
    padding: 0 18px !important;
    font-size: 15px !important;
    gap: 8px !important;
    width: auto !important;
  }
}

/* ---------- Interactive demo: plain section below 961px ---------- */
@media (max-width: 960px) {
  .section--desktop-demo.demo-track {
    height: auto !important;
    padding: 64px 0 48px !important;
  }
  .demo__sticky {
    position: relative !important;
    height: auto !important;
    overflow: visible !important;
  }
  .demo__header {
    position: relative !important;
    padding-top: 0 !important;
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .demo-quick-bar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-inline: 12px !important;
    margin: 14px auto 18px !important;
    gap: 8px !important;
  }
  .demo-showcase-stage {
    position: relative !important;
    inset: auto !important;
    height: var(--demo-stage-h, 56vw) !important;
    overflow: hidden !important;
  }
  .interactive-desktop-frame {
    transform: translate3d(0, 0, 0) scale(var(--df-scale, 0.3)) !important;
  }
}

/* ---------- Providers stepper on very small phones ---------- */
@media (max-width: 400px) {
  .prov-stepper { max-width: calc(100vw - 32px); }
  .prov-step-btn { padding: 6px 10px; }
}

/* Hero window tabs: keep labels on one line on phones */
@media (max-width: 540px) {
  .window-bar { height: auto !important; min-height: 46px !important; padding: 6px 6px !important; }
  .window-tabs { flex-wrap: nowrap !important; gap: 4px !important; }
  .win-tab { white-space: nowrap !important; padding: 6px 10px !important; font-size: 11.5px !important; gap: 4px !important; }
  .win-tab svg { width: 13px !important; height: 13px !important; }
}
@media (max-width: 360px) {
  .win-tab { padding: 5px 8px !important; font-size: 10.5px !important; }
  .win-tab svg { display: none !important; }
}

/* ---------- Phone typography and spacing ---------- */
@media (max-width: 560px) {
  #heroHeader { padding-top: calc(var(--nav-h, 64px) + 20px) !important; padding-inline: 18px !important; }
  .hero__logo { margin-bottom: 12px !important; }
  .hero__logo img { width: 44px !important; height: 44px !important; }
  .hero__badge { margin-bottom: 16px !important; }
  .hero__title {
    font-size: clamp(27px, 7.9vw, 36px) !important;
    line-height: 1.14 !important;
    letter-spacing: -0.022em !important;
  }
  .hero__title .hero__phrase { display: block !important; }
  .hero__title-line + .hero__title-line { margin-top: 0 !important; }
  .hero__subline {
    font-size: 17px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    margin: 14px auto 22px !important;
    opacity: .85;
  }

  .section { padding: 60px 0; }
  .wrap { padding-inline: 18px; }
  .eyebrow {
    font-size: 11px !important;
    letter-spacing: .1em !important;
    line-height: 1.45 !important;
    padding: 5px 12px !important;
    gap: 6px !important;
    max-width: 100%;
    text-align: center;
    justify-content: center;
    margin-bottom: 14px !important;
  }
  .eyebrow::before { display: none !important; }
  .s-title { font-size: 27px !important; line-height: 1.18 !important; letter-spacing: -0.02em !important; }
  .s-sub { font-size: 15.5px !important; line-height: 1.6 !important; }
  .problem-card__title, .solution-card__title { font-size: 21px !important; line-height: 1.22 !important; }
  .prov-card__title { font-size: 23px !important; }
  .prov-card { min-height: 0 !important; }
}

/* Providers tabs: one line per label on phones */
@media (max-width: 560px) {
  .prov-stepper { max-width: calc(100vw - 28px); gap: 2px; }
  .prov-step-btn { white-space: nowrap; padding: 7px 10px; font-size: 12px; gap: 5px; }
  .demo__header .s-sub { margin-bottom: 0 !important; }
  .demo-quick-bar { margin-top: 10px !important; }
}
@media (max-width: 360px) {
  .prov-step-btn { padding: 6px 7px; font-size: 11px; }
}
@media (max-width: 400px) {
  .prov-step-btn__num { display: none !important; }
}

/* =========================================================================
   v3: phone design pass (<=560px). Mirrors the desktop look, tuned for phones.
   ========================================================================= */
@media (max-width: 560px) {
  /* Header: logo + wordmark, theme toggle, menu. GitHub/X live in the footer. */
  .nav__in { padding-inline: 14px !important; }
  .brand span { display: inline-flex !important; }
  .brand { font-size: 15px !important; gap: 8px !important; }
  .brand img { width: 26px !important; height: 26px !important; }
  .nav__actions a.icon-btn,
  .nav__actions .btn--primary { display: none !important; }
  .nav__actions { gap: 8px !important; }

  /* Hero */
  #heroHeader { padding-top: calc(var(--nav-h, 64px) + 34px) !important; padding-inline: 20px !important; }
  .hero__logo { display: none !important; }
  .hero__badge { margin-bottom: 20px !important; font-size: 12.5px !important; padding: 5px 14px !important; }
  .hero__title {
    font-size: clamp(30px, 9.4vw, 40px) !important;
    line-height: 1.06 !important;
    letter-spacing: -0.04em !important;
    font-weight: 800 !important;
    max-width: 100% !important;
  }
  .hero__title .hero__phrase { display: block !important; white-space: nowrap !important; }
  .hero__title .hero__phrase + .hero__phrase,
  .hero__title-line + .hero__title-line { margin-top: 2px !important; }
  .hero__subline {
    font-size: 18px !important;
    font-weight: 600 !important;
    letter-spacing: -0.015em !important;
    opacity: 1 !important;
    margin: 16px auto 26px !important;
  }
  .hero__cta {
    flex-wrap: nowrap !important;
    gap: 10px !important;
    padding-inline: 0 !important;
    width: 100% !important;
    max-width: 380px !important;
    margin-inline: auto !important;
  }
  .btn--hero-download,
  .btn--hero-promo {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 50px !important;
    padding: 0 12px !important;
    font-size: 15px !important;
    gap: 7px !important;
    white-space: nowrap !important;
  }
  .btn--hero-download svg, .btn--hero-promo svg { width: 16px !important; height: 16px !important; }
  .hero__showcase { padding-inline: 12px !important; margin-top: 30px !important; }
  .hero__sticky { padding-bottom: 40px !important; }

  /* Section labels: soft pills like the hero badge */
  .eyebrow {
    border-radius: 999px !important;
    border-width: 1px !important;
    border-style: solid !important;
    padding: 5px 13px !important;
    font-size: 10.5px !important;
    letter-spacing: .12em !important;
  }
  .eyebrow:not([class*="eyebrow--"]) { border-color: transparent !important; padding-inline: 0 !important; }
  .s-title { font-size: 28px !important; line-height: 1.12 !important; letter-spacing: -0.03em !important; }
}
@media (max-width: 360px) {
  .brand { font-size: 13.5px !important; }
  .btn--hero-download, .btn--hero-promo { font-size: 13.5px !important; padding: 0 8px !important; }
  .btn--hero-download svg, .btn--hero-promo svg { display: none !important; }
}
@media (max-width: 560px) {
  .hero { padding-top: 0 !important; }
  #heroHeader { padding-top: calc(var(--nav-h, 64px) + 28px) !important; }
}
@media (max-width: 560px) {
  .hero__title { letter-spacing: -0.03em !important; }
  .section { padding: 48px 0 !important; }
  .section--desktop-demo.demo-track { padding: 52px 0 40px !important; }
}
@media (max-width: 960px) {
  /* Poster stays visible if a phone blocks video autoplay */
  .media-frame--solution .media-frame__img-wrap {
    background: #111 url("../img/hero_videoflow_poster.jpg") center / cover no-repeat !important;
  }
}

/* =========================================================================
   Mobile motion (<=960px). Classes are added by assets/js/mobile-motion.js,
   which does nothing on desktop or with reduced motion.
   ========================================================================= */
@media (max-width: 960px) {
  html.mm .mm-hero {
    animation: mmHeroIn .85s cubic-bezier(.16,1,.3,1) backwards;
    animation-delay: var(--mm-d, 0ms);
  }
  html.mm .hero__title .hero__phrase.mm-hero { display: block; }
  html.mm .hero__showcase.mm-hero { animation-name: mmShowIn; animation-duration: 1.1s; }
  @keyframes mmHeroIn { from { opacity: 0; transform: translate3d(0, 18px, 0); } to { opacity: 1; transform: none; } }
  @keyframes mmShowIn { from { opacity: 0; transform: perspective(1000px) translateY(48px) rotateX(18deg) scale(.9); } to { opacity: 1; transform: perspective(1000px) rotateX(0) scale(1); } }
  html.mm .mm-tilt { opacity: 0; transform: perspective(1000px) translate3d(0, 30px, 0) rotateX(14deg) scale(.92); transform-origin: 50% 0%;
    transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .9s cubic-bezier(.16,1,.3,1); }
  html.mm .mm-tilt.mm-in { opacity: 1; transform: none; }

  /* Accent words: slow light sweep */
  html.mm .hero__title .grad {
    background-size: 220% 100% !important;
    background-image: linear-gradient(110deg, #e06222 0%, #efa464 30%, #ffd7ac 45%, #efa464 60%, #e06222 100%) !important;
    animation: mmSheen 2.4s ease-in-out 1.2s 2 both;
  }
  html.mm[data-theme="light"] .hero__title .grad {
    background-image: linear-gradient(110deg, #b4440c 0%, #e06222 32%, #f29a55 46%, #e06222 60%, #b4440c 100%) !important;
  }
  @keyframes mmSheen { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0% 0; } }


  /* Scroll reveals */
  html.mm .mm-rv {
    opacity: 0;
    transform: translateY(28px) scale(.97);
    transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1);
    transition-delay: var(--mm-d, 0ms);
  }
  html.mm .mm-rv.mm-in { opacity: 1; transform: none; }

  /* Tap feedback */
  html.mm .btn, html.mm .win-tab, html.mm .demo-chip-btn, html.mm .prov-step-btn, html.mm .faq-question, html.mm .icon-btn {
    transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease;
  }
  html.mm .btn:active, html.mm .win-tab:active, html.mm .demo-chip-btn:active,
  html.mm .prov-step-btn:active, html.mm .faq-question:active, html.mm .icon-btn:active { transform: scale(.96); }
}
@media (prefers-reduced-motion: reduce) {
  html.mm .mm-hero, html.mm .mm-rv, html.mm .mm-tilt { opacity: 1 !important; transform: none !important; filter: none !important; }
  html.mm .hero__title .grad, html.mm .btn--hero-download, html.mm .mm-hero { animation: none !important; }
}
@media (max-width: 960px) {
  /* Before mobile-motion.js tags the hero pieces, keep them hidden (no flash) */
  html.mm-pre .hero__badge, html.mm-pre .hero__title, html.mm-pre .hero__subline,
  html.mm-pre .hero__cta, html.mm-pre .hero__showcase { opacity: 0; }
}

/* Phone performance: blur-behind effects re-render every scrolled frame, which
   stutters on budget phones. Swap them for solid backgrounds on small screens. */
@media (max-width: 960px) {
  .nav { backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
         background: var(--canvas) !important; }
  .hero__showcase *, .section *, .foot * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}


/* ============================================================
   Site audit fixes (Oct 2026)
   ============================================================ */
/* Logo never gets squeezed by the nav links */
.brand { flex-shrink: 0; }
/* Small laptops (961-1120px): the full nav is tight, so drop the
   GitHub / X icons there (both are still linked in the footer). */
@media (min-width: 961px) and (max-width: 1120px) {
  .nav__actions a.icon-btn { display: none !important; }
  .nav__links { gap: 18px !important; }
}
/* Hero Video / Audio / Voice tabs stay on one line at every width */
.win-tab { white-space: nowrap; }
.window-tabs { width: max-content; }
/* Tablets: a lone last card in a 2-column grid spans the full row */
@media (min-width: 641px) and (max-width: 960px) {
  .prov-cards-grid > :last-child:nth-child(odd),
  .priv__grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* Text contrast: small labels now meet WCAG AA (4.5:1) */
html[data-theme="light"] { --muted: #5f4d3a; --h-muted: #5f4d3a; }
.prov-legend__item, .priv__trust, .dl-file-type, .dl-other-format-link { opacity: 1 !important; }
html[data-theme="light"] #solutionCaption span { color: #a8420c !important; }
html[data-theme="light"] .problem-card__tag { color: #b91c1c !important; }
html[data-theme="light"] .prov-local-box__tag { color: #04553e !important; }
html[data-theme="light"] .prov-step-btn__num { color: #8f3510 !important; }
html[data-theme="dark"] .prov-local-box__tag { color: #6ee7b7 !important; }
html[data-theme="dark"] .prov-card__toggle-text,
html[data-theme="dark"] .prov-card__flow-badge { color: #efaa73 !important; }
.prov-step-btn__num { opacity: 1 !important; }
html[data-theme="light"] .prov-card__flow-badge,
html[data-theme="light"] .prov-card__toggle-text { color: #8f3510 !important; }
html[data-theme="light"] .solution-card__tag { color: #116530 !important; }
html[data-theme="dark"] .solution-card__tag { color: #22c55e !important; }

/* =========================================================================
   Launch polish (Oct 2026): provider cards + download section, below 961px.
   ========================================================================= */
@media (max-width: 960px) {
  /* Providers: one calm column, equal card widths (no stretched lone card) */
  .prov-cards-grid { grid-template-columns: 1fr !important; max-width: 600px; gap: 16px !important; }
  .prov-cards-grid > :last-child:nth-child(odd) { grid-column: auto; }
  .prov-head { margin-bottom: 18px; }
  .prov-card.pc2, .prov-card.pc2.is-active, .prov-card.pc2.is-active:hover { transform: none; }
  .pc2__extras { padding-top: 16px; }
}
@media (max-width: 560px) {
  .prov-card.pc2 { padding: 22px 18px 20px; border-radius: 20px; }
  .pc2__title { font-size: 22px !important; margin-bottom: 14px; }
  .pc2__free { padding: 14px 14px 4px; }
  .pc2__list li { font-size: 14.5px; }
  .pc2__names { font-size: 13.5px; }

  /* Download: full-width cards, notes straight under each card */
  .dl-grid--v2 { gap: 26px !important; }
  .dl-col { max-width: 100%; width: 100%; flex: 0 0 auto; }
  .dl-platform-card.dl-card2 { padding: 22px 18px 18px; }
  .dl-card2 .dl-platform-compat { margin-bottom: 16px; }
  .dl-card2 .dl-cta-btn { height: 54px; font-size: 15.5px; }
  .dl-note { padding: 0 4px; font-size: 13.5px; }
  .dl-note--plain { padding-left: 28px; }
  .dl-why { padding-inline: 4px; }
}
@media (min-width: 561px) and (max-width: 680px) {
  .dl-col { max-width: 440px; width: 100%; flex: 0 0 auto; }
}
@media (max-width: 960px) { .pc2__free { flex: 0 0 auto; } }
@media (max-width: 560px) { #dlRequirements .dl-dot { display: none !important; } #dlRequirements { flex-direction: column !important; gap: 2px !important; } }
