/* =========================================================================
   app-mobile.css - phone shell for GBP Ceramics
   Same materials-catalogue system as site.css, shell chrome adapted for
   thumbs: fixed app bar, bottom tab bar, swipe rows, bottom sheets.
   Loaded after site.css. Scoped to <= 860px unless noted.
   ========================================================================= */

:root {
  --tab-h: 60px;
  --app-header-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ---------------------------------------------------------------- tab bar */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: none; grid-template-columns: repeat(5, 1fr);
  align-items: end; gap: 0;
  padding: 5px 6px calc(5px + var(--safe-b));
  background: rgba(247, 243, 236, .92);
  border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  transition: transform .3s var(--ease);
}
.tabbar.is-hidden { transform: translateY(120%); }

.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 3px; min-height: 44px; padding: 6px 0 3px;
  border: 0; background: none; text-decoration: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: .75rem; font-weight: 600; letter-spacing: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .16s ease;
}
.tab svg { width: 21px; height: 21px; }
.tab-icon { display: grid; place-items: center; height: 22px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::after {
  content: ""; position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 3px; border-radius: 3px; background: var(--accent);
}

.tab--action { justify-content: center; padding: 0; }
.tab--action .tab-bubble {
  width: 50px; height: 50px; margin-top: -20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--wa); color: #fff;
  box-shadow: 0 0 0 5px var(--paper), 0 8px 18px rgba(18, 140, 74, .4);
}
.tab--action .tab-bubble svg { width: 23px; height: 23px; }
.tab--action span.tab-label { opacity: 0; height: 0; overflow: hidden; }

.snap-gallery { display: none; }

/* ------------------------------------------------------------- app shell */

