/* ==========================================================================
   Xpertpoin8 | Responsive layer
   Breakpoints (desktop-first):
   - Large desktop  >= 1440px
   - Desktop        <= 1199.98px  (1200 and 1024 laptops)
   - Tablet         <= 991.98px   (768 tablets)
   - Mobile         <= 767.98px
   - Small mobile   <= 575.98px   (430px)
   - Compact mobile <= 389.98px   (375px)
   ========================================================================== */


/* --------------------------------------------------------------------------
   Large desktop (1440px and above)
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  .container { max-width: 1360px; }
  .hero-stage { width: 106%; margin-right: -6%; }
}


/* --------------------------------------------------------------------------
   Desktop & laptop (up to 1199px)
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
  :root { --fs-display: clamp(2.1rem, 0.4rem + 3.45vw, 3.65rem); }

  .header-inner { gap: 1rem; }
  .nav-item { padding: 0.55rem 0.7rem; font-size: 0.92rem; }

  /* Recognition: intro on its own row */
  .recog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .recog-intro {
    grid-column: 1 / -1;
    max-width: 42rem;
    padding: 0 0 2.5rem;
  }
  .recog-item--tf { padding-left: 0; border-left: 0; }
  .recog-item--tf::before { display: none; }

  /* Services: two-column bento */
  .svc--wp,
  .svc--redesign { grid-column: span 12; }
  .svc--ux,
  .svc--el,
  .svc--shop,
  .svc--theme { grid-column: span 6; }

  /* Filter rows drop below their heading */
  .work-head { grid-template-columns: minmax(0, 1fr); }
  .work-head .work-filters { justify-content: flex-start; }

  /* Process: 3 x 2 grid, segments break at the end of each row */
  .timeline { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 3rem; --gap: 2rem; }
  .step:nth-child(3n)::before,
  .step:nth-child(3n)::after { display: none; }

  .why-eight { width: 28rem; right: -9rem; }

  /* Estimator: type cards as 3 + 2 */
  .est-types { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .est-type { grid-column: span 2; }
  .est-type:nth-child(n + 4) { grid-column: span 3; }
}


