/* ===========================
   Bookshelf Page
   =========================== */

.bookshelf-section {
  padding: 20px;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* Make bookshelf span 2 columns in grid */
.bookshelf-wide {
  grid-column: 2 / 4;
}

.page-title {
  font-family: 'UnifrakturCook', cursive;
  font-size: 2.5rem;
  color: #ffd4c0;
  text-align: center;
  margin-bottom: 40px;
  text-shadow:
    0 0 10px rgba(255, 140, 90, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Wrapper for all three bookcases */
.bookcases-wrapper {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 10px;
}

.bookshelf-container {
  width: 100%;
  max-width: 32%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 45px;
  padding: 8px;
  flex-shrink: 1;
  min-width: 0;
}

/* Shelf label - Decorative hanging sign */
.shelf-label {
  font-family: 'DotGothic16', monospace;
  font-size: 0.75rem;
  color: #ffefc9;
  text-transform: lowercase;
  letter-spacing: 0.06em;
  margin: 0 0 18px 8px;
  padding: 8px 14px 10px 14px;
  white-space: nowrap;
  max-width: 90%;

  /* Rich wood texture background */
  background:
    linear-gradient(135deg,
      rgba(101, 67, 33, 0.95) 0%,
      rgba(70, 47, 23, 0.98) 25%,
      rgba(60, 40, 20, 0.95) 50%,
      rgba(70, 47, 23, 0.98) 75%,
      rgba(101, 67, 33, 0.95) 100%);

  /* Decorative border with aged metal look */
  border: 3px solid rgba(139, 90, 43, 0.9);
  border-radius: 6px;

  /* Dramatic shadows and depth */
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.7),
    0 3px 8px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.15),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    inset 2px 0 3px rgba(0, 0, 0, 0.3),
    inset -2px 0 3px rgba(255, 255, 255, 0.1);

  /* Glowing text effect */
  text-shadow:
    0 0 12px rgba(255, 239, 201, 0.6),
    0 0 6px rgba(208, 226, 184, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.8),
    1px 1px 0 rgba(0, 0, 0, 0.5);

  align-self: flex-start;
  display: inline-block;
  position: relative;
  transform: rotate(-1.5deg);
  transform-origin: center top;
  transition: transform 0.3s ease, box-shadow 0.3s ease;

  /* Wood grain texture overlay */
  background-image:
    repeating-linear-gradient(90deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.08) 3px,
      rgba(0, 0, 0, 0.08) 4px),
    repeating-linear-gradient(0deg,
      transparent,
      transparent 1px,
      rgba(0, 0, 0, 0.03) 1px,
      rgba(0, 0, 0, 0.03) 2px);
}

/* Hover animation - gentle sway */
.shelf-label:hover {
  transform: rotate(-0.5deg);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.8),
    0 4px 10px rgba(0, 0, 0, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.15),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4);
}

/* Left hanging rope with nail */
.shelf-label::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 24%;
  width: 2px;
  height: 22px;
  background:
    repeating-linear-gradient(180deg,
      rgba(160, 120, 80, 0.9) 0px,
      rgba(120, 90, 60, 0.95) 2px,
      rgba(100, 75, 50, 0.9) 4px);
  box-shadow:
    2px 0 3px rgba(0, 0, 0, 0.7),
    -1px 0 2px rgba(255, 255, 255, 0.15);
  transform: rotate(-2deg);
  border-radius: 2px 2px 0 0;
}

/* Right hanging rope with nail */
.shelf-label::after {
  content: "";
  position: absolute;
  top: -18px;
  right: 24%;
  width: 2px;
  height: 22px;
  background:
    repeating-linear-gradient(180deg,
      rgba(160, 120, 80, 0.9) 0px,
      rgba(120, 90, 60, 0.95) 2px,
      rgba(100, 75, 50, 0.9) 4px);
  box-shadow:
    2px 0 3px rgba(0, 0, 0, 0.7),
    -1px 0 2px rgba(255, 255, 255, 0.15);
  transform: rotate(2deg);
  border-radius: 2px 2px 0 0;
}

/* Decorative metal corner accents using box-shadow technique */
.shelf-label {
  /* Corner brackets created with multiple box shadows */
  border-image:
    linear-gradient(135deg,
      rgba(139, 90, 43, 0.9) 0%,
      rgba(101, 67, 33, 0.7) 100%) 3;
}

/* Individual shelf */
.bookshelf {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Books on shelf */
.shelf-books {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 5px;
  padding: 0 10px 8px 10px;
  min-height: 110px;
  position: relative;
  z-index: 2;
}

/* Shelf board */
.shelf-board {
  width: 100%;
  height: 18px;
  background: linear-gradient(180deg,
      rgba(101, 67, 33, 0.9) 0%,
      rgba(70, 47, 23, 0.85) 50%,
      rgba(50, 33, 16, 0.8) 100%);
  border: 1px solid rgba(139, 90, 43, 0.6);
  border-radius: 2px;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.1),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  position: relative;

  /* Wood grain texture effect */
  background-image:
    repeating-linear-gradient(90deg,
      transparent,
      transparent 10px,
      rgba(0, 0, 0, 0.05) 10px,
      rgba(0, 0, 0, 0.05) 11px);
}

/* Shelf board shadow underneath */
.shelf-board::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 5%;
  width: 90%;
  height: 8px;
  background: radial-gradient(ellipse at center,
      rgba(0, 0, 0, 0.3) 0%,
      transparent 70%);
  filter: blur(3px);
}

/* Book spine styling on shelves - inherits from bookstack.css */
.bookshelf .book-spine {
  height: 100px;
  width: auto;
  max-width: 40px;
  object-fit: cover;
  image-rendering: auto;

  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.55));
  transform-origin: bottom center;

  cursor: pointer;
  transition: transform 180ms ease, filter 180ms ease;
}

.bookshelf .book-spine:hover {
  transform: translateY(-6px) rotate(-0.5deg);
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.65));
}

/* Empty shelf message */
.shelf-books:empty::after {
  content: "~ shelf awaiting new books ~";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  font-family: 'DotGothic16', monospace;
  font-size: 12px;
  color: rgba(208, 226, 184, 0.5);
  font-style: italic;
  letter-spacing: 0.05em;
}

/* Responsive adjustments */
@media (max-width: 1300px) {
  .bookshelf-wide {
    grid-column: auto;
  }

  .bookcases-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }

  .bookshelf-container {
    max-width: 600px;
    gap: 50px;
  }

  .shelf-label {
    font-size: 1rem;
    padding: 12px 24px 14px 24px;
    margin: 0 0 25px 20px;
  }

  .shelf-books {
    min-height: 160px;
    padding: 0 20px 10px 20px;
  }

  .bookshelf .book-spine {
    height: 150px;
    max-width: 65px;
  }
}

@media (max-width: 820px) {
  .bookshelf-container {
    max-width: 100%;
    gap: 40px;
  }

  .page-title {
    font-size: 2rem;
    margin-bottom: 30px;
  }

  .shelf-books {
    padding: 0 10px 10px 10px;
    min-height: 140px;
  }

  .bookshelf .book-spine {
    height: 130px;
    max-width: 60px;
  }

  .shelf-label {
    font-size: 0.85rem;
    padding: 10px 16px 12px 16px;
  }
}