/* Mobile context styles. Unlayered intentionally: loaded after rp-base to preserve verified cascade. */
/* Enterprise mobile shell: mobile header, bottom nav, drawer/mobile layout. */

@media (max-width: 767px) {
  :root {
    --desktop-header: 0px;
  }
  body {
    padding-top: var(--mobile-header);
    padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
  }
  .desktop-header {
    display: none;
  }
  .mobile-header {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    height: var(--mobile-header);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 120;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
    padding: 0 8px;
  }
  .mobile-header .brand {
    justify-content: center;
    font-size: 14px;
    letter-spacing: 0.18em;
  }
  .mobile-header .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }
  .brand-logo img {
    max-height: 36px;
  }
  .mobile-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
  }
  .bottom-nav a,
  .bottom-nav button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    min-width: 0;
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .bottom-nav span:first-child {
    font-size: 20px;
    line-height: 1;
  }

  main.site-main {
    padding: 14px 12px 32px;
  }
  .hero {
    min-height: auto;
    display: block;
  }
  .hero-panel {
    border-radius: 22px;
  }
  .hero-copy {
    padding: 30px 22px;
    min-height: calc(100vh - var(--mobile-header) - var(--bottom-nav) - 34px);
    justify-content: center;
  }
  .hero h1 {
    font-size: clamp(48px, 16vw, 72px);
    letter-spacing: -0.07em;
  }
  .hero-copy p {
    font-size: 14px;
    line-height: 1.62;
  }
  .hero-visual {
    display: none;
  }
  .cta-row {
    display: grid;
  }
  .btn {
    width: 100%;
    min-height: 50px;
  }
  .section-head {
    display: block;
    margin: 28px 0 16px;
  }
  .section-head h1,
  .section-head h2 {
    margin-bottom: 10px;
    font-size: 36px;
  }
  .section-head p {
    font-size: 14px;
  }
  .product-grid,
  .products {
    grid-template-columns: repeat(var(--mobile-shop-cols), minmax(0, 1fr));
    gap: 10px;
  }
  .product-card {
    border-radius: 16px;
  }
  .product-info {
    padding: 10px;
  }
  .product-name {
    font-size: 10px;
    min-height: 30px;
  }
  .product-meta {
    display: block;
    font-size: 11px;
  }
  .quick-add {
    min-height: 34px;
    font-size: 9px;
  }
  .like-btn {
    width: 32px;
    height: 32px;
    top: 8px;
    right: 8px;
  }

  .drawer {
    width: 100vw;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    top: auto;
    bottom: 0;
    height: min(82vh, 720px);
    transform: translateY(100%);
  }
  .drawer.open {
    transform: translateY(0);
  }
  .drawer-head {
    min-height: 62px;
  }

  .search-full {
    padding: calc(var(--mobile-header) + 18px) 12px 24px;
  }
  .search-box {
    margin: 0;
  }
  .search-box form {
    grid-template-columns: 1fr;
  }
  .search-box input {
    height: 54px;
    font-size: 16px;
  }
  .search-full .search-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rp-theme .desktop-only {
    display: none;
  }
  .mobile-only {
    display: block;
  }
  .toast {
    bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom) + 16px);
  }
}

/* Bottom nav and rating cleanup. */
@media (max-width: 767px) {
  body.rp-theme .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: hidden;
    height: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
    min-height: calc(var(--bottom-nav) + env(safe-area-inset-bottom));
  }
  body.rp-theme .bottom-nav a,
  body.rp-theme .bottom-nav button {
    width: 100%;
    height: var(--bottom-nav);
    min-width: 0;
    padding: 5px 1px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    line-height: 1.05;
    font-size: 10px;
    letter-spacing: 0.02em;
  }
  .bottom-nav a span:first-child,
  .bottom-nav button span:first-child {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-size: var(--mobile-nav-icon-size, 19px);
    line-height: 1;
    margin: 0;
  }
  .bottom-nav a span:last-child,
  .bottom-nav button span:last-child {
    min-height: 18px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    white-space: normal;
    overflow: hidden;
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  body.rp-theme .bottom-nav a span:first-child,
  body.rp-theme .bottom-nav button span:first-child {
    font-size: var(--mobile-nav-icon-size, 19px);
  }
}

@media (max-width: 767px) {
  body.rp-theme .site-main section:not(.shop-page-shell) > .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.rp-theme.rp-shop-context .site-main .shop-main ul.products,
  body.rp-theme.rp-shop-context .site-main .shop-main .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  body.rp-theme .app .bottom-nav,
  body.rp-theme .bottom-nav {
    display: grid;
  }
}

@media (max-width: 767px) {
  body.rp-theme
    :where(
      .mobile-header button,
      .bottom-nav a,
      .bottom-nav button,
      .quick-add,
      .like-btn,
      .site-footer a,
      .site-footer button,
      .footer-cookie-button,
      .cart-remove,
      .rp-mobile-mag-tabs a,
      .rp-mobile-mag-tabs button
    ) {
    min-width: var(--rp-touch-target);
    min-height: var(--rp-touch-target);
  }
  body.rp-theme .app .bottom-nav a,
  body.rp-theme .app .bottom-nav button,
  body.rp-theme .bottom-nav a,
  body.rp-theme .bottom-nav button {
    min-height: var(--rp-touch-target);
  }
  body.rp-theme .product-card .quick-add,
  body.rp-theme .site-main button.quick-add,
  body.rp-theme .site-main a.quick-add {
    min-height: var(--rp-touch-target);
  }
  body.rp-theme .product-card .like-btn {
    width: var(--rp-touch-target);
    height: var(--rp-touch-target);
    top: 4px;
    right: 4px;
  }
  body.rp-theme .site-footer-col {
    gap: 8px;
  }
}

/* Quality pass: five-item bottom navigation and conditional page spacing. */
@media (max-width: 767px) {
  body:not(.rp-bottom-nav-enabled) {
    padding-bottom: 0;
  }
  body.rp-theme .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  body.rp-theme .bottom-nav a,
  body.rp-theme .bottom-nav button {
    padding: 6px 3px 5px;
    gap: 3px;
    font-size: 10px;
    letter-spacing: 0.025em;
  }
  body.rp-theme .bottom-nav .bottom-nav-label {
    min-height: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
