/*
Theme Name: Sheshi Discovery Card Rail
Version: 0.28.1
Description: Real discovery cards on desktop and a horizontal snap rail on tablet and mobile.
*/

/* Six independent cards instead of one framed result list. */
body.sheshi-home .sheshi-discovery-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
  overflow: visible !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

body.sheshi-home .sheshi-discovery-grid:focus-visible {
  outline: 2px solid var(--focus) !important;
  outline-offset: 6px;
}

body.sheshi-home .sheshi-discovery-grid > .sheshi-result-card--search {
  display: grid !important;
  width: auto !important;
  height: auto !important;
  min-height: 284px !important;
  grid-template-columns: 42px minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 16px 14px !important;
  align-items: start !important;
  margin: 0 !important;
  padding: 20px !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  color: var(--text-primary) !important;
  background: var(--surface-card) !important;
  box-shadow: 0 8px 24px rgba(23, 33, 38, .06) !important;
  scroll-snap-align: start;
}

body.sheshi-home .sheshi-discovery-grid > .sheshi-result-card--search:hover {
  border-color: var(--border-strong) !important;
  background: var(--surface-card) !important;
  box-shadow: 0 12px 30px rgba(23, 33, 38, .09) !important;
  transform: translateY(-2px) !important;
}

body.sheshi-home .sheshi-discovery-grid > .sheshi-result-card--search > .sheshi-category-icon {
  grid-column: 1;
  grid-row: 1;
  align-self: start !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-body {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-title-row {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  gap: 8px !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-title-row h2 {
  order: 1;
  margin: 0 !important;
  font-size: 19px !important;
  line-height: 1.2 !important;
  letter-spacing: -.02em !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-title-row .sheshi-meta-chip {
  order: 2;
  margin: 0 !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-description {
  display: -webkit-box !important;
  overflow: hidden !important;
  margin: 10px 0 0 !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-facts {
  flex-wrap: wrap !important;
  gap: 4px 12px !important;
  overflow: visible !important;
  margin-top: 10px !important;
  white-space: normal !important;
  line-height: 1.45 !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-facts span {
  display: inline-flex !important;
  white-space: normal !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-facts span + span::before {
  display: none !important;
  content: none !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-foot {
  grid-column: 1 / -1 !important;
  grid-row: 2;
  align-self: end;
  padding-top: 14px !important;
  border-top: 1px solid var(--border) !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-links {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-details,
body.sheshi-home .sheshi-discovery-grid .sheshi-result-website {
  width: 100% !important;
  min-width: 0 !important;
}

body.sheshi-home .sheshi-discovery-grid .sheshi-result-details {
  border: 1px solid var(--border-strong) !important;
  color: var(--text-primary) !important;
}

@media (max-width: 1023px) {
  body.sheshi-home .sheshi-discovery-grid {
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: minmax(320px, 44vw);
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-inline: contain;
    padding: 2px 2px 14px !important;
    scroll-padding-inline: 2px;
    scroll-snap-type: x mandatory;
    scrollbar-color: var(--border-strong) transparent;
    scrollbar-width: thin;
  }

  body.sheshi-home .sheshi-discovery-grid::-webkit-scrollbar {
    height: 7px;
  }

  body.sheshi-home .sheshi-discovery-grid::-webkit-scrollbar-track {
    background: transparent;
  }

  body.sheshi-home .sheshi-discovery-grid::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--border-strong);
  }

  body.sheshi-home .sheshi-discovery-grid > .sheshi-result-card--search {
    min-height: 300px !important;
  }
}

@media (max-width: 767px) {
  body.sheshi-home .sheshi-discovery-grid {
    grid-auto-columns: clamp(260px, 78vw, 320px);
    gap: 12px !important;
  }

  body.sheshi-home .sheshi-discovery-grid > .sheshi-result-card--search {
    min-height: 316px !important;
    gap: 14px 12px !important;
    padding: 18px !important;
  }

  body.sheshi-home .sheshi-discovery-grid .sheshi-result-title-row h2 {
    font-size: 18px !important;
  }

  body.sheshi-home .sheshi-discovery-grid .sheshi-result-links {
    grid-template-columns: 1fr !important;
  }

  body.sheshi-home .sheshi-discovery-grid .sheshi-result-website,
  body.sheshi-home .sheshi-discovery-grid .sheshi-result-details {
    grid-column: 1 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.sheshi-home .sheshi-discovery-grid {
    scroll-behavior: auto;
  }

  body.sheshi-home .sheshi-discovery-grid > .sheshi-result-card--search {
    transition: none !important;
  }
}
