/* RvtStore Library — Apple / Linear / Notion */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --lib-max: 1440px;
  --lib-green: var(--primary, #386e44);
  --lib-green-soft: var(--primary-light, #eef4ef);
  --lib-border: #e8e8e8;
  --lib-muted: #666;
  --lib-radius: 12px;
  --lib-gap: 24px;
  --lib-section-y: 96px;
  --lib-ease: 120ms ease;
}

body.library-ui {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #111;
  background: #fff;
}

body.library-ui .bg-mesh {
  display: none;
}

body.library-ui .site-header {
  border-bottom: 1px solid var(--lib-border);
  box-shadow: none;
  background: #fff;
}

body.library-ui.is-home-library .header-search {
  display: flex;
}

body.library-ui .top-nav a {
  font-size: 14px;
  color: var(--lib-muted);
  transition: color var(--lib-ease);
}

body.library-ui .top-nav a:hover,
body.library-ui .top-nav a.active {
  color: #111;
}

/* Layout */
.library-main {
  padding: 0 32px 120px;
}

.library-container {
  max-width: var(--lib-max);
  margin: 0 auto;
}

.library-grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lib-gap);
  width: 100%;
}

body.library-ui .page-wrap {
  display: block;
  max-width: none;
  padding: 0;
}

body.library-ui .sidebar.sidebar-ozon {
  display: none !important;
}

body.library-ui .main-content {
  width: 100%;
  max-width: none;
  padding: 0;
}

/* Hero */
.library-hero {
  text-align: center;
  padding: 72px 0 var(--lib-section-y);
}

.library-hero-brand {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--lib-muted);
  margin: 0 0 12px;
}

.library-hero-title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 12px;
}

.library-hero-sub {
  font-size: 1.0625rem;
  color: var(--lib-muted);
  margin: 0 0 40px;
  font-weight: 400;
}

.library-search-wrap {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}

.library-search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  pointer-events: none;
}

.library-search-input {
  width: 100%;
  padding: 16px 20px 16px 50px;
  font-size: 16px;
  border: 1px solid var(--lib-border);
  border-radius: 14px;
  background: #fff;
  color: #111;
  transition: border-color var(--lib-ease), box-shadow var(--lib-ease);
}

.library-search-input:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

.library-search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--lib-border);
  border-radius: 14px;
  overflow: hidden;
  z-index: 40;
  text-align: left;
}

.library-search-dropdown[hidden] {
  display: none !important;
}

.library-search-dropdown button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background var(--lib-ease);
}

.library-search-dropdown button:hover {
  background: #fafafa;
}

.library-search-dropdown img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--lib-border);
}

.library-search-dropdown strong {
  font-size: 14px;
  font-weight: 600;
}

.library-search-dropdown-meta {
  font-size: 12px;
  color: var(--lib-muted);
}

.library-quick-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.library-quick-tags a {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--lib-muted);
  border: 1px solid var(--lib-border);
  border-radius: 999px;
  text-decoration: none;
  transition: color var(--lib-ease), border-color var(--lib-ease);
}

.library-quick-tags a:hover {
  color: #111;
  border-color: #ccc;
}

/* Sections */
.library-home-blocks {
  display: flex;
  flex-direction: column;
  gap: var(--lib-section-y);
  margin-bottom: var(--lib-section-y);
}

.library-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.library-section-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.library-section-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--lib-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--lib-ease);
}

.library-section-link:hover {
  color: var(--lib-green);
}

.library-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lib-gap);
}

.library-row .library-card {
  grid-column: span 6;
}

/* Cards */
.library-card {
  border: 1px solid var(--lib-border);
  border-radius: var(--lib-radius);
  overflow: hidden;
  background: #fff;
  transition: transform var(--lib-ease), border-color var(--lib-ease);
}

.library-card:hover {
  transform: scale(1.008);
  border-color: #d4d4d4;
}

.library-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.library-card-media {
  position: relative;
  aspect-ratio: 16 / 11;
  background: #fafafa;
  flex: 0 0 auto;
}

.library-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-card-verified {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #166534;
  background: var(--lib-green-soft);
  border: 1px solid #bbf7d0;
  border-radius: 6px;
}

.library-card-3d {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  background: #111;
  color: #fff;
  border-radius: 6px;
}

.library-card-fav {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--lib-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--lib-ease);
}

.library-card-fav:hover {
  transform: scale(1.06);
}

.library-card-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.library-card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.35;
}

.library-card-author {
  font-size: 13px;
  color: var(--lib-muted);
  margin: 0;
}

.library-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.library-card-rating {
  font-size: 13px;
  font-weight: 500;
  color: #111;
}

