/* Swipe between the two landing pages (/ and /buyers). Phone only. Look and motion: web/docs/swipe-navigation-design.md.
   home.css does not load motion.css, so every token carries its fallback. Nothing existing is restyled: this file adds the dots,
   the first-time hint, the swipe area's touch-action, and the page hop. */

@media (pointer: coarse) and (max-width: 819px) {
  /* The swipe area is the hero. pan-y pinch-zoom leaves vertical scroll and zoom to the browser and horizontal drags to the script,
     so the script never has to cancel a touch. */
  main > .hero { touch-action: pan-y pinch-zoom; }

  .syn-dots {
    position: absolute; left: 0; right: 0; z-index: 2; height: 6px;
    top: calc(100svh - 20px - var(--syn-bottom, env(safe-area-inset-bottom, 0px)));
    display: flex; justify-content: center; align-items: center; gap: 8px; pointer-events: none;
  }
  .syn-dots[hidden] { display: none; }
  .syn-dots a {
    position: relative; display: block; width: 6px; height: 6px; border-radius: 3px; pointer-events: auto;
    background: rgba(21, 18, 15, 0.18);
    transition: width var(--m-standard, 180ms) var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1));
    -webkit-tap-highlight-color: transparent;
  }
  .syn-dots a[aria-current="page"] { width: 18px; background: var(--ink, #15120F); }
  /* 44px tall hit area. Two dots 14px apart cannot both be 44px wide, so each reaches 22px outward and stops at the midpoint. */
  .syn-dots a::after { content: ""; position: absolute; top: -19px; bottom: -19px; left: -22px; right: -4px; }
  .syn-dots a:last-of-type::after { left: -4px; right: -22px; }
  .syn-dots-cap {
    position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font-size: 14px; line-height: 1.3;
    color: var(--muted, #6B6259); opacity: 0; pointer-events: none;
    transition: opacity var(--m-standard, 180ms) var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1));
  }
  .syn-dots-cap.on { opacity: 1; }

  .syn-peek {
    position: fixed; z-index: 1; width: 32px; pointer-events: none; display: flex; align-items: center; justify-content: center;
    background: var(--bg-2, #F4ECE2); color: var(--muted, #6B6259);
  }
  .syn-peek.l { left: 0; border-radius: 0 16px 16px 0; }
  .syn-peek.r { right: 0; border-radius: 16px 0 0 16px; }
  .syn-peek svg { display: block; }
  .syn-peek-move {
    transition: transform 500ms var(--m-ease-inout, cubic-bezier(0.77, 0, 0.175, 1));  /* hint choreography only */
  }
  .syn-snap { transition: transform var(--m-standard, 180ms) var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1)); }

  /* Dark. The strip is lighter-black on black: no hairline. */
  :root[data-theme="dark"] .syn-dots a { background: rgba(255, 255, 255, 0.22); }
  :root[data-theme="dark"] .syn-dots a[aria-current="page"] { background: #E7E9EA; }
  :root[data-theme="dark"] .syn-peek { background: #16181C; color: #A3A8AE; }
  :root[data-theme="dark"] .syn-dots-cap { color: #A3A8AE; }
  h1[data-syn-focus]:focus { outline: none; }
}
@media (pointer: coarse) and (max-width: 819px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .syn-dots a { background: rgba(255, 255, 255, 0.22); }
  :root:not([data-theme="light"]) .syn-dots a[aria-current="page"] { background: #E7E9EA; }
  :root:not([data-theme="light"]) .syn-peek { background: #16181C; color: #A3A8AE; }
  :root:not([data-theme="light"]) .syn-dots-cap { color: #A3A8AE; }
}

/* The hop: cross-document View Transition on the root only (no named regions; see seam.css for why). Opt-in only on a phone
   with motion allowed, so desktop and reduced-motion users get an instant navigation. swipe-vt.js skips every other navigation. */
@media (pointer: coarse) and (max-width: 819px) and (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  ::view-transition-group(root) { animation-duration: var(--m-expanded, 250ms); animation-timing-function: var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1)); }
  html.syn-hop-fwd::view-transition-old(root)  { animation: syn-out-r var(--m-expanded, 250ms) var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1)) both; }
  html.syn-hop-fwd::view-transition-new(root)  { animation: syn-in-l  var(--m-expanded, 250ms) var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1)) both; }
  html.syn-hop-back::view-transition-old(root) { animation: syn-out-l var(--m-expanded, 250ms) var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1)) both; }
  html.syn-hop-back::view-transition-new(root) { animation: syn-in-r  var(--m-expanded, 250ms) var(--m-ease, cubic-bezier(0.22, 1, 0.36, 1)) both; }

  @keyframes syn-out-r { to   { transform: translateX(14%);  opacity: 0; } }
  @keyframes syn-out-l { to   { transform: translateX(-14%); opacity: 0; } }
  @keyframes syn-in-l  { from { transform: translateX(-14%); opacity: 0; } }
  @keyframes syn-in-r  { from { transform: translateX(14%);  opacity: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
  .syn-dots a, .syn-dots-cap, .syn-peek-move, .syn-snap { transition: none; }
}
