
/*!
 * Adept Technologies
 * storefront.css
 *
 * Shared storefront enhancement stylesheet.
 * Works alongside existing per-page CSS and storefront.js.
 *
 * Add AFTER each page's original stylesheet.
 * Do not remove existing styles.
 *
 * Version: 1.1.0 — compact product cards
 */

/* =========================================
   1. SHARED CONFIGURATION
   ========================================= */

:root {
  --sf-accent: var(
    --teal,
    var(--green, var(--lake, var(--blue, #087b75)))
  );

  --sf-focus: #e98343;
  --sf-success-bg: #dff5e9;
  --sf-success-text: #17634d;
  --sf-hold-bg: #fff1cb;
  --sf-hold-text: #785b12;
  --sf-sold-bg: #e7ece9;
  --sf-sold-text: #596864;
  --sf-unknown-bg: #e7eef7;
  --sf-unknown-text: #334e70;
}

/* =========================================
   2. PRODUCT CARD STABILITY
   ========================================= */

:where(#catalog) > :is(.card, .product-card) {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

:where(#catalog)
:is(.card-top, .product-top, .product-heading) {
  min-width: 0;
}

:where(#catalog)
:is(.card-top, .product-top, .product-heading)
> :first-child {
  min-width: 0;
}

:where(#catalog)
:is(.card-title, .product-title, h3) {
  overflow-wrap: anywhere;
}

:where(#catalog)
:is(.price, .product-price) {
  font-variant-numeric: tabular-nums;
  max-width: 100%;
}

/* =========================================
   3. IMAGE GALLERY COMPATIBILITY
   ========================================= */

:where(#catalog)
:is(.gallery, .product-gallery) {
  min-width: 0;
  max-width: 100%;
}

:where(#catalog)
:is(.main-photo-wrap, .main-photo) {
  max-width: 100%;
}

:where(#catalog)
:is(.main-photo-wrap, .main-photo):is(button) {
  touch-action: manipulation;
  cursor: zoom-in;
}

:where(#catalog)
:is(.main-photo-wrap, .main-photo) img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Thumbnail strips */

:where(#catalog)
:is(.thumbs, .photo-thumbs) {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

:where(#catalog)
:is(.thumb, .photo-thumb) {
  touch-action: manipulation;
}

:where(#catalog)
:is(.thumb, .photo-thumb) img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Wixom uses aria-pressed instead of .active */

:where(#catalog)
.photo-thumb[aria-pressed="true"] {
  outline: 2px solid var(--sf-accent);
  outline-offset: 1px;
}

/* =========================================
   4. PRODUCT SPECIFICATIONS
   ========================================= */

:where(#catalog)
:is(.specs, .product-specs) {
  min-width: 0;
  max-width: 100%;
}

:where(#catalog)
:is(.specs, .product-specs) > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Definition lists used by most city pages */

:where(#catalog) dl.specs dt {
  overflow-wrap: anywhere;
}

:where(#catalog) dl.specs dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* =========================================
   5. INVENTORY STATUS BADGES
   ========================================= */

/*
 * Harmonize status colors.
 * Leave badge fonts, padding, and shape
 * to each page's original stylesheet.
 */

:where(#catalog)
:is(.pill, .status, .status-pill).available {
  background-color: var(--sf-success-bg);
  color: var(--sf-success-text);
}

:where(#catalog)
:is(.pill, .status, .status-pill).hold {
  background-color: var(--sf-hold-bg);
  color: var(--sf-hold-text);
}

:where(#catalog)
:is(.pill, .status, .status-pill).sold {
  background-color: var(--sf-sold-bg);
  color: var(--sf-sold-text);
}

:where(#catalog)
:is(.pill, .status, .status-pill).unknown {
  background-color: var(--sf-unknown-bg);
  color: var(--sf-unknown-text);
}

/* =========================================
   6. CHECKOUT AND DISABLED STATES
   ========================================= */

:where(#catalog)
:is(
  .buy-btn,
  .buy-button,
  .btn,
  .button,
  .btn-disabled
)[aria-disabled="true"],
:where(#catalog)
:is(
  .buy-btn,
  .buy-button,
  .btn,
  .button,
  .btn-disabled
).disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.65;
  filter: grayscale(0.15);
  text-decoration: none;
}

:where(#catalog)
:is(
  .card-foot,
  .product-footer,
  .product-bottom,
  .card-bottom
) {
  min-width: 0;
}

:where(#catalog)
:is(.buy-btn, .buy-button, .btn, .button) {
  touch-action: manipulation;
}

/* =========================================
   7. SEARCH AND FILTER CONTROLS
   ========================================= */

#search {
  min-width: 0;
  max-width: 100%;
}

.filter-btn {
  touch-action: manipulation;
}

/* Keep pressed state accessible */

.filter-btn[aria-pressed="true"] {
  font-weight: 700;
}

/* Keyboard focus */

:where(#catalog)
:is(button, a):focus-visible,
.filter-btn:focus-visible,
#search:focus-visible {
  outline: 3px solid var(--sf-focus);
  outline-offset: 3px;
}

/* =========================================
   8. EMPTY AND LOADING STATES
   ========================================= */

#catalog > .empty-state {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
}

#catalog > .empty-state p,
#catalog > .empty-state a {
  overflow-wrap: anywhere;
}

#catalog[aria-busy="true"] {
  min-height: 120px;
}

:where(#catalog) .no-photo {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* =========================================
   9. SHARED PHOTO LIGHTBOX
   ========================================= */

/*
 * Critical compatibility fix:
 * A modal's display:grid or display:flex
 * must never override HTML's hidden state.
 */

#image-modal[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

#image-modal {
  box-sizing: border-box;
}

#image-modal .modal-content {
  min-width: 0;
  max-width: min(100%, 1100px);
}

#image-modal #modal-img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  max-height: 80dvh;
  object-fit: contain;
}

#image-modal
:is(#modal-close, #modal-prev, #modal-next) {
  touch-action: manipulation;
}

#image-modal
:is(#modal-close, #modal-prev, #modal-next)[hidden] {
  display: none !important;
}

#image-modal
:is(#modal-close, #modal-prev, #modal-next):focus-visible {
  outline: 3px solid var(--sf-focus);
  outline-offset: 3px;
}

#image-modal #modal-caption {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* =========================================
   10. MOBILE STOREFRONT ADJUSTMENTS
   ========================================= */

@media (max-width: 640px) {

  /* Only change the inventory grid */

  #catalog:is(
    .catalog-grid,
    .product-grid,
    .inventory-grid,
    .products-grid
  ) {
    grid-template-columns: minmax(0, 1fr);
  }

  #catalog > :is(.card, .product-card) {
    min-width: 0;
    max-width: 100%;
  }

  /* Allow prices and titles to fit */

  :where(#catalog)
  :is(.card-top, .product-top, .product-heading) {
    flex-wrap: wrap;
    gap: 10px;
  }

  :where(#catalog)
  :is(.price, .product-price) {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Prevent footer button overflow */

  :where(#catalog)
  :is(
    .card-foot,
    .product-footer,
    .product-bottom,
    .card-bottom
  ) {
    flex-wrap: wrap;
    gap: 12px;
  }

  :where(#catalog)
  :is(
    .card-foot,
    .product-footer,
    .product-bottom,
    .card-bottom
  ) > * {
    max-width: 100%;
  }

  /* Make photo modal fit phone screens */

  #image-modal {
    padding-inline: 12px;
  }

  #image-modal .modal-content {
    max-width: 100%;
  }

  #image-modal #modal-img {
    max-height: 72vh;
    max-height: 72dvh;
  }

  #image-modal #modal-prev {
    left: 0;
  }

  #image-modal #modal-next {
    right: 0;
  }
}

/* =========================================
   11. SMALL PHONE ADJUSTMENTS
   ========================================= */

@media (max-width: 420px) {

  :where(#catalog)
  :is(.specs, .product-specs) {
    max-width: 100%;
  }

  :where(#catalog)
  :is(.thumbs, .photo-thumbs) {
    gap: 6px;
  }

  #image-modal #modal-img {
    max-height: 65vh;
    max-height: 65dvh;
  }
}

/* =========================================
   12. ACCESSIBILITY
   ========================================= */

@media (prefers-reduced-motion: reduce) {

  #catalog *,
  #image-modal * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {

  :where(#catalog)
  :is(.thumb, .photo-thumb)[aria-pressed="true"] {
    outline: 2px solid Highlight;
  }

  :where(#catalog)
  :is(
    .buy-btn,
    .buy-button,
    .btn,
    .button
  )[aria-disabled="true"] {
    color: GrayText;
  }
}


/* =========================================
   13. COMPACT, READABLE PRODUCT PREVIEW CARDS
   =========================================
   Product pages remain unchanged. These selectors are
   restricted to #catalog, across all storefront profiles.
 */

#catalog > :is(.card, .product-card) {
  gap: 10px;
  padding: 14px;
}

#catalog :is(.gallery, .product-gallery) {
  gap: 6px;
}

/* Use a shorter photo pane, but never crop the computer. */
#catalog :is(.main-photo-wrap, .main-photo) {
  width: 100%;
  height: 170px;
  aspect-ratio: auto;
  min-height: 0;
}

#catalog :is(.main-photo-wrap, .main-photo) img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Still comfortably tappable, with less wasted strip height. */
#catalog :is(.thumbs, .photo-thumbs) {
  gap: 5px;
  padding: 1px 1px 3px;
}

#catalog :is(.thumb, .photo-thumb) {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

#catalog :is(.card-top, .product-top, .product-heading) {
  gap: 8px;
  align-items: flex-start;
}

#catalog :is(.card-title, .product-title, .card-top h3, .product-top h3, .product-heading h3) {
  font-size: 17px;
  line-height: 1.3;
  margin-bottom: 5px;
  overflow-wrap: break-word;
}

#catalog :is(.price, .product-price) {
  font-size: 18px;
  line-height: 1.3;
  flex-shrink: 0;
}

#catalog :is(.pill, .status, .status-pill) {
  margin-top: 2px;
  padding: 4px 8px;
}

/* Compact specs keep all four fields and their full values. */
#catalog :is(.specs, .product-specs) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  padding: 10px 11px;
  margin: 0;
}

#catalog :is(.specs, .product-specs) > div {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
}

#catalog :is(.specs, .product-specs) :is(dt, strong, b) {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 3px;
  letter-spacing: .025em;
  text-transform: uppercase;
}

#catalog :is(.specs, .product-specs) :is(dd, span) {
  display: block;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: break-word;
}

/* Charger and power-cable information share one short row. */
#catalog .sf-included-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  margin: 0;
}

#catalog .sf-included {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--sf-success-bg);
  color: var(--sf-success-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

#catalog .sf-included.sf-not-included {
  background: var(--sf-sold-bg);
  color: var(--sf-sold-text);
}

/* Condition occupies a short line; CTAs take the full row. */
#catalog :is(.card-foot, .product-footer, .product-bottom, .card-bottom) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  padding-top: 10px;
  margin-top: auto;
}

#catalog :is(.condition, .product-condition) {
  display: block;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.4;
}

#catalog .sf-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

#catalog .sf-card-actions > :is(a, span) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 9px 7px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  border-radius: 8px;
  text-decoration: none;
  box-sizing: border-box;
}

#catalog .sf-card-actions .sf-details-link {
  color: var(--sf-accent);
  border: 1px solid currentColor;
  background: transparent;
}

#catalog .sf-card-actions .sf-details-link:hover {
  background: var(--sf-success-bg);
}

/* Very narrow cards must remain legible without horizontal overflow. */
@media (max-width: 420px) {
  #catalog > :is(.card, .product-card) {
    padding: 12px;
  }

  #catalog :is(.main-photo-wrap, .main-photo) {
    height: 175px;
  }

  #catalog :is(.specs, .product-specs) {
    gap: 8px;
    padding: 9px;
  }
}

/* Only very narrow phones switch to a single text column. */
@media (max-width: 340px) {
  #catalog :is(.specs, .product-specs),
  #catalog .sf-card-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* End of storefront.css */
