/* responsive.css
   Breakpoints. The phone layout is a reorganisation, not a shrunken desktop.
   Ported verbatim from the original design system — do not restyle. */

/* ==========================================================================
   Responsive
   ========================================================================== */

/* ==========================================================================
   Responsive — the phone layout is a reorganisation, not a shrunken desktop
   ========================================================================== */

/* Touch comfort is a property of the input device, not the viewport width:
   a 768px tablet is still a finger. Keyed off pointer type so mouse-driven
   desktops keep the original tighter control sizing. */
@media (pointer: coarse) {
  .btn {
    min-height: 46px;
  }
  .btn-sm {
    min-height: 40px;
  }
  .wallet-option {
    min-height: 58px;
  }
  .bottom-nav-item {
    min-height: 52px;
  }
  .input {
    min-height: 46px;
  }
}

@media (max-width: 1020px) {
  .g-main,
  .g4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .g3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero .row.between {
    align-items: flex-start;
  }
}

/* ---------- phones / wallet in-app browsers ---------- */
@media (max-width: 720px) {
  .g2,
  .g3,
  .g4,
  .g-main {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Headline figures stay two-up: four full-width cards would bury the page. */
  .g4.stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .shell {
    /* bottom padding clears the fixed nav + the iOS home indicator */
    padding: 14px 14px calc(112px + env(safe-area-inset-bottom));
  }

  .grid {
    gap: 14px;
  }

  .card,
  .hero {
    padding: 18px;
    border-radius: var(--radius);
  }

  .header {
    padding: 10px 12px;
    border-radius: 0 0 var(--radius) var(--radius);
    gap: 10px;
    flex-wrap: nowrap;
  }
  .logo img {
    max-height: 40px;
    max-width: min(170px, 44vw);
  }
  .logo-fallback {
    font-size: 16px;
    padding: 8px 13px;
  }
  .net-tag {
    display: none; /* network state is shown inside the wallet sheet on mobile */
  }
  .wallet-pill {
    padding: 7px 11px;
    max-width: 168px;
  }
  .wallet-pill-main {
    font-size: 12.5px;
    gap: 7px;
  }

  .hero-title {
    font-size: clamp(25px, 7.4vw, 34px);
  }
  .hero .row.between {
    flex-direction: column;
    gap: 16px;
  }
  .hero .grid {
    min-width: 100% !important;
  }

  /* Stat cards: tighter, no 3D tilt (jitters under touch scrolling) */
  .stat {
    padding: 16px;
  }
  .stat .value {
    font-size: 20px;
    margin-top: 8px;
    padding-right: 0;
  }
  .stat .label {
    font-size: 9.5px;
    letter-spacing: 0.14em;
    padding-right: 40px;
  }
  .stat .sub {
    font-size: 11px;
  }
  .stat .chip {
    width: 30px;
    height: 30px;
    top: 14px;
    right: 14px;
    font-size: 13px;
    border-radius: 10px;
  }
  .stat:hover {
    transform: none;
    box-shadow: var(--shadow-glass), var(--inset-glass);
  }

  /* Deposit cards */
  .deposit-card {
    padding: 18px;
  }
  .deposit-card:hover {
    transform: none;
  }
  .dot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .dot-grid .cell .v {
    font-size: 14px;
  }
  .dot-grid .cell:hover {
    transform: none;
  }

  /* Touch targets: 46px minimum, full-width primary actions */
  .btn {
    min-height: 46px;
    padding: 12px 16px;
  }
  .btn-sm {
    min-height: 40px;
  }
  .row > .btn {
    flex: 1 1 auto;
  }
  .input-row .btn {
    flex: 0 0 auto;
  }

  .kv {
    font-size: 13.5px;
    gap: 10px;
  }
  .kv .v {
    max-width: 58%;
    word-break: break-word;
  }

  .advantage-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .advantage {
    padding: 13px 14px;
    gap: 11px;
  }
  .advantage:hover {
    transform: none;
  }

  .level {
    padding: 12px 13px;
    gap: 12px;
  }
  .level:hover {
    transform: none;
  }
  .level .badge {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }

  /* Gauge stacks above its caption so neither is squeezed */
  .gauge-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .gauge {
    align-self: center;
  }

  .section-head h2 {
    font-size: 18px;
  }

  /* Transaction status becomes a bottom sheet, clear of the nav */
  .toast-wrap {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(78px + env(safe-area-inset-bottom));
    max-width: none;
  }
  .toast {
    padding: 15px 16px;
    animation: rise-in 0.32s var(--ease);
  }
  @keyframes rise-in {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
  }
  .toast-msg {
    margin-top: 8px;
    line-height: 1.55;
  }
  .toast-close {
    min-height: 34px;
    padding: 4px 10px;
  }

  /* Connect/wallet dialog docks to the bottom like a native sheet */
  .sheet-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .sheet {
    width: 100%;
    max-width: none;
    max-height: 88vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 16px 18px calc(22px + env(safe-area-inset-bottom));
    animation: sheet-up 0.34s var(--ease);
  }
  @keyframes sheet-up {
    from {
      transform: translateY(100%);
    }
  }
  .sheet-grip {
    display: block;
  }

  /* Bottom navigation replaces desktop scrolling chrome */
  .bottom-nav {
    display: flex;
  }

  /* FAB sits above the nav and shrinks to an icon */
  .fab-stack {
    right: 14px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .fab {
    height: 52px;
    min-width: 52px;
    font-size: 13px;
    padding: 0 18px;
  }

  /* backdrop-filter is the single most expensive thing on mobile GPUs */
  .glass {
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
  }
  .aurora {
    filter: blur(58px) saturate(140%);
  }
}

/* ---------- small phones (iPhone SE / 320–380px) ---------- */
@media (max-width: 380px) {
  .shell {
    padding: 12px 11px calc(108px + env(safe-area-inset-bottom));
  }
  .card,
  .hero {
    padding: 15px;
  }
  .stat {
    padding: 14px;
  }
  .stat .value {
    font-size: 17.5px;
  }
  .stat .chip {
    width: 26px;
    height: 26px;
    top: 12px;
    right: 12px;
    font-size: 11px;
  }
  .stat .label {
    padding-right: 32px;
  }
  .dot-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .logo img {
    max-height: 34px;
    max-width: min(130px, 40vw);
  }
  .wallet-pill {
    max-width: 132px;
  }
  /* Keep the address legible on 320–380px screens; the balance is already on
     the POL BALANCE card and inside the wallet sheet. */
  .wallet-pill-balance {
    display: none;
  }
  .bottom-nav-label {
    font-size: 9.5px;
  }
  .fab-label {
    display: none;
  }
  .fab {
    padding: 0 16px;
  }
}

/* ---------- landscape phones: keep the nav from eating the screen ---------- */
@media (max-height: 460px) and (orientation: landscape) {
  .bottom-nav {
    display: none;
  }
  .shell {
    padding-bottom: 40px;
  }
  .fab-stack {
    bottom: 14px;
  }
}
