/*
 * Tormami Mobile App Shell
 * Shared mobile UX for React + WordPress marketplace pages.
 */

.tormami-mobile-app-shell{display:none}

@media(max-width:767px){
  :root{
    --tmas-orange:#ff5a0a;
    --tmas-orange-2:#ff7424;
    --tmas-navy:#102d52;
    --tmas-text:#243a58;
    --tmas-muted:#7d8da2;
    --tmas-border:#dfe7ef;
    --tmas-soft:#f6f9fc;
    --tmas-safe-bottom:max(7px,env(safe-area-inset-bottom));
  }

  body.tormami-mobile-app-shell-active{
    padding-bottom:calc(78px + env(safe-area-inset-bottom))!important;
  }

  body.tormami-mobile-app-shell-active.tmas-sheet-open{
    overflow:hidden!important;
    touch-action:none;
  }

  .tormami-mobile-app-shell{
    display:block;
    font-family:Manrope,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  }

  /* Replace older homepage-only action bar with one shared navigation system. */
  body.tormami-mobile-app-shell-active .mobile-action-bar{
    display:none!important;
  }

  /* ---------- One consistent app-like header ---------- */
  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header){
    position:sticky!important;
    top:0!important;
    z-index:10040!important;
    border-bottom:1px solid #e8eef5!important;
    background:rgba(255,255,255,.975)!important;
    box-shadow:0 5px 18px rgba(16,35,65,.055)!important;
    backdrop-filter:blur(16px) saturate(145%)!important;
  }

  body.admin-bar.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header){
    top:46px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tormami-market-header{
    width:calc(100% - 14px)!important;
    min-height:0!important;
    margin:0 auto!important;
    padding:7px 0 8px!important;
    display:grid!important;
    grid-template-columns:86px minmax(88px,1fr) auto!important;
    grid-template-areas:
      "logo location actions"
      "search search search"!important;
    align-items:center!important;
    gap:6px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-logo{
    grid-area:logo!important;
    min-width:0!important;
    padding:0!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-logo img{
    display:block!important;
    width:auto!important;
    max-width:84px!important;
    max-height:34px!important;
    object-fit:contain!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-wrap{
    grid-area:location!important;
    width:100%!important;
    min-width:0!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-button{
    width:100%!important;
    height:38px!important;
    min-height:38px!important;
    margin:0!important;
    padding:0 8px!important;
    display:grid!important;
    grid-template-columns:17px minmax(0,1fr) 13px!important;
    align-items:center!important;
    gap:5px!important;
    border:1px solid #e1e8f0!important;
    border-radius:11px!important;
    background:#f8fafc!important;
    box-shadow:none!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-icon svg{
    width:16px!important;
    height:16px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-copy small{
    display:none!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-copy strong{
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:9.5px!important;
    line-height:1!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-chevron{
    display:grid!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-chevron svg{
    width:12px!important;
    height:12px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-actions{
    grid-area:actions!important;
    width:auto!important;
    min-width:0!important;
    margin:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:3px!important;
  }

  /* Saved lives in the persistent bottom nav on mobile. */
  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-wishlist-link{
    display:none!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-action-link{
    width:38px!important;
    min-width:38px!important;
    max-width:38px!important;
    height:38px!important;
    min-height:38px!important;
    margin:0!important;
    padding:0!important;
    display:grid!important;
    place-items:center!important;
    border-radius:10px!important;
    background:transparent!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-action-link>span:last-child{
    display:none!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-action-link svg{
    width:19px!important;
    height:19px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-sell{
    width:auto!important;
    height:38px!important;
    min-height:38px!important;
    margin:0!important;
    padding:0 10px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4px!important;
    border-radius:10px!important;
    font-size:0!important;
    box-shadow:0 6px 14px rgba(255,90,10,.18)!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-sell svg{
    width:14px!important;
    height:14px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-sell span{
    font-size:0!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-sell span::after{
    content:"Sell";
    font-size:9px!important;
    line-height:1!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-search{
    grid-area:search!important;
    width:100%!important;
    min-width:0!important;
    height:46px!important;
    min-height:46px!important;
    max-height:46px!important;
    margin:0!important;
    padding:4px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 38px!important;
    align-items:center!important;
    gap:4px!important;
    overflow:hidden!important;
    border:1px solid #dce5ee!important;
    border-radius:13px!important;
    background:#fff!important;
    box-shadow:0 2px 8px rgba(16,35,65,.025)!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-search-input{
    width:100%!important;
    min-width:0!important;
    height:38px!important;
    min-height:38px!important;
    max-height:38px!important;
    margin:0!important;
    padding:0 9px!important;
    border:0!important;
    background:transparent!important;
    box-shadow:none!important;
    font-size:16px!important;
    line-height:38px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-search-input::placeholder{
    color:#96a3b4!important;
    font-size:11px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-search-button{
    width:38px!important;
    min-width:38px!important;
    max-width:38px!important;
    height:38px!important;
    min-height:38px!important;
    max-height:38px!important;
    margin:0!important;
    padding:0!important;
    display:grid!important;
    place-items:center!important;
    border-radius:10px!important;
    box-shadow:0 6px 14px rgba(255,90,10,.2)!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-search-button svg{
    width:18px!important;
    height:18px!important;
  }

  /* Header location picker is a bottom sheet on phones. */
  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-panel{
    position:fixed!important;
    z-index:100080!important;
    left:8px!important;
    right:8px!important;
    top:auto!important;
    bottom:calc(76px + var(--tmas-safe-bottom))!important;
    width:auto!important;
    max-height:min(70dvh,620px)!important;
    padding:14px!important;
    overflow:auto!important;
    border-radius:22px!important;
    box-shadow:0 -16px 55px rgba(8,28,51,.22)!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-search{
    min-height:48px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-search input{
    font-size:16px!important;
  }

  /* ---------- Persistent bottom navigation ---------- */
  .tmas-nav{
    position:fixed;
    z-index:100070;
    left:50%;
    bottom:var(--tmas-safe-bottom);
    transform:translateX(-50%);
    width:min(calc(100% - 12px),430px);
    min-height:66px;
    padding:5px 6px;
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    align-items:end;
    gap:2px;
    border:1px solid rgba(217,227,237,.96);
    border-radius:20px;
    background:rgba(255,255,255,.965);
    box-shadow:0 16px 42px rgba(16,35,65,.18);
    backdrop-filter:blur(16px) saturate(145%);
  }

  .tmas-nav-item{
    position:relative;
    min-width:0;
    min-height:55px;
    margin:0;
    padding:5px 2px 3px;
    border:0;
    border-radius:13px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    background:transparent;
    color:#718096;
    text-decoration:none;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
    touch-action:manipulation;
  }

  .tmas-nav-item>span{
    position:relative;
    width:28px;
    height:27px;
    display:grid;
    place-items:center;
    border-radius:9px;
  }

  .tmas-nav-item svg{
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .tmas-nav-item b{
    width:100%;
    overflow:hidden;
    color:inherit;
    font-size:8.5px;
    line-height:1;
    font-weight:800;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .tmas-nav-item.is-active{
    color:var(--tmas-orange);
    background:#fff6f1;
  }

  .tmas-nav-post{
    transform:translateY(-10px);
    color:#fff;
  }

  .tmas-nav-post>span{
    width:48px;
    height:48px;
    border-radius:16px;
    background:linear-gradient(135deg,var(--tmas-orange),var(--tmas-orange-2));
    color:#fff;
    box-shadow:0 10px 22px rgba(255,90,10,.28);
  }

  .tmas-nav-post svg{
    width:22px;
    height:22px;
    stroke-width:2;
  }

  .tmas-nav-post b{
    margin-top:1px;
    color:#d94b06;
  }

  /* ---------- Browse quick-access sheet ---------- */
  .tmas-backdrop{
    position:fixed;
    z-index:100075;
    inset:0;
    background:rgba(5,19,34,.48);
    backdrop-filter:blur(2px);
  }

  .tmas-backdrop[hidden]{
    display:none!important;
  }

  .tmas-sheet{
    position:fixed;
    z-index:100080;
    left:50%;
    bottom:calc(76px + var(--tmas-safe-bottom));
    transform:translate(-50%,calc(100% + 120px));
    width:min(calc(100% - 12px),500px);
    max-height:min(74dvh,670px);
    padding:8px 14px max(16px,env(safe-area-inset-bottom));
    overflow-y:auto;
    overflow-x:hidden;
    border:1px solid #dfe7ef;
    border-radius:24px;
    background:#fff;
    box-shadow:0 -18px 65px rgba(8,28,51,.24);
    opacity:0;
    overscroll-behavior:contain;
    transition:transform .22s ease,opacity .18s ease;
  }

  .tmas-sheet:not([hidden]){
    display:block;
  }

  body.tmas-sheet-open .tmas-sheet{
    transform:translate(-50%,0);
    opacity:1;
  }

  .tmas-sheet-handle{
    width:42px;
    height:4px;
    margin:1px auto 9px;
    border-radius:999px;
    background:#d4dde7;
  }

  .tmas-sheet-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:0 1px 12px;
  }

  .tmas-sheet-head>div{
    min-width:0;
  }

  .tmas-sheet-head strong{
    display:block;
    color:var(--tmas-navy);
    font-size:17px;
    line-height:1.2;
    font-weight:900;
    letter-spacing:-.02em;
  }

  .tmas-sheet-head span{
    display:block;
    margin-top:3px;
    color:var(--tmas-muted);
    font-size:10px;
  }

  .tmas-sheet-close{
    width:40px;
    min-width:40px;
    height:40px;
    margin:0;
    padding:0;
    display:grid;
    place-items:center;
    border:0;
    border-radius:11px;
    background:#f3f6f9;
    color:#5f728a;
    cursor:pointer;
  }

  .tmas-sheet-close svg{
    width:18px;
    height:18px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.9;
    stroke-linecap:round;
  }

  .tmas-sheet-search{
    height:50px;
    margin-bottom:17px;
    padding:4px 4px 4px 13px;
    display:grid;
    grid-template-columns:20px minmax(0,1fr) 40px;
    align-items:center;
    gap:7px;
    border:1px solid #dde6ef;
    border-radius:14px;
    background:#f8fafc;
  }

  .tmas-sheet-search>svg{
    width:18px;
    height:18px;
    fill:none;
    stroke:#6e8199;
    stroke-width:1.8;
    stroke-linecap:round;
  }

  .tmas-sheet-search input{
    width:100%;
    min-width:0;
    height:40px;
    margin:0;
    padding:0;
    border:0;
    outline:0;
    background:transparent;
    color:#243a58;
    box-shadow:none;
    font-size:16px;
  }

  .tmas-sheet-search input::placeholder{
    color:#98a5b5;
    font-size:12px;
  }

  .tmas-sheet-search button{
    width:40px;
    min-width:40px;
    height:40px;
    margin:0;
    padding:0;
    display:grid;
    place-items:center;
    border:0;
    border-radius:11px;
    background:linear-gradient(135deg,var(--tmas-orange),var(--tmas-orange-2));
    color:#fff;
    cursor:pointer;
  }

  .tmas-sheet-search button svg{
    width:16px;
    height:16px;
    fill:none;
    stroke:currentColor;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .tmas-sheet-section{
    margin-top:16px;
  }

  .tmas-sheet-section-head{
    min-height:26px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:9px;
  }

  .tmas-sheet-section-head strong{
    color:#17365e;
    font-size:12px;
    font-weight:900;
  }

  .tmas-sheet-section-head a{
    color:var(--tmas-orange);
    font-size:9px;
    font-weight:850;
    text-decoration:none;
  }

  .tmas-category-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:8px;
  }

  .tmas-category{
    min-width:0;
    min-height:78px;
    padding:8px 5px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:6px;
    border:1px solid #e7edf4;
    border-radius:13px;
    background:#fbfdff;
    color:#263e5d;
    text-align:center;
    text-decoration:none;
  }

  .tmas-category>span{
    width:36px;
    height:36px;
    display:grid;
    place-items:center;
    border-radius:10px;
    background:#fff0e8;
    color:var(--tmas-orange);
  }

  .tmas-category:nth-child(2n)>span{background:#edf5ff;color:#2f7ef6}
  .tmas-category:nth-child(3n)>span{background:#f3edff;color:#8b5cf6}
  .tmas-category:nth-child(4n)>span{background:#ecf8f0;color:#18a55b}

  .tmas-category svg{
    width:18px;
    height:18px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .tmas-category b{
    max-width:100%;
    overflow:hidden;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    color:inherit;
    font-size:8.5px;
    line-height:1.15;
    font-weight:800;
  }

  .tmas-shortcut-grid{
    display:grid;
    gap:7px;
  }

  .tmas-shortcut-grid>a{
    min-height:54px;
    padding:7px 9px;
    display:grid;
    grid-template-columns:38px minmax(0,1fr) 18px;
    align-items:center;
    gap:9px;
    border:1px solid #e8eef4;
    border-radius:12px;
    background:#fff;
    color:#2a405e;
    text-decoration:none;
  }

  .tmas-shortcut-grid>a>span{
    width:38px;
    height:38px;
    display:grid;
    place-items:center;
    border-radius:10px;
    background:#f3f7fb;
    color:#4f6f91;
  }

  .tmas-shortcut-grid>a>span svg,
  .tmas-shortcut-grid>a>svg{
    width:17px;
    height:17px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .tmas-shortcut-grid>a>svg{
    color:#9aa8b8;
  }

  .tmas-shortcut-grid>a>div{
    min-width:0;
  }

  .tmas-shortcut-grid b{
    display:block;
    color:#223b5b;
    font-size:10px;
    line-height:1.2;
    font-weight:850;
  }

  .tmas-shortcut-grid small{
    display:block;
    margin-top:2px;
    color:#8796a8;
    font-size:8.5px;
    line-height:1.2;
  }

  /* Existing mobile filter/listing sheets stay above the app nav. */
  body.tormami-mobile-app-shell-active .tsr-filter-panel,
  body.tormami-mobile-app-shell-active .tcv-sidebar{
    bottom:calc(76px + var(--tmas-safe-bottom))!important;
    max-height:min(74dvh,680px)!important;
  }

  /* Homepage quick access is now provided globally by Browse. */
  body.tormami-mobile-app-shell-active .site .mobile-quick-market{
    display:none!important;
  }

  body.tormami-mobile-app-shell-active .site .hero-copy{
    padding-bottom:14px!important;
  }

  body.tormami-mobile-app-shell-active .site .hero-art{
    margin-top:0!important;
  }

  /* Avoid tiny controls for touch users. */
  .tmas-nav-item,
  .tmas-sheet-close,
  .tmas-sheet-search button,
  .tmas-category,
  .tmas-shortcut-grid>a{
    -webkit-tap-highlight-color:transparent;
    touch-action:manipulation;
  }

}

@media(max-width:360px){
  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tormami-market-header{
    width:calc(100% - 10px)!important;
    grid-template-columns:76px minmax(78px,1fr) auto!important;
    gap:5px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-logo img{
    max-width:74px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-button{
    padding-inline:6px!important;
    grid-template-columns:15px minmax(0,1fr)!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-location-chevron{
    display:none!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-action-link{
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
  }

  body.tormami-mobile-app-shell-active :is(.site-header,.tormami-global-market-header) .tmh-sell{
    padding-inline:7px!important;
  }

  .tmas-category-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .tmas-nav{
    width:calc(100% - 8px);
    padding-inline:4px;
  }

  .tmas-nav-item b{
    font-size:8px;
  }
}

@media(min-width:768px){
  .tormami-mobile-app-shell{
    display:none!important;
  }
}

@media(prefers-reduced-motion:reduce){
  .tmas-sheet{
    transition:none!important;
  }
}
