/* ===========================================================
   INCLUDE_HOME_SELECTED_PRODUCTS.CSS
   FILE SOURCE:
   static/css/pages/test_pages_css/include_home_selected_products.css

   PURPOSE:
   - Homepage Selected Agarwood Pieces section.
   - Shows 4 curated wood products.
   - Mobile: horizontal scroll.
   - Desktop: 4 cards in one row.
   - Uses skeleton_base_test.css root colors and width.

   HTML TRACEBACK:
   templates/pages/test_pages_html/include_home_selected_products.html
   =========================================================== */

.home-selected {
  width: 100%;
  background: var(--color-bg);
}

.home-selected,
.home-selected * {
  box-sizing: border-box;
}

.home-selected-inner {
  width: min(calc(100% - 32px), var(--page-max-width, 1180px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.home-selected-heading-row {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 10px;
}

.home-selected-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  text-align: center;
}

.home-selected-heading h2 {
  margin: 0;

  color: var(--color-primary);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.8rem);
  font-weight: 800;
  line-height: 1.2;
}

.home-section-line {
  width: clamp(34px, 8vw, 90px);
  height: 1px;

  display: inline-block;

  background: linear-gradient(
    90deg,
    transparent,
    rgba(185, 130, 47, 0.65),
    transparent
  );
}

.home-selected-view-all {
  position: absolute;
  right: 0;

  color: var(--color-primary);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.home-selected-view-all:hover {
  color: var(--color-accent-dark);
}

.home-selected-desc {
  max-width: 620px;

  margin: 0 auto 16px;

  color: var(--color-muted);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}


/* Track */

.home-selected-track {
  display: flex;
  align-items: stretch;
  gap: 14px;

  overflow-x: auto;
  overflow-y: hidden;

  padding: 2px 2px 10px;

  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.home-selected-track::-webkit-scrollbar {
  height: 6px;
}

.home-selected-track::-webkit-scrollbar-track {
  background: rgba(232, 222, 208, 0.65);
  border-radius: 999px;
}

.home-selected-track::-webkit-scrollbar-thumb {
  background: rgba(185, 130, 47, 0.55);
  border-radius: 999px;
}


/* Card */

.home-selected-card {
  flex: 0 0 auto;
  width: clamp(150px, 42vw, 172px);

  overflow: hidden;

  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-card);
  box-shadow: 0 8px 22px rgba(43, 33, 24, 0.06);

  scroll-snap-align: start;

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.home-selected-card:hover {
  transform: translateY(-2px);
  border-color: rgba(185, 130, 47, 0.45);
  box-shadow: 0 14px 32px rgba(43, 33, 24, 0.1);
}

.home-selected-media-link {
  display: block;
  text-decoration: none;
}

.home-selected-media {
  width: 100%;
  aspect-ratio: 1 / 1;

  overflow: hidden;

  background: var(--color-bg-soft);
}

.home-selected-media img {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;
  object-position: center;
}

.home-selected-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  padding: 9px 10px 7px;

  text-align: left;
}

.home-selected-name {
  width: 100%;

  margin: 0 0 7px;

  text-align: left;
}

.home-selected-name a {
  width: 100%;
  min-height: 2.35em;

  display: -webkit-box;

  color: var(--color-primary);
  font-size: clamp(0.78rem, 2.5vw, 0.92rem);
  font-weight: 800;
  line-height: 1.18;
  text-align: left;
  text-decoration: none;

  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-selected-price {
  width: 100%;

  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;

  margin: 0 0 6px;
  padding: 0 0 6px;

  border-bottom: 1px solid rgba(185, 130, 47, 0.28);

  text-align: left;
}

.home-selected-price-main {
  color: var(--color-primary);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.2;
}

.home-selected-price-old {
  color: var(--color-muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: line-through;
}

.home-selected-meta {
  width: 100%;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;

  margin: 0;
  padding: 0;

  text-align: left;
}

.home-selected-badge {
  max-width: 100%;
  width: fit-content;

  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;

  padding: 2px 7px;

  border-radius: 999px;

  color: var(--color-muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;

  white-space: nowrap;
}

.home-selected-unit {
  background: rgba(78, 96, 69, 0.08);
}

.home-selected-grade {
  background: rgba(185, 130, 47, 0.1);
}

.home-selected-empty {
  width: 100%;

  padding: 18px;

  border: 1px dashed var(--color-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);

  color: var(--color-muted);
  text-align: center;
  font-size: 0.95rem;
}


/* Tiny phone */

@media (max-width: 320px) {
  .home-selected-inner {
    width: min(calc(100% - 18px), var(--page-max-width, 1180px));
    padding-top: 22px;
    padding-bottom: 28px;
  }

  .home-selected-heading-row {
    margin-bottom: 18px;
  }

  .home-selected-heading {
    gap: 8px;
  }

  .home-selected-heading h2 {
    font-size: 1.12rem;
  }

  .home-section-line {
    width: 28px;
  }

  .home-selected-view-all {
    display: none;
  }

  .home-selected-desc {
    font-size: 0.78rem;
    margin-bottom: 12px;
  }

  .home-selected-card {
    width: 138px;
  }

  .home-selected-body {
    padding: 8px 8px 6px;
  }

  .home-selected-name a {
    font-size: 0.72rem;
  }

  .home-selected-price-main {
    font-size: 0.78rem;
  }

  .home-selected-price-old {
    font-size: 0.64rem;
  }

  .home-selected-badge {
    padding: 2px 6px;
    font-size: 0.6rem;
  }
}


/* Mobile */

@media (min-width: 321px) and (max-width: 640px) {
  .home-selected-inner {
    width: min(calc(100% - 24px), var(--page-max-width, 1180px));
  }

  .home-selected-heading-row {
    flex-direction: column;
    gap: 6px;

    margin-bottom: 12px;
  }

  .home-selected-view-all {
    position: static;

    display: inline-flex;
    align-self: flex-end;

    margin-top: 2px;
    margin-right: 2px;

    font-size: 0.78rem;
  }
}


/* Tablet */

@media (min-width: 641px) and (max-width: 959px) {
  .home-selected-inner {
    width: min(calc(100% - 44px), var(--page-max-width, 1180px));
  }

  .home-selected-track {
    gap: 18px;
  }

  .home-selected-card {
    width: 180px;
  }
}


/* Desktop */

@media (min-width: 960px) {
  .home-selected-inner {
    width: min(calc(100% - 36px), var(--page-max-width, 1180px));
    padding-top: 34px;
    padding-bottom: 46px;
  }

  .home-selected-track {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;

    overflow: visible;
    padding: 0;

    scroll-snap-type: none;
  }

  .home-selected-card {
    width: auto;
  }

  .home-selected-name a {
    font-size: 0.88rem;
  }
}


/* Wide desktop */

@media (min-width: 1680px) {
  .home-selected-track {
    gap: 20px;
  }
}

/* ===========================================================
   FINAL TABLET CENTER FIX
   FILE SOURCE:
   static/css/pages/test_pages_css/include_home_selected_products.css

   PURPOSE:
   - Fix Selected Products / Selected Agarwood Pieces section.
   - In 822px - 959px, all 4 cards can fit.
   - Center the 4 cards instead of letting them sit on the left.
   - Below 822px, keep horizontal scroll.
   - At 960px+, desktop grid already handles full-width layout.

   HTML TRACEBACK:
   templates/pages/test_pages_html/include_home_selected_products.html
   =========================================================== */


/* ===========================================================
   822px - 959px
   4 cards fit, so center them.
   =========================================================== */

@media (min-width: 822px) and (max-width: 959px) {
  .home-selected-track {
    justify-content: center;

    overflow-x: visible;
    overflow-y: visible;

    padding-left: 0;
    padding-right: 0;
  }

  .home-selected-card {
    width: 180px;
  }
}

