/* THORWALLET - the homepage on phones.
   Tighter rhythm, swipeable rails instead of tall stacks, feature tabs for the
   Trade chapters, a sticky download bar. Loaded after site.css; nothing here
   applies above 760px, and the elements mobile.js adds stay hidden there. */

.m-dots, .m-tabs, .m-cta { display: none; }

@media (max-width: 760px) {
  /* ---- rhythm: the desktop paddings are inline (150-260px), far too much on a phone ---- */
  #swaps, #pro-desk, #card, #titn, #rewards, #blog, #newsletter { padding-top: 84px !important; padding-bottom: 72px !important; }
  #testimonials { padding-top: 12px !important; padding-bottom: 64px !important; }
  /* the desktop stage clips (overflow: hidden), which would stop the feature tabs from sticking */
  #trade .feat-stage { padding-block: 60px 44px; overflow: visible; }

  /* ---- proof band: one card, a 2x2 grid and a full-width last stat ---- */
  .proof-row {
    grid-template-columns: 1fr 1fr; border: 1px solid var(--hairline); border-radius: 22px; overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
  }
  .proof-row .pstat { border-left: 0; border-bottom: 1px solid var(--hairline); padding: 22px 10px 20px; gap: 8px; }
  .proof-row .pstat:nth-child(odd):not(:last-child) { border-right: 1px solid var(--hairline); }
  .proof-row .pstat:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .proof-row .pstat-v { font-size: 2.05rem; }
  .proof-row .pstat-k { font-size: 0.6rem; letter-spacing: 0.1em; }

  /* ---- swaps: one clean column of route cards ---- */
  .rails { grid-template-columns: 1fr; margin-top: 34px; }
  .rails .rail { padding: 20px 20px 18px; gap: 10px; min-height: 0; }
  .rails .rail-name { font-size: 1.2rem; margin-bottom: 4px; }
  .rails .rail-desc { font-size: 0.76rem; }

  /* ---- card highlights: three numbers in one row ---- */
  .card-highlights { grid-template-columns: repeat(3, 1fr); }
  .card-highlights .ch-item { border-bottom: 0; border-right: 1px solid var(--hairline); padding: 20px 8px; text-align: center; }
  .card-highlights .ch-item:last-child { border-right: 0; }
  .card-highlights .ch-v { font-size: 1.6rem; }
  .card-highlights .ch-k { font-size: 0.72rem; }

  /* ---- swipe rails (class added by mobile.js) ---- */
  .m-rail {
    display: flex !important; position: relative; overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
    gap: 12px; margin-inline: calc(-1 * var(--gutter)); padding: 6px var(--gutter) 14px;
    scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
    border: 0 !important; border-radius: 0 !important; background: none !important; max-width: none !important;
  }
  .m-rail::-webkit-scrollbar { display: none; }
  .m-rail > * { flex: 0 0 84%; min-width: 0; scroll-snap-align: center; }
  .m-dots { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
  .m-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--hairline-strong); transition: width 0.3s, background-color 0.3s; }
  .m-dots i.on { width: 18px; background: var(--text-hi); }

  .tiers.m-rail .tier { border: 1px solid var(--hairline); border-radius: 22px; background: var(--bg-elev-1); overflow: hidden; }
  .tiers.m-rail .tier.featured { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), 0 24px 60px -34px var(--accent-glow); }
  .tms-grid.m-rail > .tm-card, .blog-grid.m-rail > .post { margin: 0; }
  .m-rail > .tier:active, .m-rail > .tm-card:active, .m-rail > .post:active { transform: scale(0.985); transition: transform 0.15s; }

  /* ---- trade chapters: one swipeable card per feature, tabs on top ---- */
  #trade .feat-copy.m-rail { align-items: stretch; }
  #trade .feat-copy.m-rail > .feat-panel {
    flex-basis: 88%; border-top: 0; padding: 20px 18px 24px !important; border-radius: 24px;
    border: 1px solid var(--hairline) !important; background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.005));
  }
  #trade .feat-inline-media { margin-bottom: 22px; }
  #trade .feat-panel .h1 { font-size: clamp(1.8rem, 7.6vw, 2.3rem); }
  .m-tabs {
    display: flex; position: sticky; top: var(--m-nav, 64px); z-index: 6; gap: 6px; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)) 18px; padding: 10px var(--gutter);
    background: color-mix(in srgb, var(--bg-base) 80%, transparent);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  }
  .m-tabs::-webkit-scrollbar { display: none; }
  .m-tabs button {
    flex: 0 0 auto; font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text-mid);
    background: var(--surface); border: 1px solid var(--hairline); border-radius: 999px; padding: 8px 14px; cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
  }
  .m-tabs button.on { background: var(--text-hi); color: var(--bg-base); border-color: transparent; }

  /* ---- sticky download bar ---- */
  .m-cta {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90; align-items: center; gap: 12px;
    padding: 9px 9px 9px 10px; border-radius: 20px;
    background: rgba(12, 30, 46, 0.8); border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(150%); opacity: 0; pointer-events: none;
    transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
  }
  .m-cta.show { transform: none; opacity: 1; pointer-events: auto; }
  .m-cta .ico { width: 40px; height: 40px; flex-shrink: 0; border-radius: 11px; background: #0E2233; border: 1px solid rgba(255, 255, 255, 0.1); display: grid; place-items: center; }
  .m-cta .ico img { width: 22px; height: 22px; object-fit: contain; }
  .m-cta .t { flex: 1; min-width: 0; line-height: 1.25; }
  .m-cta .t b { display: block; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: #FFFFFF; }
  .m-cta .t span { display: block; font-size: 12px; color: #C5D2DE; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-cta .t span em { font-style: normal; color: #F5C542; }
  .m-cta a {
    flex-shrink: 0; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: #06222B; text-decoration: none;
    background: linear-gradient(120deg, #00CCFF, #33FF99); border-radius: 14px; padding: 11px 16px;
  }
  /* the page ends above the bar, so the footer's last line is never covered */
  body.m-has-cta .footer { padding-bottom: 104px; }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .m-cta { transition: none; }
}
