/* Grocery shelf exercise -- real planogram layout rendered from
   data/shelf-manifest.json (produced by the separate shelf-builder tool,
   see C:\Users\explrvive1\shelf-builder\). This file only depends on the
   markup slots #shelf-grid / #shelf-grid-results / #shelf-results-panel
   etc. provided by index.html, not on any core exercise internals. */

.shelf-layout {
  position: absolute;
  top: 90px; left: 4%; right: 4%; bottom: 4%;
  overflow: hidden;
  z-index: 2;
}
/* Inferred shelf surface (see renderShelfBoards) -- drawn at each row's
   bottom edge, with the highlight above the shadow so it reads as the front
   lip of a board catching light. */
.shelf-board {
  position: absolute;
  height: 4px;
  border-radius: 1px;
  background: linear-gradient(to bottom,
    rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.16));
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.55) inset,
              0 2px 5px rgba(0, 0, 0, 0.10);
}
@media (prefers-color-scheme: dark) {
  .shelf-board {
    background: linear-gradient(to bottom,
      rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.20) inset,
                0 2px 5px rgba(0, 0, 0, 0.35);
  }
}

.shelf-facing {
  position: absolute;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-1);
  overflow: hidden;
}
/* The photo sits on top of the generated package face and is revealed only
   once it decodes (.has-photo), so a missing images/<upc>.jpg leaves the
   face showing rather than an empty box. */
.shelf-facing img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0;
  pointer-events: none;
}
.shelf-facing.has-photo { background: var(--surface-1) !important; }
.shelf-facing.has-photo img { opacity: 1; }
.shelf-facing.has-photo .shelf-facing-cap,
.shelf-facing.has-photo .shelf-facing-body,
.shelf-facing.has-photo .shelf-facing-size { display: none; }

/* ---- Generated package face (no photo available) ----
   Sized in px by JS from the facing's real dimensions; only colour, layout
   and weight live here. */
.shelf-facing-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-color: rgba(0, 0, 0, 0.35);
}
/* Darker band across the top reads as a cap/lid at small sizes, which is
   what makes a flat colour block scan as a bottle on a shelf. */
.shelf-facing-cap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 11%;
  min-height: 3px;
  background: rgba(0, 0, 0, 0.28);
}
.shelf-facing-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  padding: 0 2px;
  overflow: hidden;
}
/* JS sizes these to fit the longest word (fitFontSize); the wrap rules here
   are the backstop for anything it underestimates, so a label degrades by
   breaking rather than by spilling out past the box edges. */
.shelf-facing-brand {
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: #fff;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.shelf-facing-variant {
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.shelf-facing-size {
  position: absolute;
  bottom: 2px; left: 0; right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-variant-numeric: tabular-nums;
}
.shelf-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  z-index: 1;
}
#shelf-top-products {
  margin: 0 0 12px;
  padding: 0 0 0 18px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: left;
  max-height: 110px;
  overflow-y: auto;
}
