/* ═══════════════════════════════════════════════════════════════════════════
   PPK SSTU — Library Page Styles
   File: ppk-1/css/library.css
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables (inherit from rasp.css palette) ────────────────────────── */
:root {
  --lib-primary:       #1574e8;
  --lib-primary-dark:  #1264c8;
  --lib-bg:            #f6f6f6;
  --lib-white:         #ffffff;
  --lib-card:          #ffffff;
  --lib-card-shadow:   0 2px 12px rgba(0,0,0,.07);
  --lib-card-radius:   12px;
  --lib-text:          #1a1d24;
  --lib-muted:         #6d7583;
  --lib-line:          #e4e7ed;
  --lib-section-alt:   #f0f2f6;
  --lib-footer-bg:     #1e2436;
  --lib-footer-text:   #9aa3b8;
  --lib-badge-bg:      #e8f0fe;
  --lib-badge-text:    #1574e8;
}
[data-theme="dark"] {
  --lib-primary:       #4a9eff;
  --lib-primary-dark:  #3a8eef;
  --lib-bg:            #1f2430;
  --lib-white:         #2a3040;
  --lib-card:          #2a3040;
  --lib-card-shadow:   0 2px 12px rgba(0,0,0,.25);
  --lib-text:          #eef1f6;
  --lib-muted:         #8892a8;
  --lib-line:          #38404f;
  --lib-section-alt:   #252b38;
  --lib-footer-bg:     #141825;
  --lib-footer-text:   #7a8499;
  --lib-badge-bg:      #1f3a6e;
  --lib-badge-text:    #7ab8ff;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
/* Сбрасываем margin-bottom: 20px у навигации */
.section-6 { margin-bottom: 0 !important; }

/* ── Mobile nav: бургер-кнопка в одну строку ─────────────────────────────── */
@media (max-width: 767px) {
  .section-6 .dropdown-toggle-10 {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px;
    cursor: pointer;
  }
  .section-6 .text-block-10 { flex: 1; }
  .section-6 .rasp2-mob-logo { display: block; }
  .rasp2-burger-icon { flex-shrink: 0; color: #4a6fa5; opacity: 0.75; }
}
.lib-page {
  background: var(--lib-bg);
  color: var(--lib-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Open Sans', sans-serif;
  min-height: 100vh;
}
.lib-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.lib-hero {
  position: relative;
  background: #f0f4ff;
  padding: 48px 0 80px;
  overflow: hidden;
}
[data-theme="dark"] .lib-hero { background: #1a1f2e; }
.lib-hero-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 35%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.lib-hero-bg.active { opacity: 1; }
.lib-hero-arrow {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.25));
}
.lib-hero-arrow:hover {
  background: rgba(255, 255, 255, 0.48);
  transform: translateY(-50%) scale(1.06);
}
.lib-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #f0f4ff 38%, rgba(240,244,255,.97) 45%, rgba(240,244,255,.5) 58%, rgba(240,244,255,0) 75%);
}
[data-theme="dark"] .lib-hero-overlay {
  background: linear-gradient(to right, #1a1f2e 38%, rgba(26,31,46,.97) 45%, rgba(26,31,46,.5) 58%, rgba(26,31,46,0) 75%);
}
.lib-hero-inner {
  position: relative;
  z-index: 1;
}
.lib-hero-text {
  max-width: 520px;
}
.lib-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--lib-muted);
  margin-bottom: 16px;
}
.lib-breadcrumb a {
  color: var(--lib-primary);
  text-decoration: none;
}
.lib-breadcrumb a:hover { text-decoration: underline; }
.lib-bc-sep { color: var(--lib-muted); }
.lib-hero-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  color: var(--lib-text);
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 0 0 14px;
}
.lib-hero-subtitle {
  font-size: 15px;
  color: var(--lib-muted);
  max-width: 460px;
  line-height: 1.6;
  margin: 0;
}
@media (max-width: 768px) {
  .lib-hero {
    padding: 28px 0 20px;   /* no extra padding for overlap — search sits below */
    background: #f0f4ff;
  }
  [data-theme="dark"] .lib-hero { background: #1a1f2e; }
  .lib-hero-bg {
    top: auto;
    left: 50%;
    bottom: 0;
    height: 48%;
    background-position: center top;
  }
  .lib-hero-overlay {
    background: linear-gradient(to bottom, #f0f4ff 40%, rgba(240,244,255,.96) 55%, rgba(240,244,255,.4) 80%, rgba(240,244,255,0) 100%);
  }
  [data-theme="dark"] .lib-hero-overlay {
    background: linear-gradient(to bottom, #1a1f2e 40%, rgba(26,31,46,.96) 55%, rgba(26,31,46,.4) 80%, rgba(26,31,46,0) 100%);
  }
}
@media (max-width: 480px) {
  .lib-hero-bg {
    display: block;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    background-position: center center;
    opacity: 0;        /* inactive: hidden */
  }
  .lib-hero-bg.active { opacity: 0.1; } /* active: faint bg on small screens */
  .lib-hero-arrow { display: none; } /* no arrow on very small screens */
  .lib-hero {
    padding: 20px 0 90px;
    background: #f6f6f6;
  }
  [data-theme="dark"] .lib-hero { background: #1f2430; }
  .lib-hero-overlay {
    background: linear-gradient(to bottom,
      rgba(246,246,246,0) 0%,
      rgba(246,246,246,0) 55%,
      rgba(246,246,246,.7) 80%,
      rgba(246,246,246,1) 100%
    );
  }
  [data-theme="dark"] .lib-hero-overlay {
    background: linear-gradient(to bottom,
      rgba(31,36,48,0) 0%,
      rgba(31,36,48,0) 55%,
      rgba(31,36,48,.7) 80%,
      rgba(31,36,48,1) 100%
    );
  }
  .lib-hero-subtitle { font-size: 14.5px; }
  .lib-search-section { margin-top: -52px; }
  .lib-search-wrap { padding: 16px; }
  .lib-search-btn { padding: 8px 14px; font-size: 13px; }
}

/* ── Search ─────────────────────────────────────────────────────────────────── */
.lib-search-hint {
  font-size: 12.5px;
  color: var(--lib-muted);
  margin: 6px 0 0 4px;
}
.lib-search-section {
  background: transparent;
  padding: 0 0 28px;
  position: relative;
  z-index: 2;
  margin-top: 0;   /* default: no overlap */
}
@media (min-width: 769px) {
  .lib-search-section { margin-top: -52px; }  /* desktop: float over hero bottom */
}
.lib-search-wrap {
  background: var(--lib-white);
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 6px 32px rgba(21,116,232,.13);
  position: relative;
}
.lib-search-form {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--lib-bg);
  border: 2px solid var(--lib-line);
  border-radius: 50px;
  padding: 6px 6px 6px 18px;
  transition: border-color .2s, box-shadow .2s;
}
.lib-search-form:focus-within {
  border-color: var(--lib-primary);
  box-shadow: 0 0 0 3px rgba(21,116,232,.12);
}
.lib-search-icon {
  color: var(--lib-muted);
  flex-shrink: 0;
  margin-right: 8px;
}
.lib-search-input {
  flex: 1;
  min-width: 0; /* allow shrinking on small screens */
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--lib-text);
  outline: none;
  padding: 4px 0;
}
.lib-search-input::placeholder { color: var(--lib-muted); }
.lib-search-btn {
  background: var(--lib-primary);
  color: #fff;
  border: none;
  border-radius: 40px;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s;
}
.lib-search-btn:hover { background: var(--lib-primary-dark); }
.lib-popular-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding: 0 4px;
}
.lib-tags-label {
  font-size: 13px;
  color: var(--lib-muted);
  font-weight: 500;
  white-space: nowrap;
}
.lib-tag {
  background: transparent;
  border: 1.5px solid var(--lib-line);
  color: var(--lib-muted);
  border-radius: 20px;
  padding: 4px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.lib-tag:hover {
  border-color: var(--lib-primary);
  color: var(--lib-primary);
  background: var(--lib-badge-bg);
}

/* ── Quick Access Cards ─────────────────────────────────────────────────────── */
.lib-quick-section {
  padding: 32px 0;
  background: var(--lib-white);
}
.lib-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.lib-quick-card {
  display: block;
  position: relative;
  background: var(--lib-bg);
  border: 1.5px solid var(--lib-line);
  border-radius: var(--lib-card-radius);
  padding: 16px 40px 16px 16px;
  text-decoration: none;
  color: var(--lib-text);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.lib-quick-card:hover {
  border-color: var(--lib-primary);
  box-shadow: 0 4px 20px rgba(21,116,232,.1);
  background: var(--lib-white);
  text-decoration: none;
}
.lib-quick-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lib-qi-blue   { background: #1574e8; color: #fff; }
.lib-qi-green  { background: #1daf68; color: #fff; }
.lib-qi-purple { background: #7c3aed; color: #fff; }
.lib-qi-orange { background: #f59e0b; color: #fff; }
.lib-qi-teal   { background: #0097a7; color: #fff; }
[data-theme="dark"] .lib-qi-blue   { background: #1574e8; color: #fff; }
[data-theme="dark"] .lib-qi-green  { background: #1daf68; color: #fff; }
[data-theme="dark"] .lib-qi-purple { background: #7c3aed; color: #fff; }
[data-theme="dark"] .lib-qi-orange { background: #f59e0b; color: #fff; }
[data-theme="dark"] .lib-qi-teal   { background: #0097a7; color: #fff; }
.lib-quick-body {
  min-width: 0;
}
.lib-quick-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lib-quick-header strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--lib-text);
  line-height: 1.3;
}
.lib-quick-desc {
  display: block;
  font-size: 12.5px;
  color: var(--lib-muted);
  margin-top: 5px;
  line-height: 1.4;
  padding-left: 0;
}
.lib-quick-arrow {
  color: var(--lib-primary);
  position: absolute;
  bottom: 14px;
  right: 12px;
  transition: transform .15s;
}
.lib-quick-card:hover .lib-quick-arrow { transform: translateX(3px); }

/* ── About card (main page) ─────────────────────────────────────────────────── */
.lib-about-card-section {
  border-bottom: 1px solid var(--lib-border, #e5e8f0);
  background: var(--lib-bg);
}
.lib-about-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px 0;
}
.lib-about-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #e8f0fd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #1574e8;
}
.lib-about-card-body { flex: 1; }
.lib-about-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--lib-text, #1a2540);
  margin-bottom: 6px;
}
.lib-about-card-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--lib-text-muted, #666);
  margin-bottom: 16px;
}
.lib-about-card-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 20px;
  border: 1.5px solid var(--lib-accent, #1574e8);
  border-radius: 9px;
  color: var(--lib-accent, #1574e8);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.lib-about-card-btn:hover {
  background: var(--lib-accent, #1574e8);
  color: #fff;
}

/* ── About page (view=about) ────────────────────────────────────────────────── */
.lab-main {
  padding: 48px 0 80px;
  min-height: calc(100vh - 56px);
  background: var(--lib-bg, #fff);
}
.lab-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}
.lab-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--lib-text, #1a2540);
}
.lab-content h2 { font-size: 22px; font-weight: 700; margin: 28px 0 12px; }
.lab-content h3 { font-size: 18px; font-weight: 700; margin: 22px 0 10px; }
.lab-content p  { margin-bottom: 16px; }
.lab-content ul, .lab-content ol { padding-left: 24px; margin-bottom: 16px; }
.lab-content li { margin-bottom: 6px; }
.lab-content blockquote {
  border-left: 4px solid var(--lib-accent, #1574e8);
  margin: 20px 0;
  padding: 10px 20px;
  color: #555;
  background: #eef4ff;
  border-radius: 0 10px 10px 0;
}
.lab-content a { color: var(--lib-accent, #1574e8); text-decoration: underline; }
.lab-content img { max-width: 100%; border-radius: 10px; margin: 16px 0; }
.lab-files {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1.5px solid var(--lib-border, #e5e8f0);
}
.lab-files-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--lib-text, #1a2540);
  margin-bottom: 16px;
}
.lab-files-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lab-file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--lib-card-bg, #fff);
  border: 1.5px solid var(--lib-border, #e5e8f0);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.lab-file-card:hover {
  border-color: var(--lib-accent, #1574e8);
  box-shadow: 0 2px 12px rgba(21, 116, 232, .12);
}
.lab-file-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #eef4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lib-accent, #1574e8);
  flex-shrink: 0;
}
.lab-file-info { flex: 1; min-width: 0; }
.lab-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--lib-text, #1a2540);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lab-file-hint { font-size: 12px; color: #e05c2a; margin-top: 2px; }
.lab-file-arrow { color: #aab0c0; flex-shrink: 0; transition: color .15s; }
.lab-file-card:hover .lab-file-arrow { color: var(--lib-accent, #1574e8); }

/* ── Sections ───────────────────────────────────────────────────────────────── */
.lib-section {
  padding: 48px 0;
  background: var(--lib-bg);
}
.lib-section-alt {
  background: var(--lib-section-alt);
}
.lib-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}
.lib-section-title {
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
  font-weight: 800;
  color: var(--lib-text);
  margin: 0;
}
.lib-cat-header {
  justify-content: flex-start;
}
.lib-cat-header .lib-section-title {
  flex: 1;
}
.lib-section-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--lib-primary);
  white-space: nowrap;
}
.lib-section-note {
  font-size: 13px;
  color: var(--lib-muted);
}
.lib-catalog-cta {
  display: block;
  width: 100%;
  margin-top: 28px;
  padding: 16px 24px;
  background: var(--lib-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  border-radius: 12px;
  text-decoration: none;
  letter-spacing: .01em;
  transition: background .18s;
}
.lib-catalog-cta:hover {
  background: var(--lib-primary-dark);
  color: #fff;
  text-decoration: none;
}
.lib-catalog-count {
  font-size: 14px;
  color: var(--lib-muted);
  background: var(--lib-badge-bg);
  color: var(--lib-badge-text);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Book Carousel ──────────────────────────────────────────────────────────── */
.lib-carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.lib-carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 6px 2px 10px;
  flex: 1;
}
.lib-carousel::-webkit-scrollbar { display: none; }
.lib-carousel-btn {
  position: absolute;
  z-index: 3;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--lib-line);
  background: var(--lib-white);
  color: var(--lib-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--lib-card-shadow);
  transition: border-color .15s, background .15s;
}
.lib-carousel-btn:hover { border-color: var(--lib-primary); background: var(--lib-badge-bg); }
.lib-carousel-prev { left: -19px; }
.lib-carousel-next { right: -19px; }

/* ── Book Card (carousel + catalog) ─────────────────────────────────────────── */
.lib-book-card {
  flex-shrink: 0;
  width: 148px;
  background: var(--lib-card);
  border-radius: var(--lib-card-radius);
  border: 1px solid var(--lib-line);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.lib-book-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
  transform: translateY(-3px);
  border-color: var(--lib-primary);
}
.lib-book-cover {
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: var(--lib-section-alt);
  position: relative;
}
.lib-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lib-book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lib-muted);
  opacity: .4;
}
.lib-book-new-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--lib-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .05em;
}
.lib-book-info {
  padding: 10px 10px 12px;
}
.lib-book-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--lib-text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-book-author {
  font-size: 12px;
  color: var(--lib-muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-book-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.lib-book-meta span {
  font-size: 11px;
  color: var(--lib-muted);
  background: var(--lib-badge-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Electronic Resources Grid ──────────────────────────────────────────────── */
.lib-resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.lib-resource-card {
  background: var(--lib-card);
  border: 1.5px solid var(--lib-line);
  border-radius: var(--lib-card-radius);
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--lib-text);
  transition: box-shadow .18s, border-color .18s, transform .18s;
  gap: 10px;
}
.lib-resource-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.1);
  border-color: var(--lib-primary);
  transform: translateY(-2px);
  text-decoration: none;
}
.lib-resource-logo {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--lib-bg);
  border: 1px solid var(--lib-line);
  overflow: hidden;
}
.lib-resource-logo img {
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
}
.lib-resource-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--lib-primary);
  letter-spacing: -.02em;
}
.lib-resource-desc {
  font-size: 12.5px;
  color: var(--lib-muted);
  line-height: 1.5;
  flex: 1;
}
.lib-resource-btn {
  background: var(--lib-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
}
.lib-resource-btn:hover { background: var(--lib-primary-dark); }

/* ── News Grid ──────────────────────────────────────────────────────────────── */
.lib-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.lib-news-card {
  background: var(--lib-card);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-card-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s, transform .18s;
}
.lib-news-card:hover {
  box-shadow: var(--lib-card-shadow);
  transform: translateY(-2px);
}
.lib-news-img {
  height: 160px;
  overflow: hidden;
  background: var(--lib-section-alt);
}
.lib-news-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.lib-news-card:hover .lib-news-img img { transform: scale(1.04); }
.lib-news-body {
  padding: 16px 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.lib-news-date {
  font-size: 12px;
  color: var(--lib-muted);
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}
.lib-news-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--lib-text);
  line-height: 1.45;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-news-text {
  font-size: 13.5px;
  color: var(--lib-muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 12px;
}
.lib-news-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--lib-primary);
}

/* ── Catalog Controls & Grid ─────────────────────────────────────────────────── */
.lib-catalog-controls {
  margin-bottom: 20px;
}
.lib-catalog-search {
  width: 100%;
  max-width: 380px;
  padding: 9px 14px;
  border: 1.5px solid var(--lib-line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--lib-white);
  color: var(--lib-text);
  outline: none;
  transition: border-color .2s;
}
.lib-catalog-search:focus { border-color: var(--lib-primary); }

.lib-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 18px;
}

/* ── Vertical book card ─── */
.lib-catalog-item {
  background: var(--lib-card);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-card-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.lib-catalog-item:hover {
  box-shadow: 0 10px 36px rgba(0,0,0,.14);
  transform: translateY(-4px);
  border-color: var(--lib-primary);
  text-decoration: none;
  color: inherit;
}

.lib-ci-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: linear-gradient(145deg, #dde5f2 0%, #c2cedf 100%);
  position: relative;
  flex-shrink: 0;
}
[data-theme="dark"] .lib-ci-cover {
  background: linear-gradient(145deg, #2a3347 0%, #1e2838 100%);
}
.lib-ci-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.lib-catalog-item:hover .lib-ci-cover img { transform: scale(1.05); }
.lib-ci-cover-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lib-ci-cover-ph svg {
  width: 36px;
  height: 36px;
  color: #8fa0bb;
  opacity: .7;
}

/* Availability badge on cover — visible only on hover ───────── */
.lib-ci-avail-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 18px;
  padding: 0 6px;
  background: rgba(0,0,0,.48);
  color: rgba(255,255,255,.95);
  font-size: 10px;
  font-weight: 500;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1;
  z-index: 2;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.18);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .18s ease, transform .18s ease;
}
.lib-catalog-item:hover .lib-ci-avail-badge {
  opacity: 1;
  transform: translateY(0);
}
.lib-ci-avail-badge--none {
  background: rgba(0,0,0,.35);
  color: rgba(255,255,255,.65);
}
/* Dimmed cover when no copies are currently free */
.lib-catalog-item--unavail .lib-ci-cover img {
  filter: grayscale(50%) brightness(.82);
}
.lib-catalog-item--unavail .lib-ci-cover-ph {
  opacity: .5;
}

.lib-ci-info {
  padding: 10px 12px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.lib-ci-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--lib-text);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-ci-author {
  font-size: 11.5px;
  color: var(--lib-muted);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}
.lib-ci-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}
.lib-ci-badge {
  font-size: 10.5px;
  background: var(--lib-badge-bg);
  color: var(--lib-badge-text);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.lib-ci-year {
  font-size: 11px;
  color: var(--lib-muted);
  padding: 2px 0;
  font-weight: 500;
}

.lib-catalog-empty {
  text-align: center;
  padding: 40px;
  color: var(--lib-muted);
  font-size: 15px;
}

@media (max-width: 420px) {
  .lib-catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}
.lib-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--lib-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.lib-empty svg { opacity: .3; }
.lib-empty p { font-size: 16px; font-weight: 500; }

/* ── Exhibitions Grid ───────────────────────────────────────────────────────── */
/* Rich text content from Quill editor */
.lib-rich-text p  { margin: 0 0 .75em; }
.lib-rich-text p:last-child { margin-bottom: 0; }
.lib-rich-text h2 { font-size: 1.15em; font-weight: 700; margin: 1em 0 .4em; }
.lib-rich-text h3 { font-size: 1.05em; font-weight: 700; margin: 1em 0 .4em; }
.lib-rich-text ul, .lib-rich-text ol { padding-left: 1.4em; margin: 0 0 .75em; }
.lib-rich-text a  { color: var(--lib-primary); text-decoration: underline; }
.lib-rich-text strong { font-weight: 700; }
.lib-rich-text em     { font-style: italic; }

.lib-exh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.lib-exh-grid--home {
  grid-template-columns: repeat(4, 1fr);
}
.lib-exh-grid--home .lib-exh-img { height: 180px; }
@media (max-width: 900px) {
  .lib-exh-grid--home { grid-template-columns: repeat(2, 1fr); }
}
.lib-exh-card {
  background: var(--lib-card);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-card-radius);
  overflow: hidden;
  transition: box-shadow .18s, transform .18s;
}
.lib-exh-card:hover {
  box-shadow: var(--lib-card-shadow);
  transform: translateY(-2px);
}
.lib-exh-img {
  height: 150px;
  overflow: hidden;
  background: var(--lib-section-alt);
}
.lib-exh-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.lib-exh-card:hover .lib-exh-img img { transform: scale(1.04); }
.lib-exh-img-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lib-muted);
  opacity: .35;
}
.lib-exh-info { padding: 12px 14px 14px; }
.lib-exh-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--lib-text);
  line-height: 1.4;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-exh-dates {
  font-size: 12px;
  color: var(--lib-muted);
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
/* ── Electronic Resources ────────────────────────────────────────────────────── */
.lib-resources-section {
  background: #fff;
  padding: 48px 0;
  border-top: 1px solid #e8ecf2;
}
[data-theme="dark"] .lib-resources-section { background: var(--lib-card); border-top-color: var(--lib-line); }
.lib-res-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.lib-res-card {
  background: #fff;
  border: 1.5px solid #e4e9f2;
  border-radius: 14px;
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: box-shadow .18s, border-color .18s;
}
.lib-res-card:hover { border-color: #b0c8f0; box-shadow: 0 4px 16px rgba(21,116,232,.10); }
[data-theme="dark"] .lib-res-card { background: var(--lib-bg); border-color: var(--lib-line); }
.lib-res-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  gap: 4px;
  margin-bottom: 14px;
}
/* Real image logos */
.lib-res-logo__img {
  max-width: 140px;
  max-height: 52px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lib-res-logo__img--wide {
  max-width: 160px;
  max-height: 44px;
}
/* Знаниум */
.lib-res-logo__znan {
  font-size: 15px;
  font-weight: 800;
  color: #0a3080;
  letter-spacing: 0.3px;
  font-family: Arial, sans-serif;
}
/* Book.ru */
.lib-res-logo__book {
  font-size: 22px;
  font-weight: 800;
  color: #111;
  letter-spacing: -0.5px;
  font-family: Arial, sans-serif;
}
.lib-res-logo__book span { color: #1574e8; }
/* sub caption */
.lib-res-logo__sub {
  font-size: 9px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* Fallback text logo */
.lib-res-logo__fallback {
  font-size: 15px;
  font-weight: 800;
  color: #1574e8;
  letter-spacing: -0.3px;
  text-align: center;
  padding: 0 4px;
}
.lib-res-desc {
  flex: 1;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--lib-muted);
  margin: 0 0 14px;
}
.lib-res-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 0;
  background: #1574e8;
  color: #fff;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.lib-res-btn:hover { background: #1260c8; color: #fff; }
[data-theme="dark"] .lib-res-btn { background: #1e5db8; }
[data-theme="dark"] .lib-res-btn:hover { background: #1574e8; }

/* ── Info Section (About / Hours / Contacts) ──────────────────────────────── */
.lib-info-section {
  background: #f0f4fa;
  padding: 52px 0;
}
[data-theme="dark"] .lib-info-section { background: var(--lib-bg); }
.lib-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.lib-info-card {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
[data-theme="dark"] .lib-info-card {
  background: var(--lib-card);
  border-color: var(--lib-line);
}
.lib-info-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.lib-info-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 10px;
  background: #dbeafe;
  color: #1574e8;
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-theme="dark"] .lib-info-icon { background: rgba(21,116,232,.15); color: #5ba5f5; }
.lib-info-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--lib-text);
  margin: 0;
  line-height: 1.3;
}
.lib-info-text {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--lib-muted);
  margin: 0 0 18px;
}
.lib-info-btn {
  display: inline-block;
  margin-top: auto;
  padding: 8px 18px;
  border: 1.5px solid #bfcfe8;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1574e8;
  text-decoration: none;
  background: transparent;
  transition: border-color .15s, background .15s;
  align-self: flex-start;
}
.lib-info-btn:hover { border-color: #1574e8; background: #f0f6ff; }
.lib-hours-table { font-size: 14px; }
.lib-hours-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--lib-line);
  color: var(--lib-text);
}
.lib-hours-row:last-child { border-bottom: none; }
.lib-hours-row span:first-child { font-weight: 500; }
.lib-hours-row span:last-child { color: var(--lib-muted); }
.lib-hours-note {
  font-size: 12px;
  color: var(--lib-muted);
  padding: 8px 0 2px;
  font-style: italic;
}
.lib-contacts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lib-contacts-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--lib-muted);
}
.lib-contacts-list li svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #1574e8;
  opacity: .85;
}
.lib-contacts-list a { color: var(--lib-muted); text-decoration: none; }
.lib-contacts-list a:hover { color: var(--lib-primary); }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.lib-footer {
  background: var(--lib-footer-bg);
  color: var(--lib-footer-text);
  padding: 20px 0;
  border-top: 1px solid rgba(255,255,255,.07);
}
.lib-footer-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.lib-footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.lib-footer-logo { border-radius: 8px; }
.lib-footer-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.lib-footer-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.lib-footer-brand-sub {
  font-size: 12px;
  color: var(--lib-footer-text);
}
.lib-footer-links {
  display: flex;
  gap: 18px;
}
.lib-footer-links a {
  font-size: 13px;
  color: var(--lib-footer-text);
  text-decoration: none;
}
.lib-footer-links a:hover { color: #fff; }
.lib-footer-copy {
  font-size: 12px;
  color: rgba(255,255,255,.3);
  text-align: right;
}

/* ── Book Modal ─────────────────────────────────────────────────────────────── */
.lib-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lib-modal-overlay.open { display: flex; }
.lib-modal {
  background: var(--lib-card);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
.lib-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--lib-section-alt);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--lib-text);
  transition: background .15s;
  z-index: 1;
}
.lib-modal-close:hover { background: var(--lib-line); }
.lib-modal-body { padding: 24px; }
.lib-modal-inner { display: flex; gap: 20px; align-items: flex-start; }
.lib-modal-cover {
  width: 110px;
  height: 150px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--lib-line);
  background: var(--lib-section-alt);
}
.lib-modal-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lib-muted);
  opacity: .4;
}
.lib-modal-details { flex: 1; min-width: 0; }
.lib-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--lib-text);
  line-height: 1.35;
  margin: 0 0 8px;
}
.lib-modal-author {
  font-size: 14px;
  color: var(--lib-muted);
  margin: 0 0 10px;
}
.lib-modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lib-modal-badge {
  background: var(--lib-badge-bg);
  color: var(--lib-badge-text);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
}
.lib-modal-year {
  background: var(--lib-section-alt);
  color: var(--lib-muted);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12.5px;
}
.lib-modal-isbn {
  font-size: 13px;
  color: var(--lib-muted);
  margin: 0 0 8px;
}
.lib-modal-desc {
  font-size: 14px;
  color: var(--lib-text);
  line-height: 1.7;
  margin: 0 0 12px;
}
.lib-modal-avail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1daf68;
  margin: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .lib-footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .lib-res-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .lib-res-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .lib-hero { height: 240px; }
  .lib-quick-grid { grid-template-columns: 1fr 1fr; }
  .lib-res-grid { grid-template-columns: repeat(2, 1fr); }
  .lib-resources-section { padding: 32px 0; }
  .lib-resources-grid { grid-template-columns: repeat(2, 1fr); }
  .lib-footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .lib-section { padding: 32px 0; }
  .lib-search-section { padding: 22px 0 18px; }
  .lib-modal-inner { flex-direction: column; align-items: center; }
  .lib-modal-cover { width: 130px; height: 176px; }
  .lib-section-header--note-below { flex-direction: column; gap: 4px; }
  .lib-cat-header { flex-wrap: wrap; }
  .lib-cat-header .lib-catalog-count { margin-left: auto; }
  .lib-cat-link { flex: 0 0 100%; margin-top: 6px; }
}
@media (max-width: 480px) {
  .lib-quick-grid { grid-template-columns: 1fr; }
  .lib-news-grid  { grid-template-columns: 1fr; }
  .lib-catalog-grid { grid-template-columns: repeat(2, 1fr); }
  .lib-exh-grid { grid-template-columns: repeat(2, 1fr); }
  .lib-res-grid { grid-template-columns: 1fr 1fr; }
  .lib-resources-grid { grid-template-columns: 1fr; }
}