.library-card-price {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.library-card-price.is-free {
  color: var(--lib-green);
}

.library-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--lib-muted);
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.library-card-specs span::before {
  content: '·';
  margin-right: 14px;
  color: #ddd;
}

.library-card-specs span:first-child::before {
  content: none;
  margin: 0;
}

/* Catalog */
.library-catalog {
  padding-top: var(--lib-section-y);
  border-top: 1px solid var(--lib-border);
}

.library-catalog-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.library-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.btn-filters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--lib-border);
  border-radius: 10px;
  background: #fff;
  color: #111;
  cursor: pointer;
  transition: border-color var(--lib-ease), transform var(--lib-ease);
}

.btn-filters:hover {
  border-color: #ccc;
  transform: scale(1.02);
}

.btn-filters.has-active {
  border-color: var(--lib-green);
  color: var(--lib-green);
}

.library-toolbar .results-count {
  font-size: 14px;
  color: var(--lib-muted);
  margin: 0;
  flex: 1;
}

.library-toolbar .sort-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--lib-muted);
}

.library-toolbar .sort-select select {
  border: 1px solid var(--lib-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  background: #fff;
  color: #111;
}

#product-grid.library-grid .library-card {
  grid-column: span 6;
}

#product-grid.library-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lib-gap);
}

/* Authors row */
.library-authors-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lib-gap);
}

.library-author-card {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--lib-border);
  border-radius: var(--lib-radius);
  text-decoration: none;
  color: inherit;
  transition: transform var(--lib-ease), border-color var(--lib-ease);
}

.library-author-card:hover {
  transform: scale(1.02);
  border-color: #d4d4d4;
}

.library-author-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.library-author-head img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--lib-border);
}

.library-author-head strong {
  font-size: 15px;
  font-weight: 600;
}

.library-author-head span {
  font-size: 12px;
  color: var(--lib-muted);
}

.library-author-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--lib-muted);
}

.library-author-stats strong {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  color: #111;
}

/* Filters drawer */
.filters-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.24);
  z-index: 200;
  opacity: 0;
  transition: opacity 150ms ease;
}

.filters-overlay.is-open {
  opacity: 1;
}

.filters-overlay[hidden] {
  display: none !important;
}

.filters-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 92vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--lib-border);
  z-index: 210;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 150ms ease;
}

.filters-panel.is-open {
  transform: translateX(0);
}

.filters-panel[hidden] {
  display: flex !important;
}

.filters-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--lib-border);
}

.filters-panel-head h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.filters-panel-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--lib-border);
  border-radius: 8px;
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.filters-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.filters-panel-body .sidebar-panel {
  margin-bottom: 28px;
}

.filters-panel-body .sidebar-panel-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lib-muted);
  margin: 0 0 12px;
}

.filters-panel-body .ozon-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  cursor: pointer;
}

.filters-panel-body .sidebar-nav a {
  display: block;
  padding: 8px 0;
  font-size: 14px;
  color: #111;
  text-decoration: none;
}

.filters-panel-body .sidebar-nav a.active {
  color: var(--lib-green);
  font-weight: 600;
}

body.library-ui .model-card--premium {
  display: none;
}

.project-context-options--filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-context-options--filters .project-chip {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid var(--lib-border);
  border-radius: 999px;
  background: #fff;
  color: var(--lib-muted);
  cursor: pointer;
  transition: color var(--lib-ease), border-color var(--lib-ease), background var(--lib-ease);
}

.project-context-options--filters .project-chip.active {
  border-color: var(--lib-green);
  color: #166534;
  background: var(--lib-green-soft);
}

.library-section-head .library-section-link {
  text-decoration: none;
}

.library-card-rating--empty {
  color: #ccc;
}

body.filters-open {
  overflow: hidden;
}

@media (max-width: 1024px) {
  .library-row .library-card,
  #product-grid.library-grid .library-card {
    grid-column: span 12;
  }

  .library-author-card {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .library-main {
    padding: 0 16px 80px;
  }

  .library-hero {
    padding: 48px 0 64px;
  }

  .library-home-blocks {
    gap: 72px;
    margin-bottom: 72px;
  }

  .library-author-card {
    grid-column: span 12;
  }
}

/* ========== UX v2 ========== */

body.library-v2.is-home-library .library-header-logo {
  visibility: hidden;
}

body.library-v2 .library-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

body.library-v2 .library-header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  margin-right: 16px;
}

