.category-page {
  background: var(--paper);
}

.category-masthead,
.category-content {
  width: min(calc(100% - 2 * var(--page-gutter)), var(--container));
  margin-inline: auto;
}

.category-masthead {
  padding-block: 1.25rem 1.75rem;
}

.category-masthead .breadcrumbs {
  margin-bottom: 1.15rem;
  color: var(--muted);
}

.category-masthead__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 52%);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.category-masthead__copy .eyebrow {
  color: var(--text-soft);
}

.category-masthead h1 {
  max-width: 14ch;
  margin: 0.55rem 0 0.5rem;
  color: var(--ink-deep);
  font-family: var(--display);
  font-size: clamp(2.55rem, 5.25vw, 4.75rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.98;
}

.category-masthead h1 span {
  color: var(--brick);
}

.category-masthead__copy > p {
  max-width: 39rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.15vw, 1.05rem);
  line-height: 1.55;
}

.category-masthead__photo {
  position: relative;
  aspect-ratio: 2.1 / 1;
  overflow: hidden;
  background: var(--paper-deep);
  border-radius: 0;
}

.category-masthead__photo::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--paper), transparent 18%);
  pointer-events: none;
  content: "";
}

.category-masthead__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 65% 50%;
}

.category-content {
  padding-top: 0.5rem;
}

.category-themes {
  padding-block: 0.2rem 0.5rem;
}

.category-themes__list {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0.65rem 0;
  list-style: none;
}

.category-theme {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 108px;
  padding: 0.45rem 0.2rem;
  color: var(--ink-warm);
  font-size: var(--text-sm);
  text-align: center;
  line-height: 1.25;
  transition: border-color var(--duration-short) var(--ease-gentle), background-color var(--duration-short) var(--ease-gentle), color var(--duration-short) var(--ease-gentle);
}

.category-theme__symbol {
  display: grid;
  place-items: center;
  flex: 0 0 70px;
  width: 70px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-deep);
}

.category-theme:hover .category-theme__symbol {
  border-color: var(--line);
  background: var(--paper-light);
}

.category-theme.is-current {
  color: var(--ink-deep);
}

.category-theme.is-current .category-theme__symbol {
  border-color: var(--ink-deep);
  background: var(--ink-deep);
  color: var(--paper-light);
}

.category-theme__icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.category-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.45fr) repeat(3, minmax(118px, 0.8fr)) auto;
  align-items: end;
  gap: 0.85rem;
  padding-block: 1.3rem 0.85rem;
}

.category-search,
.category-filter {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-xs);
}

.category-search input,
.category-filter select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-light);
  color: var(--ink-deep);
  font: inherit;
  font-size: var(--text-sm);
}

.category-search input::placeholder {
  color: #95877b;
}

.category-toolbar--native {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.category-toolbar--native .category-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 auto;
  max-width: 17rem;
}

.category-toolbar--native .category-filter select {
  width: auto;
  max-width: 11rem;
  min-width: 6.5rem;
  border-radius: var(--radius-pill);
  background: transparent;
}

.category-toolbar--native .category-apply {
  flex: 0 0 auto;
}

.category-search input:focus-visible,
.category-filter select:focus-visible,
.category-apply:focus-visible,
.category-theme:focus-visible,
.category-pagination a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.category-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--walnut);
  border-radius: var(--radius-pill);
  background: var(--walnut);
  color: var(--paper-light);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background-color var(--duration-short) var(--ease-gentle), color var(--duration-short) var(--ease-gentle);
}

.category-apply:hover {
  background: var(--ink-deep);
}

.category-results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem 0.9rem;
}

.category-results-count {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.category-reset {
  color: var(--brick);
  font-size: var(--text-sm);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.category-product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.1rem, 2vw, 1.45rem) 1.1rem;
  grid-auto-flow: row;
}

.category-product-grid__item {
  display: flex;
  min-width: 0;
}

