/* -------------------------------------------------------------
 * PROJECTS / HORIZONTAL TIMELINE VIEW | /projects
 * -------------------------------------------------------------
 * Unified horizontal timeline layout for both mobile and desktop.
 * Horizontal scroll with magnetic card snaps.
 * Sticky year headers with chewy snap pop transition animations.
 */

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  transition: var(--transition-theme);
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 100px var(--gutter) 40px var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
}

/* ???? Horizontal Scroll Viewport ???? */
.dial-viewport {
  height: 60dvh;
  max-height: 580px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Hide scrollbar */
  -ms-overflow-style: none;
  position: relative;
  display: flex;
  flex-direction: row;
  scroll-snap-type: x mandatory; /* Snap horizontally */
  scroll-padding-left: 24px; /* Snap offset aligning with left margin */
  
  /* Smooth Gradient Wipe transition */
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 50%, transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 50%, transparent 100%);
  -webkit-mask-size: 300% 100%;
  mask-size: 300% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
  opacity: 0;
  transition: -webkit-mask-position 1.6s var(--ease-out-expo),
              mask-position 1.6s var(--ease-out-expo),
              opacity 0.6s ease-out;
}

.dial-viewport.revealed {
  -webkit-mask-position: 0% 0;
  mask-position: 0% 0;
  opacity: 1;
}

.dial-viewport::-webkit-scrollbar {
  display: none;
}

/* Spacer adjustments for horizontal timeline */
.dial-spacer:first-child {
  display: block !important;
  height: 100%;
  width: 24px; /* Mobile: start offset to align with left reference point */
  flex-shrink: 0;
}

.dial-spacer:last-child {
  display: block !important;
  height: 100%;
  width: calc(100vw - 24px); /* Mobile: viewport width minus left padding (24px) to allow full scroll & snap */
  flex-shrink: 0;
}

.dial-track {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  height: 100%;
}

/* ???? Year Nodes (Horizontal Blocks) ???? */
.dial-year-node {
  display: flex;
  flex-direction: column;
  position: relative;
  width: auto;
  margin-right: 64px;
  flex-shrink: 0;
  padding: 0 !important;
}

.dial-year-node:last-child {
  margin-right: 0;
}

/* ???? Year Header & Line Divider ???? */
.year-header-wrapper {
  width: 100%;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
}

.year-title {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  position: sticky;
  left: 24px;
  width: fit-content;
  margin: 0;
  padding: 0;
  user-select: none;
  z-index: 10;
  transform-origin: left center;
  transition: color 0.3s ease;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Chewy Directional Slide Animations for Year transitions */
@keyframes chewySlideRight {
  0% { transform: translateX(20px); }
  100% { transform: translateX(0); }
}

@keyframes chewySlideLeft {
  0% { transform: translateX(-20px); }
  100% { transform: translateX(0); }
}

.year-title span {
  display: inline-block;
  transition: color 0.3s ease;
}

.year-title.active-pop-right span {
  color: var(--text-primary) !important;
  animation: chewySlideRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.year-title.active-pop-left span {
  color: var(--text-primary) !important;
  animation: chewySlideLeft 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ???? Horizontal Cover Cards ???? */
.year-projects {
  display: flex;
  flex-direction: row;
  gap: 32px;
  width: auto;
  max-width: none;
  padding: 0;
}

.project-card {
  flex: 0 0 260px; /* Card size for mobile */
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  opacity: 1;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Image wrapper */
.image-wrapper {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out-expo);
}

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

/* Explore Tag overlay */
.image-wrapper::after {
  content: 'EXPLORE';
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  font-family: var(--font-sans);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.project-card:hover .image-wrapper::after {
  opacity: 1;
  transform: translateY(0);
}

/* Info metadata */
.project-info {
  padding: var(--space-sm) 0;
  display: flex;
  flex-direction: column;
  height: 72px;
  justify-content: flex-start;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.project-tag {
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.project-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-transform: uppercase;
}

/* Footer styling */
.gallery-footer {
  border-top: 1px solid var(--border-color);
  padding: var(--space-lg) 0;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: auto;
}

/* ???? Desktop Viewport Adjustments ???? */
@media (min-width: 768px) {
  .container {
    padding: 120px var(--gutter) 40px var(--gutter);
  }

  .dial-viewport {
    height: 70dvh;
    max-height: none;
    scroll-padding-left: 40px; /* Wider snapping padding on desktop */
  }

  .dial-year-node {
    margin-right: 120px; /* More spacing between years on desktop */
  }

  .year-header-wrapper {
    margin-bottom: 32px;
  }

  .year-title {
    left: 40px; /* Align with desktop gutter */
  }

  .year-projects {
    gap: 48px; /* Wider gap between cards on desktop */
  }

  .project-card {
    flex: 0 0 380px; /* Larger cards on desktop */
  }

  .dial-spacer:first-child {
    width: 40px; /* Desktop: start offset to align with left reference point */
  }

  .dial-spacer:last-child {
    width: calc(100vw - 40px); /* Desktop: viewport width minus left padding (40px) to allow full scroll & snap */
  }
}