/* Market + vendor detail pages (/market, /vendor) -- from traders-trove-
   handoff/design/market-detail.dc.html and vendor-detail.dc.html. Shared
   chrome/components are in site.css; tokens in tokens.css. */

.detail-loading { padding-top: 48px; padding-bottom: 64px; }

/* --- Hero ---------------------------------------------------------------- */

.detail-hero { background: var(--surface-tint); border-bottom: 1px solid var(--border); }
.detail-hero__inner { padding-top: 16px; padding-bottom: 36px; display: flex; flex-direction: column; gap: 16px; }
.detail-hero__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 32px; }
.detail-hero__copy { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; max-width: 760px; }
.detail-hero h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 44px; line-height: 1.08; letter-spacing: -0.02em;
}
.detail-hero__sub { font-size: 18px; color: var(--text-soft); }
.detail-hero__actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.highlights { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.highlights li {
  padding: 6px 12px; border-radius: var(--radius-pill); background: var(--surface);
  border: 1px solid var(--border); font-size: 15px; font-weight: 600; color: var(--ink);
}

/* --- Two-column body ------------------------------------------------------ */

.detail-layout {
  padding-top: 40px; padding-bottom: 56px;
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start;
}
.detail-main { display: flex; flex-direction: column; gap: 40px; min-width: 0; }
.detail-aside { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

@media (max-width: 960px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
}

.detail-section { display: flex; flex-direction: column; gap: 16px; }
.detail-section h2 { font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: -0.01em; }
.detail-section__head { display: flex; flex-direction: column; gap: 4px; }
.detail-section__head--row { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.detail-section p { max-width: 70ch; }

/* --- Vendors by market day --------------------------------------------------- */

.date-buttons { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; }
.date-button {
  flex: 0 0 auto; min-width: 104px; min-height: var(--target-min); padding: 10px 14px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--border-input);
  border-radius: var(--radius-card); cursor: pointer;
}
.date-button__dow { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.date-button__day { font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.1; }
.date-button__note { font-size: 13px; color: var(--text-muted); }
.date-button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.date-button[aria-pressed="true"] .date-button__note { color: var(--on-brand); }

.vendor-count { font-weight: 600; color: var(--text-muted); }
.notice { padding: 16px 20px; }

.vendor-grid--detail { gap: 12px; }
.vendor--detail { align-items: flex-start; padding: 14px; height: 100%; }
.vendor--detail .vendor__avatar { width: 48px; height: 48px; }
.vendor__blurb {
  font-size: 14px; color: var(--text); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.show-all { display: flex; justify-content: center; }

/* --- Schedule table ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.schedule-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.schedule-table th, .schedule-table td { text-align: left; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.schedule-table thead th {
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--label);
}
.schedule-table tbody th { font-weight: 600; color: var(--ink); }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.check-list li { display: flex; align-items: center; gap: 10px; }
.check-list svg { color: var(--brand); flex: 0 0 auto; }

/* --- Sidebar panels -------------------------------------------------------------- */

.panel--flush { padding: 0; overflow: hidden; gap: 0; }
.panel__body { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.panel address { font-style: normal; color: var(--ink); }
.map-region--small { height: 220px; border: 0; border-radius: 0; border-bottom: 1px solid var(--border); }

/* --- Other markets nearby / more vendors ------------------------------------------- */

.nearby { background: var(--surface-muted); border-top: 1px solid var(--border); }
.nearby__inner { padding-top: 40px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 20px; }
.nearby h2 { font-family: var(--font-display); font-weight: 700; font-size: 28px; }
.nearby__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.nearby-card {
  height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  text-decoration: none; color: var(--text);
}
.nearby-card:hover { border-color: var(--border-input); color: var(--text); }
.nearby-card__name { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--ink); line-height: 1.2; }
.nearby-card__meta { font-size: 15px; color: var(--text-muted); }

@media (max-width: 960px) {
  .nearby__list { grid-template-columns: minmax(0, 1fr); }
}

/* --- Vendor page --------------------------------------------------------------------- */

.vendor-hero__row { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; }
.vendor-photo {
  flex: 0 0 auto; width: 120px; height: 120px; border-radius: var(--radius-panel); object-fit: cover;
  background: var(--avatar-bg); color: var(--avatar-fg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 48px;
}
.vendor-hero__copy { flex: 1 1 320px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* Vendor page "Where to find them": markets list beside the map. */
.where-body { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.where-body--no-map { grid-template-columns: minmax(0, 1fr); }
.where-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.where-list--scroll { position: relative; overflow-y: auto; overscroll-behavior: contain; padding: 3px; margin: -3px; }
.where-card {
  width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-card);
}
.where-card:hover { border-color: var(--border-input); }
.where-card[aria-pressed="true"] { background: var(--surface-tint); border-color: var(--brand); }
.where-card__num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; background: var(--brand); color: var(--on-brand);
}
.where-card[aria-pressed="true"] .where-card__num { background: var(--accent); }
.where-card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.where-card__name { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--ink); line-height: 1.25; }
.where-body .map-region { height: 300px; }

/* Map popup for a selected market (vendor page). */
.market-popup .leaflet-popup-content-wrapper { border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.market-popup .leaflet-popup-content { margin: 12px 16px; font-family: var(--font-body); font-size: 15px; display: flex; flex-direction: column; gap: 2px; }
.market-popup__name { margin: 0 !important; font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); }
.market-popup a { display: inline-flex; align-items: center; min-height: var(--target-min); color: var(--link); font-weight: 600; }
.where-card__meta { font-size: 15px; color: var(--text-muted); }

.upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.upcoming li {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.upcoming__date { display: flex; flex-direction: column; }
.upcoming__dow { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--label); }
.upcoming__day { font-family: var(--font-display); font-weight: 700; font-size: 19px; color: var(--ink); }
.upcoming__where { display: flex; flex-direction: column; min-width: 0; }
.upcoming__where a { font-weight: 600; display: inline-flex; align-items: center; min-height: var(--target-min); }
.upcoming__hours { font-size: 15px; color: var(--text-muted); }
.tag { padding: 3px 10px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600; }
.tag--confirmed { background: var(--status-open-bg); color: var(--status-open-fg); }
.tag--expected { background: var(--status-upcoming-bg); color: var(--status-upcoming-fg); }

/* --- Admin ------------------------------------------------------------------------------ */

.admin-panel {
  margin-bottom: 48px; padding: 16px 20px; border: 1.5px dashed var(--border-dashed); border-radius: var(--radius-card);
  display: flex; flex-direction: column; gap: 16px;
}
.admin-panel summary { cursor: pointer; font-weight: 700; color: var(--ink); min-height: var(--target-min); display: flex; align-items: center; }
.admin-panel h3 { font-size: 16px; margin-top: 16px; }
.admin-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin-top: 12px; }
.admin-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; color: var(--ink); }
.admin-form input:not([type="checkbox"]), .admin-form textarea, .admin-form select {
  min-height: var(--target-min); padding: 8px 12px; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--border-input); border-radius: 8px;
}
.admin-form textarea { min-height: 96px; }
.admin-form__wide, .admin-form .actions, .admin-form .status-message { grid-column: 1 / -1; }
.admin-form__check { flex-direction: row !important; align-items: center; min-height: var(--target-min); }
.admin-form__check input { width: 20px; height: 20px; accent-color: var(--brand); }
.admin-form fieldset { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.admin-form legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
.admin-rows { margin: 0; display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 4px 16px; font-size: 14px; }
.admin-rows > div { display: contents; }
.admin-rows dt { color: var(--label); font-weight: 600; }
.admin-rows dd { margin: 0; overflow-wrap: anywhere; }

/* --- Mobile ------------------------------------------------------------------------------ */

@media (max-width: 640px) {
  .detail-hero__inner { padding-top: 8px; padding-bottom: 24px; }
  .detail-hero h1 { font-size: 32px; }
  .detail-hero__sub { font-size: 16px; }
  .detail-hero__actions { align-items: stretch; width: 100%; }
  .detail-hero__actions .actions > * { flex: 1 1 auto; }
  .detail-layout { padding-top: 28px; gap: 32px; }
  .detail-main { gap: 32px; }
  .where-body { grid-template-columns: minmax(0, 1fr); }
  .where-body .map-region { order: -1; height: 240px; }
  .detail-section h2, .nearby h2 { font-size: 24px; }
  .check-list { grid-template-columns: minmax(0, 1fr); }
  .vendor-photo { width: 88px; height: 88px; font-size: 36px; }
  .upcoming li { grid-template-columns: 88px minmax(0, 1fr); }
  .upcoming .tag { grid-column: 2; justify-self: start; }
  .admin-form { grid-template-columns: minmax(0, 1fr); }
}

/* Market page "Shopping for" filter above the vendor list. */
.shopping-for { display: flex; flex-direction: column; gap: 8px; }
.shopping-for__label { font-size: 14px; font-weight: 600; color: var(--ink); }
