/* Library item page: send-to-friend dialog, server messages, and focus for the share menu.
   Matches the library page palette in app.css (dark navy surfaces, cyan primary). */

.library-friend {
  /* The base reset sets margin: 0 on everything; a modal dialog needs auto margins to sit centred. */
  position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100dvh - 32px); overflow: auto;
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(var(--t-c-ffffff), 0.1);
  border-radius: 1.25rem;
  background: linear-gradient(180deg, rgba(var(--t-c-070f23), 0.99), rgba(var(--t-c-09142d), 0.98));
  color: rgb(var(--t-c-dbe4ee));
  box-shadow: 0 24px 60px rgba(var(--t-c-000000), 0.45);
}
.library-friend::backdrop { background: rgba(var(--t-c-020612), 0.7); backdrop-filter: blur(3px); }
.library-friend form { display: grid; gap: .75rem; padding: 1.25rem; }
.library-friend__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.library-friend__title { margin: 0; color: rgb(var(--t-c-ffffff)); font-size: 1.1rem; font-weight: 900; }
.library-friend__close {
  display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border: 1px solid rgba(var(--t-c-ffffff), 0.1);
  border-radius: .7rem; background: transparent; color: rgb(var(--t-c-cbd5e1)); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.library-friend__close:hover { color: rgb(var(--t-c-ffffff)); background: rgba(var(--t-c-ffffff), 0.06); }
.library-friend__lead { margin: 0; color: rgb(var(--t-c-a9b8c8)); font-size: .84rem; line-height: 1.8; }
.library-friend__sample {
  padding: .75rem .9rem; border: 1px dashed rgba(var(--t-c-22d3ee), 0.3); border-radius: .9rem; background: rgba(var(--t-c-22d3ee), 0.06);
  color: rgb(var(--t-c-cbd5e1)); font-size: .82rem; line-height: 1.8;
}
.library-friend__sample b { color: rgb(var(--t-c-ffffff)); }
.library-friend__sample span { color: rgb(var(--t-c-67e8f9)); font-weight: 800; }
.library-friend__label { color: rgb(var(--t-c-e2e8f0)); font-size: .82rem; font-weight: 800; }
.library-friend__input {
  width: 100%; min-height: 2.9rem; padding: .6rem .9rem; border: 1px solid rgba(var(--t-c-94a3b8), 0.3); border-radius: .8rem;
  background: rgba(var(--t-c-020617), 0.6); color: rgb(var(--t-c-ffffff)); font: inherit; text-align: left;
}
.library-friend__input::placeholder { color: rgba(var(--t-c-94a3b8), 0.7); }
.library-friend__input[aria-invalid="true"] { border-color: rgba(var(--t-c-f87171), 0.8); }
.library-friend__error { margin: 0; color: rgb(var(--t-c-fca5a5)); font-size: .8rem; font-weight: 700; }
.library-friend__hint { margin: 0; color: rgb(var(--t-c-94a3b8)); font-size: .76rem; }
.library-friend__actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .25rem; }
.library-friend__actions .library-action-btn { cursor: pointer; }
.library-friend__actions button[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.library-flash { display: grid; gap: .4rem; margin-top: .75rem; }
.library-flash__item { margin: 0; padding: .6rem .85rem; border: 1px solid rgba(var(--t-c-34d399), 0.3); border-radius: .8rem; background: rgba(var(--t-c-34d399), 0.08); color: rgb(var(--t-c-bbf7d0)); font-size: .82rem; font-weight: 700; }
.library-flash__item.is-error { border-color: rgba(var(--t-c-f87171), 0.3); background: rgba(var(--t-c-f87171), 0.08); color: rgb(var(--t-c-fecaca)); }

.library-actions-wrap :is(.library-action-btn, .library-share-menu__item):focus-visible,
.library-friend :is(button, input):focus-visible {
  outline: 2px solid rgb(var(--t-c-22d3ee)); outline-offset: 2px;
}
.library-share-menu__item[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .library-friend::backdrop { backdrop-filter: none; }
}

/* Sub-navigation bar (المكتبة / رجوع). It was sticky at top: 88px with a 72% see-through background,
   under a transparent 77px site header, so scrolled text showed through it and in the 11px gap.
   Now: solid surface, pinned right under the header on wide screens, in the normal flow on phones. */
.library-subnav {
  background: rgb(var(--t-c-0a1328)) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 12px 24px -12px rgba(var(--t-c-000000), 0.6);
}
@media (min-width: 1024px) {
  .library-subnav { top: 77px !important; }
}
@media (max-width: 1023px) {
  .library-subnav { position: static !important; }
}

/* Article lists and rules: the base reset removes list markers, so lists rebuilt from pasted
   "·" lines (content/html_clean.py) would not look like lists. */
.article-rich-content ul { list-style: disc; }
.article-rich-content ol { list-style: decimal; }
.article-rich-content :is(ul, ol) { margin-inline: 0; padding-inline-start: 1.5rem; }
.article-rich-content li::marker { color: rgb(var(--t-c-22d3ee)); }
.article-rich-content hr { border-top-color: rgba(var(--t-c-94a3b8), 0.28); margin: 1.8rem 0; }
