/* Public home page: one quiet discovery flow, from hero to categories to inventory. */
body[data-original-page="home"] {
  --home-accent: var(--primary);
  --home-accent-soft: var(--primary-soft);
  --home-line: var(--border);
  background: var(--background);
}

body[data-original-page="home"] #main-content {
  max-width: none;
  padding: 0;
}

.home-shell,
.hero-wrap {
  width: min(100%, var(--yw-container));
  margin-inline: auto;
  padding-inline: var(--yw-gutter);
}

.home-shell { padding-bottom: var(--yw-space-20); }

/* Hero */
.home-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--home-line);
  background: radial-gradient(circle at 82% 8%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 34%), linear-gradient(180deg, var(--card), var(--background));
}

.hero-wrap { padding-top: var(--yw-space-6); padding-bottom: var(--yw-space-10); }

.hero-tabs {
  display: flex;
  width: max-content;
  margin: 0 auto var(--yw-space-5);
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--home-line);
  border-radius: var(--yw-radius-full);
  background: var(--card);
  box-shadow: var(--yw-shadow-xs);
}

.hero-tabs a {
  display: inline-flex;
  min-width: 72px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding-inline: var(--yw-space-4);
  border-radius: var(--yw-radius-full);
  color: var(--muted-foreground);
  font-size: var(--yw-text-sm);
  font-weight: var(--yw-fw-medium);
  transition: color var(--yw-dur) var(--yw-ease), background var(--yw-dur) var(--yw-ease);
}

.hero-tabs a:hover,
.hero-tabs a.active { color: var(--primary-text); background: var(--home-accent-soft); }

.hero-stage,
.hero-carousel { position: relative; height: 390px; }
.hero-carousel { width: 100%; }

.hero-slide {
  position: absolute;
  inset-block: 0;
  left: 50%;
  width: min(860px, 72vw);
  overflow: hidden;
  border-radius: var(--yw-radius-2xl);
  background: var(--surface-strong);
  opacity: 0;
  transform: translateX(-50%) scale(.9);
  transition: opacity 320ms var(--yw-ease), transform 420ms var(--yw-ease);
}

.hero-slide.active { z-index: 4; opacity: 1; transform: translateX(-50%) scale(1); box-shadow: var(--yw-shadow-xl); }
.hero-slide.prev { z-index: 2; opacity: .42; transform: translateX(calc(-50% - min(34vw, 420px))) scale(.84); }
.hero-slide.next { z-index: 2; opacity: .42; transform: translateX(calc(-50% + min(34vw, 420px))) scale(.84); }
.hero-slide.far { z-index: 1; pointer-events: none; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }

.hero-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgb(5 35 29 / .9), rgb(5 35 29 / .38) 64%, transparent);
}

.hero-slide[data-has-image="false"] {
  background: radial-gradient(circle at 88% 12%, rgb(123 240 196 / .54), transparent 38%), linear-gradient(120deg, #073c32, #087c60);
}

.hero-slide[data-has-image="false"]::before {
  inset: -40% -14% auto auto;
  width: 430px;
  aspect-ratio: 1;
  border: 1px solid rgb(255 255 255 / .16);
  border-radius: 50%;
  background: rgb(255 255 255 / .04);
  box-shadow: 0 0 0 54px rgb(255 255 255 / .035), 0 0 0 108px rgb(255 255 255 / .025);
}

.hero-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 36px 52px 72px;
  color: #fff;
}

.hero-content > div { width: min(100%, 610px); }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: var(--yw-space-3);
  padding-inline: var(--yw-space-3);
  border: 1px solid rgb(255 255 255 / .28);
  border-radius: var(--yw-radius-full);
  background: rgb(255 255 255 / .1);
  color: #eafff6;
  font-size: var(--yw-text-xs);
  font-weight: var(--yw-fw-semibold);
  letter-spacing: .08em;
}

