/* ============================================
   Design System (ds.css)
   Shared component classes — Apple HIG inspired.
   Replaces duplicated wiki-*, forum-*, event-*,
   inspiration-* prefixed CSS across home pages.

   Depends on: bootstrap-theme.css (glass utilities,
   --theme-glassy-bg-rgb token)
   ============================================ */

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
  /* Surfaces */
  --ds-surface: var(--bs-body-bg);
  --ds-surface-elevated: var(--bs-body-tertiary-bg);
  --ds-surface-glass: rgba(var(--theme-glassy-bg-rgb), 0.7);

  /* Borders — near-invisible, Apple-style */
  --ds-border-subtle: rgba(var(--bs-body-color-rgb), 0.06);
  --ds-border: rgba(var(--bs-body-color-rgb), 0.08);
  --ds-border-hover: rgba(var(--bs-body-color-rgb), 0.12);
  --ds-border-emphasis: rgba(var(--bs-body-color-rgb), 0.2);

  /* Radii — Apple-scale */
  --ds-radius: 1rem;
  --ds-radius-lg: 1.25rem;
  --ds-radius-sm: 0.625rem;
  --ds-radius-pill: 999px;

  /* Shadows — depth progression */
  --ds-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --ds-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --ds-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --ds-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.12);

  /* Vertical rhythm — section spacing tiers */
  --ds-space-section-y: 3rem;
  --ds-space-section-y-mobile: 2rem;
  --ds-space-section-y-compact: 2rem;
  --ds-space-section-y-expanded: 4rem;

  /* Transitions — Apple-smooth */
  --ds-transition-fast: 0.15s ease;
  --ds-transition: 0.2s ease;
  --ds-transition-slow: 0.3s ease;
  --ds-transition-spring: 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ============================================
   PAGE HERO — home page hero section
   (title + subtitle, centered, clean bg)
   ============================================ */

.ds-page-hero {
  padding: 3.5rem 0 1rem;
  background: var(--ds-surface);
}

.ds-hero-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin-bottom: 0.75rem;
  color: var(--bs-body-color);
}

.ds-hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.125rem);
  font-weight: 400;
  color: var(--bs-secondary-color);
  margin-bottom: 0;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ============================================
   SEARCH BAR — pill-shaped, Apple-style
   ============================================ */

.ds-search {
  position: relative;
  max-width: 480px;
  margin: 2rem auto 0;
}

.ds-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  pointer-events: none;
  z-index: 1;
}

.ds-search-input {
  width: 100%;
  height: 44px;
  padding: 0 1rem 0 2.5rem;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-pill);
  background: var(--ds-surface-elevated);
  color: var(--bs-body-color);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color var(--ds-transition), box-shadow var(--ds-transition);
}

.ds-search-input::placeholder {
  color: var(--bs-secondary-color);
}

.ds-search-input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.12);
}

/* ============================================
   TAB BAR — horizontal scrollable tabs
   ============================================ */

.ds-tab-bar {
  position: relative;
  margin-top: 2rem;
  border-bottom: 1px solid var(--ds-border-subtle);
}

.ds-tab-scroll {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
}

.ds-tab-scroll::-webkit-scrollbar {
  display: none;
}

.ds-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--bs-secondary-color);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--ds-transition-fast), border-color var(--ds-transition-fast);
}

.ds-tab:hover {
  color: var(--bs-body-color);
  text-decoration: none;
}

.ds-tab-active {
  color: var(--bs-body-color);
  border-bottom-color: var(--bs-body-color);
  font-weight: 600;
}

.ds-tab-count {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  background: rgba(var(--bs-body-color-rgb), 0.06);
  padding: 0.0625rem 0.375rem;
  border-radius: var(--ds-radius-pill);
}

/* ============================================
   CHIP BAR — filter pills / segmented control
   ============================================ */

.ds-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
  padding-bottom: 0.5rem;
}

.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--bs-secondary-color);
  background: transparent;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-pill);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--ds-transition-fast);
}

.ds-chip:hover {
  background: rgba(var(--bs-body-color-rgb), 0.06);
  color: var(--bs-body-color);
  border-color: var(--ds-border-hover);
  text-decoration: none;
}

.ds-chip:active {
  transform: scale(0.97);
}

