/* ============================================================
   PS5 PORTFOLIO — PROJECTS / GAME LIBRARY PAGE
   Horizontal carousel + detail panel
   ============================================================ */

/* ── Page shell ── */
.projects-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--color-bg);
  overflow: hidden;
  position: relative;
}

/* ── Dynamic background (cross-fade on project hover) ── */
.dynamic-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  transition: opacity 600ms ease, background 600ms ease;
  background: var(--bg-gradient);
  background-size: 300% 300%;
  animation: backgroundShift 16s ease infinite;
}

.projects-page > *:not(.dynamic-bg):not(.game-hub-overlay) {
  position: relative;
  z-index: 1;
}

/* ── Top bar ── */
.projects-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  gap: var(--space-4);
  z-index: var(--z-above);
  animation: slideDown 0.5s var(--ease-smooth) both;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  transition: background 300ms ease;
  flex-shrink: 0;
}

.topbar-user:hover {
  background: var(--color-accent-subtle);
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), var(--color-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.topbar-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.topbar-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}

.topbar-title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Main layout: carousel + detail ── */
.projects-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── Carousel section ── */
.carousel-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: var(--space-16);
  min-width: 0;
  position: relative;
  z-index: 1;
}

.carousel-label {
  padding: 0 var(--space-6) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
  animation: fadeIn 0.5s ease 0.3s both;
}

/* ── The scrollable track ── */
.carousel-track {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-6) var(--space-8);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  animation: slideUp 0.6s var(--ease-smooth) 0.2s both;
}

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

.carousel-track:active {
  cursor: grabbing;
}

/* ── Individual game cover (glassmorphism + 3D tilt) ── */
.game-cover {
  flex-shrink: 0;
  width: 180px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  position: relative;
  overflow: hidden;
  scroll-snap-align: start;
  cursor: pointer;
  transition:
    transform 300ms var(--ease-bounce),
    box-shadow 300ms ease,
    outline 150ms ease;
  outline: 2px solid transparent;
  outline-offset: 4px;
  animation: carouselReveal 0.4s var(--ease-smooth) both;
  transform-style: preserve-3d;
  will-change: transform;

  /* cover gradient */
  background: linear-gradient(
    160deg,
    var(--cover-color-a, var(--color-accent)),
    var(--cover-color-b, var(--color-secondary))
  );
}

/* Glassmorphism sheen on cover hover */
.game-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
  z-index: 2;
}

.game-cover:hover::after {
  opacity: 1;
}

/* 3D tilt perspective container */
.covers-carousel {
  perspective: 800px;
}

.game-cover:nth-child(1)  { animation-delay: 0ms; }
.game-cover:nth-child(2)  { animation-delay: 50ms; }
.game-cover:nth-child(3)  { animation-delay: 100ms; }
.game-cover:nth-child(4)  { animation-delay: 150ms; }
.game-cover:nth-child(5)  { animation-delay: 200ms; }
.game-cover:nth-child(6)  { animation-delay: 250ms; }
.game-cover:nth-child(7)  { animation-delay: 300ms; }
.game-cover:nth-child(8)  { animation-delay: 350ms; }

.game-cover:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow:
    var(--shadow-lg),
    0 0 32px var(--color-accent-glow);
}

.game-cover.is-selected {
  transform: translateY(-12px) scale(1.1);
  outline-color: var(--color-accent);
  box-shadow:
    var(--shadow-xl),
    0 0 48px var(--color-accent-glow),
    0 0 80px color-mix(in srgb, var(--color-accent) 20%, transparent);
}

/* Noise texture overlay for depth */
.game-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.4;
}

/* ── Genre badge (top-right) ── */
.game-cover-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  padding: var(--space-1) var(--space-2);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

/* ── Cover bottom info ── */
.game-cover-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-8) var(--space-3) var(--space-3);
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.game-cover-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

/* ── Tech icon row at cover bottom ── */
.game-cover-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tech-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

/* ── Extended info on hover ── */
.game-cover-hover-info {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 250ms ease;
  pointer-events: none;
}

.game-cover:hover .game-cover-hover-info,
.game-cover:focus-visible .game-cover-hover-info {
  opacity: 1;
}

.hover-info-text {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: #fff;
}

/* ── Detail panel ── */
.detail-panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--glass-border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  z-index: 1;
  transition: transform 300ms var(--ease-smooth);
}

.detail-panel.is-hidden {
  transform: translateX(100%);
}

.detail-panel-inner {
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  animation: panelSlideIn 0.4s var(--ease-smooth) both;
}

/* Re-trigger animation when content changes */
.detail-panel-inner.refreshing {
  animation: panelSlideIn 0.35s var(--ease-smooth) both;
}