/* --------------------------------------------------------------------------
   Tablet (up to 991px)
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  :root { --header-h: 76px; }

  /* Header: hamburger replaces the inline nav */
  .primary-nav { display: none; }
  .header-cta { margin-left: auto; }
  .menu-toggle { display: block; margin-left: 0.5rem; }
  .site-header.is-scrolled { height: 68px; }

  /* Hero stacks: copy first, visual below */
  .hero { padding-bottom: 3.5rem; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 3.5rem; }
  .hero-stage {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
  }
  .hero-poly {
    -webkit-mask-image: radial-gradient(ellipse 70% 45% at 50% 75%, #000 15%, transparent 72%);
    mask-image: radial-gradient(ellipse 70% 45% at 50% 75%, #000 15%, transparent 72%);
  }

  .section-head--split { grid-template-columns: minmax(0, 1fr); }
  .work-filters { justify-content: flex-start; }

  /* About */
  .about-media { max-width: 560px; margin: 0 auto; }
  .about-note { left: 1rem; }
  .about-copy { max-width: none; }

  /* Sticky columns become static */
  .why-intro,
  .faq-intro { position: static; }

  /* Services: redesign stacks */
  .svc--redesign { grid-template-columns: minmax(0, 1fr); }
  .svc--redesign .svc-body { padding: 2.25rem 2rem 0; }
  .svc--redesign .svc-visual { padding: 1.75rem 2rem 2rem; }

  /* Portfolio: two equal columns, keep the stagger */
  .work-item,
  .work-item.is-wide { grid-column: span 6; }

  /* Process: vertical timeline */
  .timeline {
    grid-template-columns: minmax(0, 1fr);
    --gap: 2.25rem;
    row-gap: var(--gap);
    max-width: 40rem;
  }
  .step { padding: 0 0 0 calc(var(--node) + 1.5rem); }
  .step-node { position: absolute; top: 0; left: 0; margin: 0; }
  .step-title { padding-top: 0.85rem; }
  .step::before,
  .step::after {
    top: calc(var(--node) / 2);
    left: calc(var(--node) / 2 - 1px);
    width: 2px;
    height: calc(100% + var(--gap));
  }
  .step::after {
    background: linear-gradient(180deg, var(--hue), var(--hue-next, var(--hue)));
    transform: scaleY(var(--fill, 0));
    transform-origin: center top;
  }
  .step:nth-child(3n)::before,
  .step:nth-child(3n)::after { display: block; }
  .step:last-child::before,
  .step:last-child::after { display: none; }

  .stack-head { grid-template-columns: minmax(0, 1fr); }

  .cta-inner { grid-template-columns: minmax(0, 1fr); }
  .cta-ring--top { right: -12rem; }
  .cta-ring--bottom { right: -18rem; }

  .why-eight { opacity: 0.6; }
  .quote::before { font-size: 7rem; }

  /* Estimator: result card follows the controls */
  .est { grid-template-columns: minmax(0, 1fr); }
  .est-result { position: static; }
  .est-types { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .est-type,
  .est-type:nth-child(n + 4) { grid-column: auto; }
}


/* --------------------------------------------------------------------------
   Mobile (up to 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .section { padding-block: clamp(4.5rem, 14vw, 5.5rem); }

  /* Recognition stacks */
  .recog-grid { grid-template-columns: minmax(0, 1fr); }
  .recog-intro { padding-bottom: 0.5rem; }
  .recog-item {
    margin-top: 1.75rem;
    padding: 1.75rem 0 0;
    border-top: 1px solid var(--color-line);
    border-left: 0;
  }
  .recog-item::before { display: none; }
  .recog-desc { max-width: 40ch; }

  /* Services: single column */
  .svc--ux,
  .svc--el,
  .svc--shop,
  .svc--theme { grid-column: span 12; }
  .svc--wp { grid-template-columns: minmax(0, 1fr); }
  .svc--wp .svc-body { padding: 2rem 1.75rem 0; }
  .svc--wp .svc-visual { min-height: 14rem; padding: 2rem 0 0 1.75rem; }
  .code-window { min-width: 22rem; }
  .svc-body { padding: 1.5rem 1.75rem 1.75rem; }
  .svc-visual { min-height: 13rem; padding: 2rem 1.75rem 0; }
  .svc--redesign .svc-body { padding: 2rem 1.75rem 0; }
  .svc--redesign .svc-visual { padding: 1.5rem 1.25rem 1.5rem; }
  .compare { aspect-ratio: 4 / 3; }
  .compare-pane { padding: 3rem 1.25rem 1rem; }
  .ns-cards span { height: 2.25rem; }
  .os-cols span { height: 2.5rem; }

  /* Portfolio: one column, no stagger */
  .work-item,
  .work-item.is-wide,
  .work-grid.is-filtered .work-item { grid-column: span 12; }
  .work-grid:not(.is-filtered) .work-item:nth-child(even) { margin-top: 0; }
  .work-scene { height: clamp(15rem, 64vw, 24rem); }
  .work-view { display: none; }

  .why-item { gap: 1.1rem; padding: 1.6rem 0; }
  .why-icon { width: 2.85rem; height: 2.85rem; font-size: 0.95rem; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-shell { border-radius: var(--radius-lg); }

  .quote { border-radius: var(--radius-lg); }
  .quote-project { margin-left: 0; }
  .quote figcaption { row-gap: 0.75rem; }

  .footer-top { flex-direction: column; align-items: flex-start; }

  .est-types { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .est-type { grid-column: span 2; }
  .est-type:nth-child(n + 4) { grid-column: span 3; }
}


/* --------------------------------------------------------------------------
   Small mobile (up to 575px, covers 430px)
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
  .container { --bs-gutter-x: 2.5rem; }

  .header-cta { display: none; }
  .menu-toggle { margin-left: auto; }
  .brand { font-size: 1.05rem; }
  .brand-mark { width: 30px; }

  /* Estimator */
  .est-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .est-type,
  .est-type:nth-child(n + 4) { grid-column: auto; }
  .est-type:last-child { grid-column: 1 / -1; }
  .est-seg { display: flex; }
  .est-seg label { flex: 1; }
  .est-seg span { justify-content: center; width: 100%; padding-inline: 0.75rem; }
  .est-actions .button { width: 100%; }

  /* Hero */
  .hero { padding-top: calc(var(--header-h) + 2rem); }
  .hero-eyebrow { font-size: 0.7rem; letter-spacing: 0.12em; }
  .hero-line { display: inline; }
  .hero-title { letter-spacing: -0.045em; }
  .hero-actions .button { flex: 1 1 100%; }
  .hero-proof { flex-direction: column; gap: 0.9rem; margin-top: 2.25rem; }
  .hero-grid { gap: 2.75rem; }
  .hero-stage { width: 108%; margin-left: -4%; }

  .eyebrow { font-size: 0.72rem; }

  /* About */
  .about-media { padding: 0 8% 16% 0; }
  .about-note { bottom: 6%; left: 0.75rem; max-width: 13rem; padding: 1rem 1.1rem; }
  .about-note-year { font-size: 1.6rem; }
  .about-note-text { font-size: 0.8rem; }
  .about-photo--small { width: 44%; border-width: 6px; }
  .about-ring { width: 6rem; height: 6rem; top: -1.5rem; }
  .stat { padding: 1.25rem 0.75rem 1.25rem 0; }
  .stat:nth-child(even) { padding-left: 1rem; }

  /* Filters scroll sideways instead of wrapping */
  .work-filters {
    flex-wrap: nowrap;
    margin-inline: calc(var(--bs-gutter-x) * -0.5);
    padding: 0.25rem calc(var(--bs-gutter-x) * 0.5);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .work-filters::-webkit-scrollbar { display: none; }
  .filter { flex: none; }
  .work-foot { flex-direction: column; align-items: flex-start; }

  /* Ticker pills */
  .tech { gap: 0.65rem; padding: 0.6rem 1.15rem 0.6rem 0.6rem; }
  .tech-icon { width: 2.2rem; height: 2.2rem; font-size: 1.05rem; }

  /* FAQ */
  .faq-q button { gap: 1rem; padding: 1.35rem 0; }
  .faq-a-inner p { padding-right: 0; }

  /* CTA & contact */
  .cta-actions .button,
  .form-submit { flex: 1 1 100%; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .form-notice { max-width: none; }

  /* Footer */
  .footer-bottom { flex-direction: column; }

  /* Compact before/after mock */
  .compare-pane { padding: 2.75rem 1rem 1rem; }
  .new-site,
  .old-site { gap: 0.6rem; }
  .ns-nav em { width: 3rem; height: 1.1rem; }
  .ns-nav span { width: 1.6rem; }
  .ns-head { font-size: 0.85rem; }
  .ns-btn { width: 3.25rem; height: 1.2rem; }
  .ns-hero { gap: 0.75rem; }
  .ns-visual { height: 4.5rem; }
  .os-banner { padding: 0.45rem; font-size: 0.62rem; }

  .to-top { width: 2.9rem; height: 2.9rem; }
  .xp-dialog { border-radius: var(--radius-lg); }
}


/* --------------------------------------------------------------------------
   Compact mobile (up to 389px, covers 375px)
   -------------------------------------------------------------------------- */
@media (max-width: 389.98px) {
  :root { --fs-display: 1.95rem; --fs-h2: 1.6rem; }
  .container { --bs-gutter-x: 2.25rem; }

  .hero-eyebrow { font-size: 0.66rem; letter-spacing: 0.1em; }
  .proof-text strong { font-size: 0.9rem; }

  .svc-body,
  .svc--wp .svc-body,
  .svc--redesign .svc-body { padding-inline: 1.4rem; }
  .svc-visual { padding-inline: 1.25rem; }
  .widget-panel { gap: 0.45rem; padding: 0.7rem; }
  .type-specimen { font-size: 2.8rem; }

  .filter { padding: 0.55rem 0.9rem; font-size: 0.85rem; }
  .quote { padding: 1.75rem 1.4rem; }
  .quote blockquote p { font-size: 1.2rem; }
  .pill-option span { padding: 0.6rem 0.85rem; font-size: 0.85rem; }
  .mobile-nav a { font-size: 1.6rem; }
  .est-type-card { padding: 0.95rem 0.8rem 0.85rem; }
  .est-chip span { padding: 0.5rem 0.85rem; font-size: 0.84rem; }
}


/* --------------------------------------------------------------------------
   Pointer-specific: no hover lift on touch-only devices
   -------------------------------------------------------------------------- */
@media (hover: none) {
  .svc:hover { transform: none; box-shadow: none; }
  .work-item:hover .work-desktop,
  .work-item:hover .work-phone { transform: none; }
  .est-type:hover .est-type-card { translate: none; }
}
