/* ==========================================================================
   Agadir Nomad Trips — marketplace ProductCard system (2026 redesign)
   --------------------------------------------------------------------------
   One card component everywhere: listing pages, category pages, search
   results, destination pages and the "You may also like" rails on product
   pages. The markup is produced by assets/js/tour-catalog.js (client) and
   includes/tour-publisher.php (server) — same classes, same look.

   Search / sort / chips toolbar lives in discovery-2026.js and premium-2026.css.
   ========================================================================== */

/* ------------------------------------------------------------- grid */

.market-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 18px;
}

.market-card-grid--related {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1200px) {
  .market-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .market-card-grid,
  .market-card-grid--related { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}

@media (max-width: 600px) {
  .market-card-grid,
  .market-card-grid--related { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------- card */

/* display:flex would beat the UA [hidden] rule — keep filters actually hidden */
.market-card[hidden],
.hm-card[hidden] {
  display: none !important;
}

.market-card {
  position: relative;
  min-width: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid #E4E9F0;
  border-radius: 14px;
  color: #172333;
  background: #FFFFFF;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.market-card:hover {
  transform: translateY(-3px);
  border-color: rgba(11, 75, 175, .35);
  box-shadow: 0 12px 28px rgba(23, 35, 51, .10);
}

.market-card a:focus-visible {
  outline: 3px solid #1767C9;
  outline-offset: 2px;
  border-radius: 10px;
}

/* the title link stretches over the whole card — one big click target */
.market-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ------------------------------------------------------------- media */

.market-card__media {
  position: relative;
  display: block;
  flex: 0 0 auto;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #E9EEF5;
}

.market-card__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
  transition: transform .3s ease;
}

.market-card:hover .market-card__image {
  transform: scale(1.04);
}

/* Fallback state: shown only if every image in the chain fails. */
.market-card__media.is-image-missing,
.hm-card__media.is-image-missing {
  background: linear-gradient(135deg, #172333, #0B4BAF);
}

.market-card__media.is-image-missing .market-card__image,
.hm-card__media.is-image-missing img {
  opacity: 0;
}

/* ------------------------------------------------------------- badge */

.market-card__badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 20px);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  color: #172333;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(23, 35, 51, .18);
}

.market-card__badge--promotion {
  background: #0B4BAF;
  color: #fff;
}

/* ------------------------------------------------------------- body */

.market-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 14px;
}

.market-card__title {
  margin: 0 0 4px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #172333;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -.01em;
}

.market-card__title a {
  color: inherit;
  text-decoration: none;
}

.market-card__description {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #5D6B7E;
  font-size: 13px;
  line-height: 1.55;
}

.market-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12.5px;
  color: #667085;
}

.market-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.market-card__meta-item i {
  font-size: 11px;
  color: #0B4BAF;
}

/* ------------------------------------------------------------- footer */

.market-card__footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #EEF2F7;
}

.market-card__footer-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.market-card__social-proof { min-width: 0; }

.market-card__rating {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #172333;
}

.market-card__rating i {
  color: #F2B01E;
  font-size: 12px;
}

.market-card__rating strong {
  font-weight: 700;
}

.market-card__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  text-align: end;
}

.market-card__price-from {
  font-size: 12px;
  color: #667085;
}

.market-card__price-current {
  font-size: 16.5px;
  font-weight: 700;
  color: #172333;
  white-space: nowrap;
}

.market-card__price-unit {
  font-size: 11.5px;
  font-weight: 500;
  color: #667085;
  white-space: nowrap;
}

.market-card__price-old {
  font-size: 12.5px;
  color: #8A94A6;
  text-decoration: line-through;
}

.market-card__price--discount .market-card__price-current {
  color: #12855A;
}

/* error / empty states rendered into grids */
.tour-catalog-error {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: #667085;
}

@media (prefers-reduced-motion: reduce) {
  .market-card,
  .market-card__image {
    transition-duration: .01ms !important;
  }
}

/* ------------------------------------------------------------- listing header */

.listing-header {
  padding: 34px 0 6px;
  border-bottom: 1px solid #EEF2F7;
}

.listing-header__crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #8A94A6;
  margin-bottom: 14px;
}

.listing-header__crumbs a {
  color: #5D6B7E;
  text-decoration: none;
}

.listing-header__crumbs a:hover {
  color: #0B4BAF;
}

.listing-header h1 {
  margin: 0 0 16px;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: #172333;
}

.listing-header__lead {
  max-width: 72ch;
  color: #33475C;
  font-size: 15.5px;
  line-height: 1.7;
  margin: 0 0 14px;
}

.listing-header__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.listing-header__links a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid #E4E9F0;
  border-radius: 999px;
  background: #fff;
  color: #172333;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .18s ease, color .18s ease;
}

.listing-header__links a:hover {
  border-color: #0B4BAF;
  color: #0B4BAF;
}

/* ------------------------------------------------------------- filter chips */

.discovery-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
  margin: 0 0 4px;
}

.discovery-chips::-webkit-scrollbar {
  display: none;
}

.discovery-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid #E4E9F0;
  border-radius: 999px;
  background: #fff;
  color: #33475C;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.discovery-chip:hover {
  border-color: rgba(11, 75, 175, .45);
  color: #0B4BAF;
}

.discovery-chip.is-active {
  background: #0B4BAF;
  border-color: #0B4BAF;
  color: #fff;
}

.discovery-chip .discovery-chip__count {
  font-size: 11.5px;
  font-weight: 600;
  opacity: .72;
}

/* ==========================================================================
   Tour editorial hero (tours.html) — compact split header, kept from 2026.1
   ========================================================================== */

.tours-hero {
  background: linear-gradient(180deg, #FFFFFF 0%, var(--brand-cream, #F5F7FA) 100%);
  padding-top: calc(var(--header-height, 76px) + var(--header-utility-height, 34px) + 44px);
  padding-bottom: clamp(2.75rem, 5vw, 4.25rem);
}
.tours-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
}
.tours-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--brand-primary, #0B4BAF);
  font-family: var(--font-ui, 'Poppins', sans-serif);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tours-hero__eyebrow::before {
  content: "";
  width: 30px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand-primary, #0B4BAF);
}
.tours-hero__title {
  margin: 0 0 18px;
  max-width: 16ch;
  color: var(--brand-black, #172333);
  font-family: var(--font-ui, 'Poppins', sans-serif);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.tours-hero__lead {
  margin: 0 0 28px;
  max-width: 52ch;
  color: var(--color-gray, #667085);
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  line-height: 1.7;
}
.tours-hero__cta.btn-primary {
  background: var(--brand-primary, #0B4BAF);
  border-color: var(--brand-primary, #0B4BAF);
}
.tours-hero__cta.btn-primary:hover {
  background: var(--brand-primary-dark, #073B8C);
  border-color: var(--brand-primary-dark, #073B8C);
}
.tours-hero__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-lg, 1.25rem);
  background: var(--brand-sand, #EDF1F7);
  box-shadow: var(--shadow-lg, 0 20px 48px rgba(12, 42, 70, .13));
}
.tours-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 860px) {
  .tours-hero__inner { grid-template-columns: 1fr; gap: 22px; }
  .tours-hero__media { order: -1; aspect-ratio: 16 / 10; max-height: 220px; }
  .tours-hero__title { font-size: clamp(1.7rem, 7vw, 2.2rem); }
}