.category-product-grid .product-card {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.category-product-grid .product-card__image-wrap {
  flex: 0 0 auto;
  aspect-ratio: 5 / 4;
  background: var(--paper-light);
}

.category-product-grid .product-card__image-link {
  width: 100%;
  height: 100%;
}

.category-product-grid .product-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-product-grid .product-card__details {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding-top: 0.7rem;
}

.category-product-grid .product-card__heading {
  position: relative;
  display: block;
  padding-right: 44px;
}
.category-product-grid .product-card__heading h3 {
  display: -webkit-box;
  grid-column: 1;
  min-height: 0;
  overflow: hidden;
  font-family: var(--body);
  font-size: clamp(.85rem,1.1vw,1rem);
  font-weight: 400;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.category-product-grid .product-card__price { display: grid; justify-items: start; margin-top: .25rem; padding: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.category-product-grid .price-label { display: none; }
.category-product-grid .price-value { font-size: .95rem; font-weight: 600; }
.category-product-grid .favorite-toggle { position: absolute; top: -.7rem; right: 0; width: 44px; height: 44px; border: 0; background: transparent; }

.category-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  min-height: 92px;
  padding-block: 1.6rem;
}

.category-pagination p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.category-pagination__previous,
.category-pagination__next,
.category-pagination__end {
  color: var(--walnut);
  font-size: var(--text-sm);
}

.category-pagination__previous {
  justify-self: start;
}

.category-pagination__next,
.category-pagination__end {
  justify-self: end;
}

.category-pagination__next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--walnut);
  border-radius: var(--radius-pill);
  background: var(--paper-light);
  transition: background-color var(--duration-short) var(--ease-gentle), color var(--duration-short) var(--ease-gentle);
}

.category-pagination__next:hover {
  background: var(--walnut);
  color: var(--paper-light);
}

.category-pagination__next[aria-disabled="true"] {
  cursor: wait;
  opacity: 0.7;
}

.category-pagination__next[hidden],
.category-pagination__end[hidden] {
  display: none;
}

.category-empty {
  padding: clamp(2.75rem, 6vw, 5rem) 1.25rem;
  background: var(--paper-deep);
  text-align: center;
}

.category-empty .eyebrow {
  color: var(--text-soft);
}

.category-empty h2 {
  margin: 0.55rem 0;
  color: var(--ink-deep);
  font-family: var(--display);
  font-size: var(--title-sm);
  font-weight: 500;
}

.category-empty p {
  color: var(--muted);
}

.category-apply--link {
  margin-top: 0.7rem;
}

.category-story { display: grid; grid-template-columns: 42% minmax(0,1fr); min-height: 300px; margin-block: 1.5rem 0; overflow: hidden; border-radius: var(--radius); background: var(--paper-deep); }
.category-story__landscape { position: relative; min-width: 0; overflow: hidden; }
.category-story__landscape img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.category-story__content { position: relative; display: grid; align-items: center; isolation: isolate; }
.category-story__photo { position: absolute; inset: 0; z-index: -1; }
.category-story__photo img { width: 100%; height: 100%; object-fit: cover; object-position: right; }
.category-story__photo::after { position: absolute; inset: 0; background: linear-gradient(90deg,var(--paper) 0%,rgb(var(--paper-rgb)/95%) 48%,rgb(var(--paper-rgb)/25%) 100%); content: ""; }
.category-story__copy { position: relative; max-width: 36rem; padding: 2rem 2.5rem; }
.category-story h2 { margin: .6rem 0 .75rem; font-size: clamp(2rem,3vw,3.3rem); font-weight: 450; }
.category-story p { max-width: 29rem; margin-bottom: 1rem; font-size: .95rem; line-height: 1.5; }
.category-story .button { border-radius: var(--radius-pill); background: var(--ink-deep); }
@media(max-width:760px) {
  .category-story { grid-template-columns: 1fr; }
  .category-story__landscape { height: 190px; }
  .category-story__copy { padding: 1.6rem 1.2rem; }
  .category-story__photo::after { background: linear-gradient(90deg,var(--paper),rgb(var(--paper-rgb)/90%) 60%,rgb(var(--paper-rgb)/70%)); }
}

@media (max-width: 900px) {
  .category-themes__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .category-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.8rem 0.95rem;
  }

  .category-masthead__layout {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 32%);
    gap: 1.5rem;
  }

  .category-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-search {
    grid-column: 1 / -1;
  }

  .category-apply {
    justify-self: start;
  }
}

