.library-hero h1 {
  font-size: clamp(46px, 4.8vw, 76px);
  letter-spacing: -0.048em;
}

.catalog-head {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 500px);
}

.catalog-head p {
  max-width: 68ch;
  font-size: 16px;
  line-height: 1.55;
}

.search {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
}

.search::placeholder {
  color: #6c6672;
  opacity: 1;
}

.search:focus,
.vertical-filter button:focus-visible,
.filter-controls select:focus-visible,
.filter-reset:focus-visible,
.load-more:focus-visible,
.recipe-card:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.filter-workbench {
  margin-bottom: 26px;
  border: 1px solid var(--ink);
}

.vertical-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--ink);
}

.vertical-filter button {
  min-width: 0;
  min-height: 74px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--body);
  background: var(--paper);
  border: 0;
  border-right: 1px solid var(--ink);
  cursor: pointer;
  text-align: left;
}

.vertical-filter button:last-child {
  border-right: 0;
}

.vertical-filter button.is-active {
  color: var(--ink);
  background: var(--lime);
}

.vertical-filter strong {
  min-width: 0;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.05;
}

.vertical-filter span {
  flex: 0 0 auto;
  color: currentColor;
  font-size: 12px;
  font-weight: 950;
}

.filter-controls {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  background: var(--cool);
}

.filter-controls label {
  min-width: 0;
}

.filter-controls label > span {
  display: block;
  margin: 0 0 7px;
  color: var(--body);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.filter-controls select {
  width: 100%;
  min-height: 48px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background-color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
}

.filter-meta {
  min-height: 48px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.filter-status {
  font-size: 12px;
}

.filter-reset {
  min-height: 44px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 950;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.recipe-card {
  overflow: hidden;
}

.card-media img {
  background: var(--cool);
}

.card-stage,
.card-brand,
.card-open {
  font-size: 12px;
}

.card-model {
  position: absolute;
  top: 10px;
  right: 10px;
  max-width: calc(100% - 80px);
  padding: 6px 8px;
  overflow: hidden;
  color: var(--paper);
  background: var(--ink);
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-media.has-fallback {
  display: grid;
  place-items: end start;
  padding: 18px;
  background: var(--pink-soft);
}

.card-media.has-fallback::after {
  content: attr(data-fallback);
  max-width: 10ch;
  font-size: clamp(31px, 3.2vw, 49px);
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 0.92;
}

.card-copy {
  min-height: 206px;
}

.card-media-notice {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 8px;
  color: var(--ink);
  background: var(--lime);
  border: 1px solid var(--ink);
  font-size: 12px;
  font-weight: 950;
}

.card-brand-line {
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card-copy .card-brand {
  margin: 0;
  font-size: 12px;
}

.card-evidence-grade {
  flex: 0 0 auto;
  color: var(--body);
  font-size: 12px;
  font-weight: 950;
}

.card-copy h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-copy > p:not(.card-brand) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 12px;
}

.card-category {
  margin-top: auto;
  padding-top: 14px;
  color: var(--body);
  font-size: 12px;
  font-weight: 850;
}

.card-open {
  margin-top: 8px;
  padding-top: 0;
}

.load-more {
  min-height: 52px;
  margin: 28px auto 0;
  padding: 0 24px;
  display: block;
  color: var(--ink);
  background: var(--lime);
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.load-more[hidden] {
  display: none;
}

.detail-head {
  text-transform: none;
}

.detail-frame {
  position: relative;
  background: var(--paper);
}

.detail-frame img,
.detail-frame video {
  object-fit: contain;
  background: var(--paper);
}

.detail.has-portrait-reference .detail-media {
  min-height: 0;
  align-self: start;
}

.detail.has-portrait-reference .detail-frame {
  height: auto;
  aspect-ratio: 9 / 16;
}

.media-fallback {
  width: 100%;
  height: 100%;
  min-height: 520px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--pink-soft);
}

.media-fallback[hidden] {
  display: none;
}

.media-fallback strong {
  max-width: 8ch;
  font-size: clamp(46px, 6vw, 88px);
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.media-fallback span {
  max-width: 34ch;
  margin-top: 18px;
  color: var(--body);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.4;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-facts div {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.detail-facts div:first-child {
  padding-left: 0;
}

.detail-facts div:last-child {
  border-right: 0;
}

.detail-facts span {
  display: block;
  margin-bottom: 6px;
  color: var(--body);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.detail-facts strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.source-copy {
  margin: 0;
  padding: 20px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.source-copy[hidden] {
  display: none;
}

.source-copy span {
  display: block;
  margin-bottom: 10px;
  color: var(--pink-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.source-copy strong {
  display: block;
  max-width: 64ch;
  font-size: 16px;
  line-height: 1.35;
}

.source-copy p {
  max-width: 72ch;
  margin: 9px 0 0;
  color: var(--body);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.48;
}

.formula-caution {
  max-width: 72ch;
  margin: 12px 0 0;
  color: var(--body);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

@media (max-width: 1040px) {
  .filter-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .catalog-head {
    grid-template-columns: 1fr;
  }

  .vertical-filter {
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .vertical-filter button {
    min-width: 190px;
  }

  .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .catalog-head p {
    font-size: 16px;
  }

  .vertical-filter button {
    min-width: 168px;
    min-height: 64px;
    padding: 12px;
  }

  .filter-controls {
    padding: 12px;
    grid-template-columns: 1fr;
  }

  .filter-controls select {
    min-height: 50px;
    font-size: 16px;
  }

  .filter-meta {
    padding: 0 12px;
  }

  .recipe-card {
    grid-template-columns: minmax(134px, 0.78fr) minmax(0, 1fr);
  }

  .card-media img {
    object-fit: contain;
  }

  .card-model {
    display: none;
  }

  .card-copy {
    min-height: 224px;
  }

  .card-brand-line {
    display: block;
  }

  .card-evidence-grade {
    display: block;
    margin-top: 5px;
  }

  .detail-facts {
    grid-template-columns: 1fr;
  }

  .detail-facts div,
  .detail-facts div:first-child {
    padding: 13px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-facts div:last-child {
    border-bottom: 0;
  }
}
