/* ==========================================================================
   4ewdsr5y — INVENTORY
   The kit as one list — thumbnail, name and size, quantity, price, DROP — with
   the total and checkout pinned underneath. The same layout on every screen:
   a phone fills the viewport with it, a desktop gets it as a drawer of about
   phone width down the right-hand side. Every colour comes from theme.css.
   ========================================================================== */

/* ------------------------------------------------- 1. HEADER TRIGGER */

/* Sits top-right on every page, where the drop telemetry used to be. */
.hdr-inv {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 34px;
  padding-inline: var(--sp-3);
  border: 1px solid var(--rule);
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-wide);
  color: var(--fg-dim);
  flex: none;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
}
.hdr-inv:hover {
  color: var(--fg);
  border-color: var(--rule-strong);
  background: var(--signal-soft);
}
.hdr-inv .sb-count { color: var(--fg); }
.hdr-inv[data-has="true"] { border-color: var(--signal-edge); color: var(--fg); }
.hdr-inv[data-has="true"] .sb-count { color: var(--signal); }
.hdr-inv[data-has="true"] .sb-slot { background: var(--signal); }

@media (max-width: 520px) {
  .hdr-inv span { display: none; }
  .hdr-inv { padding-inline: var(--sp-2); }
}

/* A little slot glyph so the control reads as a container, not a link. */
.sb-slot {
  width: 9px; height: 9px;
  flex: none;
  border: 1px solid currentColor;
  box-shadow: inset 0 0 0 1px var(--bg);
}

/* ---------------------------------------------------------- 2. BACKDROP */

.lo-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: color-mix(in srgb, var(--bg-inset) 82%, transparent);
  backdrop-filter: blur(4px) saturate(0.6);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.lo-backdrop[data-on="true"] { opacity: 1; }

/* ------------------------------------------------------- 3. THE SCREEN */

.loadout {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  opacity: 0;
  transform: scale(0.985);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  overflow: hidden;
}
.loadout[data-on="true"] { opacity: 1; transform: none; }

/* Explicit as well as the global guard in base.css: this element sets
   display, so it must undo it when hidden or it eats every click. */
.loadout[hidden] { display: none; }

/* Belt and braces — while it is fading out it must not intercept anything. */
.loadout:not([data-on="true"]) { pointer-events: none; }
.lo-backdrop:not([data-on="true"]) { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .loadout, .lo-backdrop { transition: none; }
  .loadout { transform: none; }
}

/* corner brackets on the screen itself */
.loadout::before,
.loadout::after {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border: 0 solid var(--rule-strong);
  pointer-events: none;
}
.loadout::before { top: 14px; left: 14px;
                   border-top-width: 1px; border-left-width: 1px; }
.loadout::after  { bottom: 14px; right: 14px;
                   border-bottom-width: 1px; border-right-width: 1px; }

.lo-top {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  padding-block: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--rule);
  flex: none;
}
.lo-top .spacer { margin-left: auto; }
.lo-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: var(--tr-wide);
  line-height: 1;
}

.inv-close {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  color: var(--fg-dim);
  font-size: var(--fs-md);
  line-height: 1;
  flex: none;
}
.inv-close:hover { color: var(--fg); border-color: var(--rule-strong); }

/* ---------------------------------------------------------- 4. THE LIST */

/* Scrolls on its own, so the total and checkout below never leave the screen. */
.lo-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-block: var(--sp-2) var(--sp-4);
}

.lo-lines { list-style: none; margin: 0; padding: 0; }

/* Two rows per unit, so it fits a 320px phone as well as the desktop drawer:
     [thumb]  NAME / CODE  SIZE          PRICE
     [thumb]  − 1 +                       DROP        */
.lo-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  grid-template-areas:
    "thumb head price"
    "thumb qty  drop";
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  padding-block: var(--sp-3);
}
.lo-line + .lo-line { border-top: 1px solid var(--rule); }

/* The unit on its own plate — the same plate the slot tiles used. */
.lo-thumb {
  grid-area: thumb;
  width: 64px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-mid);
  background: color-mix(in srgb, var(--bg-plate) 70%, transparent);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.55);
}
.lo-thumb img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 14%;
}

.lo-line-head {
  grid-area: head;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lo-line-name {
  font-size: var(--fs-sm);
  letter-spacing: var(--tr-wide);
  color: var(--fg);
  align-self: start;
}
.lo-line-name:hover { color: var(--signal); }
.lo-line-sub { font-size: var(--fs-sm); color: var(--fg-dim); }

.lo-line-price {
  grid-area: price;
  font-size: var(--fs-sm);
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.lo-qtyctl {
  grid-area: qty;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
/* 32px, up from 26: these are the controls a thumb presses most in here. */
.inv-step {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-mid);
  color: var(--fg-dim);
  font-size: var(--fs-sm);
  line-height: 1;
}
.inv-step:hover { color: var(--fg); border-color: var(--rule-strong); }
.inv-n {
  min-width: 3ch;
  text-align: center;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}

/* 13px, not the 11px it was: it is a control a customer clicks, and the type
   floor for those is 13. The padding makes the target the height of a step. */
.lo-drop {
  grid-area: drop;
  justify-self: end;
  min-height: 32px;
  padding-inline: var(--sp-2);
  font-size: var(--fs-sm);
  letter-spacing: var(--tr-wide);
  color: var(--fg-faint);
  border-bottom: 1px solid transparent;
}
.lo-drop:hover { color: var(--signal); border-bottom-color: var(--signal-edge); }

.lo-empty {
  padding-block: var(--sp-5);
  font-size: var(--fs-sm);
  color: var(--fg-dim);
}

/* ------------------------------------------------------- 5. BOTTOM BAR */

.lo-bar {
  flex: none;
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: var(--sp-4) var(--sp-6);
  padding-block: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--rule-mid);
  background: color-mix(in srgb, var(--bg-inset) 82%, transparent);
}

.lo-summary {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  min-width: 0;
}
.lo-total { display: flex; align-items: baseline; gap: var(--sp-4); }
.lo-total .t-telemetry { margin-right: auto; }
.lo-sum {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.lo-checkout { width: 100%; min-height: 48px; font-weight: 700; }

.lo-note, .lo-clear { grid-column: 1 / -1; }
.lo-clear {
  justify-self: start;
  font-size: var(--fs-xs);
  letter-spacing: var(--tr-wide);
  padding: var(--sp-2) 0;
}

/* ------------------------------------------------------- 6. RESPONSIVE */

/* A desktop gets the phone layout as a drawer, rather than the phone layout
   stretched across a 1280px screen. The page stays visible behind the
   existing backdrop, and clicking the backdrop closes it.

   The gutter is set here because --gutter is clamped against the VIEWPORT
   width, not the drawer's: at 1280 it resolves to its 40px maximum, which is
   more than twice what the same content gets on a phone. */
@media (min-width: 861px) {
  .loadout {
    left: auto;
    width: 440px;
    max-width: 100vw;
    border-left: 1px solid var(--rule-mid);
    --gutter: 20px;
  }
}

/* It slides in from the edge it is attached to. Opt-in rather than overriding
   a reduce rule, so the reduced-motion `transform: none` above is never fought
   by something later in the file. */
@media (min-width: 861px) and (prefers-reduced-motion: no-preference) {
  .loadout { transform: translateX(28px); }
  .loadout[data-on="true"] { transform: none; }
}
