:root {
  --saffron: rgba(196, 142, 37, 0.45);
  --bg-top: #f4f6fb;
  --bg-mid: #fbf8f4;
  --bg-bottom: #edf1fb;
  --text: #171a21;
  --muted: #596273;
  --subtle: #707b8a;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --card-radius: 20px;
  --card-shadow: 0 12px 32px rgba(22, 34, 56, 0.08), 0 2px 8px rgba(22, 34, 56, 0.04);
  --card-border: 1px solid rgba(22, 34, 56, 0.06);
  --accent: #0a5cad;
  --pill-active: rgba(52, 199, 89, 0.18);
  --pill-beta: rgba(0, 113, 227, 0.12);
  --pill-soon: rgba(255, 159, 10, 0.2);
  --pill-planned: rgba(142, 142, 147, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(ellipse 120% 72% at 50% -14%, rgba(255, 255, 255, 0.98), transparent 58%),
    linear-gradient(165deg, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

.library-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(0.75rem, 2vw, 1.25rem) clamp(1rem, 3vw, 1.5rem) 2.5rem;
}

.library-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 1.25rem;
}

.library-nav a {
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.library-nav a:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.library-nav a[aria-current="page"] {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text);
}

.library-nav a:focus-visible {
  outline: 2px solid rgba(10, 92, 173, 0.4);
  outline-offset: 2px;
}

.library-nav__sep {
  opacity: 0.35;
  user-select: none;
  padding: 0 0.1rem;
}

.library-cards-nav {
  max-width: 42rem;
  margin: 0 auto 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  text-align: center;
}

.library-cards-nav__label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
}

.library-cards-nav__links {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--muted);
}

.library-cards-nav__links a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.library-cards-nav__links a:hover {
  text-decoration: underline;
}

.library-cards-nav__sep {
  opacity: 0.4;
  user-select: none;
  padding: 0 0.15rem;
}

.library-eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
}

.library-hero {
  text-align: center;
  margin-bottom: 1.75rem;
  padding: 0.5rem 0.75rem 0.85rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 100%);
}

.library-hero h1 {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.library-hero .subtitle {
  margin: 0.55rem auto 0;
  max-width: 36rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
  font-weight: 400;
}

.ask-block {
  max-width: 36rem;
  margin: 0 auto 2rem;
  padding: 1rem 1.1rem 1.05rem;
  background: rgba(255, 255, 255, 0.72);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

.ask-block label {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 0.45rem;
}

.ask-block input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid rgba(22, 34, 56, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
}

.ask-block input::placeholder {
  color: #8e96a3;
}

.ask-block input:focus {
  outline: none;
  border-color: rgba(10, 92, 173, 0.35);
  box-shadow: 0 0 0 3px rgba(10, 92, 173, 0.12);
}

.ask-block .examples {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

/* —— Wisdom Texts (Universal Text Module Registry) —— */
.library-wisdom-texts {
  margin: 0 auto 2rem;
  padding: 1.15rem 1.2rem 1.35rem;
  border-radius: var(--card-radius);
  border: var(--card-border);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 255, 0.72) 42%, rgba(255, 252, 246, 0.85) 100%);
  box-shadow: var(--card-shadow);
}

.library-wisdom-texts__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.library-wisdom-texts__lede {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 42rem;
}

.library-registry-root {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.library-registry-msg {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

.lib-reg-group__title {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--subtle);
}

.lib-reg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.lib-reg-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.05rem 1.1rem 1.15rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.72) 100%);
  border: var(--card-border);
  border-radius: calc(var(--card-radius) - 2px);
  box-shadow: 0 8px 24px rgba(22, 34, 56, 0.06);
  min-height: 100%;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.lib-reg-card:hover {
  box-shadow: 0 12px 28px rgba(22, 34, 56, 0.09);
  transform: translateY(-1px);
}

.lib-reg-card__head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lib-reg-card__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.lib-reg-card__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  flex: 1 1 8rem;
}

