/* ============================================================
   Navigation + browsing (perfume-wholesale.html)
   Section tabs, reading progress, smart header, back to top,
   Brands menu, All Fragrances catalogue (filters, sort, grid/list),
   product quick view, search extras, theme button.
   Colours come from tokens, so dark mode (theme.css) only swaps them.
   ============================================================ */

.store { --page: #fff; --surface: #fff; --tile: #F1F4F8; }
:root { --header-h: 130px; --header-main-h: 84px; }

/* Anchor jumps land below the sticky header */
.store main [id] { scroll-margin-top: calc(var(--header-h) + 12px); }

/* ---------- Smart header ---------- */
.store-header { transition: transform .4s var(--ease), box-shadow .3s; }
.store-header.is-stuck { box-shadow: 0 12px 30px -22px rgba(10, 14, 23, .45); }
@media (max-width: 900px) {
  /* Scrolling down tucks the search/logo row away; the section tabs stay */
  .store-header.is-tucked { transform: translateY(calc(-1 * var(--header-main-h))); }
}

/* Theme button in the header */
.theme-btn { width: 46px; padding: 0; justify-content: center; }
.theme-btn svg { width: 21px; height: 21px; }

/* ---------- Section tabs ---------- */
.section-tabs { border-top: 1px solid var(--card-line); }
.section-tabs-inner {
  position: relative; display: flex; align-items: center; gap: 2px; height: 46px;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.section-tabs-inner::-webkit-scrollbar { display: none; }
.section-tabs a {
  position: relative; flex: none; display: inline-flex; align-items: center; height: 46px; padding: 0 14px;
  font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; transition: color .2s;
}
.section-tabs a:first-child { margin-left: -14px; }
.section-tabs a:hover { color: var(--text); }
.section-tabs a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--azure); transform: scaleX(0); transition: transform .35s var(--ease);
}
.section-tabs a.is-active { color: var(--text); }
.section-tabs a.is-active::after { transform: scaleX(1); }
.section-tabs .tab-apply { margin-left: auto; color: var(--azure-2); }
.section-tabs .tab-apply svg { width: 14px; height: 14px; margin-left: 6px; transition: transform .3s var(--ease); }
.section-tabs .tab-apply:hover svg { transform: translateX(3px); }

/* Reading progress along the bottom of the header */
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--grad); transform: scaleX(0); transform-origin: left; }

/* ---------- Brands menu ---------- */
.nav-mega-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0;
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text); transition: color .2s;
}
.nav-mega-btn svg { width: 14px; height: 14px; transition: transform .3s var(--ease); }
.nav-mega-btn:hover, .nav-mega-btn[aria-expanded="true"] { color: var(--azure-2); }
.nav-mega-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.mega {
  position: absolute; left: 0; right: 0; top: var(--header-main-h); z-index: 6;
  background: var(--surface); border-top: 1px solid var(--card-line); border-bottom: 1px solid var(--card-line);
  box-shadow: 0 40px 60px -40px rgba(10, 14, 23, .4);
  animation: megaIn .28s var(--ease);
}
.mega[hidden] { display: none; }
@keyframes megaIn { from { opacity: 0; transform: translateY(-8px); } }
.mega-inner { display: grid; grid-template-columns: 1fr 1fr minmax(260px, .8fr); gap: clamp(24px, 4vw, 72px); padding-top: 30px; padding-bottom: 34px; }
.mega-col h3 {
  display: flex; justify-content: space-between; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--card-line);
  font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.mega-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; }