.detail-project-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    160deg,
    var(--cover-color-a, var(--color-accent)),
    var(--cover-color-b, var(--color-secondary))
  );
  position: relative;
  overflow: hidden;
  max-height: 240px;
  aspect-ratio: 16 / 9;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.detail-genre {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-accent);
}

.detail-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

.detail-description {
  font-size: var(--text-sm);
  font-weight: 300;
  line-height: var(--leading-loose);
  color: var(--color-text-muted);
}

.detail-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
}

.detail-tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.detail-tech-tag {
  padding: var(--space-1) var(--space-3);
  background: var(--color-accent-subtle);
  border: 1px solid color-mix(in srgb, var(--color-accent) 30%, transparent);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-accent);
  letter-spacing: 0.03em;
}

.detail-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.detail-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  transition: all 300ms ease;
  text-decoration: none;
}

.detail-link-btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.detail-link-btn--primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}

.detail-link-btn--secondary {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.detail-link-btn--secondary:hover {
  background: var(--color-surface-overlay);
  transform: translateY(-1px);
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-4);
  color: var(--color-text-faint);
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.detail-empty-icon {
  font-size: var(--text-5xl);
  opacity: 0.3;
}

.detail-empty-text {
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
}

/* ── Featured/hero section (above carousel) ── */
.featured-hero {
  flex: 1;
  display: flex;
  align-items: flex-end;
  padding: var(--space-16) var(--space-6) 0;
  position: relative;
  min-height: 0;
  transition: background 500ms ease;
}

.featured-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--cover-color-a, var(--color-accent)) 20%, transparent),
    transparent 70%
  );
  transition: background 500ms ease;
}

.featured-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  animation: fadeIn 0.4s ease both;
}

.featured-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-secondary);
}

.featured-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

@media (min-width: 768px) {
  .featured-title {
    font-size: var(--text-5xl);
  }
}

/* ── Bottom hint bar ── */
.projects-hint-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: 0 var(--space-6);
  z-index: var(--z-nav);
}

/* ── Responsive: stack on mobile ── */
@media (max-width: 768px) {
  .projects-layout {
    flex-direction: column;
  }

  .detail-panel {
    width: 100%;
    height: auto;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    transform: none !important;
  }

  .detail-panel.is-hidden {
    display: none;
  }

  .game-cover {
    width: 140px;
  }

  .featured-title {
    font-size: var(--text-2xl);
  }
}

@media (max-width: 480px) {
  .game-cover {
    width: 120px;
  }

  .projects-topbar {
    padding: var(--space-3) var(--space-4);
  }
}

/* ============================================================
   VIEW CLASS ALIASES (match slim template class names)
   ============================================================ */

/* .top-bar -> top bar / topbar style */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  gap: var(--space-4);
  z-index: var(--z-above);
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  transition: background 300ms ease;
}

.top-bar-user:hover {
  background: var(--color-accent-subtle);
}

.top-bar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-accent), var(--color-secondary));
  flex-shrink: 0;
}

.top-bar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* .library-title -> section heading */
.library-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  padding: var(--space-6) var(--space-6) var(--space-2);
}

/* ── Featured hero (fills space between header and covers) ── */
.featured-hero {
  flex: 1;
  display: flex;
  align-items: flex-end;
  padding: var(--space-8) var(--space-8) var(--space-6);
  min-height: 0;
}

.featured-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 600px;
  animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.featured-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-accent);
}

.featured-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
  color: var(--color-text);
}

.featured-description {
  font-size: var(--text-base);
  font-weight: 300;
  line-height: 1.7;
  color: var(--color-text-muted);
  max-width: 480px;
}

.featured-meta {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-2);
}

.featured-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.featured-stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
}

.featured-stat-value:empty {
  display: none;
}

.featured-stat-label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-faint);
}

/* .covers-carousel -> scrollable track */
.covers-carousel {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6) calc(52px + var(--space-8));
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  flex-shrink: 0;
  align-items: flex-end;
}

.covers-carousel::-webkit-scrollbar { display: none; }
.covers-carousel:active { cursor: grabbing; }

/* .cover-art -> gradient art area within .game-cover */
.cover-art {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-3);
}

/* .cover-title -> title on the cover */
.cover-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: #fff;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-2);
}

/* .cover-genre-badge -> genre badge on cover */
.cover-genre-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  padding: var(--space-1) var(--space-2);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

/* .cover-tech-icons -> tech icon row on cover */
.cover-tech-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* .detail-year -> year in the detail panel */
.detail-year {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  color: var(--color-text-faint);
}

/* .detail-tech -> tech tags in detail panel */
.detail-tech {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
}

/* .detail-actions -> action buttons in detail panel */
.detail-actions {
  padding: var(--space-4) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* .launch-btn -> primary CTA button in detail panel */
.launch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  transition: background 200ms ease, box-shadow 200ms ease, transform 150ms ease;
}

.launch-btn:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}