.lib-reg-card__short {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.lib-reg-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.lib-reg-badge--active {
  background: var(--pill-active);
  color: #1d6f32;
}

.lib-reg-badge--planned {
  background: var(--pill-planned);
  color: #444;
}

.lib-reg-badge--future {
  background: var(--pill-soon);
  color: #a65a00;
}

.lib-reg-card__cat {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.lib-reg-card__gate {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--subtle);
}

.lib-reg-card__gate strong {
  font-weight: 650;
  color: var(--muted);
}

.lib-reg-supports {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.15rem 0 0.25rem;
}

.lib-reg-flag {
  font-size: 0.62rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.38rem;
  border-radius: 6px;
}

.lib-reg-flag--on {
  background: rgba(52, 199, 89, 0.16);
  color: #1d6f32;
}

.lib-reg-flag--off {
  font-size: 0.62rem;
  color: #9aa3b0;
  text-decoration: line-through;
  text-decoration-color: rgba(154, 163, 176, 0.5);
}

.lib-reg-flag--soon {
  background: rgba(255, 159, 10, 0.14);
  color: #a65a00;
}

.lib-reg-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.lib-reg-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.lib-reg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  background: rgba(10, 92, 173, 0.12);
  color: var(--accent);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease;
}

a.lib-reg-btn:hover {
  background: rgba(10, 92, 173, 0.18);
}

.lib-reg-btn--primary {
  background: rgba(10, 92, 173, 0.22);
}

.lib-reg-btn--ghost {
  background: rgba(22, 34, 56, 0.06);
  color: var(--text);
}

a.lib-reg-btn--ghost:hover {
  background: rgba(22, 34, 56, 0.1);
}

.lib-reg-btn--soon:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.lib-reg-soon-msg {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

.lib-reg-notes {
  margin: 0.4rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.15rem;
}

.collection-card {
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1.25rem 1.25rem;
  background: rgba(255, 255, 255, 0.78);
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  min-height: 100%;
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.collection-card:hover {
  box-shadow: 0 16px 40px rgba(22, 34, 56, 0.1), 0 2px 8px rgba(22, 34, 56, 0.05);
  transform: translateY(-2px);
}

.collection-card--featured {
  border-left: 3px solid var(--saffron);
  background: linear-gradient(145deg, rgba(255, 252, 246, 0.95) 0%, rgba(255, 255, 255, 0.82) 100%);
}

.collection-card__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collection-card__icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.collection-card__title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.collection-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.type-pill {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: rgba(22, 34, 56, 0.06);
  padding: 0.22rem 0.45rem;
  border-radius: 6px;
}

.status-pill {
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
}

.status-pill--active {
  background: var(--pill-active);
  color: #1d6f32;
}

.status-pill--beta {
  background: var(--pill-beta);
  color: #0a5cad;
}

.status-pill--coming-soon {
  background: var(--pill-soon);
  color: #a65a00;
}

.status-pill--planned {
  background: var(--pill-planned);
  color: #555;
}

.status-pill--draft {
  background: rgba(147, 112, 219, 0.2);
  color: #4b3a6d;
}

.collection-card__desc {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  flex: 1;
}

.collection-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.action-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(10, 92, 173, 0.1);
  color: var(--accent);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

a.action-link:hover {
  background: rgba(10, 92, 173, 0.16);
}

.action-link--ghost {
  background: rgba(22, 34, 56, 0.06);
  color: var(--text);
}

a.action-link--ghost:hover {
  background: rgba(22, 34, 56, 0.1);
}

a.action-link:focus-visible,
button.action-link:focus-visible {
  outline: 2px solid rgba(10, 92, 173, 0.45);
  outline-offset: 2px;
}

button.action-link:disabled,
.action-link[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.roadmap {
  margin-top: 2.25rem;
  padding: 1.1rem 1.2rem;
  background: rgba(255, 255, 255, 0.55);
  border: var(--card-border);
  border-radius: var(--card-radius);
}

.roadmap h2 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

.roadmap p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.library-footnote {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(22, 34, 56, 0.08);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}