.mega-list button {
  width: calc(100% + 20px); display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin: 0 -10px; padding: 9px 10px; border: 0; border-radius: 9px; background: none; cursor: pointer; text-align: left;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--text); transition: background .2s, color .2s;
}
.mega-list button:hover { background: var(--panel); color: var(--azure-2); }
.mega-list small { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.mega-promo {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 26px;
  border-radius: 18px; background: var(--panel);
}
.mega-promo .eyebrow { font-size: 10.5px; }
.mega-promo p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.mega-promo strong { display: block; font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.2; color: var(--text); }
.mega-promo .btn { height: 46px; padding: 0 20px; margin-top: 4px; }
.mega-promo a.mega-all { font-size: 13px; font-weight: 700; color: var(--text); border-bottom: 1.5px solid var(--azure); }

/* ---------- Search extras ---------- */
.search-kbd {
  flex: none; display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-right: 4px; padding: 0 7px;
  border: 1px solid var(--card-line); border-radius: 6px; background: var(--surface);
  font: 700 11.5px/1 var(--sans); color: var(--muted);
}
.search-field:focus-within .search-kbd { display: none; }
.sr-item { grid-template-columns: minmax(0, 1fr) auto; }
.sr-open {
  min-width: 0; display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.sr-open .sr-thumb { display: grid; }
.sr-open .sr-text { display: block; min-width: 0; font-size: inherit; color: inherit; }
.sr-open .sr-text strong { display: block; font-size: 14px; line-height: 1.3; }
.sr-open .sr-text > span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-open:hover strong { color: var(--azure-2); }
.sr-all {
  width: 100%; display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding: 12px 10px;
  border: 0; border-top: 1px solid var(--card-line); background: none; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--azure-2);
}
.sr-all svg { width: 16px; height: 16px; }
.sr-tip { margin: 6px 10px 4px; font-size: 12px; color: var(--muted); }
.sr-tip kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--card-line); border-radius: 5px; font: 700 11px/1 var(--sans); }

/* ---------- Product cards: quick view ---------- */
.p-quick {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 0;
  border: 0; background: none; cursor: zoom-in; color: inherit;
}
.p-quick-hint {
  position: absolute; left: 50%; bottom: 12px; padding: 7px 14px; border-radius: 999px;
  background: rgba(10, 14, 23, .86); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  opacity: 0; transform: translate(-50%, 6px); transition: opacity .25s, transform .25s var(--ease); pointer-events: none;
}
.p-card:hover .p-quick-hint, .p-quick:focus-visible .p-quick-hint { opacity: 1; transform: translate(-50%, 0); }
.p-quick:focus-visible { outline-offset: -4px; border-radius: 12px; }

/* ---------- All Fragrances catalogue ---------- */
.cat-layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: clamp(20px, 2.4vw, 36px); align-items: start; }
.filters {
  position: sticky; top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 20px 20px 22px; border: 1px solid var(--card-line); border-radius: var(--radius); background: var(--surface);
}
.filters:focus { outline: none; }
.filters-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.filters-head h3 { margin: 0 auto 0 0; font-size: 17px; font-weight: 800; }
.filters-clear { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; color: var(--azure-2); }
.filters-clear[disabled] { color: var(--muted); opacity: .5; cursor: default; }
.filters-x { display: none; color: var(--text); }
.f-search {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px;
  border: 1px solid var(--card-line); border-radius: 10px; background: var(--panel); transition: border-color .2s;
}
.f-search:focus-within { border-color: var(--azure); }
.f-search svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.f-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font: inherit; font-size: 14px; color: var(--text); }
.f-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.f-group { margin: 16px 0 0; padding: 14px 0 0; border: 0; border-top: 1px solid var(--card-line); min-width: 0; }
.f-group legend { float: left; width: 100%; margin-bottom: 8px; padding: 0; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.f-opt { clear: both; display: flex; align-items: center; gap: 11px; padding: 5px 0; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .2s; }
.f-opt input {
  appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0;
  border: 1.5px solid rgba(92, 98, 114, .55); border-radius: 5px; background: var(--surface) center / 12px no-repeat;
  cursor: pointer; transition: background-color .2s, border-color .2s;
}
.f-opt input:checked {
  border-color: var(--azure); background-color: var(--azure);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='2'%3E%3Cpath d='m2.5 6.5 2.3 2.3L9.5 3.5'/%3E%3C/svg%3E");
}
.f-opt:hover input { border-color: var(--azure); }
.f-opt .n { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.f-opt.is-zero { opacity: .42; }
.f-opt.f-extra { display: none; }
.f-group.show-all .f-opt.f-extra { display: flex; }
.f-more { margin-top: 6px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; color: var(--azure-2); }
.f-switch { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--card-line); font-size: 14px; font-weight: 600; cursor: pointer; }
.f-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.f-switch-ui { position: relative; flex: none; width: 38px; height: 22px; border-radius: 99px; background: var(--panel-2); transition: background .25s; }
.f-switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .25s var(--ease);
}
.f-switch input:checked + .f-switch-ui { background: var(--azure); }
.f-switch input:checked + .f-switch-ui::after { transform: translateX(16px); }
.f-switch input:focus-visible + .f-switch-ui { outline: 2px solid var(--azure); outline-offset: 2px; }
.f-switch .n { color: var(--muted); font-weight: 600; }
.filters-done { display: none; }

