/**
 * Ember Loom — Cart (weft rows + sticky tally dock)
 */
body.em-cart {
  margin: 0;
  min-height: 100vh;
  font-family: var(--em-body, "Karla", system-ui, sans-serif);
  color: var(--em-ink, #10141c);
  background:
    radial-gradient(780px 400px at -5% 0%, rgba(27, 108, 168, 0.07), transparent 55%),
    radial-gradient(620px 360px at 100% 40%, rgba(232, 93, 4, 0.06), transparent 50%),
    var(--em-canvas, #eef1f6);
  -webkit-font-smoothing: antialiased;
}
body.em-cart.has-kb-nav { padding-bottom: 0 !important; }
body.em-cart .kb-keybed { display: none !important; }
body.em-cart a { color: inherit; text-decoration: none; }
body.em-cart button,
body.em-cart input { font: inherit; color: inherit; }

.em-cart-root {
  width: min(100% - 1.5rem, 1100px);
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.em-cart-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.em-cart-meter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: var(--em-surface, #fff);
  border: 1px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--em-mute, #3f4754);
  box-shadow: var(--em-shadow, 0 14px 40px rgba(16,20,28,0.06));
}
.em-cart-meter b {
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1rem;
  color: var(--em-ember, #e85d04);
}

.em-cart-hero {
  display: grid;
  grid-template-columns: 1.3fr auto;
  gap: 1.25rem;
  align-items: end;
  margin-bottom: 1.35rem;
}
.em-cart-hero h1 {
  margin: 0 0 0.45rem;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: clamp(1.9rem, 3.8vw, 2.7rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--em-ink, #10141c);
}
.em-cart-lede {
  margin: 0;
  color: var(--em-mute, #3f4754);
  max-width: 36rem;
  line-height: 1.55;
}

.em-cart-due {
  padding: 1rem 1.2rem;
  background: var(--em-ink, #10141c);
  color: #fff;
  border-radius: var(--em-radius-lg, 16px);
  min-width: 11rem;
  text-align: right;
  box-shadow: var(--em-shadow, 0 14px 40px rgba(16,20,28,0.12));
}
.em-cart-due span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.82);
  margin-bottom: 0.25rem;
}
.em-cart-due strong {
  display: block;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  color: #ffb088;
}
.em-cart-due em {
  display: block;
  margin-top: 0.35rem;
  font-style: normal;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.82);
}

/* Empty loom */
.em-cart-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--em-surface, #fff);
  border: 1px dashed var(--em-line, rgba(16,20,28,0.1));
  border-radius: var(--em-radius-lg, 16px);
  margin-bottom: 1.5rem;
}
.em-cart-empty-frame {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}
.em-cart-empty-frame span {
  width: 2.5rem;
  height: 3.5rem;
  border-radius: 6px;
  border: 2px solid var(--em-line, rgba(16,20,28,0.15));
  background: linear-gradient(180deg, #f7f8fb, transparent);
  animation: em-cart-loom 2.4s ease-in-out infinite;
}
.em-cart-empty-frame span:nth-child(2) { animation-delay: 0.2s; height: 4rem; }
.em-cart-empty-frame span:nth-child(3) { animation-delay: 0.4s; }

@keyframes em-cart-loom {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50% { transform: translateY(-6px); opacity: 1; border-color: var(--em-ember, #e85d04); }
}

.em-cart-empty h2 {
  margin: 0 0 0.4rem;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1.5rem;
}
.em-cart-empty p {
  margin: 0 auto 1.25rem;
  color: var(--em-mute, #3f4754);
  max-width: 28rem;
  line-height: 1.5;
}

/* Layout: weft list + sticky dock */
.em-cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.75fr);
  gap: 1.15rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.em-cart-weft {
  background: var(--em-surface, #fff);
  border: 1px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: var(--em-radius-lg, 16px);
  overflow: hidden;
  box-shadow: var(--em-shadow, 0 14px 40px rgba(16,20,28,0.06));
}
.em-cart-weft-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--em-line, rgba(16,20,28,0.1));
  background: #f7f8fb;
}
.em-cart-weft-head h2 {
  margin: 0;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1.05rem;
}
.em-cart-weft-head span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--em-mute, #3f4754);
}

.em-cart-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.em-cart-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--em-line, rgba(16,20,28,0.08));
  opacity: 0;
  transform: translateX(-12px);
  transition:
    opacity 0.45s var(--em-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 0.45s var(--em-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    background 0.25s;
}
.em-cart-row.is-in {
  opacity: 1;
  transform: none;
}
.em-cart-row:hover {
  background: rgba(232, 93, 4, 0.03);
}
.em-cart-row:last-child {
  border-bottom: 0;
}

.em-cart-thumb {
  position: relative;
  display: block;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: var(--em-radius, 10px);
  overflow: hidden;
  background: #eef1f6;
  border: 1px solid var(--em-line, rgba(16,20,28,0.1));
}
.em-cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--em-ease, cubic-bezier(0.22, 1, 0.36, 1));
}
.em-cart-row:hover .em-cart-thumb img {
  transform: scale(1.06);
}
.em-cart-thumb i {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  font-style: normal;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: var(--em-ink, #10141c);
  color: #fff;
}
.em-cart-thumb-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--em-mute, #3f4754);
}

.em-cart-row-body h3 {
  margin: 0 0 0.25rem;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}
.em-cart-row-body h3 a:hover {
  color: var(--em-ember, #e85d04);
}
.em-cart-meta {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  color: var(--em-mute, #3f4754);
}
.em-cart-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--em-pool, #1b6ca8);
}

.em-cart-row-ops {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

.em-cart-stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--em-line, rgba(16,20,28,0.12));
  border-radius: 999px;
  overflow: hidden;
  background: #f7f8fb;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.em-cart-stepper:focus-within {
  border-color: var(--em-ember, #e85d04);
  box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.12);
}
.em-cart-stepper button {
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  background: transparent;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--em-ink, #10141c);
  transition: background 0.2s, color 0.2s;
}
.em-cart-stepper button:hover {
  background: var(--em-ember-soft, rgba(232, 93, 4, 0.12));
  color: var(--em-ember, #e85d04);
}
.em-cart-stepper input {
  width: 2.4rem;
  border: 0;
  background: transparent;
  color: var(--em-ink, #10141c);
  text-align: center;
  font-weight: 700;
  font-family: var(--em-display, "Outfit", sans-serif);
  outline: none;
  -moz-appearance: textfield;
}
.em-cart-stepper input::-webkit-outer-spin-button,
.em-cart-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.em-cart-line {
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1.05rem;
}

.em-cart-weft-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--em-line, rgba(16,20,28,0.1));
  background: #fafbfc;
}
.em-cart-more {
  font-weight: 700;
  color: var(--em-pool, #1b6ca8);
  transition: color 0.2s, transform 0.2s;
}
.em-cart-more:hover {
  color: var(--em-ember, #e85d04);
  transform: translateX(3px);
}

/* Promo tag */
.em-cart-promo {
  margin-top: 1rem;
}
.em-cart-promo-form {
  display: grid;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  background: var(--em-surface, #fff);
  border: 1px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: var(--em-radius-lg, 16px);
  position: relative;
  overflow: hidden;
}
.em-cart-promo-form::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--em-pool, #1b6ca8);
}
.em-cart-promo-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--em-pool, #1b6ca8);
}
.em-cart-promo-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
}
.em-cart-promo-fields label {
  flex: 1 1 12rem;
  display: grid;
  gap: 0.3rem;
}
.em-cart-promo-fields label span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--em-mute, #3f4754);
}
.em-cart-promo-fields input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: var(--em-radius, 10px);
  background: #f7f8fb;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.em-cart-promo-fields input:focus {
  border-color: var(--em-pool, #1b6ca8);
  box-shadow: 0 0 0 3px rgba(27, 108, 168, 0.12);
  background: #fff;
}
.em-cart-promo-clear {
  border: 0;
  background: transparent;
  font-weight: 700;
  color: var(--em-mute, #3f4754);
  cursor: pointer;
  padding: 0.75rem 0.5rem;
  transition: color 0.2s;
}
.em-cart-promo-clear:hover { color: var(--em-ember, #e85d04); }
.em-cart-promo-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--em-mute, #3f4754);
}
.em-cart-promo-note strong {
  color: var(--em-ink, #10141c);
  font-family: var(--em-display, "Outfit", sans-serif);
}
.em-cart-promo-msg {
  margin: 0.55rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.em-cart-promo-msg.is-ok { color: #1a7a3a; }
.em-cart-promo-msg.is-clear { color: var(--em-mute, #3f4754); }

/* Sticky tally dock */
.em-cart-dock {
  position: sticky;
  top: 1rem;
  padding: 1.25rem 1.2rem;
  background: var(--em-surface, #fff);
  border: 1px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: var(--em-radius-lg, 16px);
  box-shadow: var(--em-shadow, 0 14px 40px rgba(16,20,28,0.08));
}
.em-cart-dock h3 {
  margin: 0 0 1rem;
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1.05rem;
}
.em-cart-tally {
  margin: 0 0 0.85rem;
  display: grid;
  gap: 0.55rem;
}
.em-cart-tally div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
}
.em-cart-tally dt { color: var(--em-mute, #3f4754); }
.em-cart-tally dd {
  margin: 0;
  font-weight: 700;
  font-family: var(--em-display, "Outfit", sans-serif);
}
.em-cart-tally-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.85rem 0;
  margin-bottom: 0.65rem;
  border-top: 1px solid var(--em-line, rgba(16,20,28,0.1));
  border-bottom: 1px solid var(--em-line, rgba(16,20,28,0.1));
}
.em-cart-tally-total span {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.em-cart-tally-total strong {
  font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 1.55rem;
  color: var(--em-ember, #e85d04);
  letter-spacing: -0.02em;
}
.em-cart-tally-note {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--em-mute, #3f4754);
  line-height: 1.45;
}
.em-cart-checkout {
  display: block;
  width: 100%;
  text-align: center;
  margin-bottom: 0.65rem;
}
.em-cart-browse {
  display: block;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--em-pool, #1b6ca8);
  transition: color 0.2s;
}
.em-cart-browse:hover { color: var(--em-ember, #e85d04); }

.em-cart-colophon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--em-line, rgba(16,20,28,0.1));
  font-size: 0.85rem;
}
.em-cart-colophon strong {
  font-family: var(--em-display, "Outfit", sans-serif);
}
.em-cart-colophon nav { display: flex; gap: 1rem; }
.em-cart-colophon a {
  color: var(--em-mute, #3f4754);
  font-weight: 600;
  transition: color 0.2s;
}
.em-cart-colophon a:hover { color: var(--em-ember, #e85d04); }

[data-em-cart-rise] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s var(--em-ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 0.5s var(--em-ease, cubic-bezier(0.22, 1, 0.36, 1));
  transition-delay: calc(var(--em-cart-delay, 0) * 75ms);
}
[data-em-cart-rise].is-in {
  opacity: 1;
  transform: none;
}

@media (max-width: 900px) {
  .em-cart-layout {
    grid-template-columns: 1fr;
  }
  .em-cart-dock {
    position: static;
  }
  .em-cart-hero {
    grid-template-columns: 1fr;
  }
  .em-cart-due {
    text-align: left;
    max-width: 16rem;
  }
}

@media (max-width: 640px) {
  .em-cart-row {
    grid-template-columns: 4.25rem 1fr;
    grid-template-rows: auto auto;
  }
  .em-cart-row-ops {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .em-cart-thumb {
    width: 4.25rem;
    height: 4.25rem;
  }
  .em-cart-colophon {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .em-cart-empty-frame span { animation: none; }
  .em-cart-row,
  [data-em-cart-rise] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