@media (max-width: 860px) {
  :root { --header-h: 56px; }

  body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
  body.has-tabbar { padding-bottom: calc(var(--tab-h) + var(--safe-b)); }

  .tabbar { display: grid; }

  .site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 80;
    height: var(--app-header-h);
    padding-top: var(--safe-t);
    transition: transform .3s var(--ease);
  }
  .site-header.is-hidden { transform: translateY(calc(-100% - 2px)); }

  .header-inner { min-height: var(--app-header-h); padding-inline: 14px; gap: 10px; }
  .brand { gap: 9px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: .84rem; letter-spacing: .05em; }
  .brand-sub { display: none; }

  .nav-toggle, .site-nav, .header-actions .btn--wa { display: none !important; }
  .header-actions { margin-left: auto; }
  .icon-link, .icon-btn { width: 40px; height: 40px; }
  .wa-fab { display: none; }

  /* ------------------------------------------------------------ layout */

  .wrap { padding-inline: 16px; }

  main > .section:first-child,
  main.section {
    padding-top: calc(var(--app-header-h) + 20px) !important;
  }

  .section { padding-block: 52px; }
  .section--tight { padding-block: 30px; }

  h1 { font-size: clamp(2.3rem, 10vw, 3rem); line-height: 1; }
  h2 { font-size: clamp(1.75rem, 7.4vw, 2.2rem); }
  .lede { font-size: .95rem; }
  .eyebrow { font-size: .8rem; margin-bottom: 14px; }
  .section-head { margin-bottom: 18px; }

  /* -------------------------------------------------------------- hero */

  .hero {
    padding-top: calc(var(--app-header-h) + 16px);
    padding-bottom: 22px;
  }
  .hero-inner { gap: 20px; }
  .hero h1 { font-size: clamp(2.5rem, 11.5vw, 3.3rem); max-width: 100%; }
  .hero .lede { font-size: .93rem; margin-top: 14px; max-width: 100%; }
  .hero-actions { flex-direction: column; gap: 8px; margin-top: 20px; }
  .hero-actions .btn { width: 100%; min-height: 48px; }
  .hero-proof { margin-top: 26px; font-size: .84rem; flex-wrap: wrap; }
  .hero-proof { gap: 6px 12px; }
  .hero-proof-sep { display: none; }
  .hero-proof > span:last-child { flex-basis: 100%; }
  .hero-slabs { height: 330px; padding-bottom: 34px; }
  .hero-badge { font-size: .78rem; padding: 9px 14px 9px 9px; }
  .hero-badge-icon { width: 32px; height: 32px; }
  .hero-fact b { font-size: 1.4rem; }

  /* ------------------------------------------------------------ buttons */

  .btn { min-height: 44px; }
  .btn:active { transform: scale(.985); }
  .chip:active, .tab:active, .product-card:active { transform: scale(.99); }

  /* --------------------------------------------------------- snap rows */

  .range-grid {
    display: grid; grid-auto-flow: column; grid-auto-columns: 80%; grid-template-columns: none;
    gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory;
    scrollbar-width: none; border-left: 0;
    margin-inline: -16px; padding-inline: 16px;
    -webkit-overflow-scrolling: touch;
  }
  .range-grid::-webkit-scrollbar { display: none; }
  .range-grid > * { scroll-snap-align: start; }
  .range-body { padding: 18px 18px 20px; }
  .range-body h3 { font-size: 1.3rem; }
  .pillars { gap: 12px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-body { padding: 12px 12px 14px; }
  .product-name { font-size: 1.02rem; }
  .product-actions { flex-direction: column; }
  .product-actions .btn { width: 100%; }
  .photo-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .photo-mosaic figcaption { font-size: .8rem; padding: 10px 12px 12px; }

  /* ------------------------------------------------------ product index */

  .toolbar {
    position: sticky; top: var(--app-header-h); z-index: 30;
    grid-template-columns: 1fr; gap: 8px;
    margin-inline: -16px; padding: 10px 16px 12px; border-radius: 0; box-shadow: none; border-width: 0 0 1px;
    background: rgba(247, 243, 236, .94);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-inline: -16px; padding-inline: 16px;
    -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; min-height: 38px; font-size: .84rem; border-color: var(--line); }
  .search-box { width: 100%; }
  .search-box input { font-size: 16px; }

  input, textarea, select { font-size: 16px !important; }
  .field input, .field textarea { min-height: 46px; }

  /* ------------------------------------------------------ bottom sheets */

  .modal { display: none; align-items: flex-end; padding: 0; overflow: hidden; }
  .modal.is-open { display: flex; }
  .modal-card {
    position: relative; width: 100%; max-height: 92dvh; margin: 0;
    border-radius: 22px 22px 0 0; overflow-y: auto; overscroll-behavior: contain;
    animation: sheet-in .28s var(--ease);
    padding-bottom: calc(10px + var(--safe-b));
    box-shadow: 0 -18px 44px rgba(16, 18, 22, .34);
    border-top: 1px solid var(--line-strong);
  }
  .modal-card::before {
    content: ""; position: sticky; top: 6px; display: block;
    width: 42px; height: 4px; border-radius: 4px; margin: 8px auto 0; background: var(--line-strong); z-index: 4;
  }
  @keyframes sheet-in { from { transform: translateY(12%); opacity: .7; } to { transform: translateY(0); opacity: 1; } }

  .modal-close {
    position: absolute; top: 10px; right: 10px; z-index: 3;
    width: 44px; height: 44px; background: var(--paper);
  }
  .inspect-grid { grid-template-columns: 1fr; }
  .inspect-stage { min-height: 250px; }
  .inspect-body { padding: 18px 16px 6px; }
  .inspect-body .btn { width: 100%; }

  .lightbox { padding: 0; }
  .lightbox img { max-width: 100vw; max-height: 78dvh; border-radius: 0; }
  .lightbox-close { top: calc(10px + var(--safe-t)); right: 10px; }
  .lightbox-cap { padding: 0 16px calc(84px + var(--safe-b)); }

  /* --------------------------------------------------------- forms */

  .panel { padding: 16px; }
  .form-grid { gap: 12px; }
  .form-grid--2 { grid-template-columns: 1fr; }
  .map-frame iframe { height: 230px; }
  .wa-band { padding: 20px 18px; }

  /* ------------------------------------------------------- account */

  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { min-height: 0; }
  .auth-art canvas { display: none; }
  .auth-art-copy { position: static; padding: 20px 16px 18px; }
  .auth-art-copy :is(h1, h2) { font-size: 1.2rem; }
  .auth-art-copy p { font-size: .87rem; }
  .auth-panel { padding: 18px 16px 22px; }
  .tabs button { min-height: 40px; }

  .acct-grid { grid-template-columns: 1fr; gap: 14px; }
  .acct-nav {
    display: flex; gap: 0; overflow-x: auto; scrollbar-width: none;
    margin-inline: -16px; padding-inline: 16px; border-top: 0;
    border-bottom: 1px solid var(--line);
  }
  .acct-nav::-webkit-scrollbar { display: none; }
  .acct-nav button {
    flex: none; min-height: 40px; padding: 0 14px;
    border: 0; border-right: 1px solid var(--line);
    font-size: .86rem;
  }
  .acct-nav button:hover { padding-left: 14px; }
  .acct-nav button[aria-current="true"] {
    padding-left: 14px;
  }

  /* ------------------------------------------------------ gallery */

  body[data-page="gallery"] .gallery-hint { display: none; }

  .snap-gallery {
    display: grid; grid-auto-flow: column; grid-auto-columns: 84%; gap: 10px;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-inline: -16px; padding-inline: 16px;
    -webkit-overflow-scrolling: touch;
  }
  .snap-gallery::-webkit-scrollbar { display: none; }
  .snap-gallery figure { margin: 0; scroll-snap-align: center; border-radius: var(--radius); overflow: hidden; background: var(--dark); }
  .snap-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
  .snap-gallery figcaption {
    padding: 10px 12px; font-family: var(--font-body);
    font-size: .82rem;
    color: rgba(242, 241, 236, .74); border-top: 1px solid rgba(255, 255, 255, .12);
  }

  /* ------------------------------------------------------- admin */

  .admin-table { display: block; overflow-x: auto; }
  .admin-side { display: none; }

  /* ------------------------------------------------------- footer */

  .site-footer { padding-bottom: calc(26px + var(--safe-b)); }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-bottom { font-size: .78rem; gap: 6px; }

  .toast {
    left: 16px; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
    transform: translateY(14px); text-align: center;
  }
  .toast.is-shown { transform: translateY(0); }
}