.hero-title {
  max-width: 610px;
  color: #fff;
  font-size: clamp(32px, 3.4vw, 48px);
  font-weight: var(--yw-fw-bold);
  line-height: 1.16;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.hero-summary {
  max-width: 520px;
  margin: var(--yw-space-4) 0 0;
  color: rgb(255 255 255 / .86);
  font-size: var(--yw-text-md);
  line-height: var(--yw-lh-relaxed);
  text-wrap: pretty;
}

.hero-action {
  display: inline-flex;
  min-height: 44px;
  margin-top: var(--yw-space-5);
  align-items: center;
  gap: var(--yw-space-4);
  padding-inline: var(--yw-space-5);
  border-radius: var(--yw-radius-md);
  background: #fff;
  color: #075c45;
  font-size: var(--yw-text-sm);
  font-weight: var(--yw-fw-semibold);
  transition: transform var(--yw-dur) var(--yw-ease), background var(--yw-dur) var(--yw-ease);
}

.hero-action:hover { background: #e7fff5; transform: translateY(-1px); }

.hero-controls {
  position: absolute;
  z-index: 5;
  bottom: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 2px;
  transform: translateX(-50%);
}

.hero-controls[hidden] { display: none; }
.hero-controls button {
  position: relative;
  display: grid;
  min-width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--yw-radius-md);
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.hero-controls button:hover { background: rgb(255 255 255 / .14); }
.hero-controls .hero-indicator::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--yw-radius-full);
  background: rgb(255 255 255 / .52);
  transition: width var(--yw-dur) var(--yw-ease), background var(--yw-dur) var(--yw-ease);
}
.hero-controls .hero-indicator.active::after { width: 20px; background: #7df0c4; }
.hero-controls .hero-pause { width: auto; padding-inline: var(--yw-space-2); font-size: var(--yw-text-2xs); white-space: nowrap; }

/* Categories */
.category-strip { margin-top: var(--yw-space-8); }
.category-strip-title { margin-bottom: var(--yw-space-3); color: var(--muted-foreground); font-size: var(--yw-text-xs); font-weight: var(--yw-fw-semibold); letter-spacing: .08em; }
.category-strip-list { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: var(--yw-space-2); }

.category-pill {
  display: flex;
  min-width: 0;
  min-height: 92px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--yw-space-2);
  padding: var(--yw-space-3) var(--yw-space-2);
  border-radius: var(--yw-radius-lg);
  color: var(--foreground);
  font-size: var(--yw-text-xs);
  font-weight: var(--yw-fw-medium);
  text-align: center;
  transition: color var(--yw-dur) var(--yw-ease), background var(--yw-dur) var(--yw-ease), transform var(--yw-dur) var(--yw-ease);
}
.category-pill:hover { color: var(--primary-text); background: var(--home-accent-soft); transform: translateY(-2px); }
.category-pill span:first-child { display: grid; width: 42px; height: 42px; place-items: center; color: var(--primary); }
.category-pill svg { width: 34px; height: 34px; stroke-width: 1.65; }

/* Inventory */
.feed-section { margin-top: var(--yw-space-12); }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: var(--yw-space-4); margin-bottom: var(--yw-space-5); }
.section-row h2 { display: flex; align-items: center; gap: var(--yw-space-2); color: var(--foreground); font-size: var(--yw-text-3xl); font-weight: var(--yw-fw-bold); letter-spacing: -.025em; }
.section-row h2 > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: var(--yw-radius-md); background: var(--home-accent-soft); color: var(--primary-text); }
.section-more { display: inline-flex; min-height: 40px; align-items: center; gap: var(--yw-space-2); padding-inline: var(--yw-space-3); border-radius: var(--yw-radius-md); color: var(--muted-foreground); font-size: var(--yw-text-sm); font-weight: var(--yw-fw-medium); }
.section-more:hover { color: var(--primary-text); background: var(--home-accent-soft); }

.market-grid,
.recommend-grid,
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--yw-space-5); }

.event-card,
.service-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: visible;
  border: 1px solid var(--home-line);
  border-radius: var(--yw-radius-lg);
  background: var(--card);
  box-shadow: var(--yw-shadow-xs);
  transition: border-color var(--yw-dur) var(--yw-ease), box-shadow var(--yw-dur) var(--yw-ease), transform var(--yw-dur) var(--yw-ease);
}
.event-card:hover,
.service-card:hover { z-index: 3; border-color: var(--primary-border); box-shadow: var(--yw-shadow-md); transform: translateY(-3px); }
.event-card-link { display: flex; min-width: 0; flex: 1; flex-direction: column; overflow: hidden; border-radius: var(--yw-radius-lg) var(--yw-radius-lg) 0 0; }
.event-cover,
.service-cover { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: var(--muted); }
.event-cover img,
.service-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 360ms var(--yw-ease); }
.event-card:hover .event-cover img,
.service-card:hover .service-cover img { transform: scale(1.025); }

