.library-page{
  background: var(--color-secondary);
}

.library{
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 32px);
  padding: clamp(24px, 4vw, 40px) 0 clamp(48px, 6vw, 80px);
}

.library-hero{
  width: min(1200px, 92%);
  margin: 0 auto;
  text-align: center;
}

.library-title{
  margin: 0;
  font-family: "Intro Rust";
  font-size: clamp(5rem, 9vw, 7rem);
  color: var(--color-text);
  text-align: center;
}

.library-subtitle{
  margin: 10px 0 0;
  color: color-mix(in srgb, var(--color-text) 75%, #fff);
  font-weight: 600;
  text-align: center;
}

.library-section{
  padding: 0;
  background: transparent;
}

.library-search{
  width: 100%;
  display: flex;
}

.library-search .search{
  width: min(100%, 560px);
  position: relative;
  flex: 1 1 320px;
}

.library-search input{
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #fff;
  color: var(--color-text);
  font: inherit;
}
.library-search input:focus{
  outline: 2px solid color-mix(in srgb, var(--color-btn) 55%, #fff);
  outline-offset: 2px;
}
.library-search .search-icon{
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.library-search .search-icon img{
  width: 18px;
  height: 18px;
  display: block;
}

.account-card{
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: #fff;
  color: var(--color-text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.account-card:hover,
.account-card:focus-visible{
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
}
.account-card:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--color-primary) 70%, #fff);
  outline-offset: 2px;
}
.account-card__avatar{
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  flex: 0 0 auto;
}
.account-card__content{
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.account-card__header{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.account-card__username{
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.account-card .rank-icon{
  width: 36px;
  height: 36px;
}
.account-card .rank-icon--signature{
  width: 40px;
  height: 40px;
}
.account-card__posts,
.account-card__stats{
  font-size: 0.85rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--color-text) 70%, #fff);
}
.account-card__bio{
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--color-text) 75%, #fff);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.section2{
  background: transparent;
  padding: 0;
}
.section2__inner{
  width: min(1200px, 92%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.6vw, 24px);
}
.section2__controls{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}
.section2__controls-left{
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}
.section2__select-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--color-text);
  transition: color .2s ease;
}
.section2__select-wrap:hover{
  color: var(--color-btn);
}
.section2__select{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border-radius: 999px;
  padding: 8px 36px 8px 16px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #fff;
  color: var(--color-text);
  font-weight: 700;
  font: inherit;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.section2__select:hover{
  border-color: color-mix(in srgb, var(--color-btn) 45%, transparent);
  color: var(--color-btn);
}
.section2__select-wrap::after{
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/miniarrow.svg") center / contain no-repeat;
  mask: url("/assets/icons/miniarrow.svg") center / contain no-repeat;
  pointer-events: none;
}
.section2__tabs{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.section2__tabs::-webkit-scrollbar{ display: none; }
.section2__tab{
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 85%, #fff);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.section2__tab.is-active{
  background: color-mix(in srgb, var(--color-btn) 15%, #fff);
  border-color: color-mix(in srgb, var(--color-btn) 45%, transparent);
  color: var(--color-text);
}
.section2__tab:hover{
  background: color-mix(in srgb, var(--color-btn) 10%, #fff);
  border-color: color-mix(in srgb, var(--color-btn) 35%, transparent);
}
.section2__filter{
  border-radius: 999px;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #fff;
  color: var(--color-text);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.section2__filter:hover{
  border-color: color-mix(in srgb, var(--color-btn) 45%, transparent);
  color: var(--color-btn);
}
.section2__filter .filter-icon{
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url("/assets/icons/filter.svg") center / contain no-repeat;
  mask: url("/assets/icons/filter.svg") center / contain no-repeat;
}

.section2__filter-panel{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 0;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--color-text) 12%, transparent);
  border-width: 0;
  background: #fff;
  box-shadow: var(--shadow-sm);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: max-height .25s ease, opacity .2s ease, transform .25s ease, padding .25s ease, border-width .25s ease;
}
.section2__filter-panel.is-open{
  padding: 14px;
  border-width: 1px;
  max-height: 360px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.section2__filter-panel[hidden]{
  display: none;
}
@media (prefers-reduced-motion: reduce){
  .section2__filter-panel{
    transition: none;
    transform: none;
  }
}
.filter-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--color-text);
}
.filter-label{
  font-weight: 700;
}
.filter-field input,
.filter-field select{
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  color: var(--color-text);
}
.filter-field input:focus,
.filter-field select:focus{
  outline: 2px solid color-mix(in srgb, var(--color-btn) 55%, #fff);
  outline-offset: 2px;
}
.filter-reset{
  align-self: end;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #f7f7f7;
  color: var(--color-text);
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.filter-reset:hover{
  background: color-mix(in srgb, var(--color-btn) 12%, #fff);
  border-color: color-mix(in srgb, var(--color-btn) 35%, transparent);
}

.home-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: clamp(16px, 2.4vw, 22px);
}
.home-grid.home-grid--accounts{
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.home-grid__loading{
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed color-mix(in srgb, var(--color-text) 20%, transparent);
  color: color-mix(in srgb, var(--color-text) 75%, #fff);
  font-weight: 700;
}
.home-grid__empty{
  text-align: center;
  padding: 24px;
  border-radius: 18px;
  border: 1px dashed color-mix(in srgb, var(--color-text) 20%, transparent);
  color: color-mix(in srgb, var(--color-text) 75%, #fff);
}
.home-card__media{
  aspect-ratio: 4 / 3;
}
.section2 .post-card__media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-pagination{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.library-pagination[hidden]{
  display: none;
}
.library-pagination__pages{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.library-page-btn{
  appearance: none;
  border-radius: var(--radius-interactive);
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #fff;
  color: var(--color-text);
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.library-page-btn:hover{
  border-color: color-mix(in srgb, var(--color-btn) 45%, transparent);
  color: var(--color-btn);
}
.library-page-btn.is-active{
  background: var(--color-btn);
  color: var(--color-secondary);
  border-color: transparent;
}
.library-page-btn:disabled{
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}
.library-pagination__ellipsis{
  padding: 0 4px;
  font-weight: 700;
  color: color-mix(in srgb, var(--color-text) 60%, #fff);
}

@media (max-width: 900px){
  .home-grid.home-grid--accounts{
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 700px){
  .home-grid.home-grid--accounts{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .account-card{
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
    gap: 12px;
  }
  .account-card__avatar{
    width: 56px;
    height: 56px;
  }
  .account-card__content{
    width: 100%;
  }
  .account-card__header{
    width: 100%;
    justify-content: space-between;
  }
  .account-card__username{
    font-size: 0.95rem;
  }
  .account-card .rank-icon{
    width: 28px;
    height: 28px;
  }
  .account-card .rank-icon--signature{
    width: 32px;
    height: 32px;
  }
  .account-card__posts,
  .account-card__stats{
    font-size: 0.78rem;
  }
  .account-card__bio{
    font-size: 0.78rem;
    -webkit-line-clamp: 3;
  }
}

@media (max-width: 520px){
  .home-grid.home-grid--accounts{
    grid-template-columns: 1fr;
  }
  .account-card{
    flex-direction: row;
    align-items: center;
    padding: 14px;
  }
  .account-card__avatar{
    width: 60px;
    height: 60px;
  }
  .account-card__header{
    justify-content: flex-start;
  }
  .account-card__bio{
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 820px){
  .section2__controls{
    align-items: center;
  }
  .section2__filter{
    width: auto;
    justify-content: center;
  }
}

@media (max-width: 720px){
  .library-hero{
    text-align: left;
  }
  .library-title{
    font-size: clamp(2rem, 8vw, 2.85rem);}
}