/* small phones */
@media (max-width: 360px) {
  .tab { font-size: .75rem; }
  .tab svg { width: 19px; height: 19px; }
  .hero h1 { font-size: 1.8rem; }
}

/* screen-to-screen transition, app style */
@view-transition { navigation: auto; }

@media (max-width: 860px) {
  ::view-transition-old(root) { animation: vt-out .14s ease both; }
  ::view-transition-new(root) { animation: vt-in .2s ease both; }
  @keyframes vt-out { to { opacity: 0; transform: translateY(-5px); } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(7px); } }

  a, button, .tab, .chip, .btn { touch-action: manipulation; }
}

@media (display-mode: standalone) and (max-width: 860px) {
  .site-header { padding-top: calc(var(--safe-t) + 2px); }
}

@media (prefers-reduced-motion: reduce) {
  .tabbar, .site-header, .modal-card { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------- midnight shell */
:root[data-theme="dark"] .tabbar { background: rgba(10, 21, 34, .94); }
:root[data-theme="dark"] .toolbar { background: rgba(10, 21, 34, .95); }
@media (max-width: 860px) {
  .acct-nav { border-radius: 0; background: transparent; border-width: 0 0 1px; padding: 0 16px; }
  .acct-nav button { border-radius: var(--pill); border: 0; margin-block: 8px; }
}

/* ------------------------------------------------ phone fit & touch sizes */
@media (max-width: 860px) {
  /* one column that can never be wider than the screen */
  .split, .showroom, .hero-inner, .footer-grid, .acct-grid, .form-grid--2 { grid-template-columns: minmax(0, 1fr); }
  .panel, .info-card, .wa-band, form { min-width: 0; }

  /* labels and small print stay readable */
  .info-card h3, .footer-grid h3, .wa-step b, .product-cat, .spec-table th, .hint, .field .hint { font-size: .78rem; }
  .footer-bottom { font-size: .8rem; }

  /* every link and button is at least a 44px target */
  .brand { min-height: 44px; }
  .text-link { padding-block: 12px; }
  .site-footer li a { display: inline-block; padding-block: 8px; }
  .hours-table td { padding-block: 12px; }
}
@media (max-width: 480px) {
  /* long button labels wrap instead of pushing the page sideways */
  .btn { white-space: normal; text-align: center; line-height: 1.3; padding: 10px 18px; min-height: 48px; }
  .wa-step { white-space: normal; }
}
