/* Layout Styles */

/* Hero Section */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4rem 0;
  gap: 2rem;
}

.hero-content {
  flex: 1;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero .lead {
  font-size: 1.25rem;
  color: #666;
  margin-bottom: 2rem;
}

.hero-image img {
  border-radius: 50%;
  width: 300px;
  height: 300px;
  object-fit: cover;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn-primary {
  display: inline-block;
  background-color: var(--secondary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.btn-primary:hover {
  background-color: #149c82;
}

/* Project Cards */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.project-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: white;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.project-card h3 {
  margin-top: 0;
}

/* About Page */
.about-header {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: start;
  margin-bottom: 3rem;
}

.about-image {
  width: 100%;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ============================
   Series Navigation Component
   ============================ */
.series-nav {
  margin-top: 3rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.series-nav-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.series-nav-badge {
  display: inline-block;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.series-nav-name {
  font-weight: 600;
  font-size: 1rem;
  color: #334155;
}

.series-nav-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.series-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none !important;
  transition: background-color 0.2s ease, transform 0.2s ease;
  flex: 1;
  min-width: 0;
}

.series-nav-link:hover {
  background-color: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.series-nav-prev {
  text-align: left;
}

.series-nav-next {
  text-align: right;
}

.series-nav-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6366f1;
}

.series-nav-title {
  font-size: 0.9rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.series-nav-link:hover .series-nav-title {
  color: #6366f1;
}

.series-nav-spacer {
  flex: 1;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .series-nav {
    border-color: #334155;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  }

  .series-nav-header {
    border-bottom-color: #334155;
  }

  .series-nav-name {
    color: #e2e8f0;
  }

  .series-nav-title {
    color: #94a3b8;
  }

  .series-nav-link:hover {
    background-color: rgba(99, 102, 241, 0.15);
  }

  .series-nav-link:hover .series-nav-title {
    color: #a5b4fc;
  }

  .series-nav-label {
    color: #a5b4fc;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .series-nav-links {
    flex-direction: column;
  }

  .series-nav-next {
    text-align: left;
  }
}

/* ============================
   Custom Project Listing Styles
   ============================ */
.project-grid-custom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.project-card-custom {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.project-card-custom:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.project-card-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid #e2e8f0;
}

.project-card-body {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-card-body h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
}

.project-card-body .card-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #64748b;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.project-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.project-badge {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.project-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: auto;
}

.project-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.project-btn-github {
  background-color: #334155;
  color: white !important;
}

.project-btn-github:hover {
  background-color: #1e293b;
}

.project-btn-posts {
  background-color: #6366f1;
  color: white !important;
}

.project-btn-posts:hover {
  background-color: #4f46e5;
}

.project-btn-disabled {
  background-color: #f1f5f9;
  color: #94a3b8 !important;
  cursor: not-allowed;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .project-card-custom {
    background: #1e293b;
    border-color: #334155;
  }

  .project-card-image img {
    border-bottom-color: #334155;
  }

  .project-card-body h3 {
    color: #f8fafc;
  }

  .project-card-body .card-text {
    color: #94a3b8;
  }

  .project-badge {
    background: #334155;
    color: #cbd5e1;
  }

  .project-btn-github {
    background-color: #475569;
  }

  .project-btn-github:hover {
    background-color: #64748b;
  }

  .project-btn-disabled {
    background-color: #0f172a;
    color: #475569 !important;
  }
}

/* Book Cover Styles - Final Corrected Selectors */
#listing-listing-books .quarto-grid-item.card {
  height: 100% !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

#listing-listing-books .card-img-top {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  margin-bottom: 1rem !important;
}

#listing-listing-books .thumbnail-image,
#listing-listing-books .card-img-top img {
  /* This kills the inline height: 150px; injected by Quarto */
  height: 420px !important;
  width: auto !important;
  max-width: 100% !important;

  /* Show everything */
  object-fit: contain !important;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#listing-listing-books .card-body {
  padding-top: 0.5rem !important;
}

/* ============================
   Back to Top Button
   ============================ */
#quarto-back-to-top {
  position: fixed !important;
  bottom: 2rem !important;
  right: 2rem !important;
  left: auto !important;
  /* Override default centering */
  transform: none !important;
  /* Override default centering transform */
  width: auto !important;
  z-index: 1050;
  /* Ensure it's above other elements */
  background-color: rgba(255, 255, 255, 0.9);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  opacity: 0.8;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none !important;
  color: #334155;
  display: flex;
  /* Flex allowed Quarto to hide it with inline display:none */
  align-items: center;
  gap: 0.4rem;
}

#quarto-back-to-top:hover {
  opacity: 1;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  color: #6366f1;
  /* Accent color */
}

/* Dark mode adjustment for back to top */
@media (prefers-color-scheme: dark) {
  #quarto-back-to-top {
    background-color: rgba(30, 41, 59, 0.9);
    border-color: #475569;
    color: #cbd5e1;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  }

  #quarto-back-to-top:hover {
    background-color: #1e293b;
    border-color: #6366f1;
    color: #818cf8;
  }
}

/* Ensure project listing images are fully visible and seamless */
.quarto-grid-item .card-img-top img,
.quarto-grid-item .thumbnail-image img {
  object-fit: cover !important;
  background-color: transparent;
  padding: 0 !important;
  margin: 0 !important;
}

@media (prefers-color-scheme: dark) {
  .quarto-grid-item .card-img-top img,
  .quarto-grid-item .thumbnail-image img {
    background-color: transparent;
  }
}

/* ============================
   Featured Series Custom Grid
   ============================ */
#listing-featured-series .quarto-grid-item.card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  padding: 0 !important;
  background-color: #ffffff;
  /* Fond blanc sous le titre */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  /* Ombre douce pour le relief */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#listing-featured-series .quarto-grid-item.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

#listing-featured-series .card-img-top {
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0;
}

#listing-featured-series .card-img-top img,
#listing-featured-series .thumbnail-image img {
  padding: 0 !important;
  object-fit: cover !important;
  /* To fill the space seamlessly */
  width: 100% !important;
  height: 200px !important;
  /* Fixed height for uniformity */
  border-bottom: 1px solid #e2e8f0;
}

#listing-featured-series .card-body {
  padding: 1.25rem !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

#listing-featured-series .card-title {
  text-align: center;
  margin: 0;
  font-weight: 700;
  font-size: 1.15rem;
  width: 100%;
}

@media (prefers-color-scheme: dark) {
  #listing-featured-series .quarto-grid-item.card {
    border-color: #334155;
    background-color: #1e293b;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  }

  #listing-featured-series .quarto-grid-item.card:hover {
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.5);
  }

  #listing-featured-series .card-img-top img,
  #listing-featured-series .thumbnail-image img {
    border-bottom-color: #334155;
  }

  #listing-featured-series .card-title {
    color: #f8fafc;
  }
}