/* ============================================================
   945 CLUB — PRODUCT COMPARE: the left-edge tab and the comparison window
   ============================================================
   Drawn by js/modules/compare.js. Built on the theme's own variables (--ink,
   --ink2, --hair, --indigo, --burgundy, --surface-*), which the dark theme
   already remaps, so almost nothing here needs a dark rule. Roles are the
   house ones: indigo is what you press, burgundy is a value worth noticing
   (the discount, the count), cream is the paper. Loaded after the theme.
   ============================================================ */

/* ---------- The tab on the left edge, once something is on the list ---------- */
.cmp-tab {
  --cmp-on-fill: #F8EEDB;
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 996;                    /* over the product window (995), under the bag and the menus */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 6px 10px;
  padding-left: calc(6px + env(safe-area-inset-left, 0px));
  border: 0;
  border-radius: 0 12px 12px 0;
  background: var(--indigo, #383C8C);
  color: var(--cmp-on-fill);
  box-shadow: 0 10px 26px rgba(28, 29, 61, 0.28);
  cursor: pointer;
  font: 600 12px/1 var(--font-sans, 'Inter', sans-serif);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: padding .2s ease, background .2s ease;
}
.cmp-tab[hidden] { display: none; }
/* Only the product window wants the tab above it (to open the comparison from there). Any
   other sheet (account, sign-in, checkout, size chart) would have it parked over its left
   edge, on top of its text. */
html:has(.modal-overlay.open:not(#pvOverlay, .cmp-overlay)) .cmp-tab { display: none; }
@media (hover: hover) { .cmp-tab:hover { padding-right: 10px; background: var(--indigo-deep, #2B2E73); } }
.cmp-tab:focus-visible { outline: 2px solid var(--burgundy, #761B2C); outline-offset: 2px; }
.cmp-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); }
.cmp-tab-count {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--burgundy, #761B2C);
  color: var(--cmp-on-fill);
  font-size: 12px;
  letter-spacing: 0;
}
.cmp-tab.is-pulse { animation: cmpPulse .9s ease; }
@keyframes cmpPulse {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  30% { transform: translateY(-50%) translateX(8px); }
  60% { transform: translateY(-50%) translateX(2px); }
}
html[data-theme="dark"] .cmp-tab { --cmp-on-fill: #13142C; }
@media (prefers-reduced-motion: reduce) { .cmp-tab.is-pulse { animation: none; } }
@media (max-width: 640px) {
  /* Not mid-screen: on a phone a tab there sits on top of the product grid. */
  .cmp-tab { top: auto; bottom: 108px; transform: none; padding: 10px 5px 8px; font-size: 11px; }
  @keyframes cmpPulse { 0%, 100% { translate: 0 0; } 40% { translate: 8px 0; } }
}

/* ---------- The window ---------- */
.cmp-overlay { z-index: 1010; }       /* above a product window opened underneath it */
.cmp-card { width: min(1120px, 96vw); padding: 30px 34px 36px; }
.cmp-close { position: absolute; top: 18px; right: 18px; z-index: 5; }
.cmp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.cmp-top { margin: 0 44px 18px 0; }
.cmp-title { font: 500 clamp(24px, 3vw, 32px)/1.15 var(--font-display, 'Outfit', sans-serif); color: var(--ink); margin: 0; letter-spacing: -0.01em; }
.cmp-count { font: 400 15px var(--font-sans, 'Inter', sans-serif); color: var(--ink2); letter-spacing: 0; }
.cmp-sub { margin: 6px 0 0; font-size: 13.5px; color: var(--ink2); }
.cmp-none { color: var(--ink2); font-size: 15px; margin: 18px 0 8px; }

.cmp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--hair); border-radius: 14px; background: var(--bg-page); }
.cmp-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-sans, 'Inter', sans-serif);
  color: var(--ink);
}
.cmp-corner { width: 148px; }

/* The product header row */
.cmp-prod, .cmp-addcol { vertical-align: top; padding: 20px 12px 22px; text-align: center; font-weight: 400; }
.cmp-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--plate, #FFF6E3);
  border: 1px solid var(--hair);
  border-radius: 12px;
  overflow: hidden;
}
.cmp-thumb img { width: 88%; height: 88%; object-fit: contain; mix-blend-mode: multiply; }
html[data-theme="dark"] .cmp-thumb, html[data-theme="dark"] .cmp-result-img { background: #F3E6CC; }
.cmp-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(28, 29, 61, 0.1);
  color: #1C1D3D;
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s ease, color .15s ease;
}
.cmp-remove:hover { background: #1C1D3D; color: #F8EEDB; }
.cmp-name {
  display: block;
  margin: 14px 4px 6px;
  font: 600 15px/1.35 var(--font-sans, 'Inter', sans-serif);
  color: var(--ink);
  text-decoration: none;
}
.cmp-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.cmp-price { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 8px; font-size: 14px; }
.cmp-price strong { font-size: 17px; font-weight: 700; color: var(--ink); }
.cmp-price s { color: var(--ink2); }
.cmp-off { color: var(--burgundy, #761B2C); font-weight: 600; font-size: 13px; }
.cmp-price-na { color: var(--ink2); font-size: 13px; }
.cmp-buy {
  --cmp-btn: #1C1D3D;
  --cmp-btn-ink: #F8EEDB;
  margin-top: 14px;
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 980px;
  background: var(--cmp-btn);
  color: var(--cmp-btn-ink);
  font: 600 14px var(--font-sans, 'Inter', sans-serif);
  cursor: pointer;
  transition: background .2s ease;
}
html[data-theme="dark"] .cmp-buy { --cmp-btn: #F8EEDB; --cmp-btn-ink: #13142C; }
@media (hover: hover) { .cmp-buy:hover:not(:disabled) { background: #5E5870; color: #F8EEDB; } }
.cmp-buy:disabled { opacity: 0.45; cursor: not-allowed; }
.cmp-buy:focus-visible, .cmp-remove:focus-visible, .cmp-result:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* The Add product box */
.cmp-addbox { text-align: left; background: var(--surface-secondary); border: 1px solid var(--hair); border-radius: 12px; padding: 14px; }
.cmp-add-title { margin: 0 0 10px; font: 500 17px var(--font-display, 'Outfit', sans-serif); color: var(--ink); }
.cmp-search {
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-regular);
  border-radius: 10px;
  background: var(--bg-page);
  color: var(--ink);
  font: 400 14px var(--font-sans, 'Inter', sans-serif);
}
.cmp-search:focus { outline: 2px solid var(--indigo); outline-offset: 1px; }
.cmp-results-label { margin: 12px 2px 6px; font: 600 11px var(--font-sans, 'Inter', sans-serif); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink2); }
.cmp-results { list-style: none; margin: 0; padding: 0; max-height: 232px; overflow-y: auto; overscroll-behavior: contain; }
.cmp-result {
  width: 100%;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
@media (hover: hover) { .cmp-result:hover { background: var(--surface-tertiary); } }
.cmp-result-img { width: 44px; height: 44px; display: grid; place-items: center; background: var(--plate, #FFF6E3); border-radius: 8px; overflow: hidden; }
.cmp-result-img img { width: 90%; height: 90%; object-fit: contain; mix-blend-mode: multiply; }
.cmp-result-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cmp-result-name { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmp-result-price { font-size: 12.5px; color: var(--ink2); }
.cmp-empty { padding: 8px 4px; font-size: 13px; color: var(--ink2); }

/* The rows: a label column, then one value per product */
.cmp-table tbody th, .cmp-table tbody td { padding: 15px 14px; border-top: 1px solid var(--hair); font-size: 14.5px; line-height: 1.4; vertical-align: top; }
.cmp-table tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left;
  font-weight: 600;
  background: var(--surface-secondary);
  color: var(--ink);
}
.cmp-table tbody td { text-align: center; overflow-wrap: anywhere; }
.cmp-dash { color: var(--ink2); }
.cmp-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.cmp-chips span { padding: 3px 9px; border: 1px solid var(--border-regular); border-radius: 980px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* Phones and small tablets: the table fits the sheet. It was 600-720px wide inside a card a
   phone cannot show, so one product and a sliver of the next was all there was to see and the
   rest scrolled sideways. Now every column shares the width, the labels take a narrow column,
   and the Add product box sits under the table (compare.js) instead of taking a column. */
@media (max-width: 768px) {
  .cmp-card { width: min(1120px, 96vw) !important; }   /* responsive.css caps .modal-card at 540px */
  .cmp-table { min-width: 0; }
  .cmp-corner { width: 21%; }
}
@media (max-width: 640px) {
  .cmp-card { padding: 22px 12px 24px; }
  .cmp-close { top: 14px; right: 14px; }
  .cmp-top { margin-right: 56px; }
  .cmp-title { font-size: 22px; }
  .cmp-sub { font-size: 12.5px; }
  .cmp-prod { padding: 10px 5px 14px; }
  .cmp-thumb { border-radius: 9px; }
  .cmp-remove { top: 4px; right: 4px; width: 22px; height: 22px; font-size: 10px; }
  .cmp-name { margin: 9px 0 4px; font-size: 12px; line-height: 1.3; }
  .cmp-price { gap: 2px 5px; font-size: 11px; }
  .cmp-price strong { font-size: 14px; }
  .cmp-off { font-size: 11px; }
  .cmp-buy { width: 100%; height: auto; min-height: 34px; margin-top: 9px; padding: 6px 4px; font-size: 11.5px; line-height: 1.2; }
  .cmp-table tbody th { padding: 10px 6px; font-size: 11.5px; }
  .cmp-table tbody td { padding: 10px 4px; font-size: 12px; line-height: 1.3; }
  .cmp-chips { gap: 4px; }
  .cmp-chips span { padding: 2px 6px; font-size: 11px; }
  .cmp-addbelow { margin-top: 14px; }
}
