:root {
  --library-navy: #162355;
  --library-blue: #163e64;
  --library-teal: #077a8d;
  --library-teal-dark: #055e6d;
  --library-teal-soft: #eaf6f8;
  --library-border: #e6ebf0;
  --library-muted: #7a8493;
}

body {
  font-family: "Hanken Grotesk", system-ui, sans-serif;
}

.library-page {
  min-width: 0;
  background: #fff;
  color: #2a3340;
}

.library-shell {
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.library-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 6px 0 22px;
  border-bottom: 1px solid #edf1f4;
}

.library-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--library-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.library-hero h1,
.library-content-heading h2,
.library-search-master-heading h2,
.library-cta h2 {
  font-family: "Crimson Pro", Georgia, serif;
}

.library-hero h1 {
  margin: 0;
  color: var(--library-navy);
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.library-hero p {
  max-width: 700px;
  margin: 10px 0 0;
  color: #657084;
  font-size: 16px;
  line-height: 1.6;
}

.snapshot-meta {
  flex: none;
  color: #9199a8;
  font-size: 11px;
  white-space: nowrap;
}

.library-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 0;
}

.library-search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(560px, 100%);
}

.library-search > svg {
  position: absolute;
  left: 15px;
  width: 17px;
  height: 17px;
  color: #9aa3b2;
  pointer-events: none;
}

.library-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 42px;
  border: 1px solid var(--library-border);
  border-radius: 11px;
  background: #fff;
  color: #2a3340;
  font: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.library-search input:focus {
  outline: none;
  border-color: #35b8ca;
  box-shadow: 0 0 0 3px rgba(53, 184, 202, 0.13);
}

.library-search button {
  position: absolute;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #f3f5f7;
  color: #667085;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.library-state {
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--library-muted);
  text-align: center;
}

.library-state h2,
.library-state p {
  margin: 0;
}

.library-state h2 {
  color: var(--library-blue);
  font-size: 20px;
}

.library-state button {
  padding: 9px 16px;
  border: 1px solid var(--library-teal);
  border-radius: 10px;
  background: var(--library-teal);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.library-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #dbecef;
  border-top-color: var(--library-teal);
  border-radius: 50%;
  animation: library-spin 0.8s linear infinite;
}

@keyframes library-spin { to { transform: rotate(360deg); } }

.library-taxonomy {
  margin: 22px 0 30px;
  padding: 24px;
  border: 1px solid var(--library-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 48px -42px rgba(22, 35, 85, 0.34);
}

.library-taxonomy-heading,
.library-category-heading,
.library-content-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.library-taxonomy-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid #eef1f4;
}

.library-taxonomy-eyebrow,
.library-content-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--library-teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.library-taxonomy-heading h2,
.library-content-heading h2 {
  margin: 0;
  color: var(--library-navy);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.15;
}

.library-taxonomy-heading p,
.library-content-heading p {
  max-width: 560px;
  margin: 0;
  color: var(--library-muted);
  font-size: 13px;
  line-height: 1.5;
}

.library-category-list {
  display: grid;
  gap: 28px;
  margin-top: 24px;
}

.library-category-section {
  min-width: 0;
}

.library-category-heading {
  align-items: center;
  margin-bottom: 12px;
}

.library-category-heading h3 {
  margin: 0;
  color: var(--library-blue);
  font-size: 16px;
  font-weight: 700;
}

.library-category-heading p {
  margin: 3px 0 0;
  color: #8a94a6;
  font-size: 12px;
}

.library-category-heading > span {
  flex: none;
  color: #8a94a6;
  font-size: 12px;
  font-weight: 600;
}

.library-folder-rail-shell {
  position: relative;
  min-width: 0;
}

.library-folder-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 42px) / 4);
  gap: 14px;
  overflow-x: auto;
  padding: 2px 1px 10px;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-color: #b7dde4 transparent;
  scrollbar-width: thin;
}

