/* App-like mobile shell — drawer nav, filter sheet, touch-friendly chrome */

/* —— Base touch targets —— */
.tjs-icon-btn,
.tjs-nav-toggle,
.tjs-announce__close,
.tjs-search-close,
.tjs-nav__drawer-close,
.tjs-filters-sheet__close {
  min-width: 44px;
  min-height: 44px;
}

.tjs-nav__drawer-head,
.tjs-filters-sheet__head,
.tjs-shop-filters-btn {
  display: none;
}

.tjs-nav-backdrop,
.tjs-filters-backdrop {
  display: none;
}

/* Desktop: content-first DOM, sidebar still on the left */
.tjs-shop-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}
.tjs-shop-sidebar {
  grid-column: 1;
  grid-row: 1;
}
.tjs-shop-content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}
.tjs-filters-backdrop { grid-column: 1 / -1; }

/* Announce close */
.tjs-announce__close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--tjs-muted);
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
}
.tjs-announce__close:hover {
  color: var(--tjs-ink);
  background: rgba(0, 0, 0, .05);
}

/* Social */
.tjs-social a {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  font-size: 0;
}

/* —— Mobile shell ≤900 —— */
@media (max-width: 900px) {
  /* Slim campaign + topbar */
  .tjs-announce {
    font-size: .78rem;
  }
  .tjs-announce__inner {
    min-height: 44px;
    padding-inline: 2.75rem 0;
  }
  .tjs-topbar__hours,
  .tjs-topbar__address {
    display: none;
  }
  .tjs-topbar__inner {
    padding: .4rem 0;
    gap: .5rem;
  }
  .tjs-topbar__meta {
    gap: .5rem;
  }

  /* Header: hamburger | logo | actions */
  .tjs-header__inner {
    grid-template-columns: 44px minmax(0, 1fr) auto !important;
    gap: .5rem .65rem !important;
    min-height: 58px;
  }
  .tjs-brand {
    justify-self: center;
  }
  .tjs-brand__logo,
  .custom-logo-link img,
  .custom-logo {
    max-height: 40px;
    height: 40px;
  }
  .tjs-header__actions {
    gap: 0;
    height: 44px;
  }
  .tjs-header__profile {
    display: none;
  }

  /* Drawer nav */
  .tjs-nav-toggle {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    z-index: 1;
  }
  .tjs-nav-toggle span {
    width: 20px;
    height: 2px;
    background: var(--tjs-ink);
    transition: transform .25s ease, opacity .2s ease;
  }
  body.tjs-nav-open .tjs-nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  body.tjs-nav-open .tjs-nav-toggle span:nth-child(2) {
    opacity: 0;
  }
  body.tjs-nav-open .tjs-nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .tjs-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 280;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }
  body.tjs-nav-open .tjs-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .tjs-nav-backdrop[hidden] {
    display: none;
  }
  body.tjs-nav-open .tjs-nav-backdrop[hidden] {
    display: block;
  }

  .tjs-nav {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    width: min(86vw, 340px) !important;
    max-width: 340px;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    border: 0 !important;
    border-right: 1px solid var(--tjs-line) !important;
    box-shadow: 8px 0 32px rgba(0, 0, 0, .12);
    z-index: 290 !important;
    display: flex !important;
    flex-direction: column;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%);
    transition: transform .28s cubic-bezier(.22, 1, .36, 1);
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .tjs-nav.is-open {
    transform: translateX(0);
  }
  .tjs-nav__drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--tjs-line);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
  }
  .tjs-nav__drawer-head strong {
    font-family: var(--tjs-display, Georgia, serif);
    font-size: 1.25rem;
    font-weight: 600;
  }
  .tjs-nav__drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tjs-line);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    color: var(--tjs-ink);
  }
  .tjs-nav .tjs-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .5rem 0 2rem;
    margin: 0;
    list-style: none;
  }
  .tjs-nav .tjs-nav__list > li {
    border-bottom: 1px solid var(--tjs-line);
  }
  .tjs-nav .tjs-nav__list > li > a,
  .tjs-nav .tjs-nav__mega-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: .85rem 1.15rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--tjs-ink);
    text-decoration: none;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
  }
  .tjs-nav .tjs-has-mega {
    position: static;
  }
  .tjs-mega {
    position: static !important;
    background: #f7f7f7 !important;
    color: var(--tjs-ink) !important;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    box-shadow: none !important;
    transform: none !important;
    padding: 0 !important;
  }
  .tjs-has-mega.is-mega-open > .tjs-mega {
    visibility: visible;
    opacity: 1;
    max-height: 2000px;
    pointer-events: auto;
    padding: 0 0 .75rem !important;
  }
  .tjs-mega__bridge { display: none; }
  .tjs-mega__panel {
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .tjs-mega__inner {
    grid-template-columns: 1fr !important;
    padding: .35rem 1rem 1rem !important;
    gap: 1.15rem !important;
  }
  .tjs-mega h4,
  .tjs-mega__cta-title {
    color: var(--tjs-ink) !important;
  }
  .tjs-mega a,
  .tjs-mega__view-all,
  .tjs-mega__cat-name,
  .tjs-mega__product-meta strong {
    color: var(--tjs-ink) !important;
  }
  .tjs-mega__cat-count,
  .tjs-mega__product-meta em,
  .tjs-mega__cta-text,
  .tjs-mega__empty {
    color: var(--tjs-muted) !important;
  }
  .tjs-mega__col--products {
    display: none !important;
  }
  .tjs-mega__col--cats h4,
  .tjs-mega__col--cta .tjs-mega__cta-text {
    display: none;
  }
  .tjs-mega__inner {
    grid-template-columns: 1fr !important;
    padding: .25rem 0 .75rem !important;
    gap: .5rem !important;
  }
  .tjs-mega__cats {
    gap: 0;
  }
  .tjs-mega__cat {
    min-height: 48px;
    padding: .65rem 1.15rem !important;
    border-radius: 0;
  }
  .tjs-mega__col--cta {
    margin: .5rem 1.15rem 1rem;
    padding: 1rem !important;
    background: #fff !important;
    border: 1px solid var(--tjs-line);
    border-radius: 10px;
  }
  .tjs-mega__eyebrow { color: var(--tjs-accent) !important; }
  .tjs-nav .tjs-nav__mega-btn {
    position: relative;
  }
  .tjs-nav .tjs-nav__mega-btn::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: auto;
    opacity: .55;
    transition: transform .2s ease;
  }
  .tjs-has-mega.is-mega-open > .tjs-nav__mega-btn::after {
    transform: rotate(-135deg);
  }

  body.tjs-nav-open,
  body.tjs-filters-open,
  body.tjs-sheet-open {
    overflow: hidden;
  }

  /* Search — full screen sheet */
  .tjs-search-modal {
    padding-top: 0 !important;
    place-items: stretch !important;
  }
  .tjs-search-modal__box {
    width: 100% !important;
    max-width: none !important;
    min-height: 100%;
    border-radius: 0 !important;
    padding: 1rem 1rem 2rem !important;
  }
  .tjs-search-form {
    grid-template-columns: 1fr !important;
  }
  .tjs-search-form .tjs-btn {
    width: 100%;
  }

  /* Cart / wishlist bottom sheets */
  .tjs-mini-cart,
  .tjs-wish-drop {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    max-height: min(78vh, 560px) !important;
    border-radius: 16px 16px 0 0 !important;
    z-index: 320 !important;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .18) !important;
  }
  .tjs-mini-cart::before,
  .tjs-wish-drop::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin: .65rem auto .25rem;
    border-radius: 999px;
    background: #ddd;
  }

  /* Shop: products first, filters as sheet */
  .tjs-shop-layout {
    display: block !important;
  }
  .tjs-shop-content {
    display: block;
    width: 100%;
  }
  .tjs-shop-filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 44px;
    padding: 0 .95rem;
    border: 1px solid var(--tjs-line);
    border-radius: 999px;
    background: #fff;
    color: var(--tjs-ink);
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
  }
  .tjs-shop-filters-btn:hover,
  .tjs-shop-filters-btn[aria-expanded="true"] {
    border-color: var(--tjs-ink);
    background: var(--tjs-ink);
    color: #fff;
  }
  .tjs-shop-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem .75rem;
    margin-bottom: 1.15rem;
  }
  .tjs-shop-toolbar .woocommerce-result-count {
    flex: 1 1 auto;
    margin: 0;
    font-size: .82rem;
  }
  .tjs-shop-toolbar .woocommerce-ordering {
    margin: 0;
    flex: 1 1 140px;
  }
  .tjs-shop-toolbar .woocommerce-ordering select {
    min-height: 44px;
    width: 100%;
    border: 1px solid var(--tjs-line);
    border-radius: 8px;
    padding: 0 .75rem;
    background: #fff;
  }

  .tjs-filters-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
    border: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
  }
  body.tjs-filters-open .tjs-filters-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .tjs-filters-backdrop[hidden] { display: none; }
  body.tjs-filters-open .tjs-filters-backdrop[hidden] { display: block; }

  .tjs-shop-sidebar {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 310;
    width: 100% !important;
    max-height: min(86vh, 640px);
    margin: 0 !important;
    padding: 0 0 env(safe-area-inset-bottom, 0);
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .16);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(110%);
    transition: transform .3s cubic-bezier(.22, 1, .36, 1);
  }
  body.tjs-filters-open .tjs-shop-sidebar {
    transform: translateY(0);
  }
  .tjs-filters-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.15rem;
    border-bottom: 1px solid var(--tjs-line);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
  }
  .tjs-filters-sheet__head strong {
    font-family: var(--tjs-display, Georgia, serif);
    font-size: 1.2rem;
    font-weight: 600;
  }
  .tjs-filters-sheet__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tjs-line);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
  }
  .tjs-shop-sidebar .tjs-filters {
    padding: .5rem 1.15rem 1.5rem;
    position: static !important;
  }
  .tjs-filters__promo {
    aspect-ratio: auto;
    min-height: 88px;
    margin-top: 1rem;
  }

  /* Blog: content before sidebar */
  .tjs-blog-layout {
    grid-template-columns: 1fr !important;
  }
  .tjs-blog-sidebar {
    order: 2;
  }
  .tjs-posts {
    order: 1;
    grid-template-columns: 1fr !important;
  }

  /* Grids tighten */
  .tjs-features__grid,
  .tjs-promo__inner,
  .tjs-footer__grid,
  .tjs-form__row,
  .tjs-values {
    grid-template-columns: 1fr 1fr;
  }

  /* Containers breathe less */
  .tjs-container {
    width: min(94vw, var(--tjs-max, 1320px));
  }
}

