/* =========================================
   1. MAIN PROJECTS DASHBOARD (The List)
   ========================================= */

/* --- MAIN LAYOUT --- */
.projects-container {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  height: calc(100vh - 240px); /* Keeps footer visible */
  overflow: hidden;
  align-items: start;
}

/* --- DETAIL PANEL (Left Side) --- */
.project-detail {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 2rem;
}

/* --- ANIMATIONS --- */
@keyframes focusReveal {
  0% {
    opacity: 0;
    filter: blur(15px);
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}
.fade-in {
  animation: focusReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- PROJECTS LIST GRID (Right Side) --- */
.projects-grid {
  height: 100%;
  overflow-y: auto;
  padding-right: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* OPTIMIZED: Custom Scrollbar for the grid specifically */
.projects-grid::-webkit-scrollbar {
  width: 6px;
}
.projects-grid::-webkit-scrollbar-thumb {
  background: var(--border-color);
}
.projects-grid::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* --- DETAIL TYPOGRAPHY --- */
.detail-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
  margin-bottom: 1rem;
}
body.light-theme .detail-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.detail-header h3 {
  font-size: 3rem;
  margin: 0;
  line-height: 1;
  color: var(--accent-gold) !important;
  display: flex;
  align-items: center;
}

.detail-header h3 i,
.detail-header h3 img {
  margin-right: 15px;
}

.detail-header .subtitle {
  font-family: "Inter", sans-serif;
  color: var(--text-dim);
  margin-top: 5px;
  font-size: 0.9rem;
}

.project-detail p {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text);
  opacity: 0.8;
}

/* --- PROJECT CARDS --- */
.project-card {
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  outline: none; /* Focus handled by border below */
}

/* Hover & Focus States */
.project-card:hover,
.project-card:focus,
.project-card.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-gold);
  transform: translateX(5px);
}

/* Focus visibility for accessibility */
.project-card:focus {
  box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

body.light-theme .project-card:hover,
body.light-theme .project-card:focus,
body.light-theme .project-card.active {
  background: #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.project-card h3 {
  font-size: 1.1rem;
  margin: 0;
  display: flex;
  align-items: center;
}
.project-card p {
  font-size: 0.85rem;
  margin: 0;
  color: var(--text-dim);
}

/* --- TAGS & BUTTONS --- */
.tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 15px;
}
.tag-pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid var(--border-color);
  text-transform: uppercase;
  font-weight: 600;
}
.tag-pill.license {
  color: #4caf50;
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}
.tag-pill.type {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: rgba(255, 193, 7, 0.1);
}
.tag-pill.platform {
  color: #2196f3;
  border-color: #2196f3;
  background: rgba(33, 150, 243, 0.1);
}

.detail-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}
.btn-action {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--text-dim);
  color: var(--text);
  border-radius: 6px;
  font-family: "Oswald", sans-serif;
  text-transform: uppercase;
  font-size: 0.9rem;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-action:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}
.btn-action.primary {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}
.btn-action.disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  border-color: #444;
  color: #888;
  background: rgba(0, 0, 0, 0.2);
}

/* =========================================
   2. SNAPDNS PRODUCT PAGE STYLES
   ========================================= */

@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.product-page {
  padding-top: 0;
  animation: fadeUp 0.8s ease-out;
}
.back-nav-container {
  margin-bottom: 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-family: "Oswald", sans-serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: 0.2s;
  padding: 6px 12px;
  border-radius: 8px;
}
.back-link:hover {
  color: var(--accent-gold);
  transform: translateX(-5px);
}

/* --- HERO SECTION --- */
.product-hero {
  display: grid;
  grid-template-columns: 0.8fr 1.5fr;
  gap: 2rem;
  align-items: start;
  min-height: 50vh;
  margin-bottom: 4rem;
}

.product-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.badge-row {
  display: flex;
  gap: 10px;
  margin-bottom: 1.2rem;
}
.title-lockup {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 1.2rem;
}
.product-logo {
  width: 50px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}
