/* =====================================================================
   featured.css — FEATURED PROJECTS ROW (on index.html)
   ---------------------------------------------------------------------
   The featured section box and its side-scrolling row of cards.
   ===================================================================== */

/* =========================================================
 FEATURED SECTION + SIDE-SCROLLING ROW
 ---------------------------------------------------------
 .featured-track is one horizontal row of cards:

   display: flex + overflow-x: auto  -> a sideways row that
                                        scrolls left/right
   scroll-snap-type: x mandatory     -> scrolling stops neatly
                                        on a card, not halfway
   flex: 0 0 <width>                 -> every card keeps the
                                        same width instead of
                                        squishing to fit

 On desktop, the arrow buttons in the header scroll the row
 by one card. With a trackpad/touch you can also just swipe.
 The arrows hide themselves when all cards already fit.
 ========================================================= */

.featured-section[hidden] { display: none; }

.featured-section {
  position: relative;
  margin-bottom: 36px;
  background: var(--accent-bg);
  border-top: 1px solid var(--accent-light);
  border-bottom: 1px solid var(--accent-light);
  padding: 24px 0 14px;
}

.featured-section::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent));
  background-size: 200% 100%;
  animation: featuredShimmer 6s ease-in-out infinite;
}

@keyframes featuredShimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .featured-section::before { animation: none; }
}

.featured-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 0 60px;
  margin-bottom: 12px;
}

.featured-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.featured-sub {
  font-size: 19px;
  font-weight: 500;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

.featured-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.featured-toggle:hover { color: var(--accent); }

.featured-toggle-caret { font-size: 0.6em; opacity: 0.6; transition: transform 0.2s ease; }
.is-collapsed .featured-toggle-caret { transform: rotate(180deg); }

.is-collapsed .featured-track,
.is-collapsed .scroll-btns { display: none; }

.is-collapsed .featured-head { margin-bottom: 4px; }
.is-collapsed .featured-sub { display: none; }

.scroll-btns {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.scroll-btns[hidden] { display: none; }

.scroll-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 30px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.scroll-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--accent-contrast);
  transform: scale(1.08);
}

.scroll-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.featured-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-start;
  max-height: 640px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 70px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 70px), transparent);
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scroll-padding-left: 60px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 60px 12px;
  scrollbar-width: none;
}

.featured-track::-webkit-scrollbar { display: none; }

.featured-track .card {
  flex: 0 0 calc((100% - 42px) / 4); /* show four complete cards */
  min-width: 0; /* stop long tags from stretching a card wider than its size */
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.featured-track .loading {
  flex: 1 0 100%;
  padding: 40px 10px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
}

.featured-track .error-state { flex: 1 0 100%; }

@media (max-width: 1000px) and (min-width: 701px) {
  .featured-track .card { flex-basis: calc((100% - 14px) / 2); }
  .featured-head { padding-left: 52px; padding-right: 52px; }
  .featured-track {
    padding-left: 52px;
    padding-right: 52px;
    scroll-padding-left: 52px;
  }
}

@media (max-width: 700px) {
  body { padding: 0; }
  :root { --card-pad: 16px; }

  .featured-section { padding-top: 12px; }
  .featured-head { padding: 0 16px; }
  .featured-title { font-size: 19px; }
  .scroll-btns { display: none; } /* just swipe on phones */

  .featured-track {
    gap: 12px;
    padding: 4px 16px 12px;
    scroll-padding-left: 16px;
  }

  .featured-track .card { flex-basis: 100%; } /* show one complete card */
}
