/*
 * windpay.org — mobile responsiveness layer (2026-11-23).
 * Loaded LAST. Every rule is inside @media (max-width: 767.98px), so the
 * desktop design (>= 768px) is unchanged. Overrides of Tailwind utilities sit
 * in @layer utilities so hover/focus variants keep working; wp-* navbar rules
 * are plain CSS (they are unlayered in windpay-nav.css, and this file is later).
 */
@media (max-width: 767.98px) {

  /* 1. Nothing wider than the screen */
  html, body { max-width: 100%; overflow-x: clip; }  /* clip, not hidden: keeps the sticky navbar working */
  img, video, canvas, iframe { max-width: 100%; height: auto; }
  svg { max-width: 100%; }

  /* 2. Long words, URLs and 0x addresses wrap instead of overflowing */
  body { overflow-wrap: break-word; }
  .font-mono, td, th, code, a[href^="http"], a[href^="mailto:"] { overflow-wrap: anywhere; word-break: normal; }

  @layer utilities {
    /* 3. Card grids: one column, consistent gaps */
    .sm\:grid-cols-2.gap-4, .sm\:grid-cols-2.gap-2 { grid-template-columns: minmax(0, 1fr); }

    /* 4. Consistent 16px side padding for page containers and cards */
    .px-4.sm\:px-6 { padding-left: 16px; padding-right: 16px; }
    .p-5, .p-6, .p-8, .sm\:p-6, .sm\:p-7, .sm\:p-8, .sm\:p-12, .md\:p-16 { padding: 16px; }

    /* 5. Readable, fluid type */
    h1.font-extrabold { font-size: clamp(2rem, 9vw, 3rem); line-height: 1.08; }
    h2.font-extrabold { font-size: clamp(1.6rem, 7vw, 2.4rem); line-height: 1.12; }
    h3 { overflow-wrap: break-word; }
    .text-\[8px\], .text-\[9px\], .text-\[10px\], .text-\[11px\] { font-size: 12px; line-height: 1.4; }
    .text-xs { font-size: 13px; line-height: 1.55; }

    /* 6. Tap targets: at least 44px */
    main button, main a[class*="px-"], main a[class*="py-"] { min-height: 44px; }
    [id^="portal-cat-btn-"], [id^="faq-cat-btn-"] { min-height: 44px; padding-left: 16px; padding-right: 16px; }
    button.whitespace-nowrap.rounded-lg, button.rounded-lg.px-2\.5 { min-height: 44px; }
    [title="Click to copy official URL"], button.rounded-md.font-mono.px-2\.5 { min-height: 44px; }
    #network ~ div a.font-mono { display: inline-block; padding-top: 12px; padding-bottom: 12px; }
    footer a, footer button, footer .grid a, footer .grid button, footer a.transition-colors { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
    footer .grid a, footer .grid button { justify-content: flex-start; }

    /* Tables keep their own horizontal scroll inside the card */
    .overflow-x-auto { -webkit-overflow-scrolling: touch; max-width: 100%; }
  }

  /* 7. Navbar (wp-*): hamburger is already used below 1100px; tidy sizes */
  .wp-container { padding-left: 16px; padding-right: 16px; }
  .wp-brand-badge { font-size: 12px; padding: 4px 7px; }
  .wp-burger { width: 44px; height: 44px; }
  .wp-mobile-links button { min-height: 48px; }
  .wp-eco-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .wp-eco-card { min-height: 56px; }

  /* Mobile menu: Ecosystem cards line up with the link buttons above them */
  .wp-mobile-menu .wp-eco-card {
    padding: 10px 14px; border-radius: 14px;
    background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .07);
  }
  .wp-mobile-menu .wp-eco-icon { width: 36px; height: 36px; border-radius: 10px; }
  .wp-mobile-label { margin: 4px 0 10px; }

  /* Fits the real visible screen (100vh includes the phone's browser bars) */
  .wp-mobile-menu {
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    overscroll-behavior: contain;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .wp-mobile-menu .wp-btn-block { min-height: 50px; margin-top: 4px; }
}

/* Very small phones (360px class) */
@media (max-width: 380px) {
  .wp-brand-word { font-size: 18px; }
  .wp-brand-icon { width: 30px; height: 30px; }
  .wp-mobile-links { grid-template-columns: minmax(0, 1fr); }
}

/* Tablets (768-1023px): same readable text and 44px tap targets; layout stays as designed. */
@media (min-width: 768px) and (max-width: 1023.98px) {
  @layer utilities {
    .text-\[8px\], .text-\[9px\], .text-\[10px\], .text-\[11px\] { font-size: 12px; line-height: 1.4; }
    main button, main a[class*="px-"], main a[class*="py-"] { min-height: 44px; }
    [id^="portal-cat-btn-"], [id^="faq-cat-btn-"], button.whitespace-nowrap.rounded-lg, button.rounded-lg.px-2\.5,
    [title="Click to copy official URL"], button.rounded-md.font-mono.px-2\.5 { min-height: 44px; }
    #network ~ div a.font-mono { display: inline-block; padding-top: 12px; padding-bottom: 12px; }
    footer a, footer button, footer .grid a, footer .grid button, footer a.transition-colors { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
  }
  .wp-brand-badge { font-size: 12px; }
}

/* Touch screens: no "stuck" hover highlight after a tap; brief press feedback instead */
@media (hover: none) {
  .wp-eco-card:hover { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .07); }
  .wp-eco-card:active { background: rgba(0, 230, 118, .12); border-color: rgba(0, 255, 135, .3); }
}
