/* ──────────────────────────────────────────────────────────────────────
   Compare window (public/js/compare.js, views/partials/compare-modal.ejs).
   Colours, fonts, spacing and radii are the site tokens from main.css; nothing new.
   Pieces: the Compare button on a product card, the tray at the bottom of the screen, the window itself
   (header, picker, comparison table, "true size" 3D section) and the Compare button on the product page.
   ────────────────────────────────────────────────────────────────────── */

/* ── Compare button on a product card (added by compare.js; top-right of the photo, badges are top-left) ── */
.cmp-card-btn {
  position: absolute;
  top: var(--space-3, 0.75rem);
  right: var(--space-3, 0.75rem);
  z-index: 3;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-light, #EDE0CE);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-brown-mid, #7A5C44);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-xs, 0 1px 3px rgba(44, 36, 24, 0.06));
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--transition-fast, 150ms ease), color var(--transition-fast, 150ms ease), border-color var(--transition-fast, 150ms ease);
}
/* the visible circle stays 34px; this ring makes the tap target 44px */
.cmp-card-btn::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.cmp-card-btn:hover { border-color: var(--color-primary, #C8A882); color: var(--color-primary-dark, #A8845E); }
.cmp-card-btn:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }
.cmp-card-btn[aria-pressed="true"] {
  background: var(--color-primary-dark, #A8845E);
  border-color: var(--color-primary-dark, #A8845E);
  color: #fff;
}
body.admin-viewing .cmp-card-btn { display: none; }

/* ── Compare button on the product page ── */
.pd-compare-row { margin-top: 0.75rem; }
.btn-pd-compare {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  color: var(--color-brown-dark, #4A3728);
  border: 1.5px solid var(--color-brown-dark, #4A3728);
  border-radius: var(--radius-md, 8px);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all var(--transition-base, 250ms ease);
}
.btn-pd-compare i { font-size: 1.1rem; }
.btn-pd-compare:hover { background: var(--color-primary-xlight, #F5EDE0); border-color: var(--color-charcoal, #2C2418); color: var(--color-charcoal, #2C2418); }
.btn-pd-compare:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }
@media (max-width: 479px) {
  .btn-pd-compare { padding: 0.65rem 1rem; font-size: 0.82rem; }
}

/* ── Tray: what has been picked so far, at the bottom of the screen ── */
.cmp-tray {
  position: fixed;
  z-index: 1035; /* above the page and the sticky navbar (1000), below every modal (1050+) and the chat bubble */
  left: 12px;
  right: 12px;
  /* leaves room for the chat bubble that sits at the bottom-right on every store page */
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
  background: var(--color-charcoal, #2C2418);
  color: var(--color-cream, #FAF6F0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(44, 36, 24, 0.12));
}
.cmp-tray[hidden] { display: none; }
.cmp-tray-items { display: flex; gap: var(--space-2, 0.5rem); min-width: 0; flex: 1 1 auto; overflow: hidden; }
.cmp-tray-item {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md, 8px);
  background: #fff center / contain no-repeat;
  cursor: pointer;
  overflow: hidden;
}
.cmp-tray-item:hover { border-color: var(--color-primary, #C8A882); }
.cmp-tray-item:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }
.cmp-tray-item img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cmp-tray-item-x {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(44, 36, 24, 0.62);
  color: #fff;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity var(--transition-fast, 150ms ease);
}
.cmp-tray-item:hover .cmp-tray-item-x,
.cmp-tray-item:focus-visible .cmp-tray-item-x { opacity: 1; }
@media (hover: none) { .cmp-tray-item-x { opacity: 1; background: rgba(44, 36, 24, 0.5); font-size: 0.7rem; align-items: flex-end; justify-content: flex-end; padding: 2px; } }
.cmp-tray-more {
  flex: 0 0 auto;
  min-width: 44px;
  height: 44px;
  padding: 0 0.5rem;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md, 8px);
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-cream, #FAF6F0);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--fs-sm, 0.875rem);
  font-weight: var(--fw-semibold, 600);
  cursor: pointer;
}
.cmp-tray-more:hover { border-color: var(--color-primary, #C8A882); }
.cmp-tray-actions { display: flex; align-items: center; gap: var(--space-2, 0.5rem); flex: 0 0 auto; }
.cmp-tray-count { font-size: var(--fs-xs, 0.75rem); color: var(--color-primary-light, #E8D5BC); white-space: nowrap; }
.cmp-tray-open {
  border: none;
  border-radius: var(--radius-full, 9999px);
  background: var(--color-primary, #C8A882);
  color: var(--color-charcoal, #2C2418);
  padding: 0.55rem 1.1rem;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--fs-sm, 0.875rem);
  font-weight: var(--fw-semibold, 600);
  white-space: nowrap;
  cursor: pointer;
}
.cmp-tray-open:hover { background: var(--color-primary-light, #E8D5BC); }
.cmp-tray-clear {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-primary-light, #E8D5BC);
  cursor: pointer;
}
.cmp-tray-clear:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.cmp-tray button:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }
@media (min-width: 900px) {
  .cmp-tray { left: 24px; right: auto; bottom: 24px; width: min(560px, calc(100vw - 220px)); }
}
@media (max-width: 575.98px) {
  .cmp-tray-open { min-height: 44px; }
  .cmp-tray-clear { width: 44px; height: 44px; }
}
@media (max-width: 400px) {
  .cmp-tray-count { display: none; }
  .cmp-tray-item { width: 38px; height: 38px; }
  .cmp-tray-more { min-width: 38px; height: 38px; }
}

/* ── The window ── */
.cmp-dialog { margin-left: auto; margin-right: auto; }
@media (min-width: 576px) {
  .cmp-dialog { max-width: min(1140px, calc(100vw - 1.5rem)); }
}
.cmp-content {
  border: none;
  border-radius: var(--radius-lg, 12px);
  background: var(--bg-card, #fff);
  overflow: hidden;
}
@media (max-width: 575.98px) { .cmp-content { border-radius: 0; } }

.cmp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3, 0.75rem);
  padding: 1.1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--color-stone, #D4C4B0);
}
.cmp-eyebrow {
  margin: 0 0 0.15rem;
  font-size: var(--fs-xs, 0.75rem);
  color: var(--color-brown-light, #B08060);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cmp-title {
  margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: var(--fs-xl, 1.5rem);
  color: var(--color-charcoal, #2C2418);
  line-height: var(--lh-tight, 1.15);
}
.cmp-sub { margin: 0.25rem 0 0; font-size: var(--fs-sm, 0.875rem); color: var(--color-brown-mid, #7A5C44); }
.cmp-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-brown-mid, #7A5C44);
  font-size: 1.1rem;
  cursor: pointer;
}
.cmp-close:hover { background: var(--color-primary-xlight, #F5EDE0); color: var(--color-charcoal, #2C2418); }
.cmp-close:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }

.cmp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2, 0.5rem) var(--space-4, 1rem);
  padding: 0.65rem 1.25rem;
  background: var(--bg-section-alt, #F5EDE0);
  border-bottom: 1px solid var(--border-light, #EDE0CE);
}
.cmp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border: 1.5px solid var(--color-stone, #D4C4B0);
  border-radius: var(--radius-full, 9999px);
  background: var(--bg-card, #fff);
  color: var(--color-brown-mid, #7A5C44);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--fs-sm, 0.875rem);
  font-weight: var(--fw-medium, 500);
  cursor: pointer;
  transition: all 0.18s;
}
.cmp-btn:hover:not(:disabled) { border-color: var(--color-primary, #C8A882); color: var(--color-primary-dark, #A8845E); }
.cmp-btn:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }
.cmp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cmp-btn[hidden] { display: none; }
.cmp-btn--primary { background: var(--color-primary-dark, #A8845E); border-color: var(--color-primary-dark, #A8845E); color: #fff; }
.cmp-btn--primary:hover:not(:disabled) { background: var(--color-brown-mid, #7A5C44); border-color: var(--color-brown-mid, #7A5C44); color: #fff; }
.cmp-btn--link { border-color: transparent; background: transparent; padding-left: 0.4rem; padding-right: 0.4rem; text-decoration: underline; text-underline-offset: 3px; }
/* "Add to Cart" and "Buy Now" under each product (2026-11-16): one above the other, as wide as the column; the pop-up of the shop's cards does the rest. */
.cmp-order { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; }
.cmp-order .cmp-btn { width: 100%; justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; white-space: nowrap; min-height: 44px; } /* the main action: a 44px tap target at every width */
.cmp-table td > .cmp-btn--link { padding-left: 0; text-align: left; }
.cmp-check { display: inline-flex; align-items: center; gap: 0.45rem; font-size: var(--fs-sm, 0.875rem); color: var(--color-brown-mid, #7A5C44); cursor: pointer; margin: 0; }
.cmp-check input { width: 1.05rem; height: 1.05rem; accent-color: var(--color-primary-dark, #A8845E); }
/* Add and Clear all sit together at the right, "Differences Only" at the far left; if a narrow screen cannot hold all three on one row the pair
   moves down as a unit and stays at the right. */
.cmp-toolbar-actions { display: flex; align-items: center; gap: var(--space-2, 0.5rem); margin-left: auto; }

.cmp-body { padding: 0; }

/* Picker */
.cmp-picker {
  padding: 0.85rem 1.25rem;
  background: var(--bg-section-alt, #F5EDE0);
  border-bottom: 1px solid var(--color-stone, #D4C4B0);
}
.cmp-picker[hidden] { display: none; }
.cmp-picker-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3, 0.75rem); margin-bottom: 0.5rem; }
.cmp-picker-hint { font-size: var(--fs-sm, 0.875rem); color: var(--color-brown-mid, #7A5C44); }
.cmp-picker-controls { display: flex; flex-wrap: wrap; gap: var(--space-2, 0.5rem); }
.cmp-input,
.cmp-select {
  min-height: 42px;
  padding: 0.45rem 0.8rem;
  border: 1.5px solid var(--color-stone, #D4C4B0);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-card, #fff);
  color: var(--color-charcoal, #2C2418);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: var(--fs-sm, 0.875rem);
}
.cmp-input { flex: 1 1 200px; min-width: 0; }
.cmp-select { flex: 0 1 210px; min-width: 0; max-width: 100%; }
.cmp-input:focus,
.cmp-select:focus { outline: none; border-color: var(--color-primary-dark, #A8845E); box-shadow: 0 0 0 3px rgba(200, 168, 130, 0.25); }
.cmp-picker-status { margin: 0.5rem 0 0; font-size: var(--fs-sm, 0.875rem); color: var(--color-brown-mid, #7A5C44); }
.cmp-results {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: var(--space-2, 0.5rem);
  max-height: min(260px, 34vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cmp-result {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-light, #EDE0CE);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-card, #fff);
}
.cmp-result img { flex: 0 0 auto; width: 46px; height: 46px; object-fit: contain; border-radius: var(--radius-sm, 4px); background: #fff; }
.cmp-result-text { flex: 1 1 auto; min-width: 0; }
.cmp-result-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: var(--fs-sm, 0.875rem); font-weight: var(--fw-semibold, 600); line-height: var(--lh-snug, 1.35); color: var(--color-charcoal, #2C2418); }
.cmp-result-meta { display: block; margin-top: 0.1rem; font-size: var(--fs-xs, 0.75rem); line-height: var(--lh-snug, 1.35); color: var(--color-brown-light, #B08060); overflow-wrap: anywhere; }
.cmp-result .cmp-btn { flex: 0 0 auto; padding: 0.35rem 0.8rem; }

/* Table */
.cmp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* The table is drawn in blocks of the products that fit side by side (compare.js blockSize): two to a block on a phone, like the shop's
   two-column grid, the next two underneath. A wide divider shows where one block ends. */
.cmp-blocks > .cmp-scroll + .cmp-scroll { border-top: 8px solid var(--bg-section-alt, #F5EDE0); }
.cmp-table {
  width: 100%;
  /* 9.25rem a product (was 9.75rem): four products fit the 744px window of a 768px tablet; compare.js blockSize uses the same numbers */
  min-width: calc(7.75rem + var(--cmp-cols, 2) * 9.25rem);
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.cmp-table col.cmp-col-label { width: 7.75rem; }
.cmp-table th,
.cmp-table td { padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--border-light, #EDE0CE); vertical-align: top; text-align: left; font-size: var(--fs-sm, 0.875rem); color: var(--color-brown-dark, #4A3728); }
.cmp-table .cmp-rowhead {
  position: sticky;
  left: 0;
  z-index: 2;
  /* the same 1.25rem the window's header and toolbar are indented by, so the labels line up with the title and never touch the window's edge */
  padding-left: 1.25rem;
  padding-right: 0.5rem;
  background: var(--bg-card, #fff);
  font-size: var(--fs-xs, 0.75rem);
  font-weight: var(--fw-semibold, 600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-brown-light, #B08060);
  box-shadow: 1px 0 0 var(--color-stone, #D4C4B0);
}
/* A vertical line between the product columns (and under the photos), so the side-by-side values are easy to tell apart. A little stronger
   than the lines between rows. The first product's column has no line of its own: the label column's edge (above) is its line. On a phone
   the row draws these lines instead (see the phone block). */
.cmp-table td + td,
.cmp-table .cmp-colhead + .cmp-colhead { border-left: 1px solid var(--color-stone, #D4C4B0); }
.cmp-table tr.cmp-row--same.is-hidden { display: none; }
.cmp-table tbody tr:last-child th,
.cmp-table tbody tr:last-child td { border-bottom: none; }

.cmp-table .cmp-colhead { text-align: center; position: relative; padding-top: 1rem; }
.cmp-photo { display: block; width: 100%; max-width: 150px; aspect-ratio: 1 / 1; object-fit: contain; margin: 0 auto 0.5rem; background: #fff; border-radius: var(--radius-md, 8px); }
.cmp-name { display: block; font-family: var(--font-display, Georgia, serif); font-size: var(--fs-md, 1.125rem); font-weight: 600; line-height: var(--lh-snug, 1.35); color: var(--color-charcoal, #2C2418); text-decoration: none; overflow-wrap: anywhere; }
.cmp-name:hover { color: var(--color-primary-dark, #A8845E); }
.cmp-cat { display: block; margin-top: 0.15rem; font-size: var(--fs-xs, 0.75rem); color: var(--color-brown-light, #B08060); text-transform: uppercase; letter-spacing: 0.06em; }
.cmp-remove {
  position: absolute;
  top: 0.3rem;
  right: 0.2rem;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-brown-light, #B08060);
  cursor: pointer;
}
.cmp-remove:hover { background: var(--color-primary-xlight, #F5EDE0); color: var(--color-danger, #B85C4A); }
.cmp-remove:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }
.cmp-more-sizes { margin-top: 0.4rem; }

.cmp-size-select { width: 100%; min-height: 40px; padding: 0.35rem 0.5rem; }
.cmp-price { display: block; font-size: var(--fs-md, 1.125rem); font-weight: var(--fw-semibold, 600); color: var(--color-primary-dark, #A8845E); }
.cmp-price-was { display: block; font-size: var(--fs-xs, 0.75rem); color: var(--color-brown-light, #B08060); text-decoration: line-through; }
.cmp-event { display: inline-block; margin-top: 0.2rem; padding: 1px 8px; border-radius: var(--radius-full, 9999px); background: var(--color-primary-xlight, #F5EDE0); color: var(--color-primary-dark, #A8845E); font-size: var(--fs-xs, 0.75rem); font-weight: 600; }
.cmp-pill { display: inline-block; padding: 2px 10px; border-radius: var(--radius-full, 9999px); font-size: var(--fs-xs, 0.75rem); font-weight: 600; }
.cmp-pill--in { background: rgba(107, 143, 94, 0.14); color: var(--color-success, #6B8F5E); }
.cmp-pill--out { background: var(--color-danger-soft, rgba(184, 92, 74, 0.08)); color: var(--color-danger, #B85C4A); }
.cmp-pill--custom { background: var(--color-warning-soft, rgba(201, 147, 90, 0.14)); color: var(--color-warning-text, #8a5f2e); }
.cmp-pill--pre { margin-left: 0.3rem; background: var(--color-warning-soft, rgba(201, 147, 90, 0.14)); color: var(--color-warning-text, #8a5f2e); }
.cmp-na { color: var(--color-brown-light, #B08060); }
.cmp-max { font-weight: var(--fw-semibold, 600); color: var(--color-charcoal, #2C2418); }
.cmp-price.cmp-max { color: var(--color-primary-dark, #A8845E); }
.cmp-delta { display: block; font-size: var(--fs-xs, 0.75rem); color: var(--color-brown-light, #B08060); }

/* "At a glance": every size drawn as a box at the SAME scale, standing on one floor line */
.cmp-stage { display: flex; align-items: flex-end; justify-content: center; height: 150px; border-bottom: 2px solid var(--color-stone, #D4C4B0); }
.cmp-box { flex: 0 0 auto; box-sizing: border-box; background: var(--color-primary-light, #E8D5BC); border: 1.5px solid var(--color-primary-dark, #A8845E); border-radius: 3px; }
.cmp-box--bar { background: var(--color-primary-dark, #A8845E); border-radius: 2px; }
.cmp-stage-label { display: block; margin-top: 0.3rem; font-size: var(--fs-xs, 0.75rem); text-align: center; color: var(--color-brown-mid, #7A5C44); }
.cmp-stage-empty { display: flex; align-items: center; justify-content: center; height: 150px; font-size: var(--fs-xs, 0.75rem); color: var(--color-brown-light, #B08060); }

.cmp-state { padding: 2.5rem 1.25rem; text-align: center; color: var(--color-brown-mid, #7A5C44); }
.cmp-state i { display: block; font-size: 2rem; color: var(--color-primary, #C8A882); margin-bottom: 0.5rem; }
.cmp-notice { margin: 0; padding: 0.55rem 1.25rem; font-size: var(--fs-sm, 0.875rem); background: var(--color-warning-soft, rgba(201, 147, 90, 0.14)); color: var(--color-warning-text, #8a5f2e); }
.cmp-notice[hidden] { display: none; }

/* True-size 3D section */
.cmp-3d { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid var(--color-stone, #D4C4B0); background: var(--bg-section-alt, #F5EDE0); }
.cmp-3d[hidden] { display: none; }
.cmp-3d-title { margin: 0; font-family: var(--font-display, Georgia, serif); font-size: var(--fs-lg, 1.25rem); color: var(--color-charcoal, #2C2418); }
.cmp-3d-note { margin: 0.25rem 0 0.75rem; font-size: var(--fs-sm, 0.875rem); color: var(--color-brown-mid, #7A5C44); }
/* Two tiles to a row on a phone and a small tablet (a sideways list inside the window's own scrolling fought the model's horizontal drag),
   one row of all of them from 768px. */
.cmp-3d-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3, 0.75rem);
}
.cmp-3d-grid[hidden] { display: none; }
@media (min-width: 768px) {
  .cmp-3d-grid { grid-template-columns: repeat(var(--cmp-n, 2), minmax(0, 1fr)); }
}
.cmp-3d-tile { border: 1px solid var(--border-light, #EDE0CE); border-radius: var(--radius-md, 8px); background: var(--bg-card, #fff); overflow: hidden; min-width: 0; }
.cmp-3d-view { position: relative; height: 320px; background: var(--color-cream, #FAF6F0); }
@media (max-width: 575.98px) { .cmp-3d-view { height: 290px; } }

/* A tile's own buttons (zoom in, zoom out, back to the first view): one vertical line in its top-right corner, the same look as the
   product page's .mv-toggle-btn (34px round, translucent charcoal, an invisible ring that makes the tap target 44px). */
.cmp-3d-tools {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmp-3d-tools[hidden] { display: none; }
.cmp-3d-btn {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: rgba(44, 36, 24, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease;
}
.cmp-3d-btn[hidden] { display: none; }
.cmp-3d-btn::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.cmp-3d-btn:hover { background-color: rgba(44, 36, 24, 0.8); }
.cmp-3d-btn:focus-visible { outline: 2px solid var(--color-primary, #C8A882); outline-offset: 2px; }
.cmp-3d-view model-viewer {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent;
  --poster-color: transparent;
  --progress-bar-color: var(--color-primary-dark, #A8845E);
  touch-action: pan-y; /* a finger on the model still scrolls the window up and down */
}
.cmp-3d-status {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 1rem;
  text-align: center;
  font-size: var(--fs-sm, 0.875rem);
  color: var(--color-brown-mid, #7A5C44);
  pointer-events: none;
}
.cmp-3d-status[hidden] { display: none; }
.cmp-3d-cap { padding: 0.55rem 0.7rem; border-top: 1px solid var(--border-light, #EDE0CE); text-align: center; }
.cmp-3d-cap strong { display: block; font-size: var(--fs-sm, 0.875rem); color: var(--color-charcoal, #2C2418); overflow-wrap: anywhere; }
.cmp-3d-cap span { display: block; font-size: var(--fs-xs, 0.75rem); color: var(--color-brown-mid, #7A5C44); }
.cmp-3d-cap .cmp-3d-flag { margin-top: 0.15rem; color: var(--color-warning-text, #8a5f2e); }
.cmp-3d-cap .cmp-3d-flag[hidden] { display: none; }

.cmp-footer { padding: 0.9rem 1.25rem; border-top: 1px solid var(--border-light, #EDE0CE); font-size: var(--fs-xs, 0.75rem); color: var(--color-brown-light, #B08060); line-height: var(--lh-snug, 1.35); }

/* Phones: the picker takes the whole window while it is open (the table is behind it, one tap on Done away) */
@media (max-width: 575.98px) {
  .cmp-content.cmp-picking .cmp-body { display: none; }
  .cmp-content.cmp-picking .cmp-picker { flex: 1 1 auto; overflow-y: auto; border-bottom: none; }
  .cmp-content.cmp-picking .cmp-results { max-height: none; overflow: visible; grid-template-columns: 1fr; }
  .cmp-long { display: none; }
  .cmp-header { padding: 0.75rem 1rem 0.55rem; align-items: center; }
  .cmp-eyebrow { display: none; }
  .cmp-title { font-size: var(--fs-lg, 1.25rem); }
  .cmp-sub { margin-top: 0.1rem; }
  .cmp-close { width: 44px; height: 44px; margin-right: -0.5rem; }
  .cmp-toolbar { padding: 0.45rem 1rem; gap: 0.25rem 0.5rem; }
  .cmp-toolbar .cmp-btn--primary { padding-left: 0.8rem; padding-right: 0.8rem; }
  .cmp-picker { padding: 0.85rem 1rem; }
  .cmp-notice { padding: 0.55rem 1rem; }

  /* Tap targets of about 44px */
  .cmp-btn, .cmp-check { min-height: 44px; }
  .cmp-btn--link { padding-left: 0.5rem; padding-right: 0.5rem; }
  .cmp-input, .cmp-select, .cmp-size-select { min-height: 44px; }
  /* The search box and the category list are each a full line of the picker, so the list is exactly as wide as the box (it used to stay 210px
     under a full-width box). */
  .cmp-picker-controls .cmp-input, .cmp-picker-controls .cmp-select { flex: 1 1 100%; }
  .cmp-remove::after { content: ""; position: absolute; inset: -7px; }

  /* The table has no label column on a phone: that column took a quarter of the screen and pushed the products out of sight. Each row is a
     small caption (the label, which stays at the left edge if the table is wider than the screen) with the values right under it in equal
     columns. Up to three products fit side by side on any phone and four on most; only four on the narrowest ones scroll a little. */
  .cmp-table { display: block; min-width: calc(var(--cmp-cols, 2) * 5.9rem); table-layout: auto; }
  .cmp-table colgroup { display: none; }
  .cmp-table thead, .cmp-table tbody { display: block; }
  .cmp-table tr { display: grid; grid-template-columns: repeat(var(--cmp-cols, 2), minmax(0, 1fr)); padding: 0 0.5rem; border-bottom: 1px solid var(--border-light, #EDE0CE); }
  .cmp-table tr { position: relative; } /* the containing block of the column lines below */
  /* The vertical lines between the products. Each row draws them itself, from top to bottom, so they run straight through the caption line of
     the row too (a border on each cell would break at every label). The strip is as wide as all the columns but the last, with one 1px line at
     the end of each repeat: --cmp-cols - 1 lines. With a single column the division is invalid, so there is no background and no line. */
  .cmp-table td + td, .cmp-table .cmp-colhead + .cmp-colhead { border-left: none; }
  .cmp-table tr::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.5rem;
    width: calc((100% - 1rem) * (var(--cmp-cols, 2) - 1) / var(--cmp-cols, 2));
    background: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / (var(--cmp-cols, 2) - 1) - 1px), var(--color-stone, #D4C4B0) calc(100% / (var(--cmp-cols, 2) - 1) - 1px), var(--color-stone, #D4C4B0) calc(100% / (var(--cmp-cols, 2) - 1)));
    pointer-events: none;
  }
  .cmp-table tr.cmp-row--same.is-hidden { display: none; }
  .cmp-table tbody tr:last-child { border-bottom: none; }
  .cmp-table th, .cmp-table td { border-bottom: none; min-width: 0; }
  .cmp-table thead .cmp-rowhead { display: none; }
  .cmp-table tbody .cmp-rowhead {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 0.7rem 0.5rem 0.1rem;
    background: transparent;
    box-shadow: none;
  }
  /* every column the same width: the 1rem edge of the window is the row's 0.5rem plus the cell's 0.5rem */
  .cmp-table td { padding: 0.2rem 0.5rem 0.75rem; overflow-wrap: anywhere; }
  .cmp-table .cmp-colhead { padding: 0.75rem 0.5rem 0.6rem; }
  .cmp-photo { max-width: 96px; margin-bottom: 0.4rem; }
  .cmp-name { font-size: var(--fs-base, 1rem); }
  .cmp-price { font-size: var(--fs-base, 1rem); }
  .cmp-remove {
    top: 0.45rem;
    right: 0.4rem;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-light, #EDE0CE);
    box-shadow: var(--shadow-xs, 0 1px 3px rgba(44, 36, 24, 0.06));
  }
  .cmp-stage, .cmp-stage-empty { height: 120px; }

  /* The 3D section */
  .cmp-3d { padding: 1rem; }
  .cmp-3d-grid { gap: var(--space-2, 0.5rem); }
  .cmp-3d-cap { padding: 0.45rem 0.4rem; }
  .cmp-footer { padding: 0.9rem 1rem; }
}

/* The very narrowest phones (320px): "Differences Only", Add and Clear all need about 14px more than the toolbar has, so the buttons and the
   gaps are a little tighter and all three stay on one row. */
@media (max-width: 359.98px) {
  .cmp-toolbar { gap: 0.25rem 0.35rem; }
  .cmp-toolbar-actions { gap: 0.35rem; }
  .cmp-toolbar .cmp-btn--primary { padding-left: 0.6rem; padding-right: 0.6rem; }
}

/* The window keeps the page behind it from scrolling (main.js adds .mira-modal-scroll-lock); nothing else needed. */
@media (prefers-reduced-motion: reduce) {
  .cmp-btn, .cmp-card-btn, .cmp-tray-item-x, .cmp-3d-btn { transition: none; }
}
