.catalog-masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  margin-block: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
}

.catalog-title h1 {
  margin: 0;
  color: var(--ink);
  font: 400 clamp(2.9rem, 7vw, 6.25rem) / 1.04 var(--heading);
  letter-spacing: -0.065em;
}

.catalog-title p {
  max-width: 33ch;
  margin: 1rem 0 0;
  font-size: clamp(1.03rem, 2vw, 1.3rem);
  line-height: 1.55;
}

.catalog-cover-spread {
  position: relative;
  isolation: isolate;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: clamp(10rem, 19vw, 15rem);
  padding: 1.3rem 8%;
}

.catalog-cover-spread::before {
  position: absolute;
  z-index: -1;
  inset: 0 2%;
  border-radius: 53% 43% 55% 44% / 48% 55% 49% 57%;
  background: var(--mint);
  content: '';
}

.catalog-cover-spread img {
  display: block;
  width: min(38%, 10.5rem);
  height: auto;
  aspect-ratio: 7 / 8;
  object-fit: contain;
  font-size: 0;
  filter: drop-shadow(0 11px 8px #294c553e);
}

.catalog-cover-spread img:first-child {
  margin-right: -5%;
  transform: translateY(9%) rotate(-12deg);
}

.catalog-cover-spread img:nth-child(2) {
  z-index: 1;
  transform: translateY(-5%) rotate(-2deg);
}

.catalog-cover-spread img:last-child {
  margin-left: -5%;
  transform: translateY(9%) rotate(12deg);
}

#tek-publications {
  min-height: 20rem;
  padding-bottom: clamp(3rem, 8vw, 6rem);
  scroll-margin-top: 5.5rem;
}

#tek-publications [hidden] {
  display: none !important;
}

.tek-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-block: 1rem;
  border-block: 1px solid var(--line);
}

.tek-filter,
.tek-pagination button,
.tek-retry {
  min-height: 2.75rem;
  padding: 0.45rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 50px;
  background: var(--cream);
  color: var(--ink);
  font: 750 0.96rem / 1.3 var(--body);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.tek-filter:hover,
.tek-pagination button:not(:disabled):hover,
.tek-retry:hover {
  border-color: var(--cobalt);
  color: var(--cobalt);
}

.tek-filter[aria-pressed='true'] {
  border-color: var(--cobalt);
  background: var(--cobalt);
  color: white;
}

.tek-pagination button:disabled {
  opacity: 0.48;
  cursor: default;
}

.tek-result-count {
  min-height: 1.5rem;
  margin: 1.15rem 0 1rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 680;
}

.tek-product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.85rem, 2.5vw, 2rem);
}

.tek-product {
  display: flex;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  --shelf: #ffe3ab;
}

.tek-product:nth-child(4n + 2) {
  --shelf: #e4ecff;
}

.tek-product:nth-child(4n + 3) {
  --shelf: var(--mint);
}

.tek-product:nth-child(4n + 4) {
  --shelf: #fbded4;
}

.tek-product-open {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: start;
  width: 100%;
  padding: 0 0 1rem;
  border: 0;
  border-radius: 1.15rem 1.15rem 0 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tek-product-cover {
  display: grid;
  width: 100%;
  aspect-ratio: 5 / 4;
  place-items: center;
  overflow: hidden;
  margin-bottom: 0.9rem;
  padding: 8%;
  border-radius: 1.15rem 1.15rem 0.3rem 0.3rem;
  background: var(--shelf);
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}

.tek-product-cover img {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  filter: drop-shadow(0 5px 6px #1f274225);
  transition: transform 180ms ease;
}

.tek-product-open:hover .tek-product-cover img {
  transform: translateY(-3px);
}

.tek-product-label {
  margin: 0;
  color: var(--brick);
  font-size: 0.77rem;
  font-weight: 760;
}

.tek-product h3 {
  margin: 0.3rem 0 0.62rem;
  color: var(--ink);
  font: 400 clamp(1rem, 1.6vw, 1.26rem) / 1.32 var(--heading);
  overflow-wrap: anywhere;
}

.tek-product-details {
  margin-top: auto;
  color: var(--cobalt);
  font-size: 0.86rem;
  font-weight: 750;
}

.tek-product-open:hover .tek-product-details {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.tek-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  margin-top: 2.5rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.tek-product-dialog {
  position: fixed;
  width: min(49rem, calc(100% - 1.5rem));
  max-height: min(45rem, calc(100dvh - 1.5rem));
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 1rem 3rem #1322493b;
}

.tek-product-dialog::backdrop {
  background: #112140a6;
}

.tek-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  align-items: start;
  gap: clamp(1rem, 4vw, 2.4rem);
  padding: clamp(3rem, 7vw, 4rem) clamp(1rem, 4vw, 2.5rem) clamp(1.5rem, 4vw, 2.5rem);
}

.tek-dialog-cover,
.tek-dialog-body > .tek-cover-placeholder {
  display: block;
  width: 100%;
  max-height: min(24rem, 45vh);
  align-self: center;
  padding: 6%;
  border-radius: 0.9rem;
  background: var(--mint);
  object-fit: contain;
  text-align: center;
}

.tek-dialog-info:only-child {
  grid-column: 1 / -1;
}

.tek-dialog-info h2 {
  margin: 0.35rem 0 0.75rem;
  font: 400 clamp(1.35rem, 3vw, 2rem) / 1.13 var(--heading);
  overflow-wrap: anywhere;
}

.tek-dialog-description {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.tek-dialog-close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font: 1.65rem / 1 var(--body);
  cursor: pointer;
}

.tek-dialog-close:hover {
  background: var(--mint);
}

.tek-resource-title {
  margin: 1.2rem 0 0.5rem;
  font-size: 1rem;
}

.tek-resource-links {
  display: grid;
  gap: 0.5rem;
}

.tek-resource-link,
.tek-buy {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.55rem;
  color: var(--cobalt);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  overflow-wrap: anywhere;
}

.tek-resource-link {
  background: #e4ecff;
}

.tek-buy {
  margin-top: 1rem;
  background: var(--cobalt);
  color: white;
  text-decoration: none;
}

.tek-buy:hover {
  text-decoration: underline;
}

.tek-catalog-page :is(button, a):focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
}

@media (max-width: 940px) {
  .tek-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .catalog-masthead {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .catalog-title h1 {
    font-size: clamp(2.55rem, 10vw, 3.7rem);
  }

  .catalog-title p {
    margin-top: 0.65rem;
  }

  .catalog-cover-spread {
    width: min(100%, 23rem);
    margin-inline: auto;
    padding-block: 0.85rem;
  }

  .catalog-cover-spread img {
    width: min(35%, 6.8rem);
  }

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

  .tek-filters {
    flex-wrap: nowrap;
    gap: 0.38rem;
    overflow-x: auto;
    padding-inline: 0.25rem;
  }

  .tek-filter {
    flex: 0 0 auto;
    padding-inline: clamp(0.44rem, 2vw, 0.8rem);
    font-size: clamp(0.78rem, 3.2vw, 0.96rem);
    white-space: nowrap;
  }

  .tek-dialog-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .tek-dialog-cover {
    max-height: 12rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tek-product-cover img,
  .tek-filter,
  .tek-pagination button,
  .tek-retry {
    transition: none;
  }
}