/* ── Full Catalog Page ───────────────────────────────────────────────────────── */
.cat-hdr {
  background: #fff;
  border-bottom: 1px solid #e8eaf0;
  position: sticky; top: 0; z-index: 50;
}
.cat-hdr-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; gap: 12px;
}
.cat-hdr-logo {
  display: flex; align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity .15s;
}
.cat-hdr-logo:hover { opacity: 0.75; }
.cat-hdr-logo img { height: 36px; width: auto; display: block; }
.cat-hdr-divider { width: 1px; height: 20px; background: #e8eaf0; flex-shrink: 0; }
.cat-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: #555; font-size: 14px; font-weight: 500;
  text-decoration: none; padding: 6px 12px;
  border-radius: 8px; transition: background .15s, color .15s;
}
.cat-back:hover { background: #f0f2f5; color: #1574e8; text-decoration: none; }
.cat-hdr-title { font-weight: 700; font-size: 16px; color: #1a1d24; }
.cat-hdr-count { font-size: 13px; color: #8892a4; margin-left: auto; }
.cat-main {
  width: 100%; max-width: 1200px; margin: 0 auto;
  padding: 32px 24px 48px;
  flex: 1;
}
/* ── Unified search + filter toolbar ─────────────────────────────────────── */
.cat-toolbar {
  background: #fff;
  border: 1px solid #e2e8f2;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
}
/* Search input row */
.cat-ac-wrap {
  position: relative;
}
.cat-search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: #9aa4b5; pointer-events: none;
}
.cat-search-input {
  width: 100%;
  padding: 10px 40px 10px 44px;
  font-size: 15px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #1a1d24;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.cat-search-input::placeholder { color: #aab2c0; }
.cat-search-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; padding: 6px;
  color: #aab2c0; cursor: pointer; border-radius: 6px; line-height: 0;
  transition: color .15s;
}
.cat-search-clear:hover { color: #1a1d24; }
/* Autocomplete dropdown */
.cat-ac-dropdown {
  display: none;
  position: absolute; top: calc(100% + 6px); left: -16px; right: -16px;
  background: #fff;
  border: 1px solid #e2e8f2;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  z-index: 100;
  overflow: hidden;
}
.cat-ac-dropdown.open { display: block; }
.cat-ac-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  transition: background .1s;
}
.cat-ac-item:hover, .cat-ac-item.active { background: #f0f4fb; }
.cat-ac-title { font-size: 14px; font-weight: 600; color: #1a1d24; }
.cat-ac-author { font-size: 12px; color: #8892a4; }

/* Divider between search and filters */
.cat-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f4fa;
}
.cat-select--sp { flex: 1; min-width: 180px; max-width: 380px; }
/* Dropdown select */
.cat-select {
  height: 36px;
  padding: 0 28px 0 11px;
  border: 1px solid #dce3ef;
  border-radius: 8px;
  background: #f7f9fc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") right 8px center / 14px no-repeat;
  font-size: 13.5px;
  color: #2d3548;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.cat-select:hover { border-color: #1574e8; background-color: #f0f6ff; }
.cat-select:focus { outline: none; border-color: #1574e8; box-shadow: 0 0 0 3px rgba(21,116,232,.12); }
.cat-select.has-value { border-color: #1574e8; background-color: #e8f1fd; color: #1358c4; font-weight: 600; }
/* Availability toggle */
.cat-avail-toggle {
  display: inline-flex;
  height: 36px;
  border: 1px solid #dce3ef;
  border-radius: 8px;
  overflow: hidden;
  background: #f7f9fc;
}
.cat-avail-btn {
  padding: 0 14px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-family: inherit;
  color: #555d72;
  cursor: pointer;
  transition: background .15s, color .15s;
  height: 100%;
  white-space: nowrap;
}
.cat-avail-btn:not(:last-child) { border-right: 1px solid #dce3ef; }
.cat-avail-btn.active { background: #1574e8; color: #fff; }
.cat-avail-btn:not(.active):hover { background: #e8f1fd; color: #1574e8; }
/* Reset button */
.cat-reset-btn {
  height: 36px;
  padding: 0 13px;
  border: 1px solid #dce3ef;
  border-radius: 8px;
  background: #f7f9fc;
  color: #8892a4;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.cat-reset-btn:hover { border-color: #e74c3c; color: #e74c3c; background: #fff5f5; }
/* Right-side group: reset + view toggle */
.cat-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
/* View mode toggle */
.cat-view-toggle {
  display: inline-flex;
  height: 36px;
  border: 1px solid #dce3ef;
  border-radius: 8px;
  overflow: hidden;
  background: #f7f9fc;
}
.cat-view-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #8892a4;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  padding: 0;
  flex-shrink: 0;
}
.cat-view-btn:not(:last-child) { border-right: 1px solid #dce3ef; }
.cat-view-btn.active { background: #1574e8; color: #fff; }
.cat-view-btn:not(.active):hover { background: #e8f1fd; color: #1574e8; }

/* ── Catalog footer ─────────────────────────────────────────────────────── */
.cat-footer {
  background: #161b25;
  color: #9aa8b8;
}
.cat-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 44px 24px 36px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 40px;
  align-items: center;
}
.cat-footer-brand { display: flex; flex-direction: row; align-items: center; gap: 16px; }
.cat-footer-logo-link { display: inline-flex; text-decoration: none; opacity: .9; transition: opacity .15s; }
.cat-footer-logo-link:hover { opacity: 1; }
.cat-footer-logo-link img { height: 42px; width: auto; display: block; }
.cat-footer-college { font-size: 12px; color: #5a6d80; margin: 0; line-height: 1.6; }
.cat-footer-social { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cat-footer-social-label { font-size: 11px; color: #5a6d80; text-transform: uppercase; letter-spacing: .08em; }
.cat-footer-social-links { display: flex; gap: 8px; }
.cat-soc-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: rgba(255,255,255,.07);
  color: #8898aa;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.cat-soc-btn:hover { color: #fff; }
.cat-soc-vk:hover  { background: #4a76a8; }
.cat-soc-tg:hover  { background: #2ca5e0; }
.cat-soc-ok:hover  { background: #ed7018; }
.cat-soc-rt:hover  { background: #3f3f3f; }
.cat-soc-mx:hover  { background: rgba(255,255,255,.15); }
.cat-soc-mx img    { opacity: .65; transition: opacity .15s; display: block; }
.cat-soc-mx:hover img { opacity: 1; }

/* ── Search autocomplete ────────────────────────────────────────────────────── */
.lib-ac-panel {
  display: none;
  position: absolute;
  top: calc(100% - 12px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #e0e4ef;
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 10px 32px rgba(0,0,0,.12);
  z-index: 200;
  overflow: hidden;
}
.lib-ac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: #1a1d24;
  border-top: 1px solid #f0f2f7;
  transition: background .1s;
}
.lib-ac-item:first-child { border-top: none; }
.lib-ac-item:hover { background: #f5f7ff; text-decoration: none; }
.lib-ac-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.lib-ac-badge-book { background: #eef4ff; color: #1574e8; }
.lib-ac-badge-news { background: #f0f9f0; color: #2e7d32; }
.lib-ac-badge-exh  { background: #f5eefa; color: #7b4eac; }
.lib-ac-all {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: #4a6fa5;
  text-decoration: none;
  border-top: 1px solid #eef0f5;
  text-align: center;
}
.lib-ac-all:hover { background: #f5f7fb; }
.lib-ac-info { flex: 1; min-width: 0; }
.lib-ac-title { font-size: 14px; font-weight: 600; color: #1a1d24; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-ac-meta  { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: nowrap; overflow: hidden; }
.lib-ac-sub  { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-ac-thumb {
  flex-shrink: 0;
  width: 38px;
  height: 50px;
  border-radius: 4px;
  overflow: hidden;
  background: #f0f3fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aab0c4;
}
.lib-ac-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-ac-thumb-ph { }
/* wide thumb for news/exhibitions */
.lib-ac-item[data-wide] .lib-ac-thumb { height: 38px; }

.cat-footer-addr { text-align: right; }
.cat-footer-addr p { font-size: 12px; color: #5a6d80; margin: 0; line-height: 1.8; }
.cat-footer-bottom {
  border-top: 1px solid rgba(255,255,255,.05);
  text-align: center;
  padding: 14px 24px;
}
.cat-footer-bottom p { font-size: 12px; color: #3a4d5f; margin: 0; }
@media (max-width: 700px) {
  .cat-footer-inner { grid-template-columns: 1fr; gap: 30px; padding: 32px 18px 24px; }
  .cat-footer-addr { text-align: left; }
  .cat-footer-social { align-items: flex-start; }
  .lib-info-grid { grid-template-columns: 1fr; }
}

/* Dark theme */
[data-theme="dark"] .cat-hdr { background: var(--lib-card); border-bottom-color: var(--lib-line); }
[data-theme="dark"] .cat-hdr-divider { background: var(--lib-line); }
[data-theme="dark"] .cat-hdr-title { color: var(--lib-text); }
[data-theme="dark"] .cat-toolbar { background: var(--lib-card); border-color: var(--lib-line); box-shadow: none; }
[data-theme="dark"] .cat-search-input { background: transparent; color: var(--lib-text); }
[data-theme="dark"] .cat-search-icon { color: var(--lib-muted); }
[data-theme="dark"] .cat-search-clear { color: var(--lib-muted); }
[data-theme="dark"] .cat-search-clear:hover { color: var(--lib-text); }
[data-theme="dark"] .cat-toolbar-filters { border-top-color: var(--lib-line); }
[data-theme="dark"] .cat-ac-dropdown { background: var(--lib-card); border-color: var(--lib-line); }
[data-theme="dark"] .cat-ac-item:hover, [data-theme="dark"] .cat-ac-item.active { background: var(--lib-section-alt); }
[data-theme="dark"] .cat-ac-title { color: var(--lib-text); }
[data-theme="dark"] .cat-select { background-color: var(--lib-section-alt); border-color: var(--lib-line); color: var(--lib-text); }
[data-theme="dark"] .cat-select:hover { background-color: rgba(21,116,232,.1); border-color: #4a8fdf; }
[data-theme="dark"] .cat-select.has-value { background-color: rgba(21,116,232,.18); border-color: #1574e8; color: #6cb2f7; }
[data-theme="dark"] .cat-avail-toggle { border-color: var(--lib-line); background: var(--lib-section-alt); }
[data-theme="dark"] .cat-avail-btn { color: var(--lib-muted); }
[data-theme="dark"] .cat-avail-btn:not(:last-child) { border-color: var(--lib-line); }
[data-theme="dark"] .cat-avail-btn.active { background: #1574e8; color: #fff; }
[data-theme="dark"] .cat-avail-btn:not(.active):hover { background: rgba(21,116,232,.15); color: #6cb2f7; }
[data-theme="dark"] .cat-reset-btn { background: var(--lib-section-alt); border-color: var(--lib-line); color: var(--lib-muted); }
[data-theme="dark"] .cat-reset-btn:hover { border-color: #e74c3c; color: #e74c3c; background: rgba(231,76,60,.08); }
[data-theme="dark"] .cat-view-toggle { border-color: var(--lib-line); background: var(--lib-section-alt); }
[data-theme="dark"] .cat-view-btn { color: var(--lib-muted); }
[data-theme="dark"] .cat-view-btn:not(:last-child) { border-color: var(--lib-line); }
[data-theme="dark"] .cat-view-btn.active { background: #1574e8; color: #fff; }
[data-theme="dark"] .cat-view-btn:not(.active):hover { background: rgba(21,116,232,.15); color: #6cb2f7; }
@media (max-width: 680px) {
  .cat-hdr-title { font-size: 14px; }
  .cat-toolbar { padding: 12px; border-radius: 10px; }
  .cat-toolbar-filters { gap: 6px; }
  .cat-select { font-size: 13px; flex: 1 1 calc(50% - 3px); min-width: 0; }
  .cat-select--sp { flex: 1 1 100%; max-width: 100%; }
  .cat-avail-btn { padding: 0 11px; font-size: 13px; flex: 1; }  /* buttons fill toggle */
  .cat-avail-toggle { flex: 1 1 100%; display: flex; }   /* toggle fills full row */
  .cat-toolbar-right {                                    /* view toggle — full-width column */
    flex: 1 1 100%; margin-left: 0;
    flex-direction: column; align-items: stretch; gap: 0;
  }
  .cat-toolbar-right::before {                           /* "Вид" label on mobile */
    content: 'Вид';
    display: block;
    font-size: 12px;
    color: #8892a4;
    font-weight: 500;
    margin-bottom: 6px;
  }
  .cat-reset-btn { display: none; }                      /* no space for it on mobile */
  .cat-view-toggle { display: flex; }                    /* align-items:stretch fills full width */
  .cat-view-btn { width: auto; flex: 1; }
  /* News toolbar: search full-width; second row — Вид left, toggle right */
  .an-toolbar .cat-toolbar-right {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
  }
  .an-toolbar .cat-toolbar-right::before { margin-bottom: 0; }
  .an-toolbar .cat-view-toggle { width: auto; }
  .an-toolbar .cat-view-btn { flex: initial; width: 36px; }
}
@media (max-width: 420px) {
  .cat-select { flex: 1 1 100%; }   /* each select full-width on very small screens */
}

/* ── Catalog list view ───────────────────────────────────────────────────── */
.lib-catalog-grid.cat-view-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cat-view-list .cat-catalog-item {
  flex-direction: row;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
}
.cat-view-list .cat-catalog-item:hover { transform: none; box-shadow: 0 2px 12px rgba(0,0,0,.1); }
.cat-view-list .lib-ci-cover {
  width: 50px;
  height: 72px;
  aspect-ratio: unset;
  flex-shrink: 0;
  border-radius: 0;
}
.cat-view-list .lib-ci-info {
  flex-direction: row;
  align-items: center;
  padding: 0 14px;
  gap: 14px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.cat-view-list .lib-ci-title {
  flex: 1;
  -webkit-line-clamp: 1;
  margin-bottom: 0;
  font-size: 14px;
  min-width: 80px;
}
.cat-view-list .lib-ci-author {
  width: 160px;
  flex-shrink: 0;
  margin-bottom: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-view-list .lib-ci-meta {
  margin-top: 0;
  flex-shrink: 0;
  flex-wrap: nowrap;
}
@media (max-width: 600px) {
  .cat-view-list .lib-ci-author { display: none; }
  .cat-view-list .lib-ci-cover { width: 44px; }
}

/* ── Book detail page ─────────────────────────────────────────────────────── */
.bk-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.bk-container {
  max-width: 860px;
  margin: 0 auto;
}
.bk-content {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  margin-bottom: 56px;
}
.bk-cover-wrap { flex-shrink: 0; width: 200px; }
.bk-cover-img {
  width: 200px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  display: block;
  object-fit: cover;
}
.bk-cover-ph {
  width: 200px;
  height: 280px;
  background: linear-gradient(145deg, #dde5f2, #c2cedf);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8fa0bb;
}
.bk-details { flex: 1; min-width: 0; }
.bk-badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  color: #1574e8;
  background: #e8f0fe;
  padding: 4px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  letter-spacing: .02em;
}
.bk-title {
  font-size: 24px;
  font-weight: 800;
  color: #1a1d24;
  line-height: 1.3;
  margin: 0 0 10px;
}
.bk-author {
  font-size: 15px;
  color: #6d7583;
  font-style: italic;
  margin: 0 0 16px;
}
.bk-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #4a5568;
}
.bk-specialty {
  font-size: 13px;
  color: #5a6376;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: #f0f3f8;
  border-radius: 6px;
  border-left: 3px solid #1574e8;
}
.bk-avail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.bk-avail--free { background: #e6f9f0; color: #18a558; }
.bk-avail--none { background: #fef2f2; color: #e53e3e; }
.bk-desc {
  font-size: 14.5px;
  color: #4a5568;
  line-height: 1.75;
  margin-top: 4px;
}
.bk-desc-label {
  font-size: 12px;
  font-weight: 700;
  color: #8892a4;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}
.bk-related { border-top: 1px solid #e4e7ed; padding-top: 36px; }
.bk-related-title {
  font-size: 19px;
  font-weight: 700;
  color: #1a1d24;
  margin: 0 0 20px;
}
.bk-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
[data-theme="dark"] .bk-title { color: var(--lib-text); }
[data-theme="dark"] .bk-badge { background: rgba(21,116,232,.18); }
[data-theme="dark"] .bk-desc-label { color: var(--lib-muted); }
[data-theme="dark"] .bk-desc { color: var(--lib-muted); }
[data-theme="dark"] .bk-specialty { background: rgba(255,255,255,.06); border-left-color: #1574e8; color: var(--lib-muted); }
[data-theme="dark"] .bk-related { border-top-color: var(--lib-line); }
[data-theme="dark"] .bk-related-title { color: var(--lib-text); }
[data-theme="dark"] .bk-cover-ph { background: #2a3045; }
@media (max-width: 640px) {
  .bk-main { padding: 24px 16px 60px; }
  .bk-content { flex-direction: column; align-items: stretch; gap: 24px; }
  .bk-cover-wrap { width: 100%; display: flex; justify-content: center; }
  .bk-cover-img { width: 100%; max-width: 100%; border-radius: 10px; }
  .bk-cover-ph { width: 100%; height: 260px; }
  .bk-title { font-size: 20px; }
  .bk-meta-row { flex-direction: column; gap: 8px; }
}

/* ── Clickable news cards (now <a> tags) ────────────────────────────────────── */
.lib-news-card--clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.lib-news-card--clickable .lib-news-link {
  display: inline-block;
  cursor: pointer;
  text-decoration: none;
  transition: color .15s;
}
.lib-news-card--clickable:hover .lib-news-link { text-decoration: underline; }

/* ── News article modal ──────────────────────────────────────────────────────── */
.lib-news-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 2100;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px 40px;
  overflow-y: auto;
}
.lib-news-modal-overlay.open { display: flex; }
.lib-news-modal-box {
  background: var(--lib-card);
  border-radius: 18px;
  width: 100%;
  max-width: 720px;
  position: relative;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
  overflow: hidden;
  margin: auto;
}
.lib-news-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0,0,0,.38);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  z-index: 2;
  transition: background .15s;
}
.lib-news-modal-close:hover { background: rgba(0,0,0,.6); }
.lib-news-modal-cover-wrap { width: 100%; max-height: 340px; overflow: hidden; }
.lib-news-modal-cover {
  width: 100%;
  height: 340px;
  object-fit: cover;
  display: block;
}
.lib-news-modal-content {
  padding: 28px 36px 40px;
}
.lib-news-modal-date {
  font-size: 13px;
  color: var(--lib-muted);
  font-weight: 500;
  display: block;
  margin-bottom: 10px;
}
.lib-news-modal-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--lib-text);
  line-height: 1.3;
  margin: 0 0 20px;
}
/* Body text from Quill: ql-editor class gives Quill typography */
.lib-news-modal-body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--lib-text);
  /* Override Quill editor styles we don't want in read mode */
  border: none !important;
  padding: 0 !important;
  min-height: unset !important;
  max-height: unset !important;
}
.lib-news-modal-body img {
  max-width: 100%;
  border-radius: 10px;
  margin: 12px 0;
}
.lib-news-modal-body p { margin-bottom: 12px; }
.lib-news-modal-body h2, .lib-news-modal-body h3 {
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--lib-text);
}
.lib-news-modal-body a { color: var(--lib-primary); }
.lib-news-modal-body ul, .lib-news-modal-body ol {
  padding-left: 24px;
  margin-bottom: 12px;
}
.lib-news-modal-body blockquote {
  border-left: 4px solid var(--lib-primary);
  margin: 14px 0;
  padding: 8px 16px;
  color: var(--lib-muted);
  background: var(--lib-section-alt);
  border-radius: 0 8px 8px 0;
}
@media (max-width: 600px) {
  .lib-news-modal-content { padding: 20px 18px 32px; }
  .lib-news-modal-title { font-size: 19px; }
  .lib-news-modal-cover { height: 200px; }
}
