/* ============================================================
   ORBIX — Shop: spec filters, card spec lines, product-page specs
   Loaded after site.css (see _Layout). Uses site.css tokens only.
   ============================================================ */

/* ---------- Listing with a filter sidebar (/shop, site.js setupPlpFilters) ----------
   The aside is server-rendered EMPTY and filled by JS, which then adds
   .plp--ready — so without JS the grid simply stays full width. */
.plp__main { min-width: 0; }
.plp__side:empty { display: none; }
@media (min-width: 1025px) {
  .plp--ready { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 2.2rem; align-items: start; }
  .plp__side {
    position: sticky; top: 96px;
    max-height: calc(100vh - 112px); overflow-y: auto; overscroll-behavior: contain;
    padding-right: .5rem; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  }
}
@media (max-width: 1024px) {
  .plp__side { display: none; }
}

.plp-side__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
  padding: .35rem 0 .75rem; border-bottom: 1px solid var(--line);
}
.plp-side__title, .plp-sheet__title {
  font-family: var(--display); font-style: italic; font-weight: 800; font-stretch: 85%;
  text-transform: uppercase; letter-spacing: .06em; font-size: 1.05rem; margin: 0;
}
.plp-side__clear {
  color: var(--red-glow); font-size: .8rem; font-weight: 600; padding: .2rem 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.plp-side__clear:hover { color: #fff; }

/* One group per spec: label + wrapping option pills with live counts. */
.plp-group { border: 0; margin: 0; padding: .95rem 0 1rem; min-width: 0; border-bottom: 1px solid var(--line); }
.plp-group:last-child { border-bottom: 0; }
/* float + full width makes the legend lay out like a normal heading instead
   of sitting on the fieldset's top border. */
.plp-group__title {
  float: left; width: 100%; padding: 0; margin: 0 0 .6rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.plp-group__opts { clear: both; display: flex; flex-wrap: wrap; gap: .4rem; }

.plp-opt {
  position: relative; display: inline-flex; align-items: center; gap: .42rem;
  min-height: 34px; padding: .32rem .72rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font-size: .82rem; font-weight: 600; line-height: 1.2;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s, color .15s, opacity .15s;
}
.plp-opt:hover { border-color: rgba(61,232,255,.55); }
/* The real checkbox stays in the a11y tree; the pill is its visual. */
.plp-opt__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.plp-opt:has(.plp-opt__input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.plp-opt.is-on { border-color: var(--red); background: rgba(61,232,255,.14); color: #fff; }
/* A check mark, so "on" doesn't rely on colour alone. */
.plp-opt.is-on .plp-opt__label::before {
  content: ""; display: inline-block; width: 9px; height: 5px; margin: 0 .38rem .18em 0;
  border-left: 2px solid var(--red-glow); border-bottom: 2px solid var(--red-glow); transform: rotate(-45deg);
}
.plp-opt__n { color: var(--muted-2); font-size: .74rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.plp-opt.is-on .plp-opt__n { color: var(--red-glow); }
.plp-opt.is-off { opacity: .38; cursor: default; }
.plp-opt.is-off:hover { border-color: var(--line); }
.plp-opt__sw {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: var(--sw, #888); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28);
}

/* Listing bar: [Filters] [n products] ……… [Sort] */
.plp .listing__bar { justify-content: flex-start; gap: .6rem 1rem; }
.plp .listing__count { margin-right: auto; }
.plp-trigger { display: none; }
@media (max-width: 1024px) {
  .plp-trigger {
    display: inline-flex; align-items: center; gap: .45rem; min-height: 40px;
    padding: .45rem .85rem; border: 1px solid var(--line); border-radius: 8px;
    background: var(--bg-2); color: var(--text); font-size: .86rem; font-weight: 700;
  }
  .plp-trigger:hover, .plp-trigger[aria-expanded="true"] { border-color: var(--red); }
  .plp-trigger svg { width: 18px; height: 18px; flex: none; color: var(--red-glow); }
}
.plp-trigger__n {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 .35rem;
  border-radius: 999px; background: var(--red); color: var(--on-accent); font-size: .72rem; font-weight: 800;
}

/* Applied-filter pills (reuse .active-chip from site.css). */
.plp-active { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.35rem 0 1rem; }
.plp-active:empty { display: none; }
.active-chip .plp-active__k { color: var(--muted); font-size: .92em; font-weight: 500; }

/* Phones: two equal controls — [Filters] [Sort] — with the count under them,
   and the applied pills as one swipeable row. */
@media (max-width: 760px) {
  .plp .listing__bar { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem .6rem; align-items: center; }
  .plp .plp-trigger { justify-content: center; width: 100%; }
  .plp .listing__sort { min-width: 0; }
  .plp .listing__sort select { flex: 1 1 auto; min-width: 0; min-height: 40px; }
  .plp .listing__count { grid-column: 1 / -1; order: 3; margin: 0; font-size: .82rem; }
  .plp-active {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin: -.25rem 0 .8rem; padding-bottom: .1rem;
  }
  .plp-active::-webkit-scrollbar { display: none; }
  .plp-active .active-chip { flex: none; white-space: nowrap; }
}

/* ---------- Filter sheet (phones: bottom sheet · tablets: right drawer) ---------- */
.plp-sheet { position: fixed; inset: 0; z-index: 420; }
.plp-sheet__overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.62);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .25s ease;
}
.plp-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 86vh; max-height: 86dvh;
  display: flex; flex-direction: column;
  background: var(--bg-2); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
  box-shadow: 0 -24px 60px -20px rgba(0,0,0,.9);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.22,1,.36,1);
}
.plp-sheet__panel::before {
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 4px; border-radius: 2px; background: var(--line);
}
.plp-sheet.is-open .plp-sheet__overlay { opacity: 1; }
.plp-sheet.is-open .plp-sheet__panel { transform: none; }
@media (min-width: 761px) {
  .plp-sheet__panel {
    left: auto; top: 0; width: min(420px, 92vw); max-height: none;
    border-top: 0; border-left: 1px solid var(--line); border-radius: 0;
    transform: translateX(100%);
  }
  .plp-sheet__panel::before { display: none; }
}
.plp-sheet__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.1rem .7rem; border-bottom: 1px solid var(--line);
}
.plp-sheet__close {
  width: 42px; height: 42px; flex: none; border-radius: 10px;
  background: var(--surface-2); color: var(--text); font-size: 1rem;
}
.plp-sheet__close:hover { background: var(--line); }
.plp-sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 1.1rem; }
.plp-sheet__body .plp-opt { min-height: 42px; padding: .45rem .9rem; font-size: .88rem; }
.plp-sheet__foot {
  display: grid; grid-template-columns: 1fr 1.8fr; gap: .6rem;
  padding: .8rem 1.1rem calc(.8rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg-2);
}
.plp-sheet__foot .btn { width: 100%; padding: .85rem .8rem; font-size: .9rem; }
.plp-sheet__foot .btn:disabled { opacity: .45; }

/* ---------- Product cards: one-line spec summary under the name ---------- */
.card__spec {
  margin: -.1rem 0 .1rem; font-size: .78rem; font-weight: 500; line-height: 1.35;
  color: var(--muted); letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal__spec { margin: .1rem 0 .15rem; white-space: normal; }
/* Narrow 2-up phone cards: wrap to two lines rather than cut the line off. */
@media (max-width: 520px) {
  .card__spec {
    font-size: .72rem; margin-top: -.15rem; white-space: normal;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  }
}

/* ---------- Product page: key-spec chips ---------- */
.pd-keyspecs { margin: .5rem 0 .55rem; }
.pd-highlights {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem;
}
.pd-hl {
  display: flex; flex-direction: column; gap: .2rem; min-width: 0;
  padding: .6rem .75rem .65rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: inset 2px 0 0 var(--red);
}
.pd-hl__k { font-size: .64rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--muted-2); }
.pd-hl__v { font-family: var(--display); font-weight: 700; font-size: .98rem; line-height: 1.2; color: var(--text); overflow-wrap: anywhere; }
.pd-keyspecs__links { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; margin: .55rem 0 0; font-size: .82rem; }
.pd-keyspecs__links:empty { display: none; }
.pd-keyspecs__all { color: var(--red-glow); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.pd-keyspecs__all:hover { color: #fff; }
@media (max-width: 520px) {
  .pd-highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Product page: grouped spec table ---------- */
.spec-groups { display: flex; flex-direction: column; gap: 1.4rem; }
.spec-group__title {
  margin: 0 0 .3rem; font-family: var(--font); font-style: normal;
  font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--red-glow);
}
.spec-table { margin: 0; }
.spec-table__row {
  display: grid; grid-template-columns: minmax(7rem, 42%) minmax(0, 1fr); gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; line-height: 1.4;
}
.spec-table__row dt { color: var(--muted); }
.spec-table__row dd { margin: 0; color: var(--text); font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------- Compare: card tick (site.js setupCompare) ---------- */
.card__compare {
  position: relative; z-index: 2; align-self: flex-start;   /* above the card's stretched link */
  display: inline-flex; align-items: center; gap: .45rem; margin: -.15rem 0 .45rem; padding: .15rem 0;
  font-size: .78rem; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.card__compare input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); cursor: pointer; }
.card__compare:hover, .card__compare.is-on { color: var(--text); }
.card__compare.is-blocked { opacity: .5; }

/* ---------- Compare tray: floating bar (desktop) · app-shell row above the bottom nav (phones) ---------- */
.cmp-tray {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 300;
  width: min(780px, calc(100vw - 2rem));
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem .7rem;
  background: rgba(13,22,40,.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(61,232,255,.35); border-radius: 12px; box-shadow: 0 20px 50px -18px rgba(0,0,0,.9);
}
.cmp-tray__items { display: flex; gap: .5rem; min-width: 0; flex: 1 1 auto; }
.cmp-tray__item {
  position: relative; display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1 1 0; max-width: 210px;
  padding: .3rem .35rem .3rem .3rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
}
.cmp-tray__img { width: 44px; height: 33px; object-fit: cover; border-radius: 4px; flex: none; }
.cmp-tray__name { font-size: .78rem; font-weight: 600; min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-tray__x { flex: none; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); font-size: .72rem; }
.cmp-tray__x:hover { color: #fff; background: var(--line); }
.cmp-tray__item--empty { justify-content: center; min-height: 41px; color: var(--muted-2); background: transparent; border-style: dashed; }
.cmp-tray__actions { display: flex; align-items: center; gap: .8rem; flex: none; }
.cmp-tray__clear { color: var(--muted); font-size: .8rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.cmp-tray__clear:hover { color: #fff; }
.cmp-tray__go { padding: .6rem 1.15rem; font-size: .88rem; white-space: nowrap; }
.cmp-tray__hint { font-size: .8rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) {
  .cmp-tray {
    position: static; transform: none; width: auto; flex: 0 0 auto; z-index: 151;
    border-radius: 0; border-width: 1px 0 0; box-shadow: none; padding: .55rem 1rem; gap: .7rem;
  }
  .cmp-tray__item { flex: 0 0 auto; padding: .2rem; }
  .cmp-tray__name { display: none; }
  .cmp-tray__x {
    position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--line); font-size: .62rem; color: var(--text);
  }
  .cmp-tray__item--empty { width: 50px; min-height: 37px; }
  .cmp-tray__go { padding: .55rem .9rem; font-size: .82rem; }
}

/* ---------- Compare page (/compare) ---------- */
.cmp-page .listing__head { margin-bottom: 1.4rem; }
.cmp { --label: 190px; }
.cmp__row {
  display: grid; grid-template-columns: var(--label) repeat(var(--n), minmax(0, 1fr)); gap: 1.2rem;
  padding: .6rem 0; border-bottom: 1px solid var(--line); align-items: start;
}
.cmp__row--head { align-items: stretch; border-bottom: 0; padding: 0 0 .6rem; }
.cmp__corner { display: flex; align-items: flex-end; padding-bottom: .4rem; }
.cmp__label { color: var(--muted); font-size: .86rem; line-height: 1.4; }
.cmp__val { font-size: .9rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.cmp__val.is-none { color: var(--muted-2); font-weight: 400; }
/* Rows where the products differ get a cyan dot by the label. */
.cmp__row.is-diff .cmp__label { color: var(--text); }
.cmp__row.is-diff .cmp__label::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 .5rem .12em 0;
  border-radius: 50%; background: var(--red);
}
.cmp--diff .cmp__row.is-same { display: none; }
.cmp__gtitle {
  margin: 1.6rem 0 .1rem; font-family: var(--font); font-style: normal;
  font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--red-glow);
}
.cmp__prod {
  position: relative; display: flex; flex-direction: column; gap: .35rem; min-width: 0;
  padding: .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
}
.cmp__img { display: block; aspect-ratio: 4/3; overflow: hidden; border-radius: 4px; background: #0c0c10; }
.cmp__img img { width: 100%; height: 100%; object-fit: cover; }
.cmp__name { font-family: var(--display); font-weight: 700; font-size: 1rem; line-height: 1.2; }
.cmp__name:hover { color: var(--red-glow); }
.cmp__spec { margin: 0; white-space: normal; }
.cmp__price { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-top: auto; }
.cmp__price strong { font-family: var(--display); font-size: 1.2rem; color: #fff; }
.cmp__price s { color: var(--muted-2); font-size: .85rem; }
.cmp__cta { padding: .7rem .8rem; font-size: .85rem; }
.cmp__remove {
  position: absolute; top: .5rem; right: .5rem; z-index: 2; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(8,8,11,.75); color: var(--muted); font-size: .78rem;
}
.cmp__remove:hover { color: #fff; background: var(--line); }
.cmp-diff { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 600; cursor: pointer; }
.cmp-diff input { width: 16px; height: 16px; margin: 0; accent-color: var(--red); }
.cmp-note { color: var(--muted); font-size: .82rem; margin: 1rem 0 0; }
.cmp-empty { max-width: 640px; }
@media (max-width: 760px) {
  /* Phones: the label gets its own line, values sit side by side under it. */
  .cmp__row { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .2rem .6rem; }
  .cmp__label { grid-column: 1 / -1; font-size: .74rem; letter-spacing: .03em; }
  .cmp__row--head { gap: .5rem; }
  .cmp__corner { order: 2; padding: .5rem 0 0; }
  .cmp__prod { padding: .45rem; gap: .3rem; }
  .cmp__name { font-size: .82rem; }
  .cmp__price strong { font-size: 1rem; }
  .cmp__cta { padding: .55rem .3rem; font-size: .72rem; letter-spacing: 0; }
  .cmp__val { font-size: .8rem; }
  .cmp__remove { width: 26px; height: 26px; top: .3rem; right: .3rem; }
}
