/* Hub overrides for /library — not overwritten by handoff sync. */

/* No visible scrollbar track — wheel/trackpad still scroll the pane. */
.catalog-main.library-main {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.catalog-main.library-main::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.lib-card--clickable {
  cursor: pointer;
}

.lib-card--clickable:focus-visible {
  outline: 2px solid rgba(0, 210, 255, 0.65);
  outline-offset: 2px;
}

.lib-card__cover--photo {
  background-color: #0f172a;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.lib-card__cover--photo::before {
  opacity: 1;
  background-image: linear-gradient(180deg, rgba(2, 6, 18, 0.15) 0%, rgba(2, 6, 18, 0.72) 100%);
  background-size: auto;
  mask-image: none;
}

.lib-card__teapot {
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.85;
}

.lib-card__teapot:hover {
  opacity: 1;
}

/* Full article page (SEO URL) — centered readable column */
.library-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.library-article__hero {
  position: relative;
  margin: 0 0 1.25rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  aspect-ratio: 16 / 7;
  background: #020617;
}

.library-article__hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-article__hero span {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 1;
  font-size: clamp(1.25rem, 2.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

/* Reader modal on document.body (escapes app-stage transform). */
body.is-lib-reader-open {
  overflow: hidden !important;
}

body.is-lib-reader-open .catalog-main {
  pointer-events: none;
}

.lib-reader-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  pointer-events: none;
}

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

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

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

.lib-reader-modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 820px);
  max-height: min(90dvh, 900px);
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #12141c;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  color: #ececec;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.lib-reader-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.lib-reader-modal__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.lib-reader-modal__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 210, 255, 0.28);
  background: rgba(0, 210, 255, 0.1);
  color: #67e8f9;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lib-reader-modal__title {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  line-height: 1.25;
  font-weight: 700;
  color: #f8fafc;
}

.lib-reader-modal__author {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.lib-reader-modal__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(0, 210, 255, 0.14);
  color: #67e8f9;
  font-size: 0.65rem;
  font-weight: 700;
}

.lib-reader-modal__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  cursor: pointer;
}

.lib-reader-modal__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

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

.lib-reader-modal__body {
  overflow-y: auto;
  padding: 0 20px 24px;
  -webkit-overflow-scrolling: touch;
}

.lib-reader-modal__hero-wrap {
  position: relative;
  margin: 16px 0;
  min-height: 200px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #1e293b, #0f172a);
}

.lib-reader-modal__hero-wrap--ai {
  background: linear-gradient(135deg, #7c3aed, #4c1d95);
}

.lib-reader-modal__hero-wrap--devtools {
  background: linear-gradient(135deg, #334155, #0f172a);
}

.lib-reader-modal__hero-wrap--network {
  background: linear-gradient(135deg, #059669, #064e3b);
}

.lib-reader-modal__hero-img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.lib-reader-modal__hero-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(2, 6, 18, 0.72) 100%);
  pointer-events: none;
}

.lib-reader-modal__hero-tag {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 1;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.lib-reader-modal__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
}

.lib-reader-modal__modes {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lib-reader-modal__mode {
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.lib-reader-modal__mode.is-active {
  background: rgba(0, 210, 255, 0.16);
  color: #67e8f9;
}

.lib-reader-modal__share {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lib-reader-modal__share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lib-reader-modal__share-btn:hover {
  background: rgba(0, 210, 255, 0.12);
  border-color: rgba(0, 210, 255, 0.35);
  color: #e0f2fe;
}

.lib-reader-modal__simple-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: #94a3b8;
}

.lib-reader-modal__content {
  display: grid;
  gap: 0.95rem;
  font-size: 0.98rem;
  line-height: 1.7;
  color: #e2e8f0;
}

.lib-reader-modal__content p {
  margin: 0;
}

@media (max-width: 640px) {
  .lib-reader-modal {
    padding: 12px;
    align-items: flex-end;
  }

  .lib-reader-modal__dialog {
    max-height: 92dvh;
    width: 100%;
    border-radius: 16px 16px 10px 10px;
    transform: translateY(28px) scale(1);
  }

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

  .lib-reader-modal__hero-img,
  .lib-reader-modal__hero-wrap {
    min-height: 160px;
  }

  .lib-reader-modal__hero-img {
    height: 160px;
  }

  .lib-reader-modal__share-btn span {
    display: none;
  }

  .lib-reader-modal__share-btn {
    padding: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lib-reader-modal__backdrop,
  .lib-reader-modal__dialog {
    transition: none;
  }

  .lib-reader-modal__dialog,
  .lib-reader-modal.is-open .lib-reader-modal__dialog {
    transform: none;
  }
}
