/* ============================================
   Project Detail Page
   ============================================ */

/* ============================================
   Lightbox
   ============================================ */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  animation: lbFadeIn 0.2s ease;
}

.lightbox.is-open {
  display: flex;
}

@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Stage (imagen + caption) */
.lightbox-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
  max-width: calc(100vw - 160px);
  max-height: calc(100vh - 4rem);
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transition: opacity 0.15s ease;
  display: block;
}

.lightbox-caption {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.25px;
}

/* Contador (1 / 6) */
.lightbox-counter {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  pointer-events: none;
}

/* Botón cerrar */
.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Flechas prev / next */
.lightbox-prev,
.lightbox-next {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox-prev:hover { transform: translateX(-3px); }
.lightbox-next:hover { transform: translateX(3px); }

/* Responsive: flechas debajo en móvil */
@media (max-width: 600px) {
  .lightbox {
    flex-direction: column;
    padding: 1rem;
  }

  .lightbox-stage {
    max-width: 100%;
    order: 1;
  }

  .lightbox-prev,
  .lightbox-next {
    position: fixed;
    bottom: 2.5rem;
  }

  .lightbox-prev { left: 1.5rem; }
  .lightbox-next { right: 1.5rem; }
}

.project-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .project-container {
    padding: 3rem 2rem;
  }
}

/* ============================================
   Navigation
   ============================================ */

.project-nav {
  margin-bottom: 2rem;
  animation: fadeInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--blue);
}

.back-link svg {
  transition: transform 0.3s ease;
}

.back-link:hover svg {
  transform: translateX(-4px);
}

/* ============================================
   Project Header
   ============================================ */

.project-header {
  margin-bottom: 2.5rem;
  animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.1s backwards;
}

.project-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
}

.project-title::before {
  content: "";
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 100%;
  height: 10px;
  background-color: var(--light-yellow);
  opacity: 0.75;
  z-index: -1;
  animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.4s backwards;
}

@keyframes slideIn {
  from { width: 0; opacity: 0; }
  to { width: 100%; opacity: 0.75; }
}

@media (min-width: 768px) {
  .project-title {
    font-size: 3rem;
  }
  .project-title::before {
    height: 14px;
    bottom: 18px;
  }
}

.project-tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Meta row: tech + botones de acción */
.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.3rem 0.875rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-wordpress {
  background: rgba(33, 117, 155, 0.12);
  color: #21759B;
  border: 1px solid rgba(33, 117, 155, 0.3);
}

[data-theme="dark"] .badge-wordpress {
  color: #4aabcf;
  border-color: rgba(74, 171, 207, 0.3);
  background: rgba(74, 171, 207, 0.1);
}

.badge-php {
  background: rgba(136, 146, 191, 0.2);
  color: #8892BF;
  border: 1px solid rgba(136, 146, 191, 0.4);
}

.badge-mysql {
  background: rgba(0, 117, 143, 0.15);
  color: #00758F;
  border: 1px solid rgba(0, 117, 143, 0.3);
}

[data-theme="dark"] .badge-mysql {
  color: #00a8cc;
  border-color: rgba(0, 168, 204, 0.3);
  background: rgba(0, 168, 204, 0.1);
}

.badge-js {
  background: rgba(247, 223, 30, 0.2);
  color: #b8960a;
  border: 1px solid rgba(247, 223, 30, 0.5);
}

[data-theme="dark"] .badge-js {
  color: #F7DF1E;
  border-color: rgba(247, 223, 30, 0.4);
  background: rgba(247, 223, 30, 0.1);
}

/* Botones de acción: GitHub y Visitar web */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.125rem;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-action svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-action:not(.disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--card-shadow);
}

.btn-web:not(.disabled):hover {
  border-color: var(--yellow);
  color: var(--black);
}

[data-theme="dark"] .btn-web:not(.disabled):hover {
  color: var(--yellow);
}

.btn-github:not(.disabled):hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-action.disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   Divider
   ============================================ */

.section-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2.5rem 0;
}

/* ============================================
   Gallery Section
   ============================================ */

.gallery-section {
  margin-bottom: 0.5rem;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s backwards;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.gallery-item {
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  transition: all 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.02);
  border-color: var(--yellow);
  box-shadow: 0 8px 24px var(--card-hover-shadow);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-item figcaption {
  padding: 0.625rem 0.875rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  border-top: 1px solid var(--border-color);
}

/* Placeholder when no images yet */
.gallery-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 2rem;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.gallery-placeholder p {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ============================================
   Markdown Content Area
   ============================================ */

.markdown-section {
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s backwards;
}

.markdown-content {
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 0.95rem;
}

.markdown-content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 2rem 0 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--yellow);
  color: var(--text-primary);
}

.markdown-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.625rem;
  color: var(--text-primary);
}

.markdown-content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.markdown-content ul,
.markdown-content ol {
  margin: 0.75rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

.markdown-content li {
  margin-bottom: 0.375rem;
  line-height: 1.7;
}

.markdown-content strong {
  font-weight: 700;
  color: var(--text-primary);
}

.markdown-content em {
  font-style: italic;
}

.markdown-content code {
  font-family: 'Courier New', Courier, monospace;
  background: var(--bg-secondary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--blue);
}

.markdown-content pre {
  background: var(--bg-secondary);
  padding: 1.25rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
}

.markdown-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.markdown-content blockquote {
  border-left: 4px solid var(--yellow);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.markdown-content a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.markdown-content a:hover {
  opacity: 0.8;
}

/* Loading state */
.markdown-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ============================================
   Footer
   ============================================ */

.project-footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.project-footer p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================
   Animations (shared)
   ============================================ */

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
