/* =========================================================
   THE LEARNING LIBRARY – builds on style.css tokens
   ========================================================= */

/* ---------- hero ---------- */
.lib-hero { position: relative; overflow: hidden; background: var(--light); padding: 40px 0 52px; }
.lib-hero::before { content: ""; position: absolute; right: -150px; top: -170px; width: 460px; height: 460px; border-radius: 50%; border: 2px dashed rgba(52,156,92,.18); }
.js .lib-hero::before { animation: spin 80s linear infinite; }
.lib-hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 48px; align-items: center; }
.lib-hero .eyebrow { margin-top: 20px; }
.lib-h1 { margin-top: 10px; font-family: var(--font-head); font-weight: 700; font-size: clamp(32px, 4vw, 48px); line-height: 1.1; letter-spacing: -.02em; color: var(--ink); }
.lib-tagline { margin-top: 10px; display: inline-block; font-family: var(--font-head); font-weight: 600; font-size: clamp(17px, 1.7vw, 21px); color: var(--primary);
  background: linear-gradient(transparent 62%, rgba(248,189,37,.55) 62%); padding: 0 4px; }
.lib-lead { margin-top: 14px; max-width: 560px; font-size: 16.5px; line-height: 1.7; color: var(--text); }
.lib-searchbar { position: relative; margin-top: 26px; max-width: 600px; display: flex; align-items: center; gap: 8px; padding: 7px 7px 7px 16px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); box-shadow: var(--shadow); transition: border-color .25s, box-shadow .25s; }
.lib-searchbar:focus-within { border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(52,156,92,.15), var(--shadow); }
.lib-searchbar > svg { flex: none; width: 20px; height: 20px; color: var(--secondary); }
.lib-searchbar input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; font-size: 16px; color: var(--ink); outline: none; }
.lib-searchbar input::-webkit-search-cancel-button { display: none; }
.lib-searchbar input::placeholder { color: #8a9a95; }
.lib-clear { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--light); color: var(--primary); font-size: 20px; line-height: 1; cursor: pointer; }
.lib-clear:hover { background: #d9f1e2; }
.lib-search-btn { flex: none; height: 44px; padding: 0 22px; }
.lib-browse-link { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-head); font-weight: 600; font-size: 14.5px; color: var(--primary); }
.lib-browse-link svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.lib-browse-link:hover svg { transform: translateY(3px); }
.lib-shelf svg { width: 100%; max-width: 440px; height: auto; margin: 0 auto; }
.js .lib-row { opacity: 0; animation: rise .9s var(--ease) forwards; }
.js .lib-row.r1 { animation-delay: .15s; }
.js .lib-row.r2 { animation-delay: .4s; }
.js .lib-spark { animation: floatSm 5s ease-in-out infinite; }

/* ---------- categories ---------- */
.lib-browse { padding: 64px 0 36px; }
.lib-browse-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; margin-bottom: 26px; }
.lib-browse-head p { color: var(--muted); font-size: 15px; }
.lib-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.lib-catcard { display: grid; grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 14px; align-items: center; text-align: left;
  padding: 14px 16px; border-radius: 18px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font: inherit; color: inherit;
  transition: border-color .3s, background-color .3s, transform .3s var(--ease), box-shadow .3s; }
