/* ==========================================================================
   Books Directory NEW - Editorial Redesign (The Repository)
   ========================================================================== */

:root {
  --sb-bg: transparent;
  --sb-ink: #1b1c15;
  --sb-ink-soft: #4a4c44;
  --sb-accent: #173124;
  --sb-stone: #727973;
  --sb-bone: var(--tf-bg-mid);
  --sb-border: rgba(27, 28, 21, 0.1);
  --manrope: "Manrope", sans-serif;
  --newsreader: "Newsreader", serif;
}

.tf-page--books-list {
  background: transparent;
  min-height: 100vh;
  color: var(--sb-ink);
  max-width: 100vw;
  overflow-x: clip;
}

.editorial-container {
  width: var(--tf-public-w);
  max-width: var(--tf-public-max-w);
  margin: 0 auto;
  padding: var(--tf-public-pad-y) 0;
  overflow-x: clip;
}

/* ------------------------------
   Editorial Header (Standardized)
   ------------------------------ */
.series-list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 60px;
  border-bottom: 2px solid var(--sb-ink);
  padding-bottom: 24px;
  max-width: 1200px;
  margin: 0 auto 32px;
}

.series-list-header__content {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.series-list-tag {
  font-family: var(--manrope);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--sb-stone);
  display: block;
  margin-bottom: 16px;
}

.series-list-title {
  font-family: var(--newsreader);
  font-size: 2.6rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.05em;
  margin-bottom: 12px;
}

.series-list-sub {
  font-family: var(--manrope);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--sb-ink-soft);
  max-width: 1000px;
  overflow-wrap: anywhere;
}

/* Search Box (Archive & Ink Standard) */
/* Search Box Integration */
.series-search-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: min(420px, 100%);
    max-width: 100%;
}

.series-search-box {
    position: relative;
    border: 0;
    border-radius: 999px;
    display: flex;
    align-items: stretch;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 246, 238, 0.72));
    transition: all 0.3s var(--tf-ease);
    height: 44px;
    padding: 4px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(27, 28, 21, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.94) inset,
        0 10px 22px rgba(27, 28, 21, 0.045);
}

.series-search-box:focus-within {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 250, 245, 0.86));
    box-shadow:
        0 0 0 1px rgba(23, 49, 36, 0.34),
        0 1px 0 rgba(255, 255, 255, 0.96) inset,
        0 12px 26px rgba(27, 28, 21, 0.065),
        0 0 0 4px rgba(23, 49, 36, 0.045);
}

.series-search-input {
    min-width: 0;
    width: 0;
    padding: 0 18px;
    border: 0 !important;
    font-family: var(--manrope);
    font-size: 0.9rem;
    flex: 1;
    outline: none;
    color: var(--sb-ink);
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
}

.series-search-input::placeholder {
    color: var(--sb-stone);
    opacity: 0.6;
}

.series-search-input:focus,
.series-search-input:focus-visible,
.series-search-btn:focus,
.series-search-btn:focus-visible,
.series-search-clear:focus,
.series-search-clear:focus-visible {
    outline: none;
}

.series-search-clear {
    width: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    color: var(--sb-stone);
    border-radius: 999px;
    background: transparent;
    font-family: var(--manrope);
    font-size: 1.1rem;
    line-height: 1;
    transition: color 180ms var(--tf-ease), background 180ms var(--tf-ease), transform 180ms var(--tf-ease);
}

.series-search-clear:hover,
.series-search-clear:focus-visible {
    color: var(--sb-ink);
    background: rgba(27, 28, 21, 0.08);
}

.series-search-clear:active {
    transform: scale(0.94);
}

.series-search-clear[hidden] {
    display: none;
}

.series-search-btn {
    background:
        linear-gradient(180deg, #25261f, #12130f);
    color: white;
    border: none;
    width: 48px;
    flex: 0 0 48px;
    margin: 0;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms var(--tf-ease-spring), background 200ms var(--tf-ease-spring), box-shadow 200ms var(--tf-ease-spring);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.16) inset,
        0 8px 16px rgba(27, 28, 21, 0.16);
}

.series-search-btn:hover {
    background:
        linear-gradient(180deg, #1f4633, var(--sb-accent));
    transform: translateY(-1px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 10px 20px rgba(23, 49, 36, 0.22);
}

.series-search-btn:focus-visible {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 10px 20px rgba(23, 49, 36, 0.2),
        0 0 0 3px rgba(23, 49, 36, 0.12);
}

.series-search-btn svg {
    width: 21px;
    height: 21px;
}

.series-clear-btn {
    font-family: var(--manrope);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sb-stone);
    text-decoration: underline;
    position: absolute;
    bottom: -30px;
    left: 32px;
}

/* ------------------------------
   Filter Bar (Horizontal Optimization)
   ------------------------------ */
.repo-filter-bar {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 250, 0.84), rgba(242, 242, 232, 0.7)),
        rgba(245, 244, 233, 0.78);
    padding: 16px;
    border: 1px solid rgba(27, 28, 21, 0.12);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.78) inset,
        0 20px 50px rgba(27, 28, 21, 0.055);
    max-width: 1200px;
    margin: 0 auto 30px;
    position: relative;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    width: 100%;
    min-width: 0;
}


/* Main Group Row */
.repo-filter-groups {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
}

/* Specific Select Container Fix (Horizontal) */
.repo-filter-selects {
  display: flex;
  flex-direction: row;
  gap: 20px;
  flex: 1;
  justify-content: flex-end;
}

.repo-filter-group label,
.repo-select-field label {
  display: block;
  font-family: var(--manrope);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sb-stone);
  margin-bottom: 8px;
}