body.library-v2 .sort-select--header select {
  border: 1px solid var(--lib-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: #fff;
}

.library-hero--v2 {
  min-height: calc(100dvh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0 80px;
  text-align: center;
}

.library-hero-logo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  margin-bottom: 32px;
  font-size: 1.25rem;
}

.library-hero--v2 .library-hero-title {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  max-width: 16ch;
  margin-bottom: 16px;
}

.library-hero--v2 .library-hero-sub {
  font-size: 1.125rem;
  line-height: 1.55;
  margin-bottom: 48px;
}

.library-hero--v2 .library-search-wrap {
  max-width: 720px;
  width: 100%;
}

.library-hero--v2 .library-search-input {
  padding: 20px 24px 20px 56px;
  font-size: 18px;
  border-radius: 16px;
}

.library-search-hint {
  margin-top: 14px;
  font-size: 14px;
  color: var(--lib-muted);
}

.library-hint-term {
  border: none;
  background: none;
  padding: 0 4px;
  font: inherit;
  color: #111;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--lib-ease);
}

.library-hint-term:hover {
  color: var(--lib-green);
}

.library-popular-queries {
  margin-top: 36px;
}

.library-popular-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lib-muted);
  margin-bottom: 12px;
}

.library-query-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.library-query-chip {
  padding: 10px 18px;
  border: 1px solid var(--lib-border);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  color: #111;
  cursor: pointer;
  transition: transform var(--lib-ease), border-color var(--lib-ease);
}

.library-query-chip:hover {
  transform: scale(1.03);
  border-color: #ccc;
}

.library-cat-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lib-gap);
}

.library-cat-tile {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 28px 24px;
  border: 1px solid var(--lib-border);
  border-radius: var(--lib-radius);
  text-decoration: none;
  color: inherit;
  transition: transform var(--lib-ease), border-color var(--lib-ease);
}

.library-cat-tile:hover {
  transform: scale(1.015);
  border-color: #ccc;
}

.library-cat-emoji {
  font-size: 2rem;
  line-height: 1;
}

.library-cat-label {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.library-cat-count {
  font-size: 14px;
  color: var(--lib-muted);
}

.library-trust {
  padding: 40px 0;
  border-top: 1px solid var(--lib-border);
  border-bottom: 1px solid var(--lib-border);
}

.library-trust-title {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 28px;
  color: var(--lib-muted);
}

.library-trust-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--lib-gap);
  text-align: center;
}

.library-trust-stat strong {
  display: block;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.library-trust-stat span {
  font-size: 14px;
  color: var(--lib-muted);
}

.library-trust-stat--accent strong {
  color: var(--lib-green);
}

.library-card-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 6px;
}

.library-card-badge.badge-verified {
  color: #166534;
  background: var(--lib-green-soft);
  border: 1px solid #bbf7d0;
}

.library-card-badge.badge-official {
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.library-card-badge.badge-author {
  color: #5b21b6;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
}

.library-card-badge.badge-community {
  color: #666;
  background: #fafafa;
  border: 1px solid var(--lib-border);
}

.library-card-actions {
  padding: 0 20px 20px;
}

.btn-library-action {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: #111;
  color: #fff;
  cursor: pointer;
  transition: transform var(--lib-ease), background var(--lib-ease);
}

.btn-library-action:hover {
  transform: scale(1.02);
}

.btn-library-action.is-free-btn,
.btn-library-action.owned {
  background: var(--lib-green);
}

.library-authors-row-v2 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--lib-gap);
}

.library-author-card-v2 {
  grid-column: span 3;
  border: 1px solid var(--lib-border);
  border-radius: var(--lib-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.library-author-card-v2-link {
  padding: 24px;
  text-decoration: none;
  color: inherit;
  flex: 1;
}

.library-author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--lib-border);
  margin-bottom: 12px;
}

.library-author-card-v2 h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 2px;
}

.library-author-login {
  font-size: 12px;
  color: var(--lib-muted);
  margin: 0 0 12px;
}

.library-author-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--lib-muted);
}

.library-author-metrics strong {
  color: #111;
}

.library-author-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--lib-border);
}

.btn-author-follow,
.btn-author-profile {
  padding: 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  border: none;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: #111;
  transition: background var(--lib-ease);
}

.btn-author-follow {
  border-right: 1px solid var(--lib-border);
}

.btn-author-follow:hover,
.btn-author-profile:hover {
  background: #fafafa;
}

.btn-author-follow.is-following {
  color: var(--lib-green);
}

.library-filter-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--lib-border);
  border-radius: 8px;
  font-size: 14px;
}

.library-results-count {
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--lib-muted);
}

.library-catalog {
  padding-top: var(--lib-section-y);
}

@media (max-width: 1024px) {
  .library-cat-tile {
    grid-column: span 6;
  }
  .library-author-card-v2 {
    grid-column: span 6;
  }
  .library-trust-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  body.library-v2 .library-header-tools {
    display: none;
  }
  .library-cat-tile {
    grid-column: span 12;
  }
  .library-author-card-v2 {
    grid-column: span 12;
  }
  .library-hero--v2 {
    min-height: auto;
    padding-top: 24px;
  }
}