.fallback-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: var(--yw-space-5);
  overflow: hidden;
  border-bottom: 1px solid var(--primary-border);
  background: linear-gradient(var(--primary-soft) 1px, transparent 1px), linear-gradient(90deg, var(--primary-soft) 1px, transparent 1px), color-mix(in srgb, var(--primary) 7%, var(--card));
  background-size: 24px 24px;
  color: var(--primary-text);
  font-size: var(--yw-text-xl);
  font-weight: var(--yw-fw-semibold);
  line-height: var(--yw-lh-snug);
}
.fallback-cover span { position: relative; z-index: 1; }
.home-card-rank { display: none; }
.event-body,
.service-body { padding: var(--yw-space-5); }
.event-title,
.service-title { min-height: 44px; color: var(--card-foreground); font-size: var(--yw-text-lg); font-weight: var(--yw-fw-semibold); line-height: var(--yw-lh-snug); }
.event-meta,
.service-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--yw-space-3); margin-top: var(--yw-space-3); color: var(--muted-foreground); font-size: var(--yw-text-xs); }
.event-meta span:last-child,
.service-meta span:last-child { overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.service-card-price { color: var(--price); font-size: var(--yw-text-lg); font-weight: var(--yw-fw-bold); font-variant-numeric: tabular-nums; }

.event-organizer-foot { margin-inline: var(--yw-space-5); padding: var(--yw-space-4) 0 var(--yw-space-5); border-top: 1px solid var(--home-line); }
.organizer-card { position: static; }
.organizer-card summary { display: flex; min-height: 44px; align-items: center; gap: var(--yw-space-3); border-radius: var(--yw-radius-sm); cursor: pointer; list-style: none; }
.organizer-card summary::-webkit-details-marker { display: none; }
.organizer-avatar { display: grid; width: 40px; height: 40px; flex: none; place-items: center; overflow: hidden; border-radius: var(--yw-radius-md); background: var(--home-accent-soft); color: var(--primary-text); font-size: var(--yw-text-xl); font-weight: var(--yw-fw-semibold); }
.organizer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.organizer-copy { display: grid; min-width: 0; gap: 3px; }
.organizer-copy strong { overflow: hidden; color: var(--card-foreground); font-size: var(--yw-text-sm); font-weight: var(--yw-fw-medium); text-overflow: ellipsis; white-space: nowrap; }
.organizer-meta { display: flex; align-items: center; gap: var(--yw-space-2); color: var(--muted-foreground); font-size: var(--yw-text-2xs); }
.organizer-card:not([open]) > .organizer-popover { display: none; }

.organizer-popover {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 50%;
  display: flex;
  width: calc(100% - 40px);
  max-width: 240px;
  min-height: 220px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--yw-space-5);
  border: 1px solid var(--home-line);
  border-radius: var(--yw-radius-lg);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: var(--yw-shadow-xl);
  text-align: center;
  transform: translate(-50%, -50%);
}
.organizer-popover-name { max-width: 100%; margin-top: var(--yw-space-2); overflow-wrap: anywhere; color: var(--popover-foreground); font-size: var(--yw-text-md); }
.organizer-stats { display: grid; width: 100%; grid-template-columns: repeat(2, 1fr); margin: var(--yw-space-4) 0; }
.organizer-stats > div { display: grid; gap: 2px; }
.organizer-stats > div + div { border-left: 1px solid var(--home-line); }
.organizer-stats span,
.organizer-address,
.organizer-unavailable { color: var(--muted-foreground); font-size: var(--yw-text-2xs); }
.organizer-address,
.organizer-unavailable { margin: 0 0 var(--yw-space-4); }
.organizer-profile { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding-inline: var(--yw-space-4); border-radius: var(--yw-radius-md); background: var(--primary); color: var(--primary-foreground); font-size: var(--yw-text-xs); font-weight: var(--yw-fw-semibold); }

.event-favorite {
  position: absolute;
  z-index: 4;
  top: var(--yw-space-2);
  right: var(--yw-space-2);
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  color: var(--muted-foreground);
  box-shadow: var(--yw-shadow-sm);
  cursor: pointer;
}
.event-favorite:hover { color: var(--primary-text); }
.event-favorite[aria-pressed="true"] { color: var(--destructive); }

/* Trust and CTA */
.trust-band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: var(--yw-space-12); padding: var(--yw-space-6) 0; border-top: 1px solid var(--home-line); border-bottom: 1px solid var(--home-line); }
.trust-item { min-width: 0; padding-inline: var(--yw-space-5); }
.trust-item:first-child { padding-left: 0; }
.trust-item + .trust-item { border-left: 1px solid var(--home-line); }
.trust-item strong { display: block; color: var(--foreground); font-size: var(--yw-text-md); }
.trust-item span { display: block; margin-top: var(--yw-space-2); color: var(--muted-foreground); font-size: var(--yw-text-xs); line-height: var(--yw-lh-relaxed); }

