/* Fast, thumb-friendly storefront on phones. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.site-header {
  padding-top: env(safe-area-inset-top, 0);
}

.main-nav a,
.language-switch,
.mobile-nav nav a,
.outline,
.checkout-submit,
.package,
.payment-method,
.payment-close {
  touch-action: manipulation;
}

@media (max-width: 820px) {
  .loading {
    min-height: 40vh;
    align-items: flex-start;
    padding-top: 2.5rem;
  }

  /* Home: catalog above the fold — skip decorative hero art. */
  .hero {
    border-bottom: 0;
  }
  .hero-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .hero-copy {
    padding: 2.75rem 0 1.25rem;
    order: 1;
  }
  .hero-copy h1 {
    font-size: clamp(2.35rem, 9.5vw, 3.15rem);
    margin-bottom: 1rem;
  }
  .hero-copy .lead {
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }
  .hero-visual {
    display: none;
  }
  .hero .button-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .hero .outline {
    width: 100%;
    min-height: 52px;
    justify-content: center;
  }
  .hero-index {
    margin-top: 1.5rem;
  }

  #catalog.section {
    padding-top: 2.5rem;
  }

  .token-card {
    min-height: 11.5rem;
    padding: 1.1rem 1.05rem;
  }
  .token-card h3 {
    font-size: 1.45rem;
  }

  .mobile-nav summary {
    min-width: 44px;
    min-height: 44px;
    align-content: center;
    justify-items: end;
  }

  /* Checkout first on product pages. */
  body.product-page .product-grid {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
  }
  body.product-page .checkout {
    order: -1;
    margin-top: 0;
    position: relative;
    z-index: 2;
  }
  body.product-page .product-copy h1 {
    font-size: clamp(2rem, 8vw, 2.65rem);
  }
  body.product-page .breadcrumb {
    padding: 1rem 0 1.25rem;
    font-size: 12px;
  }
  body.product-page .product-example .example-viewport {
    height: min(52vw, 220px);
  }

  .checkout {
    padding: 1.35rem 1.15rem;
    border-radius: 14px;
  }
  .checkout h2 {
    font-size: 1.65rem;
  }
  .package-grid {
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }
  .package {
    min-height: 54px;
    padding: 0.65rem 0.7rem;
  }
  .field {
    margin-top: 1.35rem;
  }
  .field input,
  .field select {
    font-size: 16px;
    min-height: 48px;
  }
  .checkout .checkout-submit {
    min-height: 52px;
    font-size: 1rem;
  }
  .price-row strong {
    font-size: 1.65rem;
  }

  /* Payment as bottom sheet. */
  .payment-overlay {
    align-items: flex-end;
    padding: 0;
    padding-top: max(12px, env(safe-area-inset-top, 0));
  }
  .payment-dialog {
    width: 100%;
    max-height: min(94dvh, 820px);
    margin: 0;
    border-radius: 18px 18px 0 0;
    padding: 1.35rem 1.15rem max(1.35rem, env(safe-area-inset-bottom, 0));
  }
  .payment-method {
    min-height: 72px;
  }
  .payment-method:hover {
    transform: none;
  }
  .payment-dialog .payment-confirm.checkout-submit {
    min-height: 52px;
    margin-top: 1rem;
  }

  body.payment-modal-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .site-footer {
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0));
  }

  .footer-grid {
    gap: 1.25rem;
    padding: 2rem 0;
    min-height: 0;
  }
  body:not(.product-page) .seo-topics {
    margin-bottom: 0;
  }
  body:not(.product-page) .site-footer {
    margin-top: 0;
  }
}

/* Sticky buy bar when checkout scrolls away. */
.mobile-buy-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left, 0)) max(12px, env(safe-area-inset-bottom, 0))
    max(16px, env(safe-area-inset-right, 0));
  border-top: 1px solid var(--line);
  background: #07120fed;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  transform: translateY(110%);
  transition: transform 0.28s var(--ease, ease);
}
.mobile-buy-bar.is-visible {
  transform: translateY(0);
}
.mobile-buy-bar__price {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.mobile-buy-bar__price span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.mobile-buy-bar__price strong {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.mobile-buy-bar__cta {
  flex: none;
  min-width: 44%;
  min-height: 48px;
  border: 1px solid #5ef0c8;
  border-radius: 12px;
  background: #89f5d2;
  color: #08201a;
  font-weight: 700;
  font-size: 0.95rem;
}

@media (max-width: 820px) {
  body.product-page {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
  }
  body.product-page .mobile-buy-bar {
    display: flex;
  }
  body.product-page.payment-modal-open .mobile-buy-bar {
    display: none;
  }
}

@media (min-width: 821px) {
  .mobile-buy-bar {
    display: none !important;
  }
}