.cat-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 16px; }
.cat-count { margin: 0 auto 0 0; font-size: 14px; color: var(--muted); }
.cat-count strong { color: var(--text); }
.cat-filter-btn {
  display: none; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border: 1px solid var(--card-line); border-radius: 10px; background: var(--surface); cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 700; color: var(--text);
}
.cat-filter-btn svg { width: 17px; height: 17px; }
.cat-filter-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--azure); color: #fff; font-size: 11px; }
.cat-filter-n[hidden] { display: none; }
.cat-sort select {
  height: 42px; padding: 0 38px 0 14px; border: 1px solid var(--card-line); border-radius: 10px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA3B5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center / 16px no-repeat;
  -webkit-appearance: none; appearance: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text);
}
.view-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--card-line); border-radius: 10px; background: var(--surface); }
.view-toggle button {
  display: grid; place-items: center; width: 36px; height: 34px; border: 0; border-radius: 7px; background: none; cursor: pointer;
  color: var(--muted); transition: background .2s, color .2s;
}
.view-toggle button svg { width: 18px; height: 18px; }
.view-toggle button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.cat-chips[hidden] { display: none; }
.f-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 12px;
  border: 1px solid var(--card-line); border-radius: 999px; background: var(--panel); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text); transition: border-color .2s;
}
.f-chip:hover { border-color: var(--azure); }
.f-chip svg { width: 14px; height: 14px; color: var(--muted); }
.f-chip em { font-style: normal; color: var(--muted); }