.repo-toggle-group {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(27, 28, 21, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 250, 0.5);
}

.repo-toggle {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-family: var(--manrope);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 7px 12px;
    color: var(--sb-ink-soft);
    cursor: pointer;
    transition: all 0.3s var(--tf-ease);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.repo-toggle:hover {
    background: rgba(27, 28, 21, 0.045);
    color: var(--sb-ink);
}

.repo-toggle.is-active {
    background: var(--sb-ink);
    color: white;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 8px 16px rgba(27, 28, 21, 0.14);
}

.repo-select-field select {
  font-family: var(--manrope);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sb-ink);
  border: 1px solid rgba(27, 28, 21, 0.12);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 250, 0.64);
  cursor: pointer;
  outline: none;
  width: 180px; /* Fixed width for better grid look */
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.78) inset;
  transition: border-color 0.2s var(--tf-ease), box-shadow 0.2s var(--tf-ease), background 0.2s var(--tf-ease);
}

.repo-select-field select:focus {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(23, 49, 36, 0.34);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 0 0 3px rgba(23, 49, 36, 0.06);
}

.repo-select-field.is-hidden {
  display: none;
}

.repo-filter-actions {
  margin-top: 15px;
  text-align: left;
}

.repo-reset {
  font-family: var(--manrope);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--sb-stone);
  text-decoration: underline;
}

/* ------------------------------
   Repository Grid (Reduced Cards)
   ------------------------------ */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 48px 32px; /* More breathing room */
  width: 100%;
  max-width: 1200px;
  margin: 40px auto 100px;
}

@media (max-width: 1100px) {
    .repo-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .repo-grid { grid-template-columns: repeat(2, 1fr); gap: 20px 15px; }
}

@media (max-width: 480px) {
    .repo-grid { grid-template-columns: 1fr; }
}

.repo-book-card {
  background: rgba(27, 28, 21, 0.02); /* Faint tint for texture */
  padding: 20px 16px;
  border: 1px solid rgba(27, 28, 21, 0.08); /* Slightly darker than background */
  border-radius: 2px;
  transition: all 0.4s var(--tf-ease);
  display: flex;
  flex-direction: column;
}

.repo-book-card:hover {
  transform: translateY(-8px);
  background: rgba(27, 28, 21, 0.04);
  border-color: rgba(27, 28, 21, 0.15);
  box-shadow: 0 15px 40px rgba(0,0,0,0.04);
}

.repo-book-card__link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.repo-book-card__media {
  aspect-ratio: 10 / 14;
  overflow: visible; 
  background: transparent;
  margin-bottom: 20px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.repo-book-card:hover .repo-book-card__media {
  transform: translateY(-6px);
  box-shadow: 15px 25px 60px rgba(0,0,0,0.08);
}

.repo-book-card__media img {
  width: 90%; /* Leave space for shadow */
  height: 90%;
  object-fit: contain;
  filter: drop-shadow(0 15px 30px rgba(0,0,0,0.18)); /* Realistic book shadow */
  transition: all 0.5s var(--tf-ease);
}

.repo-book-card:hover .repo-book-card__media img {
  filter: drop-shadow(0 25px 45px rgba(0,0,0,0.22));
  transform: scale(1.04);
}

.repo-book-card__body {
  text-align: left;
  padding: 0 4px;
}

.repo-book-tag {
  font-family: var(--manrope);
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--sb-stone);
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
  line-height: 1.2;
  letter-spacing: 0.05em;
}

.repo-book-title {
  font-family: var(--newsreader);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--sb-ink);
}

.repo-book-author {
  font-family: var(--manrope);
  font-size: 0.8rem;
  color: var(--sb-ink-soft);
  margin-bottom: 12px;
  opacity: 0.8;
}

.repo-book-footer {
  border-top: 1px solid var(--sb-border);
  padding-top: 12px;
}

.repo-book-category {
  font-family: var(--manrope);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--sb-stone);
}

/* ------------------------------
   Pagination
   ------------------------------ */
.repo-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  border-top: 1px solid var(--sb-ink);
  padding-top: 40px;
  margin-bottom: 80px;
}

.repo-pag-btn {
  font-family: var(--manrope);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--sb-ink);
  text-decoration: none;
  border: 1px solid var(--sb-ink);
  padding: 10px 20px;
  transition: all 200ms var(--tf-ease-spring);
}

.repo-pag-btn:hover {
  background: var(--sb-ink);
  color: white;
}

/* Responsive */
@media (max-width: 900px) {
  .repo-filter-groups { flex-direction: column; align-items: stretch; gap: 20px; }
  .repo-filter-selects { justify-content: flex-start; }
  .repo-filter-bar { padding: 18px; }
  .repo-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 640px) {
  .editorial-container {
    padding-inline: 0;
  }

  .series-list-header {
    width: 100%;
    gap: 20px;
  }

  .repo-filter-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    max-width: calc(100vw - 48px);
    overflow: hidden;
  }

  .repo-toggle-group {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .repo-toggle-group::-webkit-scrollbar {
    display: none;
  }

  .repo-select-field,
  .repo-select-field select,
  .series-search-form,
  .series-search-box {
    max-width: 100%;
    width: 100%;
    min-width: 0;
  }

  .repo-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

@media (max-width: 420px) {
  .series-list-sub {
    max-width: calc(100vw - 72px);
  }

  .repo-filter-bar {
    width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
  }

  .series-search-form,
  .series-search-box {
    max-width: calc(100vw - 84px);
  }

  .series-search-btn {
    flex-basis: 42px;
    width: 42px;
  }
}
