/* ==========================================================================
   PINNED PROJECTS SECTION STYLES (pinned-page-animation)
   GSAP Pinned Split Scroll Component for trang-chu.html
   ========================================================================== */

:root {
  --pinned-bg: #f4f1ea;
  --pinned-text-dark: #1a1a1a;
  --pinned-text-grey: #6e6e6e;
  --pinned-accent: #d4a373;
}

#projects {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background-color: var(--pinned-bg);
  color: var(--pinned-text-dark);
  font-family: 'Manrope', sans-serif;
}

/* LEFT SIDE - STICKY */
.project-left {
  width: 40%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 5rem;
  z-index: 2;
}

.overline {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pinned-text-grey);
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
  padding-top: 10px;
}

.overline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 36px;
  height: 2px;
  background-color: var(--pinned-accent, #d4a373);
  border-radius: 2px;
}

.project-title {
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  line-height: 1.1;
  font-weight: 400;
  margin-bottom: 2rem;
  color: var(--pinned-text-dark);
}

.project-title em {
  font-family: 'Playfair Display', serif;
  font-weight: 400;
  font-style: italic;
  color: var(--pinned-accent);
}

.project-description {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--pinned-text-grey);
  max-width: 350px;
  margin-bottom: 3rem;
}

/* Interactive Button */
.btn-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--pinned-text-dark);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
}

.btn-arrow svg {
  transition: transform 0.3s ease;
}

.btn-arrow:hover {
  color: var(--pinned-accent);
}

.btn-arrow:hover svg {
  transform: translateX(5px);
  stroke: var(--pinned-accent);
}

/* RIGHT SIDE - SCROLLABLE */
.project-right {
  width: 60%;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* GRID */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  padding: 8rem 4rem 150px 0;
  width: 100%;
}

/* CARD DESIGN */
.project-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--pinned-text-dark);
}

.img-wrapper {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #e0e0e0;
  border-radius: 12px;
}

.img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.project-card:hover .img-wrapper img {
  transform: scale(1.05);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 1rem;
}

.meta-left h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  line-height: 1.35;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.meta-left p {
  font-size: 0.85rem;
  color: var(--pinned-text-grey);
}

.meta-right {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--pinned-text-dark);
}

/* CONTROLS (Hidden by default on Desktop) */
.cards-slider-controls {
  display: none;
}

/* ==========================================================================
   RESPONSIVE - TABLET & MOBILE SWIPE SLIDER
   ========================================================================== */
@media (max-width: 1024px) {
  #projects {
    flex-direction: column;
    min-height: auto;
    height: auto !important;
    padding: 3.5rem 0 4rem 0;
    overflow: hidden;
  }

  .project-left {
    width: 100%;
    height: auto;
    padding: 0 2rem 1.75rem 2rem;
    align-items: flex-start;
  }

  .project-title {
    font-size: 2.5rem;
    line-height: 1.15;
    margin-bottom: 1.25rem;
  }

  .project-description {
    max-width: 600px;
    margin-bottom: 1.75rem;
  }

  .project-right {
    width: 100%;
    height: auto;
    padding: 0;
    overflow: visible;
    position: relative;
  }

  /* Transform cards-grid into horizontal swipe slide */
  .cards-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 2rem;
    scroll-padding-inline: 2rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: 1.5rem;
    padding: 0.75rem 2rem 1.5rem 2rem;
    width: 100%;
    box-sizing: border-box;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior-x: contain;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }

  .cards-grid::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }

  .cards-grid.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto !important;
    scroll-snap-type: none !important;
  }

  /* Card Item in Slide */
  .project-card {
    flex: 0 0 315px;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
    background: #ffffff;
    border-radius: 20px;
    padding: 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .project-card:active {
    transform: scale(0.99);
  }

  .img-wrapper {
    aspect-ratio: 4/5;
    border-radius: 14px;
  }

  .card-meta {
    padding-top: 0.85rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }

  .meta-left h3 {
    font-size: 1.15rem;
    line-height: 1.4;
    margin-bottom: 0.35rem;
  }

  .meta-left p {
    font-size: 0.82rem;
  }

  .meta-right {
    font-size: 0.78rem;
    background: rgba(212, 163, 115, 0.15);
    color: #b07842;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    margin-left: 8px;
    font-weight: 600;
  }

  /* Slider Controls: Hint + Dots + Counter + Arrows */
  .cards-slider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    margin-top: 0.5rem;
    box-sizing: border-box;
  }

  .slider-hint-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--pinned-text-grey);
    background: rgba(0, 0, 0, 0.04);
    padding: 6px 14px;
    border-radius: 20px;
  }

  .slider-hint-badge svg {
    stroke: var(--pinned-accent);
    animation: hintSwipeAnim 1.8s ease-in-out infinite;
  }

  @keyframes hintSwipeAnim {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(5px); }
  }

  .slider-controls-right {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .slider-dots-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .slider-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.18);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
    border: none;
    padding: 0;
  }

  .slider-dot.active {
    width: 22px;
    border-radius: 10px;
    background: var(--pinned-accent, #d4a373);
  }

  .cards-counter-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--pinned-text-grey);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: center;
  }

  .slider-nav-btns {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .slider-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pinned-text-dark);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }

  .slider-nav-btn:hover:not(:disabled) {
    background: var(--pinned-accent, #d4a373);
    color: #ffffff;
    border-color: var(--pinned-accent, #d4a373);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 163, 115, 0.3);
  }

  .slider-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: none;
  }
}

/* SMARTPHONE BREAKPOINT */
@media (max-width: 640px) {
  #projects {
    padding: 2.75rem 0 3.25rem 0;
  }

  .project-left {
    padding: 0 1.5rem 1.25rem 1.5rem;
  }

  .project-title {
    font-size: 2rem;
  }

  .project-description {
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
  }

  .cards-grid {
    padding: 0.5rem 1.5rem 1.25rem 1.5rem;
    scroll-padding-left: 1.5rem;
    scroll-padding-inline: 1.5rem;
    gap: 1rem;
  }

  .project-card {
    flex: 0 0 78vw;
    max-width: 300px;
    min-width: 245px;
    padding: 12px;
    border-radius: 16px;
  }

  .meta-left h3 {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 0.35rem;
  }

  .cards-slider-controls {
    padding: 0 1.5rem;
    flex-wrap: wrap;
    gap: 10px;
  }

  .slider-hint-badge {
    order: 2;
    width: 100%;
    justify-content: center;
    font-size: 0.78rem;
    padding: 5px 12px;
  }

  .slider-controls-right {
    order: 1;
    width: 100%;
    justify-content: space-between;
  }
}