/* Limitless IR: app-like layer for phones and small tablets. Every rule sits inside a max-width query
   (or styles elements that only mobile.js creates and that stay display:none above 980px), so desktop is unchanged. */
.m-tabbar, .m-appbar { display: none; }
dialog.m-sheet:not([open]) { display: none; }

@media (max-width: 980px) {
  html { -webkit-tap-highlight-color: transparent; }
  a, button, summary, label, select, input, textarea { touch-action: manipulation; }
  /* tap feedback within 100ms, no hover needed */
  a:active, button:active, summary:active { opacity: .72; transition: opacity 60ms; }
  :root .card:active, :root .subnav a:active, .m-row:active { transform: scale(.985); transition: transform 80ms; }

  /* Menu as a bottom sheet (replaces the full-screen menu) */
  dialog.m-sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 560px; max-height: calc(100dvh - env(safe-area-inset-top) - 24px); padding: 0; border: 0; border-radius: 16px 16px 0 0; background: #f2f2f7; color: #13243d; box-shadow: 0 -10px 40px rgba(7, 27, 72, .25); display: flex; flex-direction: column; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; animation: m-up 340ms cubic-bezier(.32, .72, 0, 1); transition: transform 220ms cubic-bezier(.32, .72, 0, 1); }
  dialog.m-sheet::backdrop { background: rgba(7, 27, 72, .38); animation: m-fade 240ms ease; }
  dialog.m-sheet.is-closing { transform: translateY(100%); }
  .m-grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(60, 60, 67, .3); margin: 7px auto 0; flex: none; }
  .m-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 6px 20px; flex: none; }
  .m-sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: #071b48; }
  .m-sheet-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #3c4a63; cursor: pointer; }
  .m-sheet-close svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: rgba(118, 118, 128, .14); fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
  .m-sheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); }
  .m-group h3 { margin: 22px 4px 7px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #6b7487; }
  .m-list { background: #fff; border-radius: 12px; overflow: hidden; }
  .m-sheet-body > .m-list:first-child { margin-top: 8px; }
  .m-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 14px 0 16px; color: #13243d; font-size: 17px; text-decoration: none; }
  .m-row + .m-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; transform: scaleY(.5); background: rgba(60, 60, 67, .29); }
  .m-row svg { width: 16px; height: 16px; flex: none; fill: none; stroke: #b0b6c3; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .m-row[aria-current="page"] { color: #0a3dcc; font-weight: 600; }
  .m-row[aria-current="page"] svg { stroke: #0a3dcc; }
  .m-row:focus-visible, .m-sheet-close:focus-visible { outline: 3px solid #1747dc; outline-offset: -3px; }
  @keyframes m-up { from { transform: translateY(100%); } }
  @keyframes m-fade { from { opacity: 0; } }
}

@media (max-width: 760px) {
  /* safe areas (viewport-fit=cover) */
  :root .page-hero, :root .hero { margin-left: max(8px, env(safe-area-inset-left)); margin-right: max(8px, env(safe-area-inset-right)); }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

  /* Bottom tab bar */
  .m-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: rgba(250, 250, 252, .92); border-top: .5px solid rgba(60, 60, 67, .22); view-transition-name: m-tabbar; }
  .m-tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 6px 0 4px; color: #6b7487; font: 600 10.5px/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; letter-spacing: .01em; text-decoration: none; }
  .m-tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .m-tabbar a[aria-current="page"] { color: #0a3dcc; }
  .m-tabbar a[aria-current="page"] svg { stroke-width: 2.1; }
  .m-tabbar a:focus-visible { outline: 3px solid #1747dc; outline-offset: -4px; border-radius: 10px; }

  /* Compact app bar: the hero's large title collapses into it on scroll */
  .m-appbar { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; align-items: center; position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); background: rgba(250, 250, 252, .92); border-bottom: .5px solid rgba(60, 60, 67, .22); transform: translateY(-101%); transition: transform 260ms cubic-bezier(.32, .72, 0, 1); view-transition-name: m-appbar; }
  .m-appbar.is-on { transform: none; }
  .m-appbar-home { display: grid; place-items: center; height: 48px; }
  .m-mark { width: 30px; height: 20px; background: #071b48; -webkit-mask: url(/site/assets/app/limitless-mark.svg) center / contain no-repeat; mask: url(/site/assets/app/limitless-mark.svg) center / contain no-repeat; }
  .m-appbar-title { text-align: center; font: 600 16px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; color: #071b48; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-appbar-menu { justify-self: center; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: #0a3dcc; cursor: pointer; }
  .m-appbar-menu svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .m-appbar a:focus-visible, .m-appbar-menu:focus-visible { outline: 3px solid #1747dc; outline-offset: -4px; border-radius: 10px; }

  /* Section tabs become one swipeable rail instead of wrapping rows */
  :root .subnav { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding-left: 20px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  :root .subnav::-webkit-scrollbar { display: none; }
  :root .subnav a { flex: none; scroll-snap-align: start; min-height: 44px; }
  :root .subnav::after { content: ""; flex: none; width: 8px; }

  /* Home ecosystem tabs: let long labels wrap instead of pushing the page wider than the screen
     (the overflow also shifted every fixed bar on 320px phones) */
  :root .business-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root .business-tabs button { min-width: 0; overflow-wrap: anywhere; }

  /* Native-feeling forms: 16px+ so iOS never zooms */
  :root input, :root select, :root textarea { font-size: max(16px, 1em); }
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  @media (max-width: 760px) {
    .m-tabbar, .m-appbar { background: rgba(250, 250, 252, .78); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
  }
}

/* Smooth page-to-page transitions on phones (cross-document View Transitions), off for reduced motion */
@media (max-width: 980px) and (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: 160ms ease both m-vt-out; }
  ::view-transition-new(root) { animation: 240ms cubic-bezier(.32, .72, 0, 1) both m-vt-in; }
  @keyframes m-vt-out { to { opacity: 0; } }
  @keyframes m-vt-in { from { opacity: 0; transform: translateY(8px); } }
}
@media (prefers-reduced-motion: reduce) {
  dialog.m-sheet, dialog.m-sheet::backdrop, .m-appbar { animation: none; transition: none; }
}
