/* UX-09 merchant list/detail. All rules stay scoped to the two merchant shells. */
.app-shell--merchant-list,
.app-shell--merchant-list *,
.app-shell--shop-detail,
.app-shell--shop-detail * {
  min-inline-size: 0;
}

.app-shell--merchant-list [hidden],
.app-shell--shop-detail [hidden] {
  display: none !important;
}

/* Compact directory: choices finish before editorial content. */
.app-shell--merchant-list .screen-stage {
  padding-block-end: var(--space-xs);
}

.app-shell--merchant-list .page-head {
  min-height: 6.5rem;
  padding-block: var(--space-sm);
}

.app-shell--merchant-list .page-head__photo {
  width: min(5.75rem, 26vw);
  height: min(4.5rem, 20vw);
  object-fit: cover;
}

.app-shell--merchant-list .shop-filter {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: var(--space-xs);
  padding-block: var(--space-xs);
  /* Trailing room plus an edge fade: the row visibly continues past the screen edge. */
  padding-inline-end: 2.5rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
}

.app-shell--merchant-list .shop-filter::-webkit-scrollbar {
  display: none;
}

.app-shell--merchant-list .shop-filter .filter-chip {
  min-height: 3rem;
  padding-inline: var(--space-md);
  white-space: nowrap;
}

.app-shell--merchant-list .merchant-results {
  padding: var(--space-sm) var(--space-gutter) var(--space-lg);
  background: var(--color-surface);
}

.app-shell--merchant-list .merchant-results .section-heading {
  margin-block-end: var(--space-xs);
}

.app-shell--merchant-list .merchant-truth,
.app-shell--shop-detail .merchant-adjacent-truth {
  padding: var(--space-sm);
  border-inline-start: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: color-mix(in srgb, var(--color-tint-food) 34%, var(--color-surface));
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

.app-shell--merchant-list .merchant-truth {
  margin-block-end: var(--space-sm);
}

.app-shell--merchant-list .merchant-list {
  display: grid;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-shell--merchant-list .merchant-row {
  overflow: clip;
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-tile);
  background: var(--color-canvas);
  box-shadow: var(--shadow-control);
}

.app-shell--merchant-list .merchant-row__link {
  display: grid;
  grid-template-columns: clamp(5.75rem, 31vw, 7.25rem) minmax(0, 1fr);
  min-height: 9rem;
  color: var(--color-ink);
  text-decoration: none;
}

.app-shell--merchant-list .merchant-row__media {
  display: grid;
  min-height: 100%;
  place-items: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-tint-food) 42%, var(--color-surface));
}

.app-shell--merchant-list .merchant-row__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-shell--merchant-list .merchant-row__placeholder {
  padding: var(--space-xs);
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: center;
}

.app-shell--merchant-list .merchant-row__copy {
  display: flex;
  padding: var(--space-sm);
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-2xs);
  overflow-wrap: anywhere;
}

.app-shell--merchant-list .merchant-row__identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.app-shell--merchant-list .merchant-row__category,
.app-shell--merchant-list .merchant-row__badge {
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: var(--lh-title);
}

.app-shell--merchant-list .merchant-row__badge {
  padding: 0.08rem var(--space-xs);
  border: var(--rule-hair) solid currentColor;
  border-radius: var(--radius-pill);
}

.app-shell--merchant-list .merchant-row__name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  line-height: var(--lh-title);
  text-wrap: pretty;
  font-weight: 700;
}

.app-shell--merchant-list .merchant-row__blurb,
.app-shell--merchant-list .merchant-row__decision,
.app-shell--merchant-list .merchant-row__hours {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  line-height: var(--lh-title);
}

.app-shell--merchant-list .merchant-row__decision {
  color: var(--color-ink);
  font-size: var(--text-sm);
}

.app-shell--merchant-list .merchant-row__hours {
  font-size: var(--text-sm);
  line-height: var(--lh-body);
}

.app-shell--merchant-list .merchant-row__action {
  display: inline-flex;
  min-height: 3rem;
  margin-block-start: var(--space-2xs);
  align-items: center;
  gap: var(--space-2xs);
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 800;
}

.app-shell--merchant-list .merchant-row__action .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.app-shell--merchant-list .merchant-story {
  display: grid;
  gap: var(--space-sm);
  padding-block-start: var(--space-lg);
}

.app-shell--merchant-list .merchant-story__heading {
  padding-inline: var(--space-gutter);
}

