/* CYBERSHOP — Библиотека (Hub) */

.library-main {
  overflow-y: auto;
  align-items: stretch;
  scrollbar-color: rgba(255, 255, 255, 0.2) var(--catalog-bg);
}

.library-page {
  --library-max: 1120px;
  padding: 162px 40px 56px;
  max-width: var(--library-max);
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.library-hero h1 {
  margin: 0 0 14px;
  max-width: none;
  font-size: clamp(1.65rem, 2.8vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  white-space: nowrap;
}

.library-hero__accent {
  background: linear-gradient(90deg, #00d2ff 0%, #67e8f9 55%, #a5f3fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.library-hero__desc {
  margin: 0 0 22px;
  max-width: 680px;
  color: #94a3b8;
  font-size: 15px;
  line-height: 1.55;
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0 22px;
}

.library-toolbar .hub-page-tabs {
  margin: 0;
}

.library-toolbar__write {
  flex-shrink: 0;
  color: #00d2ff;
}

.library-toolbar__write:hover {
  color: #67e8f9;
}

html.catalog-theme-biz .library-toolbar__write {
  color: #0891b2;
}

html.catalog-theme-biz .library-toolbar__write:hover {
  color: #0e7490;
}

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

.library-panel[hidden] {
  display: none !important;
}

.lib-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 12, 22, 0.72);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.lib-card:hover {
  border-color: rgba(0, 210, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.lib-card__cover {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 148px;
  padding: 20px;
  overflow: hidden;
  text-align: center;
}

.lib-card__cover::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px, 100% 100%, 100% 100%;
  mask-image: linear-gradient(180deg, #000 40%, transparent 100%);
}

.lib-card__cover--ai {
  background: linear-gradient(145deg, #5b21b6 0%, #312e81 45%, #1e1b4b 100%);
}

.lib-card__cover--devtools {
  background: linear-gradient(145deg, #334155 0%, #1e293b 50%, #0f172a 100%);
}

.lib-card__cover--network {
  background: linear-gradient(145deg, #047857 0%, #065f46 50%, #064e3b 100%);
}

.lib-card__cover--office {
  background: linear-gradient(145deg, #0369a1 0%, #0c4a6e 50%, #082f49 100%);
}

.lib-card__cover--retail {
  background: linear-gradient(145deg, #b45309 0%, #92400e 50%, #78350f 100%);
}

.lib-card__cover--logistics {
  background: linear-gradient(145deg, #475569 0%, #334155 50%, #1e293b 100%);
}

.lib-card__cover-tag {
  position: relative;
  z-index: 1;
  font-family: var(--catalog-nav-font);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.25);
}

.lib-card__cover-brand {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.lib-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 14px;
}

.lib-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.lib-card__cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #94a3b8;
}

.lib-card__cat svg {
  width: 13px;
  height: 13px;
  color: #00d2ff;
}

.lib-card__time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lib-card__time svg {
  width: 13px;
  height: 13px;
}

.lib-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: #f8fafc;
}

.lib-card__excerpt {
  margin: 0;
  flex: 1;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
}

.lib-card__author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.lib-card__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 210, 255, 0.15);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: #67e8f9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.lib-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.lib-card__read {
  color: #00d2ff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.lib-card__read:hover {
  color: #67e8f9;
  text-decoration: underline;
}

/* Article reader */
.library-article {
  padding-bottom: 64px;
}

.library-article__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.library-article__back:hover {
  color: #00d2ff;
}

.library-article__head {
  margin-bottom: 28px;
  max-width: 760px;
}

.library-article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.library-article__head h1 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

.library-article__lead {
  margin: 0;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1.55;
}

.library-article__content {
  max-width: 680px;
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1.7;
}

.library-article__content p {
  margin: 0 0 1.15em;
}

.library-article__content p:last-child {
  margin-bottom: 0;
}

html.catalog-theme-biz .library-hero__desc,
html.catalog-theme-biz .lib-card__excerpt,
html.catalog-theme-biz .library-article__lead {
  color: #64748b;
}

html.catalog-theme-biz .library-hero h1,
html.catalog-theme-biz .lib-card__title,
html.catalog-theme-biz .library-article__head h1 {
  color: #0f172a;
}

html.catalog-theme-biz .lib-card {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.1);
}

html.catalog-theme-biz .library-article__content {
  color: #334155;
}

@media (max-width: 1024px) {
  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .library-page {
    padding: 154px 16px 40px;
  }

  .library-hero h1 {
    white-space: normal;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }
}

/* ── New article modal ── */
body.is-lib-article-modal-open .catalog-main {
  pointer-events: none;
}

.lib-article-modal {
  position: fixed;
  inset: 0;
  z-index: 10055;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.lib-article-modal[hidden] {
  display: none;
}

.lib-article-modal.is-open {
  pointer-events: auto;
}

.lib-article-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 12, 0.72);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.lib-article-modal.is-open .lib-article-modal__backdrop {
  opacity: 1;
}

.lib-article-modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 720px);
  max-height: calc(100dvh - 48px);
  padding: 22px 24px 20px;
  border-radius: 16px;
  border: 1px solid var(--catalog-border);
  background: var(--catalog-surface);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  font-family: var(--catalog-nav-font);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition:
    opacity 0.28s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.lib-article-modal.is-open .lib-article-modal__dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

html.catalog-theme-biz .lib-article-modal__dialog {
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.12);
}

.lib-article-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.lib-article-modal__title {
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--catalog-text);
}

.lib-article-modal__lead {
  margin: 0;
  max-width: 520px;
  color: var(--catalog-muted);
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

.lib-article-modal__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--catalog-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--catalog-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.lib-article-modal__close:hover {
  color: var(--catalog-text);
  border-color: rgba(0, 210, 255, 0.35);
}

.lib-article-modal__close svg {
  width: 18px;
  height: 18px;
}

.lib-article-modal__form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.lib-article-field {
  display: block;
  margin-bottom: 16px;
}

.lib-article-field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
}

.lib-article-field__req {
  color: #f87171;
}

.lib-article-field input,
.lib-article-field textarea,
.lib-article-field select {
  box-sizing: border-box;
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
  color: var(--catalog-text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  transition: border-color 0.15s;
}

html.catalog-theme-biz .lib-article-field input,
html.catalog-theme-biz .lib-article-field textarea,
html.catalog-theme-biz .lib-article-field select {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
}

.lib-article-field input::placeholder,
.lib-article-field textarea::placeholder {
  color: #64748b;
}

.lib-article-field input:focus,
.lib-article-field textarea:focus,
.lib-article-field select:focus {
  outline: none;
  border-color: rgba(0, 210, 255, 0.45);
}

.lib-article-field textarea {
  resize: vertical;
  min-height: 88px;
}

.lib-article-field select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='1.75'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.lib-article-field__hint {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-family: Inter, system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

.lib-article-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 14px;
  margin-bottom: 16px;
}

.lib-article-field-row .lib-article-field {
  margin-bottom: 0;
}

.lib-article-field--topic select {
  min-height: 44px;
}

.lib-article-cover {
  position: relative;
  min-height: 132px;
  padding: 18px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.lib-article-cover.is-dragover {
  border-color: rgba(0, 210, 255, 0.55);
  background: rgba(0, 210, 255, 0.06);
}

.lib-article-cover.has-preview .lib-article-cover__empty {
  display: none;
}

.lib-article-cover__preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

.lib-article-cover__empty svg {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  color: #64748b;
}

.lib-article-cover__text {
  margin: 0 0 6px;
  color: #94a3b8;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

.lib-article-cover__pick {
  padding: 0;
  border: none;
  background: transparent;
  color: #00d2ff;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.lib-article-cover__pick:hover {
  color: #67e8f9;
  text-decoration: underline;
}

.lib-article-cover__meta {
  margin: 0;
  color: #64748b;
  font-family: Inter, system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.4;
}

.lib-article-cover-url {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.lib-article-cover-url input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
  color: var(--catalog-text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
}

.lib-article-cover-url input:focus {
  outline: none;
  border-color: rgba(0, 210, 255, 0.45);
}

.lib-article-cover-url__apply {
  flex-shrink: 0;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-family: var(--catalog-nav-font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.lib-article-cover-url__apply:hover {
  border-color: rgba(0, 210, 255, 0.35);
  color: #fff;
}

.lib-article-modal__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  padding-top: 8px;
}

.lib-article-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-family: var(--catalog-nav-font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.lib-article-modal__btn svg {
  width: 16px;
  height: 16px;
}

.lib-article-modal__btn--ghost {
  border: 1px solid var(--catalog-border);
  background: transparent;
  color: var(--catalog-text);
}

.lib-article-modal__btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

.lib-article-modal__btn--primary {
  border: none;
  background: var(--catalog-accent);
  color: #0d0d0d;
}

.lib-article-modal__btn--primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.lib-article-modal__btn--primary:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

html.catalog-theme-biz .lib-article-modal__btn--primary {
  color: #fff;
  background: #0891b2;
}

@media (max-width: 720px) {
  .lib-article-modal {
    padding: 12px;
  }

  .lib-article-modal__dialog {
    padding: 18px 16px 16px;
  }

  .lib-article-field-row {
    grid-template-columns: 1fr;
  }

  .lib-article-modal__actions {
    flex-direction: column-reverse;
  }

  .lib-article-modal__btn {
    width: 100%;
  }
}