.library-folder-rail::-webkit-scrollbar { height: 5px; }
.library-folder-rail::-webkit-scrollbar-track { background: transparent; }
.library-folder-rail::-webkit-scrollbar-thumb { background: #b7dde4; border-radius: 99px; }

.library-folder-card {
  min-width: 0;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5eaf0;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff, #fafcfd);
  color: var(--library-navy);
  scroll-snap-align: start;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.library-folder-card-main {
  width: 100%;
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.library-folder-card-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid #e8edf1;
  background: #f4f7f9;
}

.library-folder-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.library-folder-card-footer {
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-sizing: border-box;
  padding: 12px 14px;
}

.library-folder-card:hover,
.library-folder-card.active {
  transform: translateY(-2px);
  border-color: #83cfda;
  background: #f3fbfc;
  box-shadow: 0 14px 30px -24px rgba(7, 122, 141, 0.7);
}

.library-folder-card:hover .library-folder-card-preview img { transform: scale(1.025); }

.library-folder-card-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: #e6f5f7;
  color: var(--library-teal);
}

.library-folder-card-icon svg { width: 21px; height: 21px; }
.library-folder-card-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.library-folder-card-name {
  overflow: hidden;
  color: var(--library-navy);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.library-folder-card-breadcrumb,
.library-folder-card-count {
  overflow: hidden;
  color: #8a94a6;
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-folder-card-open {
  display: inline-flex;
  color: #9ba5b2;
}

.library-folder-card-open svg { width: 16px; height: 16px; }

.library-folder-card-subfolders {
  padding: 0 14px 12px;
  color: #7d8798;
  font-size: 11px;
  line-height: 1.45;
}

.library-folder-card-subfolder-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--library-teal);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.library-folder-card-subfolder-link:hover { color: var(--library-teal-dark); text-decoration: underline; }
.library-folder-card-subfolder-separator,
.library-folder-card-subfolder-suffix { color: #8a94a6; }

.library-folder-rail-arrow,
.rail-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #cfe8ec;
  border-radius: 50%;
  background: #fff;
  color: var(--library-teal);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.library-folder-rail-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 34px;
  height: 34px;
  box-shadow: 0 8px 22px -12px rgba(22, 35, 85, 0.55);
  transform: translateY(-62%);
}

.library-folder-rail-arrow:hover,
.rail-control:hover { background: var(--library-teal); color: #fff; }
.library-folder-rail-arrow.previous { left: -17px; }
.library-folder-rail-arrow.next { right: -17px; }
.library-folder-rail-arrow svg { width: 17px; height: 17px; }

.tag-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
}

.rail-control {
  flex: none;
  width: 28px;
  height: 28px;
  border-color: var(--library-teal);
  background: var(--library-teal);
  color: #fff;
}

.rail-control svg { width: 15px; height: 15px; }

.tag-rail {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 36px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 36px), transparent 100%);
}

.tag-rail::-webkit-scrollbar { display: none; }

.tag-chip,
.clear-filters {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--library-border);
  border-radius: 999px;
  background: #fff;
  color: #5b6472;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tag-chip:hover { border-color: #9fd9e2; color: var(--library-teal); }
.tag-chip.active { border-color: var(--library-teal); background: var(--library-teal); color: #fff; }

.clear-filters {
  border-color: #c6e6ec;
  background: var(--library-teal-soft);
  color: var(--library-teal);
}

.library-content-heading {
  align-items: center;
  margin: 24px 0 0;
  padding: 20px 0 14px;
  border-bottom: 1px solid #e5eaf0;
  scroll-margin-top: 18px;
}

.library-folder-page-heading {
  margin-top: 20px;
  padding: 22px 24px 18px;
  border: 1px solid var(--library-border);
  border-radius: 16px;
  background: linear-gradient(135deg, #fbfdfe, #f3fafb);
}

.library-content-heading p { margin-top: 5px; }

.library-content-count {
  flex: none;
  padding: 7px 11px;
  border-radius: 999px;
  background: #f1f7f8;
  color: var(--library-teal);
  font-size: 12px;
  font-weight: 700;
}

.library-content-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--library-teal);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.library-content-back svg { width: 15px; height: 15px; }

.library-folder-children {
  min-width: 0;
  margin: 16px 0 4px;
  padding: 20px 24px 16px;
  border: 1px solid var(--library-border);
  border-radius: 16px;
  background: #fff;
}

.inspiration-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 22px;
  padding-top: 22px;
}

