/* Book Index Page Styling - ONLY for landing page with listings */

/* Target only pages with listings (the index page) */
body:has(.quarto-listing) {
  background-color: #ffffff; /* White background */
  font-family: 'Crimson Text', 'Garamond', 'Georgia', serif;
  color: #2c2c2c;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header styling - only on listing pages */
body:has(.quarto-listing) .navbar {
  background-color: #f8f9fa !important; /* Light gray to match blog posts */
  border-bottom: 1px solid #dee2e6;
  box-shadow: none;
}

body:has(.quarto-listing) .navbar-brand {
  /* Use default navbar styling */
}

/* Main content container - only on listing pages */
body:has(.quarto-listing) #quarto-content {
  max-width: 1200px;
  width: 100%;
  margin: 3rem auto;
  padding: 3rem 4rem;
  background-color: #ffffff; /* White background */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Title styling - only on listing pages */
body:has(.quarto-listing) .quarto-title-block {
  text-align: center;
  margin-bottom: 4rem;
  border-bottom: 2px solid #2c2c2c;
  padding-bottom: 2rem;
  width: 100%;
}

body:has(.quarto-listing) h1.title {
  font-family: 'Crimson Text', 'Garamond', serif;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #2c2c2c;
  margin-bottom: 1rem;
  text-align: center;
}

/* Listing/Index styling - Chapter-based TOC */
.quarto-listing {
  margin-top: 3rem;
  padding: 0;
  counter-reset: chapter;
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.quarto-post {
  margin-bottom: 2rem;
  padding: 2.5rem;
  border-bottom: 1px solid #dee2e6;
  display: grid;
  grid-template-columns: 80px 1fr 150px;
  gap: 2.5rem;
  align-items: center;
  position: relative;
  counter-increment: chapter;
  transition: background-color 0.3s ease;
  border-radius: 8px;
}

.quarto-post:hover {
  background-color: #f8f9fa;
}

.quarto-post:last-child {
  border-bottom: none;
}

/* Chapter number styling */
.quarto-post::before {
  content: "CHAPTER\A" counter(chapter);
  white-space: pre;
  font-family: 'Crimson Text', 'Garamond', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 2px;
  grid-column: 3;
  text-align: center;
  line-height: 1.5;
  align-self: center;
}

/* Thumbnail image placeholder */
.listing-image {
  width: 60px;
  height: 60px;
  background-color: #e9ecef;
  border: 2px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 1.2rem;
  border-radius: 4px;
  grid-column: 1;
  justify-self: center;
}

.listing-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}

/* Content area (title, author, date) */
.listing-content {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Post title in listing - Chapter style */
.listing-title {
  font-family: 'Crimson Text', 'Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: #2c2c2c;
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.listing-title a {
  color: #2c2c2c;
  text-decoration: none;
  transition: color 0.3s ease;
}

.listing-title a:hover {
  color: #495057;
  text-decoration: none;
}

/* Post metadata */
.listing-subtitle,
.listing-description {
  display: none;
}

/* Date and author styling */
.listing-date {
  font-size: 0.9rem;
  color: #6c757d;
  font-style: italic;
  letter-spacing: 0.3px;
  display: inline;
}

.listing-author {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 500;
  display: inline;
}

.listing-author::before {
  content: " • ";
  color: #adb5bd;
  margin: 0 0.3rem;
}

/* Category/tag styling */
.listing-categories {
  margin-top: 0.5rem;
}

.listing-category {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  margin-right: 0.5rem;
  background-color: #e8dcc4;
  color: #5c4a3a;
  font-size: 0.8rem;
  border-radius: 3px;
  font-variant: small-caps;
}

/* Sort controls */
.listing-option-group {
  text-align: right;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #5c5c5c;
  font-variant: small-caps;
}

/* Footer - only on listing pages */
body:has(.quarto-listing) footer {
  background-color: #8b7355;
  color: #f5f5dc;
  padding: 2rem;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.9rem;
  border-top: 3px solid #5c4a3a;
}

body:has(.quarto-listing) footer a {
  color: #f5f5dc;
  text-decoration: none;
  border-bottom: 1px dotted #f5f5dc;
}

body:has(.quarto-listing) footer a:hover {
  border-bottom: 1px solid #f5f5dc;
}

/* Page numbers / pagination */
.listing-pagination {
  text-align: center;
  margin-top: 2rem;
  font-variant: small-caps;
}

/* Custom decorative elements - only on listing pages */
body:has(.quarto-listing) .quarto-title-block::before {
  content: "";
  display: none;
}

body:has(.quarto-listing) .quarto-title-block::after {
  content: "";
  display: none;
}

/* Responsive design */
@media (max-width: 992px) {
  body:has(.quarto-listing) #quarto-content {
    padding: 2rem;
    margin: 1rem;
    max-width: 95%;
  }

  body:has(.quarto-listing) h1.title {
    font-size: 2rem;
    letter-spacing: 2px;
  }

  .quarto-post {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .quarto-post::before {
    grid-column: 1;
    order: 1;
  }

  .listing-image {
    grid-column: 1;
    justify-self: center;
    order: 2;
  }

  .listing-content {
    grid-column: 1;
    order: 3;
    text-align: center;
  }
}