@media (max-width: 640px) {
  .tjs-topbar {
    display: none;
  }
  .tjs-features__grid,
  .tjs-promo__inner,
  .tjs-footer__grid,
  .tjs-form__row,
  .tjs-values,
  .tjs-testimonials__grid,
  .tjs-contact-grid,
  .tjs-about-grid {
    grid-template-columns: 1fr !important;
  }
  .tjs-shop-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .tjs-shop-filters-btn {
    width: 100%;
  }
  .tjs-shop-toolbar .woocommerce-ordering {
    flex: 1 1 auto;
    width: 100%;
  }
  .woocommerce ul.products,
  .tjs-page-shop .woocommerce ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem .85rem !important;
  }
  .tjs-product-card__title {
    font-size: .92rem !important;
  }
  .tjs-hero {
    min-height: 62vh;
  }
  .tjs-page-hero {
    padding: 1.75rem 0 1rem;
  }
  .tjs-page-hero__title {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
  }
  .tjs-cart-wrap .tjs-icon-btn__count,
  .tjs-wish-wrap .tjs-icon-btn__count {
    min-width: 18px;
    height: 18px;
    font-size: .65rem;
  }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 900px) {
    .tjs-mini-cart,
    .tjs-wish-drop,
    .tjs-shop-sidebar,
    .tjs-nav {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}