.app-shell--merchant-list .merchant-story .signature-copy h3 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: var(--lh-display);
}

/* Focused detail: no bottom nav, one measured sticky action. */
html body .app-shell--shop-detail {
  --merchant-target: 3rem;
  --merchant-sticky-height: 8.75rem;
  padding-block-end: var(--merchant-sticky-height);
  scroll-padding-block: max(var(--space-md), env(safe-area-inset-top, 0px))
    calc(var(--merchant-sticky-height) + var(--space-md));
}

.app-shell--shop-detail .merchant-detail-header {
  position: sticky;
  z-index: var(--z-sticky);
  inset-block-start: 0;
  display: flex;
  min-height: calc(var(--merchant-target) + (2 * var(--space-xs)));
  padding: max(var(--space-xs), env(safe-area-inset-top, 0px))
    max(var(--space-gutter), env(safe-area-inset-right, 0px))
    var(--space-xs)
    max(var(--space-gutter), env(safe-area-inset-left, 0px));
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xs);
  border-block-end: var(--rule-hair) solid var(--color-border);
  background: color-mix(in srgb, var(--color-canvas) 94%, transparent);
  backdrop-filter: blur(12px);
}

.app-shell--shop-detail .merchant-detail-header__end {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.app-shell--shop-detail .merchant-header-action {
  display: inline-flex;
  min-height: var(--merchant-target);
  padding-inline: var(--space-sm);
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: var(--lh-title);
  text-decoration: none;
}

.app-shell--shop-detail .merchant-header-action--icon {
  width: var(--merchant-target);
  padding: 0;
}

.app-shell--shop-detail .merchant-header-action .icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

.app-shell--shop-detail .merchant-detail-main {
  flex: 1 0 auto;
  width: 100%;
  outline: 0;
}

.app-shell--shop-detail .merchant-detail {
  display: grid;
  gap: 0;
}

.app-shell--shop-detail .merchant-opening {
  background: var(--color-surface);
}

.app-shell--shop-detail .merchant-hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--color-surface-sunken);
}

.app-shell--shop-detail .merchant-hero__track,
.app-shell--shop-detail .merchant-hero__frame {
  width: 100%;
  aspect-ratio: 1;
}

.app-shell--shop-detail .merchant-hero__frame {
  position: relative;
  overflow: hidden;
}

.app-shell--shop-detail .merchant-hero__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-shell--shop-detail .merchant-hero__counter,
.app-shell--shop-detail .merchant-hero__hint,
.app-shell--shop-detail .merchant-hero__sample {
  position: absolute;
  z-index: 2;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  background: rgb(14 71 71 / 86%);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: var(--lh-title);
}

.app-shell--shop-detail .merchant-hero__counter {
  inset-block-start: var(--space-sm);
  inset-inline-end: var(--space-sm);
}

.app-shell--shop-detail .merchant-hero__hint {
  inset-inline-end: var(--space-sm);
  inset-block-end: 3.1rem;
}

.app-shell--shop-detail .merchant-hero__sample {
  inset-inline-start: var(--space-sm);
  inset-block-end: 3.1rem;
  background: rgb(176 68 38 / 90%);
}

.app-shell--shop-detail .merchant-hero__caption {
  min-height: 2.5rem;
  padding: var(--space-xs) var(--space-gutter);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  line-height: var(--lh-title);
}

.app-shell--shop-detail .merchant-photo-state {
  display: grid;
  min-height: 15rem;
  padding: var(--space-xl) var(--space-gutter);
  place-content: center;
  justify-items: center;
  gap: var(--space-sm);
  background: color-mix(in srgb, var(--color-tint-food) 30%, var(--color-surface));
  color: var(--color-ink-muted);
  text-align: center;
}

.app-shell--shop-detail .merchant-photo-state strong {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-md);
}

.app-shell--shop-detail .merchant-title-block,
.app-shell--shop-detail .merchant-facts,
.app-shell--shop-detail .merchant-menu,
.app-shell--shop-detail .merchant-location,
.app-shell--shop-detail .merchant-related {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-gutter);
  border-block-start: var(--rule-hair) solid var(--color-border);
}

.app-shell--shop-detail .merchant-title-block {
  border-block-start: 0;
}

.app-shell--shop-detail .merchant-category,
.app-shell--shop-detail .merchant-related__eyebrow {
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: var(--lh-title);
}

