.library-page {
  background: #f7f9f8;
}

.library-hero {
  min-height: min(68svh, 650px);
  display: flex;
  align-items: center;
  padding: clamp(68px, 9vw, 112px) clamp(18px, 4vw, 58px);
  color: #fff;
  background:
    linear-gradient(
      90deg,
      rgba(5, 12, 10, 0.98) 0%,
      rgba(5, 12, 10, 0.94) 39%,
      rgba(5, 12, 10, 0.62) 57%,
      rgba(5, 12, 10, 0.12) 100%
    ),
    url("library-collection-v2.webp") 70% center / cover no-repeat;
}

.library-hero-copy {
  width: min(760px, 58%);
}

.library-hero-copy > p:not(.eyebrow) {
  max-width: 670px;
  margin-top: 22px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 19px;
}

.library-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 620px;
  margin-top: 38px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  border-bottom: 1px solid rgba(255, 255, 255, 0.24);
}

.library-stats div {
  padding: 18px 18px 18px 0;
}

.library-stats div + div {
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.library-stats strong,
.library-stats span {
  display: block;
}

.library-stats strong {
  color: #fff;
  font-size: 26px;
}

.library-stats span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.59);
  font-size: 12px;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 24px clamp(18px, 4vw, 58px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.library-search {
  max-width: 620px;
}

.library-search label {
  margin-top: 0;
}

.library-search input {
  background: var(--wash);
  border-color: transparent;
}

.access-toggle {
  display: inline-flex;
  padding: 3px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.access-filter {
  min-height: 39px;
  padding: 8px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.access-filter.active {
  color: #fff;
  background: var(--night);
}

.library-catalog {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: clamp(30px, 4vw, 58px);
  padding: clamp(48px, 7vw, 84px) clamp(18px, 4vw, 58px);
}

.library-sidebar {
  align-self: start;
  position: sticky;
  top: 94px;
}

.sidebar-label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.category-list {
  border-top: 1px solid var(--line);
}

.category-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 45px;
  padding: 10px 4px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.category-filter span {
  display: grid;
  place-items: center;
  min-width: 25px;
  min-height: 25px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.category-filter.active,
.category-filter:hover {
  color: var(--ink);
  font-weight: 900;
}

.category-filter.active span {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.sidebar-offer {
  margin-top: 28px;
  padding: 22px 0;
  border-top: 3px solid var(--amber);
  border-bottom: 1px solid var(--line);
}

.sidebar-offer > span {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-offer strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.sidebar-offer p {
  margin: 7px 0 13px;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-offer a {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.catalog-heading {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
  margin-bottom: 28px;
}

.catalog-heading h2 {
  max-width: 700px;
  font-size: clamp(30px, 3.5vw, 46px);
}

#library-result-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.library-grid-v2 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.library-card-v2 {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(19, 32, 29, 0.06);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.library-card-v2:hover {
  transform: translateY(-3px);
  box-shadow: 0 17px 40px rgba(19, 32, 29, 0.12);
}

.resource-cover,
.resource-detail-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 190px;
  padding: 22px;
  color: #fff;
  background: var(--night);
  text-decoration: none;
  overflow: hidden;
}

.resource-cover::before,
.resource-detail-cover::before {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -24px;
  top: -31px;
  border: 24px solid rgba(255, 255, 255, 0.09);
  transform: rotate(24deg);
}

.resource-cover::after,
.resource-detail-cover::after {
  content: "";
  position: absolute;
  width: 58%;
  height: 1px;
  left: 22px;
  top: 58px;
  background: rgba(255, 255, 255, 0.24);
}

.cover-account {
  background: #176a5d;
}

.cover-scripts {
  background: #273f73;
}

.cover-planning {
  background: #8c5d17;
}

.cover-analytics {
  background: #4b5963;
}

.cover-production {
  background: #7a403a;
}

.cover-operations {
  background: #304a3c;
}

.cover-prompts {
  background: #355b63;
}

.cover-storefront {
  background: #69533a;
}

.cover-number,
.cover-format,
.resource-cover strong,
.resource-cover small,
.resource-detail-cover strong,
.resource-detail-cover small {
  position: relative;
  z-index: 1;
}

.cover-number {
  position: absolute;
  left: 22px;
  top: 19px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 13px;
  font-weight: 900;
}

.cover-format {
  margin-bottom: 10px;
  color: #f2c76d;
  font-size: 10px;
  font-weight: 900;
}

.resource-cover strong,
.resource-detail-cover strong {
  max-width: 90%;
  font-size: 22px;
  line-height: 1.08;
}

.resource-cover small,
.resource-detail-cover small {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 9px;
  font-weight: 900;
}

.library-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px;
}

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
}

.access-badge.free {
  color: #075f40;
  background: #dbf5e9;
}

.access-badge.toolkit {
  color: #754a00;
  background: #fff0cc;
}

.library-card-body h3 {
  margin-top: 15px;
}

.library-card-body h3 a {
  text-decoration: none;
}

.library-card-body > p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.resource-role {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.resource-role strong {
  color: var(--ink);
  text-align: right;
}

.resource-card-link {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.library-empty {
  padding: 55px 0;
  border-top: 1px solid var(--line);
}

.library-empty p {
  margin-top: 8px;
  color: var(--muted);
}

.library-path {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.5fr);
  gap: clamp(36px, 7vw, 100px);
  padding: clamp(64px, 8vw, 104px) clamp(18px, 4vw, 58px);
  color: #fff;
  background: var(--night);
}

.library-path ol {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, 0.17);
}

.library-path li {
  display: grid;
  grid-template-columns: 56px 180px minmax(0, 1fr);
  gap: 18px;
  padding: 23px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.17);
}

.library-path li span {
  color: #5ed0c1;
  font-size: 12px;
  font-weight: 900;
}

.library-path li p {
  color: rgba(255, 255, 255, 0.6);
}

.resource-detail-loading,
.resource-not-found {
  min-height: 65vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 18px;
  padding: 70px clamp(18px, 4vw, 58px);
}

.resource-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 470px);
  gap: clamp(36px, 7vw, 100px);
  align-items: center;
  min-height: 70vh;
  padding: clamp(64px, 9vw, 110px) clamp(18px, 4vw, 58px);
  background: var(--wash);
}

.back-link {
  display: inline-block;
  margin-bottom: 27px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.resource-detail-copy h1 {
  margin-top: 20px;
}

.resource-detail-copy > p:not(.resource-disclaimer) {
  max-width: 760px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 19px;
}

.resource-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 28px;
}

.resource-secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.resource-disclaimer {
  max-width: 700px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

.resource-detail-cover {
  min-height: 430px;
  padding: 38px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.resource-detail-cover::before {
  width: 260px;
  height: 260px;
  right: -52px;
  top: -50px;
  border-width: 42px;
}

.resource-detail-cover::after {
  left: 38px;
  top: 92px;
}

.resource-detail-cover .cover-number {
  left: 38px;
  top: 35px;
}

.resource-detail-cover strong {
  max-width: 90%;
  font-size: clamp(34px, 4vw, 51px);
}

.resource-detail-cover small {
  margin-top: 20px;
  font-size: 11px;
}

.resource-detail-grid,
.resource-outcomes {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: clamp(40px, 8vw, 110px);
  padding: clamp(64px, 8vw, 104px) clamp(18px, 4vw, 58px);
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.detail-list li {
  position: relative;
  padding: 17px 0 17px 26px;
  border-bottom: 1px solid var(--line);
}

.detail-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 23px;
  width: 9px;
  height: 9px;
  background: var(--teal);
  border-radius: 2px;
}

.resource-specs {
  border-top: 3px solid var(--amber);
}

.resource-specs div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 20px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.resource-specs span {
  color: var(--muted);
  font-size: 12px;
}

.resource-specs strong {
  font-size: 14px;
}

.resource-outcomes {
  color: #fff;
  background: var(--night);
}

.outcome-list {
  border-top: 1px solid rgba(255, 255, 255, 0.17);
}

.outcome-list div {
  display: grid;
  grid-template-columns: 55px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.17);
}

.outcome-list span {
  color: #5ed0c1;
  font-size: 12px;
  font-weight: 900;
}

.outcome-list p {
  color: rgba(255, 255, 255, 0.76);
}

.resource-steps {
  padding: clamp(64px, 8vw, 104px) clamp(18px, 4vw, 58px);
  background: #fff;
}

.resource-steps ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  max-width: 1100px;
  margin: 31px 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
  counter-reset: resource-step;
}

.resource-steps li {
  min-height: 180px;
  padding: 27px;
  background: var(--wash);
  counter-increment: resource-step;
}

.resource-steps li::before {
  content: "0" counter(resource-step);
  display: block;
  margin-bottom: 42px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 1060px) {
  .library-grid-v2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .library-hero {
    min-height: 78svh;
    align-items: flex-end;
    background:
      linear-gradient(
        180deg,
        rgba(5, 12, 10, 0.09) 0%,
        rgba(5, 12, 10, 0.58) 40%,
        rgba(5, 12, 10, 0.98) 75%
      ),
      url("library-collection-v2.webp") 67% center / cover no-repeat;
  }

  .library-hero-copy {
    width: 100%;
  }

  .library-toolbar,
  .library-catalog,
  .library-path,
  .resource-detail-hero,
  .resource-detail-grid,
  .resource-outcomes {
    grid-template-columns: 1fr;
  }

  .access-toggle {
    width: 100%;
  }

  .access-filter {
    flex: 1;
  }

  .library-sidebar {
    position: static;
  }

  .category-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-filter:nth-child(odd) {
    padding-right: 12px;
  }

  .category-filter:nth-child(even) {
    padding-left: 12px;
    border-left: 1px solid var(--line);
  }

  .library-path li {
    grid-template-columns: 45px minmax(0, 1fr);
  }

  .library-path li p {
    grid-column: 2;
  }

  .resource-detail-cover {
    min-height: 360px;
  }

  .resource-steps ol {
    grid-template-columns: 1fr;
  }

  .resource-steps li {
    min-height: auto;
  }

  .resource-steps li::before {
    margin-bottom: 25px;
  }
}

@media (max-width: 520px) {
  .library-hero {
    min-height: 82svh;
  }

  .library-stats {
    grid-template-columns: 1fr;
  }

  .library-stats div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
  }

  .library-stats div + div {
    padding-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-left: 0;
  }

  .library-stats span {
    margin-top: 0;
    text-align: right;
  }

  .category-list,
  .library-grid-v2 {
    grid-template-columns: 1fr;
  }

  .category-filter:nth-child(even) {
    padding-left: 4px;
    border-left: 0;
  }

  .catalog-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .resource-cover {
    min-height: 210px;
  }

  .resource-detail-actions,
  .resource-detail-actions .button {
    width: 100%;
  }

  .resource-detail-cover {
    min-height: 320px;
    padding: 27px;
  }

  .resource-detail-cover .cover-number {
    left: 27px;
    top: 25px;
  }

  .resource-specs div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
