/**
 * Load last: safe areas (needs viewport-fit=cover), page wraps, checkout/review/thank-you/404, touch targets.
 */

@media (max-width: 768px) {
  .nav-logo-image {
    width: auto;
    height: 64px;
    max-height: 64px;
    max-width: min(86vw, 390px);
    transform: scale(2);
    transform-origin: left center;
  }

  .checkout-wrap,
  .review-wrap,
  .thank-wrap,
  .notfound-wrap {
    min-height: 100dvh;
    min-height: 100svh;
    padding-top: max(5rem, calc(3.5rem + env(safe-area-inset-top, 0px)));
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  }

  .checkout-card,
  .review-card,
  .thank-card,
  .notfound-card {
    padding: clamp(1rem, 4.2vw, 1.35rem);
    border-radius: clamp(14px, 3.5vw, 18px);
  }

  .checkout-head h1 {
    font-size: clamp(1.05rem, 5.5vw, 1.65rem);
    line-height: 1.2;
    word-break: break-word;
  }

  .checkout-sub {
    font-size: clamp(0.875rem, 3.8vw, 0.98rem);
  }

  .checkout-item {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: clamp(0.85rem, 3vw, 1rem);
    align-items: stretch;
  }

  .checkout-item h2 {
    font-size: clamp(0.92rem, 4vw, 1.02rem);
  }

  .checkout-price {
    font-size: clamp(0.95rem, 4.2vw, 1.05rem);
    justify-self: start;
  }

  .checkout-form h3,
  .pay-panel h3 {
    font-size: clamp(0.78rem, 3.2vw, 0.9rem);
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 44px;
    font-size: 16px;
    padding: 0.65rem 0.75rem;
  }

  .field textarea {
    min-height: 100px;
  }

  .field input[type="date"] {
    min-height: 48px;
  }

  .pay-btn,
  .pay-option,
  .checkout-actions .btn,
  .pay-next-btn,
  .stripe-pay-btn {
    min-height: 48px;
    box-sizing: border-box;
  }

  .pay-btn {
    padding: 0.85rem 1rem;
  }

  .pay-option {
    padding: 0.95rem 1rem;
  }

  .pay-btn:hover {
    transform: none;
  }

  .checkout-actions {
    flex-direction: column;
  }

  .checkout-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .stripe-accepts {
    font-size: clamp(0.82rem, 3.5vw, 0.9rem);
  }

  .review-card h1,
  .thank-card h1 {
    font-size: clamp(1.05rem, 5.5vw, 1.5rem);
    line-height: 1.2;
  }

  .review-lead,
  .thank-lead,
  .review-note,
  .thank-note {
    font-size: clamp(0.82rem, 3.6vw, 0.95rem);
  }

  .review-summary,
  .thank-summary {
    font-size: clamp(0.86rem, 3.5vw, 0.92rem);
  }

  .review-record-btn,
  .review-actions .btn,
  .thank-actions .btn {
    min-height: 48px;
    align-items: center;
  }

  .review-record-actions {
    flex-direction: column;
  }

  .review-record-btn {
    min-width: 0;
    width: 100%;
  }

  .notfound-card h1 {
    font-size: clamp(1.15rem, 6vw, 1.75rem);
  }

  .notfound-actions .btn {
    min-height: 48px;
  }

  .legal-wrap {
    min-height: 100dvh;
    min-height: 100svh;
    align-items: flex-start;
    padding-top: max(5rem, calc(3.5rem + env(safe-area-inset-top, 0px)));
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  }

  .legal-card {
    width: 100%;
    border-radius: clamp(14px, 3.5vw, 18px);
    padding: clamp(1rem, 4.2vw, 1.35rem);
  }

  .legal-title {
    font-size: clamp(1.05rem, 5.5vw, 1.5rem);
    line-height: 1.2;
    word-break: break-word;
  }

  .legal-meta,
  .legal-intro,
  .legal-section p,
  .legal-help,
  .legal-mini-footer p,
  .legal-mini-footer-links a {
    font-size: clamp(0.82rem, 3.6vw, 0.95rem);
  }

  .legal-mini-footer-links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .brand-reminder {
    margin-bottom: 0.65rem;
    padding: 0.3rem 0.5rem;
    gap: 0.45rem;
    font-size: clamp(0.56rem, 2.8vw, 0.64rem);
    letter-spacing: 0.06em;
  }

  .brand-reminder .brand-mini-mark {
    width: 26px;
  }

  .footer-brand-icon {
    width: clamp(88px, 28vw, 122px);
  }

  .legal-mini-footer-brand .brand-mini-mark {
    width: clamp(44px, 14vw, 58px);
  }
}

@media (max-width: 480px) {
  .checkout-wrap,
  .review-wrap,
  .thank-wrap,
  .notfound-wrap {
    padding-top: max(4.75rem, calc(3.25rem + env(safe-area-inset-top, 0px)));
  }

  .checkout-head h1 {
    letter-spacing: 0.05em;
  }

  .pay-method-options {
    gap: 0.55rem;
  }

  .legal-wrap {
    padding-top: max(4.75rem, calc(3.25rem + env(safe-area-inset-top, 0px)));
  }

  .brand-reminder {
    font-size: 0.55rem;
    padding: 0.26rem 0.45rem;
  }

  .brand-reminder .brand-mini-mark {
    width: 24px;
  }

  .nav-logo-image {
    width: auto;
    height: 60px;
    max-height: 60px;
    max-width: min(84vw, 360px);
    transform: scale(2);
    transform-origin: left center;
  }
}