.app-shell--shop-detail #shop-title {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 8vw, 2.45rem);
  line-height: var(--lh-display);
}

.app-shell--shop-detail .merchant-blurb {
  color: var(--color-ink-muted);
  line-height: var(--lh-body);
}

.app-shell--shop-detail h2 {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: var(--lh-display);
}

.app-shell--shop-detail .merchant-fact {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-control);
  background: var(--color-surface-sunken);
  color: var(--color-ink);
}

.app-shell--shop-detail .merchant-fact > .icon {
  margin-block-start: var(--space-2xs);
  color: var(--color-primary);
}

.app-shell--shop-detail .merchant-fact h3 {
  font-size: var(--text-base);
  line-height: var(--lh-title);
}

.app-shell--shop-detail .merchant-fact h3 span,
.app-shell--shop-detail .merchant-section-heading > span {
  color: var(--color-primary);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 800;
}

.app-shell--shop-detail .merchant-fact p {
  margin-block-start: var(--space-2xs);
  color: var(--color-ink-muted);
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

.app-shell--shop-detail .merchant-section-heading,
.app-shell--shop-detail .merchant-related__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.app-shell--shop-detail .merchant-menu__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-shell--shop-detail .merchant-menu__list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 3rem;
  padding-block: var(--space-sm);
  align-items: start;
  gap: var(--space-sm);
  border-block-end: var(--rule-hair) solid var(--color-border);
  line-height: var(--lh-body);
}

.app-shell--shop-detail .merchant-menu__price {
  color: var(--color-ink);
  font-weight: 800;
  white-space: nowrap;
}

.app-shell--shop-detail .merchant-missing {
  color: var(--color-ink-muted);
  line-height: var(--lh-body);
  overflow-wrap: anywhere;
}

.app-shell--shop-detail .merchant-related {
  min-width: 0;
}

.app-shell--shop-detail .merchant-related__heading,
.app-shell--shop-detail .merchant-related__controls {
  padding-inline-end: var(--space-gutter);
}

.app-shell--shop-detail .merchant-related__count {
  flex: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--color-ink);
  color: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 800;
}

.app-shell--shop-detail .merchant-related__viewport {
  width: 100%;
  min-width: 0;
}

.app-shell--shop-detail .merchant-related__track {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-shell--shop-detail .merchant-related__item {
  min-width: 0;
}

.app-shell--shop-detail .merchant-related__link {
  display: grid;
  height: 100%;
  align-content: start;
  overflow: hidden;
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-tile);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-control);
  text-decoration: none;
}

.app-shell--shop-detail .merchant-related__media {
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: var(--color-surface-sunken);
}

.app-shell--shop-detail .merchant-related__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.app-shell--shop-detail .merchant-related__placeholder {
  padding: var(--space-sm);
  color: var(--color-ink-muted);
  font-weight: 800;
  text-align: center;
}

.app-shell--shop-detail .merchant-related__copy {
  display: grid;
  min-height: 5.25rem;
  padding: var(--space-sm);
  align-content: center;
  gap: var(--space-2xs);
}

.app-shell--shop-detail .merchant-related__copy strong {
  font-family: var(--font-display);
  font-size: var(--text-base);
  line-height: var(--lh-title);
  overflow-wrap: anywhere;
}

.app-shell--shop-detail .merchant-related__category {
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 800;
}

.app-shell--shop-detail .merchant-related__controls {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
}

.app-shell--shop-detail .merchant-related__button {
  display: inline-flex;
  min-height: var(--merchant-target);
  padding-inline: var(--space-sm);
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  border: var(--rule-hair) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 800;
}

.app-shell--shop-detail .merchant-related__button[aria-disabled="true"] {
  color: var(--color-ink-muted);
  opacity: 0.58;
}

.app-shell--shop-detail .site-footer {
  padding-block-end: var(--space-lg);
}

.app-shell--shop-detail .merchant-sticky {
  position: fixed;
  z-index: var(--z-sticky);
  inset-inline-start: 50%;
  inset-block-end: 0;
  display: grid;
  width: min(100%, 26.875rem);
  padding: var(--space-sm)
    max(var(--space-gutter), env(safe-area-inset-right, 0px))
    max(var(--space-sm), env(safe-area-inset-bottom, 0px))
    max(var(--space-gutter), env(safe-area-inset-left, 0px));
  gap: var(--space-xs);
  border-block-start: var(--rule-hair) solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 96%, transparent);
  box-shadow: 0 -8px 24px var(--color-shadow-soft);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.app-shell--shop-detail .merchant-sticky p {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  line-height: var(--lh-title);
  text-align: center;
}