.ds-chip-active {
  background: var(--bs-body-color);
  color: var(--bs-body-bg);
  border-color: var(--bs-body-color);
}

.ds-chip-active:hover {
  background: var(--bs-body-color);
  color: var(--bs-body-bg);
  border-color: var(--bs-body-color);
  opacity: 0.85;
}

.ds-chip i {
  font-size: 0.625rem;
  opacity: 0.6;
}

@media (max-width: 575.98px) {
  .ds-chip-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .ds-chip-bar::-webkit-scrollbar {
    display: none;
  }
}

/* ============================================
   SECTION HEADER — title + subtitle + actions
   ============================================ */

.ds-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ds-section-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--bs-body-color);
  margin: 0;
  padding: 0;
}

.ds-section-title::after {
  display: none;
}

.ds-section-subtitle {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--bs-secondary-color);
  margin: 0.125rem 0 0;
}

.ds-section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 767.98px) {
  .ds-section-header {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ============================================
   NAV BUTTON — 34px circular arrow buttons
   ============================================ */

.ds-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(var(--bs-body-color-rgb), 0.1);
  background: transparent;
  color: var(--bs-secondary-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  cursor: pointer;
  transition: all var(--ds-transition-fast);
  padding: 0;
}

.ds-nav-btn:hover {
  border-color: var(--ds-border-emphasis);
  color: var(--bs-body-color);
  background: rgba(var(--bs-body-color-rgb), 0.04);
}

.ds-nav-btn:active {
  transform: scale(0.95);
}

@media (max-width: 767.98px) {
  .ds-nav-btn {
    width: 30px;
    height: 30px;
    font-size: 0.625rem;
  }
}

/* ============================================
   VIEW-ALL LINK — primary tint pill
   ============================================ */

.ds-view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--bs-primary);
  text-decoration: none;
  white-space: nowrap;
  transition: gap var(--ds-transition-fast);
}

.ds-view-all:hover {
  gap: 0.5rem;
  text-decoration: none;
  color: var(--bs-primary);
}

.ds-view-all i {
  font-size: 0.625rem;
  transition: transform var(--ds-transition-fast);
}

.ds-view-all:hover i {
  transform: translateX(2px);
}

/* ============================================
   SECTION SPACING — page-level rhythm
   ============================================ */

.ds-page .page-section {
  padding-top: var(--ds-space-section-y, 3rem);
  padding-bottom: var(--ds-space-section-y, 3rem);
}

@media (max-width: 767.98px) {
  .ds-page .page-section {
    padding-top: var(--ds-space-section-y-mobile, 2rem);
    padding-bottom: var(--ds-space-section-y-mobile, 2rem);
  }
}

.ds-page .page-section-compact {
  padding-top: var(--ds-space-section-y-compact, 2rem);
  padding-bottom: var(--ds-space-section-y-compact, 2rem);
}

.ds-page .page-section-expanded {
  padding-top: var(--ds-space-section-y-expanded, 4rem);
  padding-bottom: var(--ds-space-section-y-expanded, 4rem);
}

/* ============================================
   CAROUSEL CONTAINER — edge-to-edge Swiper
   ============================================ */

.ds-carousel-container {
  padding-left: max(1rem, calc((100vw - 1320px) / 2 + 1rem));
  padding-right: 0;
  overflow: visible !important;
  padding-top: 16px;
  padding-bottom: 16px;
  margin-top: -16px;
}

@media (max-width: 1400px) {
  .ds-carousel-container {
    padding-left: max(1rem, calc((100vw - 1140px) / 2 + 1rem));
  }
}

@media (max-width: 1200px) {
  .ds-carousel-container {
    padding-left: max(1rem, calc((100vw - 960px) / 2 + 1rem));
  }
}

@media (max-width: 992px) {
  .ds-carousel-container {
    padding-left: max(1rem, calc((100vw - 720px) / 2 + 1rem));
  }
}

@media (max-width: 768px) {
  .ds-carousel-container {
    padding-left: 1rem;
  }
}

.ds-page .page-section,
.ds-page .container-fluid {
  overflow: visible !important;
}