.product-info h1 {
  font-size: 3.5rem;
  margin: 0;
  color: var(--accent-gold);
  line-height: 1;
}
.product-info .lead {
  font-size: 1.05rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 450px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* --- VISUALS (3D Perspective) --- */
.product-visual {
  position: relative;
  height: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1500px;
  outline: none;
}

.mobile-hint {
  display: none;
}

.shot-wrapper {
  position: absolute;
  width: 55%;
  max-width: 450px;
  background: transparent !important;
  /* OPTIMIZATION: Hardware Acceleration Hint */
  will-change: transform, opacity;
  transition:
    transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.3s;
}

.app-screenshot {
  width: 100%;
  display: block;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

/* --- THEME STACKING (Logic) --- */
/* Default: Dark Front */
.front-shot {
  z-index: 10;
  transform: translateX(-20px) rotateY(-5deg);
  opacity: 1;
}
.back-shot {
  z-index: 5;
  transform: translateX(40px) translateY(20px) rotateY(-5deg) scale(0.9);
  opacity: 0.6;
}

/* Light Theme: Light Front */
body.light-theme .back-shot {
  z-index: 10;
  transform: translateX(-20px) rotateY(-5deg) scale(1);
  opacity: 1;
}
body.light-theme .front-shot {
  z-index: 5;
  transform: translateX(40px) translateY(20px) rotateY(-5deg) scale(0.9);
  opacity: 0.6;
}

/* HOVER EFFECTS */
/* Dark Hover */
body:not(.light-theme) .product-visual:hover .front-shot {
  z-index: 5;
  transform: translateX(40px) translateY(20px) rotateY(-5deg) scale(0.9);
  opacity: 0.6;
}
body:not(.light-theme) .product-visual:hover .back-shot {
  z-index: 20;
  transform: translateX(-20px) rotateY(-5deg) scale(1);
  opacity: 1;
}

/* Light Hover */
body.light-theme .product-visual:hover .back-shot {
  z-index: 5;
  transform: translateX(40px) translateY(20px) rotateY(-5deg) scale(0.9);
  opacity: 0.6;
}
body.light-theme .product-visual:hover .front-shot {
  z-index: 20;
  transform: translateX(-20px) rotateY(-5deg) scale(1);
  opacity: 1;
}

/* --- GLOW EFFECT --- */
.glow-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: var(--accent-gold);
  filter: blur(140px);
  opacity: 0.12;
  z-index: 0;
  pointer-events: none;
  animation: pulseGlow 4s infinite alternate;
}
@keyframes pulseGlow {
  from {
    opacity: 0.1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0.15;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* --- FEATURES GRID --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
  padding-bottom: 4rem;
}

.feature-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 180px;
  transition:
    transform 0.2s,
    border-color 0.2s;
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-gold);
}
.feature-card i {
  font-size: 1.8rem;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}
.feature-card h3 {
  font-size: 1.1rem;
  margin: 0 0 0.8rem 0;
  color: var(--text);
  line-height: 1.2;
}
.feature-card p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.5;
  font-size: 0.9rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 1100px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Stack Projects Container Vertical on small screens */
  .projects-container {
    grid-template-columns: 1fr;
    overflow-y: auto;
    height: auto;
  }
  .projects-grid {
    overflow-y: visible;
    padding-right: 0;
  }
  .project-detail {
    padding-top: 0;
    margin-bottom: 40px;
  }
}

@media (max-width: 900px) {
  .product-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .product-info {
    align-items: center;
  }
  .badge-row,
  .title-lockup,
  .hero-actions {
    justify-content: center;
  }
  .product-visual {
    flex-direction: column;
    height: auto;
    margin-top: 40px;
    gap: 40px;
    display: block;
  }

  .mobile-hint {
    display: block;
    margin-top: 15px;
    font-family: "Oswald", sans-serif;
    font-size: 0.8rem;
    color: var(--text-dim);
    opacity: 0.8;
  }

  .shot-wrapper {
    position: relative;
    width: 100%;
    transform: none !important;
    transition: opacity 0.3s ease;
  }

  /* MOBILE TOGGLE LOGIC (CSS handles class added by JS) */
  body:not(.light-theme) .back-shot {
    display: none;
  }
  body:not(.light-theme) .front-shot {
    display: block;
  }

  body:not(.light-theme) .product-visual.swapped .front-shot {
    display: none;
  }
  body:not(.light-theme) .product-visual.swapped .back-shot {
    display: block;
    opacity: 1;
    transform: none;
  }

  body.light-theme .front-shot {
    display: none;
  }
  body.light-theme .back-shot {
    display: block;
  }

  body.light-theme .product-visual.swapped .back-shot {
    display: none;
  }
  body.light-theme .product-visual.swapped .front-shot {
    display: block;
    opacity: 1;
    transform: none;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }
}