.app-shell--shop-detail .merchant-sticky__button {
  min-height: var(--merchant-target);
  opacity: 0.72;
  cursor: help;
}

html body .app-shell--shop-detail ~ .toast,
html body:has(.app-shell--shop-detail) .toast {
  inset-block-end: calc(var(--merchant-sticky-height, 8.75rem) + var(--space-xs));
}

html[data-input="key"] .app-shell--merchant-list .merchant-row__link:focus-visible,
html[data-input="key"] .app-shell--shop-detail .merchant-header-action:focus-visible,
html[data-input="key"] .app-shell--shop-detail .merchant-hero__frame:focus-visible,
html[data-input="key"] .app-shell--shop-detail .merchant-related__link:focus-visible,
html[data-input="key"] .app-shell--shop-detail .merchant-related__button:focus-visible,
html[data-input="key"] .app-shell--shop-detail .merchant-sticky__button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -3px;
}

@media (max-width: 22.5rem) {
  .app-shell--merchant-list .merchant-row__link {
    grid-template-columns: 5.75rem minmax(0, 1fr);
  }

  .app-shell--merchant-list .merchant-row__copy {
    padding: var(--space-xs);
  }

  .app-shell--shop-detail .merchant-menu__list li {
    grid-template-columns: 1fr;
    gap: var(--space-2xs);
  }

  .app-shell--shop-detail .merchant-menu__price {
    white-space: normal;
  }
}

html[data-easy="on"] .app-shell--merchant-list .shop-filter .filter-chip,
html[data-easy="on"] .app-shell--merchant-list .merchant-row__action,
html[data-easy="on"] .app-shell--shop-detail .merchant-header-action,
html[data-easy="on"] .app-shell--shop-detail .merchant-related__button,
html[data-easy="on"] .app-shell--shop-detail .merchant-sticky__button {
  min-height: 3.5rem;
}

html[data-easy="on"] body .app-shell--shop-detail {
  --merchant-target: 3.5rem;
  padding-block-end: var(--merchant-sticky-height);
}

@media (prefers-reduced-motion: no-preference) {
  html:not([data-entrance="off"]) .app-shell--merchant-list .merchant-row,
  html:not([data-entrance="off"]) .app-shell--shop-detail .merchant-opening,
  html:not([data-entrance="off"]) .app-shell--shop-detail .merchant-title-block {
    animation: merchant-enter var(--dur-long) var(--ease-out) both;
  }

  html:not([data-entrance="off"]) .app-shell--merchant-list .merchant-row:nth-child(2) {
    animation-delay: 70ms;
  }

  html:not([data-entrance="off"]) .app-shell--merchant-list .merchant-row:nth-child(3) {
    animation-delay: 120ms;
  }

  html:not([data-entrance="off"]) .app-shell--shop-detail .merchant-title-block {
    animation-delay: 80ms;
  }
}

@keyframes merchant-enter {
  from { opacity: 0; transform: translateY(0.65rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell--shop-detail .merchant-related__track {
    transition: none;
  }
}

/* Editorial promotions have their own heading and reading flow, never a menu-price column. */
.app-shell--shop-detail .merchant-promotions {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-gutter);
  border-block-start: var(--rule-hair) solid var(--color-border);
}
.merchant-promotions h2 { font-family: var(--font-display); font-size: var(--text-md); }
.merchant-promotions__list { display: grid; gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }
.merchant-promotions__list li {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-sm);
  border-radius: var(--radius-tile);
  background: var(--color-surface-sunken);
  overflow-wrap: anywhere;
}
.merchant-promotions__list li > span { color: var(--color-ink-muted); line-height: var(--lh-body); }
@media (min-width: 700px) {
  .app-shell--merchant-list .merchant-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
  .app-shell--merchant-list .merchant-row__link { height: 100%; }
  html body .app-shell--shop-detail .merchant-sticky { width: 100%; max-width: none; }
  .app-shell--shop-detail .merchant-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell--shop-detail .merchant-opening {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
  .app-shell--shop-detail .merchant-hero__track,
  .app-shell--shop-detail .merchant-hero__frame { aspect-ratio: 4 / 3; }
  .app-shell--shop-detail .merchant-related { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .app-shell--merchant-list .merchant-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