@media (min-width: 640px) { .inspiration-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .inspiration-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1320px) { .inspiration-grid { grid-template-columns: repeat(4, 1fr); } }

.library-search-master-heading,
.library-folder-group-heading {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #cfe1e5;
}

.library-search-master-heading h2 {
  margin: 0;
  color: var(--library-blue);
  font-size: 22px;
  font-weight: 500;
}

.library-folder-group-heading {
  margin-top: 2px;
  border-bottom-color: #e5e7eb;
  border-bottom-style: dashed;
}

.library-folder-group-heading h3 {
  margin: 0;
  color: #286b7c;
  font-size: 14px;
  font-weight: 700;
}

.tmpl-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #eaecf0;
  border-radius: 16px;
  background: #fff;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.tmpl-card:hover {
  transform: translateY(-3px);
  border-color: #dfe3ea;
  box-shadow: 0 18px 40px -20px rgba(22, 35, 85, 0.28);
}

.tmpl-card-link {
  display: flex;
  min-height: 100%;
  flex: 1;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.tmpl-thumb {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #edeff3;
  background: #f4f6f9;
  color: inherit;
}

.tmpl-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.25s ease;
}

.tmpl-card:hover .tmpl-thumb img { transform: scale(1.03); }

.tmpl-card-link:focus-visible {
  outline: 3px solid rgba(53, 184, 202, 0.42);
  outline-offset: -3px;
}

.image-placeholder {
  aspect-ratio: 16 / 9;
  display: none;
  align-items: center;
  justify-content: center;
  color: #aeb6c2;
  font-size: 12px;
}

.tmpl-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px 18px 14px;
}

.tmpl-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 6px;
  color: var(--library-navy);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tmpl-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.tmpl-tags {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tmpl-tag {
  overflow: hidden;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--library-teal-soft);
  color: var(--library-teal);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmpl-tag--more { flex: none; background: #f4f6f8; color: #8a94a6; }

.tmpl-type {
  flex: none;
  color: #8a94a6;
  font-size: 11px;
}

.library-empty { min-height: 270px; }

.library-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 32px 0 0;
}

.pagination-button,
.pagination-number {
  min-width: 35px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid var(--library-border);
  border-radius: 999px;
  background: #fff;
  color: #5b6472;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pagination-number.active {
  border-color: var(--library-teal);
  background: var(--library-teal);
  color: #fff;
}

.pagination-button:disabled { opacity: 0.4; cursor: default; }
.pagination-ellipsis { padding: 0 3px; color: #9aa3b2; }
.pagination-info { width: 100%; margin-top: 4px; color: #8a94a6; font-size: 11px; text-align: center; }

.library-cta {
  padding: 64px 24px;
  background: #21657f;
  color: #fff;
  text-align: center;
}

.library-cta > div { width: min(720px, 100%); margin: 0 auto; }
.library-cta h2 { margin: 0; font-size: 34px; font-weight: 400; line-height: 1.15; }
.library-cta p { margin: 13px 0 26px; color: rgba(255,255,255,0.82); }

.library-cta a {
  display: inline-flex;
  padding: 11px 24px;
  border-radius: 8px;
  background: #fff;
  color: #21657f;
  font-size: 14px;
  font-weight: 700;
}

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .library-folder-rail { grid-auto-columns: minmax(270px, 46%); }
}

@media (max-width: 720px) {
  .library-shell { width: min(100% - 28px, 1460px); padding-top: 30px; }
  .library-hero { align-items: flex-start; flex-direction: column; gap: 10px; }
  .snapshot-meta { white-space: normal; }
  .library-taxonomy { margin-top: 14px; padding: 18px 14px; }
  .library-taxonomy-heading,
  .library-content-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .library-folder-rail { grid-auto-columns: minmax(245px, 82%); }
  .library-folder-rail-arrow,
  .rail-control { display: none; }
  .library-category-heading { align-items: flex-start; }
  .library-folder-children { padding: 18px 14px 14px; }
  .tag-filters { flex-wrap: wrap; }
  .tag-rail { width: 100%; flex-basis: 100%; }
  .library-cta h2 { font-size: 29px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