.lib-catcard:hover { border-color: var(--secondary); transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.lib-catic { grid-row: span 2; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--light); color: var(--primary); transition: background-color .3s, color .3s; }
.lib-catic svg { width: 24px; height: 24px; }
.lib-cattxt b { display: block; font-family: var(--font-head); font-weight: 600; font-size: 15px; line-height: 1.3; color: var(--ink); }
.lib-cattxt small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.lib-count { grid-column: 2; margin-top: 8px; justify-self: start; padding: 2px 10px; border-radius: 999px; background: #fff7df; font-size: 11.5px; font-weight: 600; color: #7a5a0c; }
.lib-catcard[aria-pressed="true"] { background: var(--grad-green); border-color: var(--primary); }
.lib-catcard[aria-pressed="true"] .lib-catic { background: rgba(255,255,255,.14); color: #fff; }
.lib-catcard[aria-pressed="true"] .lib-cattxt b { color: #fff; }
.lib-catcard[aria-pressed="true"] .lib-cattxt small { color: #cdeedd; }
.lib-catcard[aria-pressed="true"] .lib-count { background: var(--accent); color: var(--primary); }
.lib-catcard.is-all .lib-catic { background: var(--accent); color: var(--primary); }
.lib-noscript { padding: 18px 20px; border-radius: 16px; background: #fff7df; }

/* ---------- access types band ---------- */
.lib-access-band { padding: 8px 0 8px; }
.lib-access-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-radius: 22px; background: var(--light); overflow: hidden; }
.lib-access-list li { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 20px 22px; }
.lib-access-list li + li { border-left: 1px solid #d3e8db; }
.lib-access-list p { font-size: 14px; line-height: 1.55; color: var(--text); }
.lib-access-list b { color: var(--ink); }

/* badges (shared by the band and the cards) */
.lib-access-badge, .lib-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; font-family: var(--font-head); font-weight: 700; font-size: 10.5px; letter-spacing: .08em; line-height: 1.2; }
.lib-access-badge.is-free, .is-free .lib-badge { background: var(--secondary); color: #fff; }
.lib-access-badge.is-enrolled_only, .is-enrolled_only .lib-badge { background: var(--accent); color: var(--primary); }
.lib-access-badge.is-external, .is-external .lib-badge { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.lib-badge svg { width: 13px; height: 13px; flex: none; }

/* ---------- results ---------- */
.lib-results-wrap { padding: 44px 0 96px; }
.lib-results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lib-total { margin-top: 4px; font-size: 14px; color: var(--muted); min-height: 1em; }
.lib-reset { border: 0; background: none; padding: 6px 0; font-family: var(--font-head); font-weight: 600; font-size: 14px; color: var(--secondary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lib-toolbar { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 20px; padding: 16px 18px; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.lib-toolbar[hidden] { display: none; }
.lib-field { display: grid; gap: 6px; min-width: 0; }
.lib-field[hidden] { display: none; }
.lib-field-label { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lib-sortfield { margin-left: auto; }
.lib-field select { height: 40px; min-width: 160px; max-width: 100%; padding: 0 34px 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: #fbfdfc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23035643' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; font-size: 14px; color: var(--ink); appearance: none; -webkit-appearance: none; cursor: pointer; }
.lib-field select:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(52,156,92,.15); }
.lib-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-chips button { height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-family: var(--font-head); font-weight: 500; font-size: 13.5px; color: var(--primary); cursor: pointer; transition: background-color .25s, color .25s, border-color .25s; }
.lib-chips button:hover { border-color: var(--secondary); }
.lib-chips button[aria-pressed="true"] { background: var(--grad-green); border-color: var(--primary); color: #fff; }
.lib-results { margin-top: 28px; }

.lib-section + .lib-section { margin-top: 48px; }
.lib-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lib-section-head h3 { font-family: var(--font-head); font-weight: 700; font-size: 21px; color: var(--primary); }
.lib-section-count { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center; background: var(--light); font-family: var(--font-head); font-weight: 600; font-size: 12.5px; color: var(--primary); }
.lib-viewall { margin-left: auto; border: 0; background: none; font-family: var(--font-head); font-weight: 600; font-size: 14px; color: var(--secondary); cursor: pointer; }
.lib-viewall:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- resource cards ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.lib-card { display: flex; flex-direction: column; min-width: 0; border-radius: 20px; background: #fff; border: 1px solid var(--line); overflow: hidden; transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; }
.lib-card:hover { transform: translateY(-5px); box-shadow: 0 18px 34px rgba(3,86,67,.12); border-color: #bfe0cb; }
.lib-media { position: relative; aspect-ratio: 16 / 10; background: var(--light); overflow: hidden; }
.lib-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lib-ph { position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(52,156,92,.16) 1.2px, transparent 1.4px) 0 0 / 14px 14px, linear-gradient(135deg, #f3fbf6 0%, #e2f4e9 100%); color: var(--secondary); }
.lib-ph svg { width: 56px; height: 56px; padding: 14px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); opacity: .9; }
.is-enrolled_only .lib-ph { background: radial-gradient(circle, rgba(248,189,37,.22) 1.2px, transparent 1.4px) 0 0 / 14px 14px, linear-gradient(135deg, #fffaf0 0%, #fbf1d3 100%); color: #a07a13; }
.lib-media:not(.is-empty) .lib-ph { visibility: hidden; }
.lib-badge { position: absolute; left: 12px; top: 12px; z-index: 1; box-shadow: 0 4px 10px rgba(0,0,0,.08); }
.lib-body { flex: 1; display: flex; flex-direction: column; padding: 16px 18px 18px; }
.lib-cat { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--secondary); }
.lib-title { margin-top: 6px; font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-desc { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-meta { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.lib-meta li { padding: 3px 9px; border-radius: 8px; background: var(--light); font-size: 12px; font-weight: 600; color: var(--primary); }
.lib-skills, .lib-provider { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--text); }
.lib-skills span { font-weight: 600; color: var(--primary); }
.lib-action { margin-top: auto; padding-top: 16px; }
.lib-cta { display: flex; align-items: center; justify-content: center; height: 42px; border-radius: 12px; background: var(--grad-green); color: #fff; font-family: var(--font-head); font-weight: 600; font-size: 14px; transition: background-color .25s, transform .25s var(--ease); }
.lib-cta:hover { background: var(--grad-green-hover); }
.is-external .lib-cta { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.is-external .lib-cta:hover { background: var(--grad-green); color: #fff; }
.lib-note { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 10px; border-radius: 12px; background: #fff7df; font-size: 13px; font-weight: 600; color: #7a5a0c; text-align: center; }
.lib-note svg { width: 16px; height: 16px; flex: none; }
.is-free .lib-note { background: #f3f5f4; color: var(--muted); }

/* ---------- empty states ---------- */
.lib-empty { max-width: 620px; margin: 8px auto 0; padding: 40px 28px; border-radius: 26px; text-align: center; background: #fff; border: 1.5px dashed #bfe0cb; }
.lib-empty.is-library { background: linear-gradient(180deg, #fff, var(--light)); border-style: solid; border-color: var(--line); }
.lib-empty-art { width: 210px; height: auto; margin: 0 auto 16px; }
.lib-empty h3 { font-family: var(--font-head); font-weight: 700; font-size: 22px; line-height: 1.3; color: var(--primary); }
.lib-empty p { margin-top: 10px; font-size: 15px; line-height: 1.7; color: var(--text); }
.lib-empty .btn { margin-top: 20px; max-width: 100%; height: auto; min-height: 46px; padding: 10px 22px; white-space: normal; text-align: center; line-height: 1.35; }

/* ---------- responsive ---------- */
@media (max-width: 999px) {
  .lib-hero-inner { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .lib-shelf { order: -1; max-width: 340px; margin: 0 auto; }
  .lib-access-list { grid-template-columns: minmax(0, 1fr); }
  .lib-access-list li + li { border-left: 0; border-top: 1px solid #d3e8db; }
  .lib-sortfield { margin-left: 0; }
}
@media (max-width: 640px) {
  .lib-hero { padding: 28px 0 40px; }
  .lib-shelf { display: none; }
  .lib-searchbar { padding-left: 12px; }
  .lib-search-btn { padding: 0 14px; }
  .lib-cats { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .lib-catcard { padding: 12px 14px; }
  .lib-cattxt small { display: none; }
  .lib-count { margin-top: 4px; }
  .lib-toolbar { padding: 14px; }
  .lib-field, .lib-field select { width: 100%; }
  .lib-grid { grid-template-columns: minmax(0, 1fr); }
  .lib-empty { padding: 30px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .lib-row { opacity: 1; animation: none; }
  .lib-card { animation: none; }
}

/* sample-content notice (shown only while library-demo-data.js is loaded) */
.lib-demo-note { margin: 18px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 16px; border-radius: 14px; background: #FEF6DE; border: 1px dashed #E3B53A; color: #6b5310; font-size: 14px; line-height: 1.5; }
.lib-demo-note b { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #3d2f05; font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* hero text arrives on page load, like the other pages */
.js .lib-hero-copy > * { animation: rise .9s var(--ease) both; }
.js .lib-hero-copy > :nth-child(2) { animation-delay: .08s; }
.js .lib-hero-copy > :nth-child(3) { animation-delay: .16s; }
.js .lib-hero-copy > :nth-child(4) { animation-delay: .28s; }
.js .lib-hero-copy > :nth-child(5) { animation-delay: .38s; }
.js .lib-hero-copy > :nth-child(6) { animation-delay: .5s; }
.js .lib-hero-copy > :nth-child(7) { animation-delay: .62s; }
@media (prefers-reduced-motion: reduce) { .js .lib-hero-copy > * { animation: none; } }
