/* ================================================
   books.css
   Styles for:
     - Books listing page (/books/)
     - Individual book pages (/books/title/)

   Shared component styles (book-card, buttons)
   live in components.css.
   ================================================ */


/* ------------------------------------------------
   BOOKS HERO
   ------------------------------------------------ */
.books-hero {
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: flex-end;
  background-image: url('../images/hero-farmhouse.jpg');
  background-size: cover;
  background-position: center 35%;
  padding-top: var(--header-height);
}

.books-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(14, 13, 11, 0.4) 0%,
    rgba(14, 13, 11, 0.92) 100%
  );
}

.books-hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.books-hero-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 5vw, var(--text-3xl));
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--color-white);
  margin-bottom: var(--space-3);
}

.books-hero-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}


/* ------------------------------------------------
   BOOKS LISTING SECTIONS
   ------------------------------------------------ */
.books-section {
  background-color: var(--color-bg);
}

.books-section--alt {
  background-color: var(--color-surface);
}

/* Stacked list of horizontal book cards */
.books-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-width: 900px;
  margin: 0 auto;
}


/* ------------------------------------------------
   BOOK LISTING CARD
   Horizontal layout: cover left, info right.
   Used on the /books/ listing page.
   ------------------------------------------------ */
.book-listing-card {
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-raised);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.book-listing-card:hover {
  border-color: var(--color-accent-dim);
  box-shadow: var(--shadow-card);
}

.book-listing-card-link {
  display: grid;
  grid-template-columns: 180px 1fr;
  text-decoration: none;
  color: inherit;
  min-height: 260px;
}

/* Cover */
.book-listing-cover-wrap {
  overflow: hidden;
  background: var(--color-surface);
  flex-shrink: 0;
}

.book-listing-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-slow);
}

.book-listing-card:hover .book-listing-cover {
  transform: scale(1.04);
}

/* Placeholder when no cover image */
.book-listing-cover--placeholder {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--color-bg-raised), var(--color-surface));
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-faint);
  text-align: center;
}

/* Info */
.book-listing-info {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  justify-content: center;
}

.book-listing-type {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.book-listing-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 300;
  color: var(--color-text);
  line-height: 1.15;
  margin-bottom: var(--space-1);
}

.book-listing-author {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.book-listing-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  flex: 1;
}

.book-listing-cta {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-top: var(--space-4);
  transition: letter-spacing var(--transition-fast);
}

.book-listing-card:hover .book-listing-cta {
  letter-spacing: 0.22em;
}


/* ------------------------------------------------
   BOOKS CTA SECTION
   Dark closing band at the bottom of /books/
   ------------------------------------------------ */
.books-cta {
  position: relative;
  padding: var(--space-24) 0;
  background-color: var(--color-bg);
  border-top: var(--border-subtle);
  text-align: center;
  overflow: hidden;
}

.books-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/hero-barn.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.05;
  pointer-events: none;
}

.books-cta-inner {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

.books-cta-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 300;
  letter-spacing: 0.05em;
  color: var(--color-text);
  margin-bottom: var(--space-6);
  text-transform: uppercase;
}

.books-cta-body {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-8);
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.books-cta-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}


/* ------------------------------------------------
   INDIVIDUAL BOOK PAGE
   ------------------------------------------------ */

/* Book hero — simple dark header, no background image */
.book-hero {
  position: relative;
  padding-top: calc(var(--header-height) + var(--space-16));
  padding-bottom: var(--space-12);
  background: var(--color-bg-raised);
  border-bottom: var(--border-subtle);
  text-align: center;
  overflow: hidden;
}

/* Faint atmospheric texture */
.book-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/hero-barn.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.04;
  pointer-events: none;
}

.book-hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 20%,
    var(--color-bg-raised) 75%
  );
}

.book-hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
}

.book-hero-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 5vw, var(--text-3xl));
  font-weight: 300;
  letter-spacing: 0.03em;
  color: var(--color-text);
  line-height: 1.1;
}


/* ------------------------------------------------
   BOOK DETAIL — TWO COLUMN
   ------------------------------------------------ */
.book-detail {
  background-color: var(--color-bg);
}

.book-detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: var(--space-16);
  align-items: start;
  max-width: 960px;
  margin: 0 auto;
}

/* Cover */
.book-detail-cover-wrap {
  position: relative;
}

.book-detail-cover {
  width: 100%;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

/* Placeholder cover */
.book-detail-cover--placeholder {
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background: linear-gradient(135deg, var(--color-bg-raised), var(--color-surface));
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
}

.placeholder-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text-faint);
  text-align: center;
  line-height: 1.4;
}

/* Decorative offset frame */
.book-detail-cover-frame {
  position: absolute;
  top: 12px;
  left: 12px;
  right: -12px;
  bottom: -12px;
  border: var(--border-accent);
  border-radius: var(--radius-sm);
  z-index: -1;
  pointer-events: none;
}

/* Info column */
.book-detail-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 300;
  color: var(--color-text);
  line-height: 1.15;
  margin-bottom: var(--space-2);
}

.book-detail-author {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.book-detail-rule {
  height: 1px;
  background: linear-gradient(to right, var(--color-accent-dim), transparent);
  margin-bottom: var(--space-6);
}

.book-detail-description p {
  font-size: 1.1rem;
  line-height: 1.85;
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.book-detail-description p:last-child {
  margin-bottom: 0;
}

/* Retailer links */
.book-retailers {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: var(--border-subtle);
}

.book-retailers-label {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.book-retailers-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}


/* ------------------------------------------------
   MORE BOOKS SECTION
   ------------------------------------------------ */
.more-books {
  background-color: var(--color-surface);
}

/* Book card type label */
.book-card-type {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-1);
}

/* Placeholder for book cards without covers */
.book-card-cover--placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--color-bg-raised), var(--color-surface));
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  text-align: center;
}


/* ------------------------------------------------
   RESPONSIVE
   ------------------------------------------------ */
@media (max-width: 900px) {

  .book-detail-grid {
    grid-template-columns: 1fr;
    gap: var(--space-10);
    max-width: 560px;
  }

  .book-detail-cover-wrap {
    max-width: 280px;
    margin: 0 auto;
  }

  .book-listing-card-link {
    grid-template-columns: 140px 1fr;
    min-height: 200px;
  }
}

@media (max-width: 600px) {

  .book-listing-card-link {
    grid-template-columns: 1fr;
  }

  .book-listing-cover-wrap {
    height: 220px;
  }

  .book-listing-cover--placeholder {
    min-height: 220px;
  }

  .book-listing-info {
    padding: var(--space-6);
  }

  .books-cta-actions {
    flex-direction: column;
    align-items: center;
  }

  .book-retailers-list {
    flex-direction: column;
  }

  .book-retailers-list .btn {
    width: 100%;
    justify-content: center;
  }
}
