/* =========================================================
   TriNex Library
   Closed GM catalog for guides, books, maps, and knowledge records.
   ========================================================= */

.library-page {
  --library-accent: #f7c948;
  --library-ink: #38bdf8;
}

.library-header .page-title-row::before {
  background:
    radial-gradient(circle at 34% 30%, rgba(247, 201, 72, .34), transparent 44%),
    url("/gallery/tnx-logo-ts1760711022.png") center / cover no-repeat,
    url("/gallery/tnx-logo.WebP") center / cover no-repeat;
}

.library-layout {
  align-items: start;
}

.library-filters {
  display: grid;
  gap: 12px;
}

.library-filter-field {
  display: grid;
  gap: 6px;
}

.library-filter-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.library-filter-field input,
.library-filter-field select {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
  color: var(--text);
  padding: 8px 10px;
}

.library-filter-field input:focus,
.library-filter-field select:focus {
  border-color: rgba(56, 189, 248, .55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .12);
}

.library-content {
  gap: 12px;
}

.mode-tab:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.library-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid rgba(165, 180, 252, .14);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  padding: 10px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.library-card,
.library-empty,
.library-locked {
  border: 1px solid rgba(165, 180, 252, .16);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(247, 201, 72, .09), transparent 44%),
    color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .14);
}

.library-card {
  display: grid;
  gap: 8px;
  border-radius: 14px;
  padding: 11px;
}

.library-card.selected {
  border-color: rgba(56, 189, 248, .58);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, .18) inset,
    0 16px 44px rgba(0, 0, 0, .16);
}

.library-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.library-card-actions .select-print {
  justify-self: start;
  min-height: 30px;
  padding: 5px 9px;
}

.library-card-head {
  display: grid;
  gap: 6px;
}

.library-card-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.library-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.18;
}

.library-cost {
  justify-self: end;
  white-space: nowrap;
  border: 1px solid rgba(247, 201, 72, .30);
  border-radius: 999px;
  background: rgba(247, 201, 72, .07);
  color: var(--library-accent);
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 850;
}

.library-meta,
.library-reveal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.library-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid rgba(165, 180, 252, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .035);
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.2;
}

.library-chip.is-status {
  color: var(--library-ink);
  border-color: rgba(56, 189, 248, .28);
  background: rgba(56, 189, 248, .07);
}

.library-description,
.library-note,
.library-aliases {
  margin: 0;
  color: color-mix(in srgb, var(--text) 84%, var(--muted));
  font-size: 12px;
  line-height: 1.35;
}

.library-note,
.library-aliases {
  color: var(--muted);
}

.library-section {
  display: grid;
  gap: 6px;
  border-top: 1px solid rgba(165, 180, 252, .10);
  padding-top: 8px;
}

.library-section h3 {
  margin: 0;
  color: var(--library-ink);
  font-size: 13px;
  line-height: 1.25;
}

.library-reveal-list {
  display: grid;
  gap: 6px;
}

.library-reveal {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(165, 180, 252, .12);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  padding: 8px;
}

.library-reveal strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.library-empty,
.library-locked {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  align-content: center;
  min-height: 240px;
  padding: 26px;
  text-align: center;
}

.library-empty h2,
.library-locked h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
}

.library-empty p,
.library-locked p {
  max-width: 640px;
  margin: 0 auto;
  color: var(--muted);
}

[data-theme="light"] .library-card,
[data-theme="light"] .library-empty,
[data-theme="light"] .library-locked,
[data-theme="light"] .library-toolbar {
  background: rgba(255, 255, 255, .78);
}

@media (max-width: 920px) {
  .library-layout {
    grid-template-columns: 1fr;
  }

  .library-filters {
    position: static;
  }
}

@media (max-width: 620px) {
  .library-card-title-row {
    grid-template-columns: 1fr;
  }

  .library-cost {
    justify-self: start;
  }

  .library-toolbar .btn {
    width: 100%;
  }
}

@media print {
  .library-header,
  .library-filters,
  .mode-tabs,
  .library-toolbar,
  .library-card-actions {
    display: none !important;
  }

  body.library-print-selected .library-card:not(.selected) {
    display: none !important;
  }

  .library-layout {
    display: block;
    padding: 0;
  }

  .library-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .library-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