.home-promo {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: var(--yw-space-10);
  margin-top: var(--yw-space-10);
  padding: var(--yw-space-8) var(--yw-space-10);
  border: 1px solid var(--primary-border);
  border-radius: var(--yw-radius-xl);
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  color: var(--foreground);
}
.promo-title { max-width: 18em; color: var(--foreground); font-size: var(--yw-text-4xl); font-weight: var(--yw-fw-bold); line-height: var(--yw-lh-snug); text-wrap: balance; }
.promo-actions { display: flex; flex-wrap: wrap; gap: var(--yw-space-3); }
.promo-actions a { min-height: 42px; background: var(--surface-strong); color: var(--surface-strong-foreground); }
.promo-panel { padding-left: var(--yw-space-8); border-left: 1px solid var(--primary-border); }
.promo-panel strong,
.promo-panel span { display: block; }
.promo-panel strong { color: var(--foreground); font-size: var(--yw-text-xl); }
.promo-panel span { margin-top: var(--yw-space-2); color: var(--muted-foreground); font-size: var(--yw-text-sm); line-height: var(--yw-lh-relaxed); }

.home-float { position: fixed; z-index: 40; right: var(--yw-space-4); bottom: var(--yw-space-5); display: grid; gap: var(--yw-space-2); }
.home-float-btn { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--home-line); border-radius: var(--yw-radius-lg); background: var(--card); color: var(--muted-foreground); box-shadow: var(--yw-shadow-md); cursor: pointer; }
.home-float-btn:hover { color: var(--primary-text); border-color: var(--primary-border); }
.home-float-btn svg { width: 18px; height: 18px; }

body[data-original-page="home"] #toast { position: fixed; z-index: var(--yw-z-toast); top: 72px; left: 50%; max-width: calc(100vw - 32px); padding: var(--yw-space-3) var(--yw-space-5); border-radius: var(--yw-radius-md); background: var(--surface-inverse); color: var(--surface-inverse-foreground); box-shadow: var(--yw-shadow-lg); transform: translateX(-50%); }
body[data-original-page="home"] #toast:not(.show) { display: none; }
body[data-original-page="home"] #toast.bad { background: var(--destructive); color: var(--destructive-foreground); }

@media (max-width: 900px) {
  .hero-slide { width: 84vw; }
  .category-strip-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .market-grid,
  .recommend-grid,
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--yw-space-6) 0; }
  .trust-item:nth-child(3) { border-left: 0; padding-left: 0; }
  .home-promo { grid-template-columns: 1fr; gap: var(--yw-space-6); }
  .promo-panel { padding: var(--yw-space-5) 0 0; border-top: 1px solid var(--primary-border); border-left: 0; }
}

@media (max-width: 640px) {
  .hero-wrap { padding-top: var(--yw-space-4); padding-bottom: var(--yw-space-6); }
  .hero-tabs { width: 100%; margin-bottom: var(--yw-space-4); }
  .hero-tabs a { min-width: 0; flex: 1; }
  .hero-stage,
  .hero-carousel,
  .hero-slide { height: 330px; }
  .hero-carousel { overflow: hidden; border-radius: var(--yw-radius-xl); }
  .hero-slide { width: 100%; }
  .hero-slide.prev,
  .hero-slide.next { opacity: 0; pointer-events: none; transform: translateX(-50%) scale(.94); }
  .hero-content { padding: var(--yw-space-6) var(--yw-space-6) 70px; }
  .hero-title { font-size: 30px; }
  .hero-summary { font-size: var(--yw-text-sm); }
  .category-strip { margin-top: var(--yw-space-6); }
  .category-strip-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--yw-space-1); }
  .category-pill { min-height: 76px; gap: var(--yw-space-1); padding: var(--yw-space-2) var(--yw-space-1); }
  .category-pill span:first-child { width: 32px; height: 32px; }
  .category-pill svg { width: 28px; height: 28px; }
  .feed-section { margin-top: var(--yw-space-10); }
  .section-row { margin-bottom: var(--yw-space-4); }
  .section-row h2 { font-size: var(--yw-text-2xl); }
  .section-row h2 > span { width: 30px; height: 30px; }
  .section-more { min-height: 36px; padding-inline: var(--yw-space-2); font-size: var(--yw-text-xs); }
  .market-grid,
  .recommend-grid,
  .service-grid { grid-template-columns: 1fr; gap: var(--yw-space-4); }
  .event-card:hover,
  .service-card:hover { transform: none; }
  .event-title,
  .service-title { min-height: 0; }
  .trust-band { grid-template-columns: 1fr; gap: 0; padding-block: var(--yw-space-2); }
  .trust-item,
  .trust-item:first-child,
  .trust-item:nth-child(3) { padding: var(--yw-space-4) 0; border-left: 0; border-right: 0; }
  .trust-item + .trust-item { border-top: 1px solid var(--home-line); border-left: 0; }
  .home-promo { margin-top: var(--yw-space-8); padding: var(--yw-space-6); }
  .promo-title { font-size: var(--yw-text-3xl); }
  .home-float { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-slide,
  .hero-action,
  .event-card,
  .service-card,
  .event-cover img,
  .service-cover img,
  .category-pill { transition: none; }
}
