/* desktop-layout.css - desktop layout for Bongo Shi
   Load it AFTER style.css and theme.css (index.html already does).
   Below 900px nothing here applies, so the phone layout stays exactly as it is.

   Desktop (900px and wider (also covers "Desktop site" mode on phones, which is about 980px)):
   - full-width page, content centered up to 1240px
   - the bottom tab bar moves up into the header, next to search + theme
   - the "More" bottom sheet becomes a dropdown under the header
   - product grid: 4 columns, then 5 columns from 1280px
*/

@media (min-width: 900px) {

  :root {
    --header-h: 72px;
    --tabbar-h: 0px;                               /* no bottom bar on desktop */
    --max-w: none;
    --desk-w: 1240px;
    --gutter: max(24px, calc((100vw - var(--desk-w)) / 2));
  }

  body { background: var(--cream); }

  /* App shell: full width instead of a phone-width column */
  .app { max-width: none; min-height: 100vh; }

  /* ---------- Header ---------- */
  .header {
    z-index: 40;                                   /* stays above the More dropdown backdrop */
    padding: 0 var(--gutter);
  }
  .brand { gap: 10px; }
  .brand__logo { width: 66px; height: 66px; }
  .brand__name { font-size: 26px; }
  .search { margin-right: 8px; }
  .theme:hover { background: rgba(127, 127, 127, .15); }

  /* ---------- Tab bar -> header navigation ---------- */
  .tabbar,
  html[data-theme="dark"] .tabbar {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    z-index: 41;
    transform: none;
    width: auto;
    max-width: none;
    height: var(--header-h);
    padding: 0 calc(var(--gutter) + 100px) 0 0;    /* leaves room for the search + theme buttons */
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 0;
    box-shadow: none;
    pointer-events: none;                          /* only the links themselves are clickable */
  }
  .tab {
    flex: none;
    flex-direction: row;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 15px;
    pointer-events: auto;
    transition: background .15s ease, color .15s ease;
  }
  #accountBtn { flex: none; }
  .tab svg { width: 22px; height: 22px; }
  .tab:hover { background: rgba(242, 106, 0, .08); color: var(--orange); }
  .tab.is-active { background: rgba(242, 106, 0, .12); }
  .tab.is-active::before { display: none; }        /* the top bar marker is for the phone only */
  .tab:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
  html[data-theme="dark"] .tab:hover { background: rgba(242, 106, 0, .16); }
  html[data-theme="dark"] .tab.is-active { background: rgba(242, 106, 0, .2); }

  /* ---------- Content ---------- */
  .main { padding: 28px var(--gutter) 64px; }
  .banner { border-radius: 16px; }

  .products { padding: 36px 0 0; }
  .products__title { margin: 0 0 18px; font-size: 24px; }
  .products__grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }

  .card {
    border-radius: 16px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  }
  .card:hover {
    border-color: var(--orange);
    box-shadow: 0 10px 26px rgba(242, 106, 0, .12);
    transform: translateY(-3px);
  }
  .card__body { padding: 14px 14px 16px; }
  .card__name { margin-bottom: 8px; font-size: 15px; }
  .card__price b { font-size: 18px; }
  .card__price s { font-size: 13px; }
  .card__badge { top: 10px; left: 10px; padding: 4px 9px; font-size: 12px; }

  .products__msg { padding: 56px 12px; font-size: 15px; }

  /* ---------- "More" menu: dropdown under the header ---------- */
  .more,
  .more.is-open {
    top: var(--header-h);
    left: 0;
    right: 0;
    transform: none;
    max-width: none;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 8px var(--gutter) 0 0;
  }
  .more__panel {
    width: 400px;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
    opacity: 0;
    transform: translateY(-8px);
    transition: transform .22s ease, opacity .22s ease;
  }
  .more.is-open .more__panel { opacity: 1; transform: translateY(0); }
  .more__handle { display: none; }                 /* swipe handle is for touch only */
  .more__item { cursor: pointer; transition: border-color .15s ease, background .15s ease; }
  .more__item:hover { background: #fff1e6; border-color: var(--orange); }
  html[data-theme="dark"] .more__item:hover { background: #3a2a1d; border-color: var(--orange); }
  html[data-theme="dark"] .more__panel { box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }

  /* ---------- Toast ---------- */
  .toast { bottom: 24px; }
}

/* 5 product columns on wider screens */
@media (min-width: 1280px) {
  .products__grid { grid-template-columns: repeat(5, 1fr); }
}

/* respect "reduce motion" */
@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
  .card, .card:hover, .more__panel, .tab { transition: none; }
  .card:hover { transform: none; }
}

/* slightly tighter header between 900px and 1279px so the nav never crowds the logo
   (phones in "Desktop site" mode land here) */
@media (min-width: 900px) and (max-width: 1279px) {
  .brand__name { font-size: 22px; }
  .tab { padding: 0 10px; gap: 6px; font-size: 14px; }
  .tabbar, html[data-theme="dark"] .tabbar { gap: 2px; }
}
