/* Small, truthful motion for the live marketplace. */
.topline {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.topline::after {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: -42%;
  width: 34%;
  content: "";
  background: linear-gradient(105deg, transparent, #d9ed7630, transparent);
  transform: skewX(-22deg);
  animation: market-banner-glide 18s ease-in-out infinite;
  pointer-events: none;
}

.featured-card {
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 42px #20352512;
  animation: market-arrive .55s cubic-bezier(.2,.7,.25,1) both;
}

.featured-photo img,
.live-product-art img,
.market-shop-cover img {
  transform-origin: center;
  animation: market-image-drift 18s ease-in-out infinite alternate;
}

.featured-copy {
  animation: market-copy-arrive .6s .08s ease both;
}

.featured-actions button,
.discovery-category,
.filter,
.add-btn,
.market-shop-cover .heart {
  transition: transform .22s ease, box-shadow .22s ease, background-color .22s ease, border-color .22s ease;
}

.featured-actions button:hover,
.discovery-category:hover,
.filter:hover,
.add-btn:hover,
.market-shop-cover .heart:hover {
  transform: translateY(-2px);
}

.product-grid > .market-shop-card,
.product-grid > .product-card,
.discovery-product-grid > .product-card {
  animation: market-arrive .48s cubic-bezier(.2,.7,.25,1) backwards;
}

.product-grid > :nth-child(2),
.discovery-product-grid > :nth-child(2) { animation-delay: .06s; }
.product-grid > :nth-child(3),
.discovery-product-grid > :nth-child(3) { animation-delay: .12s; }
.product-grid > :nth-child(4),
.discovery-product-grid > :nth-child(4) { animation-delay: .18s; }
.product-grid > :nth-child(5),
.discovery-product-grid > :nth-child(5) { animation-delay: .24s; }

.market-shop-card {
  transition: transform .28s cubic-bezier(.2,.7,.25,1), box-shadow .28s ease, border-color .28s ease;
}

.market-shop-card:hover {
  transform: translateY(-5px);
  border-color: #d6e1d4;
  box-shadow: 0 18px 38px #27362816;
}

.product-card:hover .live-product-art img,
.market-shop-card:hover .market-shop-cover img,
.featured-card:hover .featured-photo img {
  animation-play-state: paused;
  filter: saturate(1.06);
}

.seller-presence.available i {
  animation: market-live-pulse 2.4s ease-out infinite;
}

.market-shop-count {
  box-shadow: 0 5px 16px #1d34291c;
  backdrop-filter: blur(8px);
}

.market-guide {
  position: fixed;
  z-index: 1000;
  right: 22px;
  bottom: 22px;
  display: grid;
  justify-items: end;
  gap: 12px;
  font-family: var(--sans, Inter, "Segoe UI", Arial, sans-serif);
}

.market-guide-panel {
  display: flex;
  width: min(365px, calc(100vw - 28px));
  max-height: min(560px, calc(100dvh - 112px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dfe6dc;
  border-radius: 18px;
  background: var(--paper, #fff);
  box-shadow: 0 20px 60px #17251c30;
  animation: market-guide-open .2s ease-out both;
}

.market-guide-panel[hidden] { display: none; }

.market-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line, #e7e8e0);
  background: #1d3429;
  color: #fff;
}

.market-guide-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 12px;
  background: #d9ed76;
  color: #1d3429;
  font: 700 22px Georgia, serif;
}

.market-guide-header h2 { margin: 0; font: 600 14px var(--sans, Arial, sans-serif); }
.market-guide-header p { margin: 3px 0 0; color: #dfe8db; font-size: 10px; }

.market-guide-close {
  width: 32px;
  height: 32px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: #ffffff18;
  color: #fff;
  font-size: 21px;
  cursor: pointer;
}

.market-guide-messages {
  display: flex;
  min-height: 112px;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 15px;
  overscroll-behavior: contain;
}

.market-guide-message { max-width: 88%; }
.market-guide-message p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 13px 13px 13px 4px;
  background: #f0f3ed;
  color: var(--ink, #202922);
  font-size: 11px;
  line-height: 1.6;
}

.market-guide-message.buyer { align-self: flex-end; }
.market-guide-message.buyer p {
  border-radius: 13px 13px 4px 13px;
  background: #e5efdf;
}

.market-guide-action {
  margin: 8px 0 0 2px;
  padding: 7px 10px;
  border: 1px solid #d8e3d4;
  border-radius: 99px;
  background: var(--paper, #fff);
  color: var(--green, #245d44);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.market-guide-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 15px 12px;
}

.market-guide-suggestions[hidden] { display: none; }
.market-guide-suggestions button {
  padding: 7px 9px;
  border: 1px solid #dfe6dc;
  border-radius: 99px;
  background: var(--paper, #fff);
  color: var(--green, #245d44);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.market-guide-form {
  display: flex;
  gap: 8px;
  padding: 11px 13px;
  border-top: 1px solid var(--line, #e7e8e0);
}

.market-guide-form input {
  min-width: 0;
  flex: 1;
  height: 38px;
  padding: 0 11px;
  border: 1px solid #dfe6dc;
  border-radius: 10px;
  background: var(--paper, #fff);
  color: var(--ink, #202922);
  font: inherit;
  font-size: 11px;
}

.market-guide-form button {
  min-width: 56px;
  border: 0;
  border-radius: 10px;
  background: var(--green, #245d44);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.market-guide-note { margin: 0; padding: 0 14px 11px; color: var(--muted, #778179); font-size: 8px; }

.market-guide-toggle {
  position: relative;
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  padding: 8px 15px 8px 10px;
  border: 1px solid #335846;
  border-radius: 16px;
  background: #1d3429;
  color: #fff;
  box-shadow: 0 8px 28px #17251c35;
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.market-guide-toggle:hover { transform: translateY(-2px); box-shadow: 0 12px 32px #17251c42; }
.market-guide-toggle-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: #d9ed76;
  color: #1d3429;
  font-size: 19px;
}

.market-guide-toggle b { display: block; font-size: 11px; }
.market-guide-toggle small { display: block; margin-top: 3px; color: #dfe8db; font-size: 9px; }
.market-guide-presence { width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: #b5dc73; box-shadow: 0 0 0 0 #b5dc7355; animation: market-live-pulse 2.4s ease-out infinite; }

.market-guide :focus-visible { outline: 2px solid #8eaf8f; outline-offset: 2px; }

/* Bring real listings into view quickly, like a shopping marketplace. */
main#top {
  display: flex;
  flex-direction: column;
}

main#top > .hero { order: 1; }
main#top > .live-roll { order: 2; }
main#top > .featured-pick { order: 3; }
main#top > .market-discovery { order: 4; }
main#top > #discover { order: 5; }
main#top > #how-it-works { order: 6; }
main#top > #seller-note { order: 7; }

.live-roll { margin-top: 4px; margin-bottom: 22px; }
.live-roll-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  padding: 17px 20px;
  border: 1px solid #e0e6da;
  border-radius: 16px;
  background: linear-gradient(110deg, #fff 0%, #f1f5ec 100%);
  box-shadow: 0 12px 32px #2035250b;
}
.live-roll-heading { display: flex; align-items: center; gap: 8px; color: #245d44; font-size: 9px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.live-roll-dot { width: 8px; height: 8px; border-radius: 50%; background: #46a46b; box-shadow: 0 0 0 4px #46a46b1c; animation: market-live-pulse 2.4s ease-out infinite; }
.live-roll-caption { margin-left: 4px; color: #89938b; font-size: 9px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.live-roll-window { overflow: hidden; perspective: 500px; }
.live-roll-item { padding-top: 9px; animation: market-listing-rise .5s cubic-bezier(.2,.7,.25,1) both; transform-origin: bottom center; }
.live-roll-item h2 { margin: 0; color: #202922; font: 500 clamp(20px, 3vw, 29px)/1.15 var(--serif, Georgia, serif); }
.live-roll-item p { margin: 6px 0 0; color: #68736a; font-size: 10px; line-height: 1.5; }
.live-roll-item .live-roll-price { color: #245d44; font-weight: 800; }
.live-roll-action { min-height: 38px; padding: 0 15px; border: 0; border-radius: 99px; background: #1d3429; color: #fff; font-size: 10px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.live-roll-empty { margin: 10px 0 0; color: #68736a; font-size: 11px; }

@keyframes market-listing-rise {
  from { opacity: 0; transform: translateY(95%) rotateX(-34deg); }
  to { opacity: 1; transform: translateY(0) rotateX(0); }
}

@media (max-width: 800px) {
  main#top > .hero { padding-top: 30px; padding-bottom: 18px; }
  main#top > .hero .hero-art { display: none; }
  main#top > .hero h1 { font-size: clamp(38px, 8vw, 58px); }
}

@media (max-width: 650px) {
  header {
    position: sticky;
    z-index: 80;
    top: 0;
    background: var(--canvas, #f6f5f0);
  }

  main#top > .hero { padding-top: 24px; padding-bottom: 14px; }
  main#top > .hero .hero-copy { margin-top: 9px; font-size: 12px; }
  main#top > .hero .hero-search { margin-top: 14px; }
  .live-roll { margin-bottom: 14px; }
  .live-roll-card { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; min-height: 102px; padding: 13px; }
  .live-roll-caption { display: none; }
  .live-roll-action { min-height: 34px; padding: 0 10px; font-size: 9px; }
  main#top > .featured-pick { margin-top: 6px; }
  main#top > .featured-pick .featured-card {
    grid-template-columns: minmax(105px, .72fr) minmax(0, 1.28fr);
    gap: 12px;
    padding: 12px;
  }
  main#top > .featured-pick .featured-photo { min-height: 128px; }
  main#top > .featured-pick .featured-copy h2 { font-size: 19px; }
  main#top > .featured-pick .featured-actions { flex-wrap: wrap; gap: 6px; margin-top: 9px; }
  main#top > .featured-pick .featured-actions button { padding: 7px 9px; }
}

@media (max-width: 420px) {
  .live-roll-card { grid-template-columns: 1fr; gap: 8px; }
  .live-roll-action { justify-self: start; }
  main#top > .featured-pick .featured-card { grid-template-columns: 1fr; }
  main#top > .featured-pick .featured-photo { min-height: 150px; }
}

@keyframes market-guide-open {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 650px) {
  .market-guide { right: 12px; bottom: 12px; gap: 9px; }
  .market-guide-panel { max-height: min(520px, calc(100dvh - 96px)); }
  .market-guide-toggle { min-height: 51px; border-radius: 15px; }
}

/* Keep every marketplace section on the same page grid at each screen size. */
:root { --market-page-gutter: 24px; }
.wrap {
  width: min(1180px, calc(100% - var(--market-page-gutter) - var(--market-page-gutter)));
  margin-inline: auto;
}

@media (max-width: 800px) {
  :root { --market-page-gutter: 18px; }
}

@media (max-width: 370px) {
  :root { --market-page-gutter: 12px; }
}

.product-card:focus-within,
.market-shop-card:focus-within {
  outline: 2px solid #6e9879;
  outline-offset: 3px;
}

@keyframes market-banner-glide {
  0%, 68% { left: -42%; }
  100% { left: 112%; }
}

@keyframes market-arrive {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes market-copy-arrive {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes market-image-drift {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

@keyframes market-live-pulse {
  0% { box-shadow: 0 0 0 0 #1d9a5744; }
  65%, 100% { box-shadow: 0 0 0 5px #1d9a5700; }
}

@media (max-width: 650px) {
  .featured-card { box-shadow: 0 12px 28px #20352510; }
  .market-shop-card:hover { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
