/* ===========================================================================
   Furniture Story — MOBILE chrome (header + drawer + search overlay + tab bar)
   Ported 1:1 from +Makieta/index-mobile.html. Applies only on phones (<=767px).
   Desktop .fs-chrome is untouched. All classes prefixed .fsm- to avoid clashes.
   =========================================================================== */

/* hide mobile chrome on tablet/desktop */
@media (min-width: 768px) {
  .fsm, .fsm-tabbar, .fsm-scrim, .fsm-drawer, .fsm-search-ov { display: none !important; }
}

@media (max-width: 767px) {
  /* swap: hide desktop chrome, show mobile chrome */
  .fs-chrome > .announce,
  .fs-chrome > header { display: none !important; }

  body { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }

  /* ---------- Header ---------- */
  .fsm-header {
    position: sticky; top: 0; z-index: 80;
    background: rgba(250,248,244,.86);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s, box-shadow .3s;
  }
  .fsm-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 20px -12px rgba(26,26,26,.18); }
  .fsm-row { height: 60px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 14px; }
  .fsm-left { justify-self: start; display: flex; align-items: center; gap: 2px; }
  .fsm-right { justify-self: end; display: flex; gap: 2px; }
  .fsm-ico { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); position: relative; background: none; border: none; cursor: pointer; padding: 0; }
  .fsm-ico svg { width: 22px; height: 22px; stroke-width: 1.6; }
  .fsm-burger { flex-direction: column; gap: 4px; }
  .fsm-burger span { display: block; width: 19px; height: 1.6px; background: var(--ink); border-radius: 2px; }
  .fsm-logo { justify-self: center; line-height: 0; }
  .fsm-logo img { height: 46px; width: auto; display: block; margin: 0 auto; }
  .fsm-cart-badge { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--terracotta); color: #fff; border-radius: 9px; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; line-height: 1; }
  .fsm-cart-badge[hidden] { display: none; }

  /* ---------- Bottom tab bar ---------- */
  .fsm-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    height: calc(66px + env(safe-area-inset-bottom,0px)); padding-bottom: env(safe-area-inset-bottom,0px);
    background: rgba(250,248,244,.93); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--line); display: flex; align-items: stretch;
  }
  .fsm-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); position: relative; padding-top: 4px; text-decoration: none; }
  .fsm-tab svg { width: 23px; height: 23px; stroke-width: 1.6; }
  .fsm-tab span { font-size: 10px; letter-spacing: .02em; font-weight: 500; white-space: nowrap; }
  .fsm-tab.active { color: var(--ink); }
  .fsm-tb-badge { position: absolute; top: 6px; right: calc(50% - 18px); min-width: 15px; height: 15px; padding: 0 4px; background: var(--terracotta); color: #fff; font-size: 9px; font-weight: 600; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
  .fsm-tb-badge[hidden] { display: none; }

  /* ---------- Scrim ---------- */
  .fsm-scrim { position: fixed; inset: 0; z-index: 200; background: rgba(15,12,9,.42); opacity: 0; visibility: hidden; transition: .35s; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .fsm-scrim.show { opacity: 1; visibility: visible; }

  /* ---------- Drawer ---------- */
  .fsm-drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 300; width: 87%; max-width: 360px; background: var(--bg); transform: translateX(-101%); transition: transform .4s; display: flex; flex-direction: column; box-shadow: 30px 0 60px -30px rgba(0,0,0,.4); }
  .fsm-drawer.open { transform: translateX(0); }
  .fsm-dtop { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
  .fsm-dtop img { height: 30px; width: auto; }
  .fsm-dclose { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: var(--ink); }
  .fsm-dclose svg { width: 22px; height: 22px; }
  .fsm-dsearch { margin: 4px 18px 8px; position: relative; }
  .fsm-dsearch input { width: 100%; padding: 13px 14px 13px 42px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); font-family: inherit; font-size: 14px; }
  .fsm-dsearch input:focus { outline: none; border-color: var(--ink); }
  .fsm-dsearch svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
  .fsm-dnav { flex: 1; overflow-y: auto; padding: 8px 0 16px; }
  .fsm-dnav::-webkit-scrollbar { display: none; }
  .fsm-ditem { border-bottom: 1px solid var(--line); }
  .fsm-dlink { display: flex; align-items: center; justify-content: space-between; }
  .fsm-dlink > a { flex: 1; padding: 16px 22px; font-size: 16px; font-weight: 500; color: var(--ink); text-decoration: none; }
  .fsm-dlink > a.sale { color: var(--terracotta); }
  .fsm-dlink > a.outlet { color: var(--sage); }
  .fsm-dtoggle { background: none; border: none; padding: 8px 18px 8px 8px; cursor: pointer; }
  .fsm-dtoggle svg { width: 20px; height: 20px; transition: transform .3s; color: var(--muted); }
  .fsm-ditem.open .fsm-dtoggle svg { transform: rotate(180deg); }
  .fsm-dsub { max-height: 0; overflow: hidden; transition: max-height .4s; background: var(--bg-alt); }
  .fsm-ditem.open .fsm-dsub { max-height: 520px; }
  .fsm-dsub a { display: block; padding: 12px 22px 12px 34px; font-size: 14px; color: var(--ink-soft); text-decoration: none; }
  .fsm-dsub h5 { padding: 14px 22px 4px 34px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 600; }
  .fsm-dfoot { border-top: 1px solid var(--line); padding: 16px 22px 22px; background: var(--bg-alt); }
  .fsm-dquick { display: flex; gap: 14px; margin-bottom: 16px; }
  .fsm-dquick a { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-soft); flex: 1; text-decoration: none; }
  .fsm-dquick svg { width: 22px; height: 22px; stroke-width: 1.5; color: var(--ink); }
  .fsm-dcall { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; }
  .fsm-dcall svg { width: 18px; height: 18px; color: var(--accent); }

  /* ---------- Search overlay ---------- */
  .fsm-search-ov { position: fixed; inset: 0; z-index: 320; background: var(--bg); transform: translateY(-8px); opacity: 0; visibility: hidden; transition: .3s; display: flex; flex-direction: column; }
  .fsm-search-ov.show { transform: translateY(0); opacity: 1; visibility: visible; }
  .fsm-sbar { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--line); }
  .fsm-sbar input { flex: 1; border: none; background: none; font-family: inherit; font-size: 17px; color: var(--ink); }
  .fsm-sbar input:focus { outline: none; }
  .fsm-sbar svg { width: 22px; height: 22px; color: var(--muted); }
  .fsm-sclose { font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; background: none; border: none; cursor: pointer; }
  .fsm-sbody { padding: 24px 22px; }
  .fsm-sbody h4 { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
  .fsm-stags { display: flex; flex-wrap: wrap; gap: 9px; }
  .fsm-stags a { padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: var(--white); text-decoration: none; color: var(--ink); }

  body.fsm-lock { overflow: hidden; }
}