@media (max-width: 560px) {
  .category-masthead {
    padding-block: 0.9rem 1.25rem;
  }

  .category-masthead .breadcrumbs {
    margin-bottom: 0.8rem;
  }

  .category-masthead__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .category-masthead h1 {
    max-width: 12ch;
    font-size: clamp(2.4rem, 11vw, 3.4rem);
  }

  .category-masthead__photo {
    max-height: none;
    aspect-ratio: 1.9 / 1;
  }

  .category-themes__list {
    gap: 0.45rem;
  }

  .category-theme {
    min-height: 96px;
    font-size: 0.75rem;
    gap: 0.5rem;
  }

  .category-theme__symbol {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
  }

  .category-theme__icon {
    width: 24px;
    height: 24px;
  }

  .category-toolbar {
    gap: 0.7rem;
    padding-top: 1rem;
  }

  .category-toolbar--native .category-filter {
    display: grid;
    flex: 1 1 calc(50% - 0.7rem);
    max-width: none;
  }

  .category-toolbar--native .category-filter select {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .category-results-heading {
    padding-block: 0.75rem;
  }

  .category-product-grid {
    gap: 1.35rem 0.7rem;
  }

  .category-product-grid .product-card__heading {
    padding-right: 34px;
    min-height: 0;
  }

  .category-product-grid .product-card__heading h3 {
    min-height: 0;
    font-size: .85rem;
  }

  .category-product-grid .product-card__price {
    justify-items: start;
    padding: 0;
    text-align: left;
  }

  .category-product-grid .favorite-toggle {
    width: 44px;
    height: 44px;
    right: -5px;
  }

  .category-pagination {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.6rem;
    padding-block: 1.4rem;
  }

  .category-pagination__previous,
  .category-pagination__next,
  .category-pagination__end {
    justify-self: center;
  }

  .category-pagination__previous--empty {
    display: none;
  }

}

/* Compact native toolbar, aligned with the approved category reference. */
.category-toolbar--native { gap: 1rem; align-items: center; padding-block: 1.3rem 1.5rem; }
.category-toolbar__label { color: var(--charcoal); font-size: .84rem; font-weight: 600; }
.category-toolbar--native .category-filter { max-width: none; flex: 0 1 auto; }
.category-toolbar--native .category-filter select { width: auto; min-width: 7rem; max-width: 14rem; min-height: 36px; padding: .4rem 2.1rem .4rem 1rem; border-radius: 14px; font-size: .78rem; line-height: 1.3; }
.category-toolbar--native .category-filter--sort { margin-left: auto; padding-left: 1.8rem; border-left: 1px solid var(--line); gap: 1rem; }
.category-filter--sort > span { color: var(--charcoal); font-size: .84rem; font-weight: 600; white-space: nowrap; }
.category-toolbar--native .category-filter--sort select { width: 10rem; }
.category-toolbar__count { margin: 0 0 0 1.2rem; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.category-results-heading--native { padding: 0; }
.category-results-heading--native:has(.category-reset) { padding-bottom: 1rem; }
@media (max-width: 1100px) {
  .category-toolbar--native { gap: .65rem; }
  .category-toolbar--native .category-filter--sort { padding-left: 1rem; gap: .6rem; }
  .category-toolbar__count { margin-left: 0; }
}
@media (max-width: 760px) {
  .category-toolbar--native { display: flex; flex-wrap: wrap; gap: .65rem; }
  .category-toolbar__label { flex-basis: 100%; }
  .category-toolbar--native .category-filter { display: flex; flex: 1 1 calc(50% - .65rem); }
  .category-toolbar--native .category-filter select { width: 100%; max-width: none; min-width: 0; min-height: 44px; }
  .category-toolbar--native .category-filter--sort { margin-left: 0; padding-left: 0; border: 0; flex-basis: 100%; justify-content: flex-end; }
  .category-toolbar--native .category-filter--sort select { width: auto; flex: 1; max-width: 14rem; }
  .category-toolbar__count { margin-left: auto; }
}

@media (max-width: 760px) {
  .category-toolbar--native .category-filter--sort,
  .category-toolbar--native .category-toolbar__count { display: none; }
  .category-toolbar--native { padding-bottom: .85rem; }
}
