/**
 * Ember Loom — Catalog (aisle rail + packet grid)
 */
body.em-catalog {
  margin: 0; min-height: 100vh;
  font-family: var(--em-body, "Karla", system-ui, sans-serif);
  color: var(--em-ink, #10141c);
  background:
    radial-gradient(700px 380px at 100% 0%, rgba(27, 108, 168, 0.07), transparent 55%),
    radial-gradient(560px 340px at 0% 70%, rgba(232, 93, 4, 0.06), transparent 50%),
    var(--em-canvas, #eef1f6);
  -webkit-font-smoothing: antialiased;
}
body.em-catalog.has-kb-nav { padding-bottom: 0 !important; }
body.em-catalog .kb-keybed { display: none !important; }
body.em-catalog a { color: inherit; text-decoration: none; }
body.em-catalog button, body.em-catalog input { font: inherit; color: inherit; }

.em-cat-root { width: min(100% - 1.5rem, 1120px); margin: 0 auto; padding: 1.25rem 0 3rem; }
.em-cat-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.em-cat-crumb { display: flex; gap: 0.4rem; font-size: 0.82rem; color: var(--em-mute, #3f4754); font-weight: 600; }
.em-cat-crumb a:hover { color: var(--em-ember, #e85d04); }

.em-cat-hero {
  display: grid; grid-template-columns: 1.3fr auto; gap: 1.25rem; align-items: end; margin-bottom: 1.15rem;
}
.em-cat-hero h1 {
  margin: 0 0 0.4rem; font-family: var(--em-display, "Outfit", sans-serif);
  font-size: clamp(1.85rem, 3.6vw, 2.55rem); letter-spacing: -0.025em;
  color: var(--em-ink, #10141c);
}
.em-cat-lede { margin: 0; color: var(--em-mute, #3f4754); max-width: 34rem; line-height: 1.55; }
.em-cat-totals { display: flex; gap: 0.55rem; }
.em-cat-totals div {
  padding: 0.85rem 1rem; background: var(--em-ink, #10141c); color: #fff;
  border-radius: var(--em-radius, 10px); text-align: center; min-width: 4.5rem;
}
.em-cat-totals strong {
  display: block; font-family: var(--em-display, "Outfit", sans-serif); font-size: 1.35rem; color: #ffb088;
}
.em-cat-totals span { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255,255,255,0.82); }

.em-cat-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center;
  padding: 0.65rem 0.75rem; margin-bottom: 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);
}
.em-cat-sort {
  padding: 0.45rem 0.75rem; border: 1.5px solid var(--em-line, rgba(16,20,28,0.12));
  border-radius: 999px; background: #f7f8fb; font-weight: 700; font-size: 0.8rem; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.em-cat-sort.is-on {
  background: var(--em-ember, #e85d04); border-color: var(--em-ember, #e85d04); color: #fff;
}
.em-cat-search { flex: 1 1 12rem; }
.em-cat-search input {
  width: 100%; padding: 0.55rem 0.85rem; border: 1.5px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: 999px; background: #f7f8fb; outline: none; color: var(--em-ink, #10141c);
}
.em-cat-search input::placeholder { color: #5a6472; opacity: 1; }
.em-cat-search input:focus {
  border-color: var(--em-pool, #1b6ca8); box-shadow: 0 0 0 3px rgba(27, 108, 168, 0.12); background: #fff;
}

/* Unique: sticky aisle rail + dense card grid */
.em-cat-deck {
  display: grid; grid-template-columns: minmax(200px, 0.75fr) 1.4fr; gap: 1.15rem; align-items: start;
  margin-bottom: 1.35rem;
}
.em-cat-rail {
  position: sticky; top: 1rem; display: grid; gap: 0.4rem;
  max-height: calc(100vh - 2rem); overflow-y: auto; padding-right: 0.25rem;
}
.em-cat-bay {
  display: grid; grid-template-columns: 3rem 1fr; gap: 0.65rem; align-items: center;
  padding: 0.65rem 0.7rem; border: 1.5px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: var(--em-radius, 10px); background: var(--em-surface, #fff); text-align: left; cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
}
.em-cat-bay:hover { transform: translateX(3px); border-color: rgba(232, 93, 4, 0.3); }
.em-cat-bay.is-on {
  background: var(--em-ink, #10141c); border-color: var(--em-ink, #10141c); color: #fff;
}
.em-cat-bay-code {
  display: grid; place-items: center; height: 2.25rem; border-radius: 6px;
  background: #f0f2f6; font-family: var(--em-display, "Outfit", sans-serif);
  font-size: 0.65rem; font-weight: 800;
}
.em-cat-bay.is-on .em-cat-bay-code { background: var(--em-ember, #e85d04); color: #fff; }
.em-cat-bay strong { display: block; font-family: var(--em-display, "Outfit", sans-serif); font-size: 0.85rem; line-height: 1.2; }
.em-cat-bay em { display: block; font-style: normal; font-size: 0.72rem; opacity: 0.65; margin-top: 0.15rem; }

.em-cat-shelf-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.85rem;
}
.em-cat-shelf-head h2 { margin: 0; font-family: var(--em-display, "Outfit", sans-serif); font-size: 1.15rem; }
.em-cat-shelf-head span { display: block; font-size: 0.8rem; color: var(--em-mute, #3f4754); font-weight: 600; }
.em-cat-shelf-head a { font-weight: 700; color: var(--em-pool, #1b6ca8); }
.em-cat-shelf-head a:hover { color: var(--em-ember, #e85d04); }

.em-cat-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem;
}
.em-cat-card {
  display: flex; flex-direction: column; background: var(--em-surface, #fff);
  border: 1px solid var(--em-line, rgba(16,20,28,0.1)); border-radius: var(--em-radius, 10px); overflow: hidden;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.4s, transform 0.4s var(--em-ease, cubic-bezier(0.22, 1, 0.36, 1)), border-color 0.25s, box-shadow 0.25s;
}
.em-cat-card.is-in { opacity: 1; transform: none; }
.em-cat-card.is-hidden { display: none; }
.em-cat-card:hover { border-color: rgba(232, 93, 4, 0.35); box-shadow: 0 12px 28px rgba(16,20,28,0.08); }
.em-cat-card-thumb { display: block; aspect-ratio: 1; background: #eef1f6; overflow: hidden; }
.em-cat-card-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.4s var(--em-ease, cubic-bezier(0.22, 1, 0.36, 1));
}
.em-cat-card:hover .em-cat-card-thumb img { transform: scale(1.05); }
.em-cat-card-body { padding: 0.75rem 0.85rem 0.9rem; display: flex; flex-direction: column; flex: 1; gap: 0.35rem; }
.em-cat-card-body h3 { margin: 0; font-family: var(--em-display, "Outfit", sans-serif); font-size: 0.95rem; line-height: 1.25; }
.em-cat-card-body h3 a:hover { color: var(--em-ember, #e85d04); }
.em-cat-card-body > p { margin: 0; font-size: 0.75rem; color: var(--em-mute, #3f4754); }
.em-cat-card-foot {
  display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 0.45rem;
}
.em-cat-card-foot strong { font-family: var(--em-display, "Outfit", sans-serif); color: var(--em-ember, #e85d04); }
.em-cat-card-foot a { font-weight: 700; font-size: 0.82rem; color: var(--em-pool, #1b6ca8); }
.em-cat-card-foot a:hover { color: var(--em-ember, #e85d04); }

.em-cat-empty {
  padding: 1.5rem; text-align: center; color: var(--em-mute, #3f4754);
  border: 1px dashed var(--em-line, rgba(16,20,28,0.15)); border-radius: var(--em-radius, 10px); margin-top: 0.75rem;
}

.em-cat-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.15rem 1.25rem; margin-bottom: 1.25rem;
  background: var(--em-surface, #fff); border: 1px solid var(--em-line, rgba(16,20,28,0.1));
  border-radius: var(--em-radius-lg, 16px);
}
.em-cat-foot p { margin: 0; color: var(--em-mute, #3f4754); max-width: 28rem; line-height: 1.45; }
.em-cat-colophon {
  display: flex; justify-content: space-between; gap: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--em-line, rgba(16,20,28,0.1)); font-size: 0.85rem; color: var(--em-mute, #3f4754);
}
.em-cat-colophon strong { font-family: var(--em-display, "Outfit", sans-serif); color: var(--em-ink, #10141c); }

[data-em-cat-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-cat-delay, 0) * 70ms);
}
[data-em-cat-rise].is-in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .em-cat-deck { grid-template-columns: 1fr; }
  .em-cat-rail { position: static; max-height: none; display: flex; overflow-x: auto; gap: 0.45rem; }
  .em-cat-bay { flex: 0 0 auto; min-width: 11rem; }
  .em-cat-grid { grid-template-columns: repeat(2, 1fr); }
  .em-cat-hero { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .em-cat-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .em-cat-card, [data-em-cat-rise] { opacity: 1; transform: none; transition: none; }
}
