/* THE LIBRARY - page-level overrides (library pages only) */

body.library-page {
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><defs><pattern id="texture" x="0" y="0" width="30" height="30" patternUnits="userSpaceOnUse"><rect width="30" height="30" fill="%231A0C07"/><circle cx="8" cy="8" r="2" fill="%23241208" opacity="0.8"/><circle cx="22" cy="22" r="1.5" fill="%23120804" opacity="0.6"/><circle cx="15" cy="5" r="1" fill="%231E1008" opacity="0.7"/><circle cx="5" cy="20" r="1.2" fill="%23160A05" opacity="0.5"/><circle cx="25" cy="10" r="0.8" fill="%23120804" opacity="0.9"/><ellipse cx="12" cy="25" rx="3" ry="1" fill="%231E1008" opacity="0.4"/><ellipse cx="20" cy="15" rx="2" ry="1.5" fill="%23120804" opacity="0.3"/></pattern></defs><rect width="60" height="60" fill="url(%23texture)"/></svg>'),
    linear-gradient(45deg, rgba(26,12,7,0.97), rgba(36,18,8,0.95), rgba(20,10,5,0.97));
  background-size: 60px 60px, 400% 400%;
  animation: none;
}

body.library-page .hat-icon {
  animation: none;
}

body.library-page .left-hats {
  animation: none;
}

body.library-page .right-hats {
  animation: none;
}

body.library-page .cowboy-header {
  background: linear-gradient(135deg, #1A0C07, #2C1508);
  border-color: #5C3010;
}

body.library-page .cowboy-header::before {
  color: #3D1E0A;
  animation: none;
}

body.library-page .cowboy-main {
  background: rgba(30, 15, 7, 0.92);
  border-color: #5C3010;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.6);
  color: #E8D5B8;
}

body.library-page .nav-link {
  background: linear-gradient(45deg, #3D2010, #5C3018);
  border-color: #8B6030;
  color: #C9A84C;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

body.library-page .nav-link::before {
  background: linear-gradient(45deg, #5C3A18, #7A4A20);
}

body.library-page .cowboy-main::before {
  animation: none;
  color: #3D1E0A;
}

body.library-page .site-title {
  color: #C9A84C;
  text-shadow: 2px 2px 0px #3D1A00, 4px 4px 12px rgba(180,140,60,0.4);
}

body.library-page .howdy-text {
  color: #C9A84C;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
}

body.library-page .welcome-text {
  color: #A08060;
}

/* THE LIBRARY - component styles */

.library-box {
  background: linear-gradient(135deg, #2C1810, #3D2214);
  border: 3px dashed #8B6914;
  border-radius: 15px;
  padding: 25px;
  margin-top: 30px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  position: relative;
}

.library-box::before {
  content: '~ ~ ~ THE LIBRARY ~ ~ ~';
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: #2C1810;
  padding: 0 15px;
  font-size: 14px;
  color: #C9A84C;
  font-weight: bold;
  letter-spacing: 2px;
}

.library-title {
  color: #C9A84C;
  font-size: 1.8em;
  margin: 0 0 15px 0;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.library-subtitle {
  color: #D4B896;
  font-style: italic;
  margin: 0 0 10px 0;
}

.library-link {
  display: inline-block;
  margin-top: 15px;
  color: #C9A84C;
  font-weight: bold;
  text-decoration: none;
  font-size: 1.1em;
}

.library-link:hover {
  text-decoration: underline;
}

/* Story cards */

.stories-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.story-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(45deg, #1A0F0A, #2C1810);
  color: #D4B896;
  text-decoration: none;
  padding: 15px;
  border: 2px solid #8B6914;
  border-radius: 10px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.05), 0 2px 6px rgba(0,0,0,0.4);
  transition: all 0.3s ease;
  min-width: 120px;
  max-width: 160px;
  text-align: center;
  position: relative;
}

.story-glyph {
  width: 2em;
  height: 2em;
  margin-bottom: 8px;
  display: block;
}

@media (hover: hover) {
  .story-card::after {
    content: attr(data-preview);
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2C1810, #3D2214);
    color: #D4B896;
    border: 2px solid #8B6914;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.78rem;
    font-weight: normal;
    line-height: 1.45;
    white-space: normal;
    width: 240px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 200;
    text-shadow: none;
    pointer-events: none;
    font-style: italic;
  }

  .story-card:hover::after {
    display: block;
  }

  .story-card:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 8px rgba(0,0,0,0.5);
    background: linear-gradient(45deg, #2C1810, #3D2214);
    color: #C9A84C;
  }
}

/* Story content (rendered markdown) */

.story-content {
  font-size: 1.05em;
  line-height: 1.9;
  color: #E8D5B8;
  max-width: 680px;
  margin: 0 auto;
}

.story-content h1 {
  color: #C9A84C;
  font-size: 2em;
  margin: 0 0 20px 0;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
  border-bottom: 2px solid #5C3A18;
  padding-bottom: 10px;
}

.story-content h2 {
  color: #C9A84C;
  font-size: 1.4em;
  margin: 30px 0 12px 0;
}

.story-content p {
  margin: 0 0 18px 0;
}

.story-content ul,
.story-content ol {
  margin: 0 0 15px 1.5em;
  padding: 0;
}

.story-content li {
  margin-bottom: 6px;
}