/* Keep carousel sections usable if Swiper JS/CSS fails to initialize. */
.ds-carousel-container .swiper:not(.swiper-initialized) {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.ds-carousel-container .swiper:not(.swiper-initialized)::-webkit-scrollbar {
  display: none;
}

.ds-carousel-container .swiper:not(.swiper-initialized) .swiper-wrapper {
  display: flex;
  gap: 1.5rem;
}

.ds-carousel-container .swiper:not(.swiper-initialized) .swiper-slide {
  flex: 0 0 min(82vw, 320px);
  width: min(82vw, 320px);
}

@media (min-width: 768px) {
  .ds-carousel-container .swiper:not(.swiper-initialized) .swiper-slide {
    flex-basis: min(44vw, 340px);
    width: min(44vw, 340px);
  }
}

@media (min-width: 992px) {
  .ds-carousel-container .swiper:not(.swiper-initialized) .swiper-slide {
    flex-basis: 320px;
    width: 320px;
  }
}

/* ============================================
   FEATURE SECTION — Apple-style info card
   Uses glass-subtle from bootstrap-theme.css
   ============================================ */

.ds-feature-section {
  background: var(--ds-surface-elevated);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius-lg);
  padding: 1.75rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform var(--ds-transition), box-shadow var(--ds-transition);
}

.ds-feature-section:hover {
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow-hover);
}

.ds-feature-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.ds-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--ds-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.ds-feature-icon-blue {
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
}

.ds-feature-icon-green {
  background: rgba(var(--bs-success-rgb), 0.12);
  color: var(--bs-success);
}

.ds-feature-icon-purple {
  background: rgba(111, 66, 193, 0.12);
  color: #6f42c1;
}

.ds-feature-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--bs-body-color);
  margin: 0;
}

.ds-feature-desc {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--bs-secondary-color);
  margin: 0.0625rem 0 0;
}

.ds-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
  flex: 1;
}

.ds-feature-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(var(--bs-body-color-rgb), 0.04);
}

.ds-feature-item:last-child {
  border-bottom: none;
}

.ds-feature-item-title {
  color: var(--bs-body-color);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
  transition: color var(--ds-transition-fast);
}

.ds-feature-item-title:hover {
  color: var(--bs-primary);
}

.ds-feature-item-meta {
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  white-space: nowrap;
  margin-left: 1rem;
}

.ds-feature-item-empty {
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
}

/* ============================================
   CTA BANNER — subtle inline call-to-action
   ============================================ */

.ds-cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  background: var(--ds-surface-elevated);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--ds-radius);
}

@media (max-width: 575.98px) {
  .ds-cta-banner {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem;
  }
}

/* Dark CTA banner variant — gradient background */
.ds-cta-banner-dark {
  border: none;
  border-radius: var(--ds-radius-lg);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}

.ds-cta-banner-dark::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(var(--bs-primary-rgb), 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.ds-cta-banner-dark .ds-section-title {
  color: #fff;
}

.ds-cta-banner-dark .ds-section-subtitle {
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 575.98px) {
  .ds-cta-banner-dark {
    padding: 2rem 1.5rem;
  }
}

/* Dark CTA action button */
.ds-cta-btn-light {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f3460;
  background: #fff;
  border: none;
  border-radius: var(--ds-radius-pill);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--ds-transition);
  position: relative;
  z-index: 1;
}

.ds-cta-btn-light:hover {
  background: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  color: #0f3460;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.ds-cta-btn-light i {
  font-size: 0.6875rem;
  transition: transform var(--ds-transition-fast);
}

.ds-cta-btn-light:hover i {
  transform: translateX(3px);
}

/* ============================================
   EMPTY STATE — centered icon + message
   ============================================ */

.ds-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--ds-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--bs-secondary-color);
  background: var(--ds-surface-elevated);
  margin-bottom: 1rem;
}

/* ============================================
   CAROUSEL PAGINATION (poster carousels only)
   ============================================ */

/* Minimal bullet pagination — Apple-inspired pill active bullet */
.ds-carousel-pagination.swiper-pagination {
  position: relative;
  margin-top: 1.25rem;
  text-align: center;
}

.ds-carousel-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  background: var(--bs-secondary-bg);
  opacity: 0.5;
  transition: all 0.3s ease;
  border-radius: 999px;
}

.ds-carousel-pagination .swiper-pagination-bullet-active,
.ds-carousel-pagination .swiper-pagination-bullet-active-main {
  width: 24px;
  opacity: 1;
  background: var(--bs-primary);
}