.p-grid.cat-grid { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 1440px) { .p-grid.cat-grid { grid-template-columns: repeat(4, 1fr); } }
.cat-grid > *, .cat-list > .p-row { animation: catIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes catIn { from { opacity: 0; transform: translateY(10px); } }

/* List view: a compact order-sheet style table */
.cat-list { border: 1px solid var(--card-line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.p-row, .p-row-head {
  display: grid; grid-template-columns: 64px minmax(0, 2.2fr) 1.1fr .8fr .9fr 196px; align-items: center; gap: 18px;
  padding: 10px 18px; border-bottom: 1px solid var(--card-line);
}
.p-row:last-child { border-bottom: 0; }
.p-row:hover { background: var(--panel); }
.p-row-head { padding-top: 12px; padding-bottom: 12px; background: var(--panel); font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.p-row-thumb {
  width: 64px; height: 64px; display: grid; place-items: center; padding: 4px; overflow: hidden;
  border: 0; border-radius: 10px; background: var(--tile); cursor: zoom-in;
}
.p-row-thumb img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.p-row-thumb svg { width: 40px; height: auto; }
.p-row-name { min-width: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.p-row-name strong { display: block; font-size: 15px; font-weight: 800; line-height: 1.3; }
.p-row-name span { display: block; font-size: 13px; color: var(--muted); }
.p-row-name:hover strong { color: var(--azure-2); }
.p-row-cell { font-size: 13.5px; color: var(--muted); }
.p-row-cell.arabian { color: #A3651F; font-weight: 600; }
.p-row-cell.designer { color: var(--azure-2); font-weight: 600; }
.p-row .p-add { height: 40px; }

.cat-empty { padding: 56px 24px; border: 1px dashed var(--card-line); border-radius: var(--radius); text-align: center; color: var(--muted); }
.cat-empty svg { width: 46px; height: 46px; margin: 0 auto 14px; color: var(--muted); opacity: .6; }
.cat-empty p { max-width: 42ch; margin: 0 auto; font-size: 15px; }
.cat-empty p strong { display: block; margin-bottom: 4px; font-size: 17px; color: var(--text); }
.cat-empty .cat-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.cat-empty .btn { height: 46px; border-radius: 12px; }
/* Phones show the first 8; this button shows the rest */
.cat-more { display: flex; width: 100%; height: 50px; margin-top: 16px; }
.cat-foot { margin: 22px 0 0; font-size: 13.5px; color: var(--muted); }
.cat-foot a { color: var(--text); font-weight: 700; border-bottom: 1.5px solid var(--azure); }
.filters-scrim { display: none; }

/* ---------- Quick view ---------- */
.qv { position: fixed; inset: 0; z-index: 96; display: grid; place-items: center; padding: 24px; }
.qv[hidden] { display: none; }
.qv-scrim { position: absolute; inset: 0; background: rgba(6, 9, 15, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: qvFade .3s ease; }
.qv-dialog {
  position: relative; width: min(1000px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  display: grid; grid-template-columns: 1.05fr 1fr; border-radius: 24px; background: var(--surface); color: var(--text);
  box-shadow: 0 50px 120px -40px rgba(0, 0, 0, .6); animation: qvIn .4s var(--ease);
}
.qv-dialog:focus { outline: none; }
@keyframes qvFade { from { opacity: 0; } }
@keyframes qvIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.qv-close { position: absolute; top: 14px; right: 14px; z-index: 2; background: var(--surface); color: var(--text); opacity: 1; }
.qv-close:hover { background: var(--panel); }
.qv-media { position: relative; display: grid; place-items: center; min-height: 460px; padding: 36px 36px 70px; background: var(--tile); }
.qv-photo { width: 100%; display: grid; place-items: center; }
.qv-photo img { width: min(100%, 440px); height: auto; mix-blend-mode: multiply; animation: qvFade .35s ease; }
.qv-photo svg { width: 60%; height: auto; }
.qv-pager {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .9);
  box-shadow: 0 8px 20px -10px rgba(10, 14, 23, .35); color: #0A0E17;
}
.qv-pager button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; cursor: pointer; color: inherit; }
.qv-pager button:hover:not([disabled]) { background: #EEF2F7; }
.qv-pager button[disabled] { opacity: .3; cursor: default; }
.qv-pager svg { width: 16px; height: 16px; }
.qv-pager span { min-width: 54px; text-align: center; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qv-body { display: flex; flex-direction: column; padding: clamp(28px, 3.4vw, 48px); padding-top: clamp(34px, 3.6vw, 52px); }
.qv-tags { display: flex; gap: 8px; }
.qv-tag { padding: 5px 11px; border-radius: 999px; background: rgba(58, 151, 242, .12); color: var(--azure-2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.qv-tag.arabian { background: rgba(163, 101, 31, .12); color: #A3651F; }
.qv-tag.best { background: var(--grad); color: #fff; }
.qv-tag[hidden] { display: none; }
.qv-brand { margin: 18px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.qv-name { margin: 6px 0 0; font-family: var(--display); font-weight: 800; font-size: clamp(28px, 3vw, 40px); line-height: 1.05; letter-spacing: -.02em; }
.qv-facts { display: grid; margin: 22px 0 22px; border-top: 1px solid var(--card-line); }
.qv-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--card-line); font-size: 14.5px; }
.qv-facts dt { color: var(--muted); }
.qv-facts dd { margin: 0; font-weight: 700; text-align: right; }
.qv-actions .p-add { height: 52px; border-radius: 12px; font-size: 12px; }
.qv-wa { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; height: 46px; border-radius: 12px; border: 1px solid var(--card-line); font-size: 13.5px; font-weight: 700; color: var(--text); transition: border-color .2s, background .2s; }
.qv-wa:hover { border-color: #1FAF5A; background: rgba(31, 175, 90, .06); }
.qv-wa svg { width: 19px; height: 19px; color: #1FAF5A; }
.qv-more { margin-top: 26px; }
.qv-more[hidden] { display: none; }
.qv-more h3 { margin: 0 0 12px; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.qv-more-list { display: flex; flex-wrap: wrap; gap: 10px; }
.qv-more-list button {
  width: 76px; height: 76px; display: grid; place-items: center; padding: 4px; overflow: hidden;
  border: 1px solid transparent; border-radius: 12px; background: var(--tile); cursor: pointer; transition: border-color .2s, transform .2s var(--ease);
}
.qv-more-list button:hover { border-color: var(--azure); transform: translateY(-2px); }
.qv-more-list img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.qv-more-list svg { width: 46px; height: auto; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 50; width: 52px; height: 52px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: 0 14px 30px -14px rgba(10, 14, 23, .45), 0 0 0 1px var(--card-line);
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .35s var(--ease), transform .35s var(--ease), visibility .35s, background .2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--panel); }
.to-top .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.to-top .ring circle { fill: none; stroke-width: 2.5; }
.to-top .ring-bg { stroke: var(--card-line); }
.to-top .ring-fg { stroke: var(--azure); stroke-linecap: round; stroke-dasharray: 150.8; stroke-dashoffset: 150.8; }
.to-top .up { width: 19px; height: 19px; }

/* ---------- Responsive ---------- */
@media (max-width: 1160px) {
  .section-tabs .tab-apply { margin-left: 0; }
}
@media (max-width: 1024px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr); }
  .filters {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 95; width: min(360px, 88vw); max-height: none;
    padding-bottom: 0; border-radius: 0 20px 20px 0; border-left: 0;
    transform: translateX(-104%); transition: transform .45s var(--ease); visibility: hidden;
  }
  .cat-section.filters-open .filters { transform: none; visibility: visible; }
  .filters-x { display: grid; }
  .filters-done { display: block; position: sticky; bottom: 0; margin: 20px -20px 0; padding: 14px 20px 18px; background: var(--surface); border-top: 1px solid var(--card-line); }
  .filters-done .btn { height: 50px; border-radius: 12px; }
  .filters-scrim { display: block; position: fixed; inset: 0; z-index: 94; background: rgba(6, 9, 15, .55); opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
  .cat-section.filters-open .filters-scrim { opacity: 1; visibility: visible; }
  .cat-filter-btn { display: inline-flex; }
  .cat-count { order: 5; width: 100%; margin: 0; }
  .mega-inner { grid-template-columns: 1fr 1fr; }
  .mega-promo { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .p-grid.cat-grid { grid-template-columns: repeat(2, 1fr); }
  .p-row, .p-row-head { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; padding: 10px 12px; }
  .p-row-head { display: none; }
  .p-row-cell { display: none; }
  .p-row-thumb { width: 56px; height: 56px; }
  .p-row .p-add { width: auto; padding: 0 12px; }
  .p-row .p-add .on .long { display: none; }
}
@media (max-width: 760px) {
  .theme-btn { display: none; }
  .search-kbd { display: none; }
  .section-tabs-inner { height: 44px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .section-tabs a { height: 44px; padding: 0 12px; font-size: 12.5px; }
  .section-tabs a:first-child { margin-left: -12px; }
  .section-tabs a::after { left: 12px; right: 12px; }
  .to-top { right: 14px; bottom: calc(var(--tabbar-h) + 14px); width: 46px; height: 46px; }
  .view-toggle button { width: 44px; height: 40px; }
  .search-btn { width: 44px; height: 44px; }
  .cat-filter-btn, .cat-sort select { height: 44px; }
  .qv { padding: 0; align-items: end; }
  .qv-dialog { grid-template-columns: 1fr; max-height: 92vh; border-radius: 22px 22px 0 0; animation-name: qvUp; }
  @keyframes qvUp { from { transform: translateY(40px); opacity: 0; } }
  .qv-media { min-height: 0; padding: 26px 26px 64px; }
  .qv-photo img { width: min(78%, 300px); }
  .qv-body { padding: 24px 22px 28px; }
  .p-row .p-add { font-size: 0; gap: 0; width: 40px; padding: 0; }
  .p-row .p-add svg { width: 18px; height: 18px; }
}
@media (hover: none) { .p-quick-hint { display: none; } .search-kbd { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .cat-grid > *, .cat-list > .p-row, .mega, .qv-dialog, .qv-scrim { animation: none !important; }
}
