/* Equipment catalog (/equipment/): sticky category bar, catalog sections, item
   cards and the item dialog. Shared tokens, page intro, category bar, product
   card basics, gallery, hexagon lists and the call-to-action band come from
   site.css. */

/* Height of the sticky category bar, so jumps to a category land below it. */
:root {
  --category-bar-height: 4rem;
}

html {
  scroll-padding-top: calc(var(--category-bar-height) + 1rem);
  scrollbar-gutter: stable;
}

/* Keep the page still behind an open item. */
html:has(.item-dialog[open]) {
  overflow: hidden;
}

equipment-catalog {
  display: block;
}

/* ---------- Category bar ---------- */

/* The shared category bar (site.css) sticks to the top of the catalog, and each
   link shows its item count. */
.category-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 2px 12px rgb(28 58 44 / 0.07);
}

.category-bar__count {
  font-size: 0.65625rem;
  font-weight: 700;
  color: var(--amber-700);
}

.category-bar a[aria-current] .category-bar__count {
  color: var(--gold-500);
}

/* ---------- Catalog sections ---------- */

.catalog {
  display: grid;
  gap: 1.875rem;
  padding-block: 1.625rem 2.25rem;
}

.catalog-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--green-900);
}

.catalog-section__head h2 {
  font-size: 1.5rem;
}

.catalog-section__count {
  font-size: 0.65625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber-700);
}

.catalog-section__note {
  display: none;
}

/* ---------- Item cards ---------- */

/* Phones: photo beside the text in compact rows. */
.equipment-card {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  align-items: center;
  gap: 0.875rem;
  padding-block: 0.875rem;
  border-bottom: 1px solid var(--line);
}

.equipment-card__media {
  display: grid;
  place-items: center;
  padding: 0.5rem;
  background: var(--cream-50);
  border: 1px solid var(--line);
  transition: border-color 0.2s;
}

.equipment-card__media img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.equipment-card:hover .equipment-card__media {
  border-color: var(--line-strong);
}

.equipment-card h3 {
  font: 500 1.1875rem/1.15 var(--font-serif);
  letter-spacing: -0.01em;
}

/* SKUs keep their letter case (351024a), so the label is typed in capitals
   instead of transformed. */
.equipment-card .equipment-card__sku {
  margin-top: 0.1875rem;
  font-size: 0.71875rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.12em;
  color: var(--amber-700);
}

.equipment-card .equipment-card__summary {
  margin-top: 0.1875rem;
  font-size: 0.84375rem;
  line-height: 1.5;
}

/* ---------- Item dialog ---------- */

/* Phones: the dialog fills the screen. */
.item-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cream-100);
  border: 0;
  color: var(--ink-900);
}

.item-dialog::backdrop {
  background: rgb(15 28 21 / 0.66);
}

.item-dialog__bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem 0.625rem var(--gutter);
  background: var(--cream-50);
  border-bottom: 1px solid var(--line);
}

.item-dialog__category {
  display: flex;
  align-items: center;
  gap: 0.5625rem;
  font-size: 0.65625rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber-700);
}

.item-dialog__category .hex {
  width: 0.875rem;
}

.item-dialog__close {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
  padding: 0;
  background: none;
  border: 0;
  font-size: 0.71875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-600);
  cursor: pointer;
}

/* Phones show only the icon; the label stays for screen readers. */
.item-dialog__close-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.item-dialog__close-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--cream-100);
  border: 1px solid var(--line-strong);
  color: var(--green-900);
  transition: border-color 0.2s;
}

.item-dialog__close-icon::before {
  content: "";
  width: 1rem;
  height: 1rem;
  background:
    linear-gradient(45deg, transparent calc(50% - 1px), currentColor calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(-45deg, transparent calc(50% - 1px), currentColor calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}

.item-dialog__close:hover .item-dialog__close-icon {
  border-color: var(--green-900);
}

/* Phones: Contact sales stays pinned to the bottom of the screen. */
.item-dialog__actions {
  position: sticky;
  bottom: 0;
  padding: 0.75rem var(--gutter) 1rem;
  background: var(--cream-100);
  border-top: 1px solid var(--line);
}

.item-dialog__actions .btn {
  width: 100%;
}

/* ---------- Item details ---------- */

.item-detail__media {
  padding: 1.125rem var(--gutter) 0;
}

/* The row is capped at the stage's height. Left to size itself, it grows to the
   photo's own height, and any square or upright photo spills past the frame. */
.item-detail .gallery__stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  height: 16.625rem;
  padding: 1.125rem;
}

.item-detail .gallery__image {
  width: auto;
  max-height: 100%;
  object-fit: contain;
}

.item-detail .gallery__thumbs {
  grid-auto-columns: 4.75rem;
}

.item-detail__summary {
  padding: 1.375rem var(--gutter) 1.5rem;
}

.item-detail__summary h2 {
  font-size: clamp(1.875rem, 1.35rem + 1.9vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.item-detail__sku {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--ink-600);
}

.item-detail__sku :empty {
  display: none;
}

.sku-chip {
  padding: 0.4375rem 0.6875rem;
  background: var(--cream-50);
  border: 1px solid var(--line-strong);
  font-size: 0.71875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--amber-700);
}

.item-detail__lead {
  margin-top: 0.875rem;
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--ink-700);
}

.item-detail__contact {
  display: none;
}

/* Sizes that each have their own SKU, as choice chips (site.css). */
.size-options {
  min-width: 0;
  margin: 1.5rem 0 0;
  padding: 1.125rem 0 0;
  border: 0;
  border-top: 1px solid var(--green-900);
}

.size-options legend {
  float: left;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-600);
}

.size-options__list {
  display: grid;
  clear: both;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

/* Detail sections: overview, features, notes and specifications. */
.item-detail__sections > * {
  padding: 1.5rem var(--gutter);
  border-top: 1px solid var(--line);
}

.item-detail__sections > :nth-child(odd) {
  background: var(--cream-50);
}

.item-detail__sections h3 {
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
}

.detail-block p {
  font-size: 0.96875rem;
  line-height: 1.7;
  color: var(--ink-700);
}

.detail-block__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 1rem;
  margin-bottom: 0.75rem;
}

.item-detail__sections .detail-block__head h3 {
  margin-bottom: 0;
}

.detail-block .detail-block__head p {
  font-size: 0.8125rem;
  color: var(--ink-600);
}

.detail-block__head strong {
  color: var(--amber-700);
}

.note-list li {
  padding-block: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.90625rem;
  line-height: 1.6;
  color: var(--ink-700);
}

.note-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

/* Specification tables. Label and value rows by default. */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--green-900);
  font-variant-numeric: lining-nums;
}

.spec-table th,
.spec-table td {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: baseline;
}

.spec-table tbody th {
  width: 44%;
  padding-right: 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-600);
}

.spec-table td {
  font-size: 0.9375rem;
}

/* Tables with a column per size or model. */
.spec-scroll {
  overflow-x: auto;
}

.spec-table--columns {
  background: var(--cream-50);
  border: 1px solid var(--line-strong);
}

.spec-table--columns th,
.spec-table--columns td {
  padding: 0.75rem 0.625rem;
}

.spec-table--columns thead th {
  background: var(--green-900);
  border-bottom: 0;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  color: var(--cream-50);
}

.spec-table--columns thead th:first-child {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  color: var(--sage-400);
}

.spec-table--columns tbody th {
  width: auto;
}

.spec-table--columns td {
  text-align: center;
}

.spec-table--columns td:first-child {
  text-align: left;
}

.detail-block .spec-note {
  margin-top: 0.875rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-600);
}

/* Phones: a size table shows just the selected size, as label and value rows. */
@media (max-width: 47.99rem) {
  .spec-table--sizes {
    background: none;
    border: 0;
    border-top: 1px solid var(--green-900);
  }

  .spec-table--sizes thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .spec-table--sizes :is(th, td) {
    padding-inline: 0;
  }

  .spec-table--sizes tbody th {
    width: 44%;
    padding-right: 1rem;
  }

  .spec-table--sizes td:not(.is-selected) {
    display: none;
  }

  .spec-table--sizes td {
    text-align: left;
  }

  .spec-table--sizes .spec-table__sku td {
    font-weight: 700;
    color: var(--amber-700);
  }
}

.item-detail__back {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  margin: 1.625rem var(--gutter) 1.875rem;
  padding-block: 1rem;
  border-top: 1px solid var(--green-900);
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--green-900);
}

.item-detail__back span {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--amber-700);
}

/* ---------- Breakpoints ---------- */

@media (min-width: 40rem) {
  .equipment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
  }

  .equipment-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: var(--cream-50);
    border: 1px solid var(--line);
    transition: border-color 0.2s, box-shadow 0.2s;
  }

  .equipment-card:hover {
    border-color: var(--green-900);
    box-shadow: 0 8px 24px rgb(28 58 44 / 0.08);
  }

  .equipment-card__media {
    padding: 1.125rem;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .equipment-card__media img {
    aspect-ratio: 4 / 3;
  }

  .equipment-card__body {
    flex: 1;
    padding: 1rem 1.125rem 1.125rem;
  }

  .equipment-card h3 {
    font-size: 1.3125rem;
  }

  .equipment-card .equipment-card__sku,
  .equipment-card .equipment-card__summary {
    margin-top: 0.375rem;
  }
}

/* Tablets and up: the dialog sits over the catalog instead of filling the screen. */
@media (min-width: 48rem) {
  .equipment-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .item-dialog {
    width: min(100% - 3rem, 72.5rem);
    height: fit-content;
    max-height: calc(100dvh - 3rem);
    margin: auto;
    border: 1px solid var(--line-strong);
    box-shadow: 0 36px 96px rgb(12 24 18 / 0.5);
  }

  .item-dialog__bar {
    padding: 0.875rem 2rem;
  }

  .item-dialog__category {
    gap: 0.6875rem;
    font-size: 0.71875rem;
    letter-spacing: 0.18em;
  }

  .item-dialog__category .hex {
    width: 1rem;
  }

  .item-dialog__close-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  .item-dialog__close-icon {
    width: 2.25rem;
    height: 2.25rem;
  }

  .item-dialog__actions {
    display: none;
  }

  .item-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    column-gap: 2.5rem;
    padding: 2rem;
  }

  .item-detail__media,
  .item-detail__summary {
    padding: 0;
  }

  .item-detail .gallery__stage {
    height: 20rem;
    padding: 1.5rem;
  }

  .item-detail__contact {
    display: inline-flex;
    margin-top: 1.875rem;
    padding: 1.0625rem 1.875rem;
  }

  .item-detail__sections {
    grid-column: 1 / -1;
    margin-top: 2.5rem;
    border-top: 1px solid var(--line);
  }

  .item-detail__sections > *,
  .item-detail__sections > :nth-child(odd) {
    padding: 2rem 0 0;
    background: none;
    border-top: 0;
  }

  .item-detail__back {
    display: none;
  }

  .spec-table--sizes thead th.is-selected {
    background: var(--gold-500);
    color: var(--ink-900);
    font-weight: 700;
  }

  .spec-table--sizes td.is-selected {
    background: color-mix(in srgb, var(--gold-500) 14%, var(--cream-50));
    font-weight: 600;
  }

  .spec-table--sizes .spec-table__sku td.is-selected {
    font-weight: 700;
    color: var(--amber-700);
  }
}

@media (min-width: 64rem) {
  equipment-catalog {
    margin-top: 3.625rem;
  }

  .catalog {
    grid-template-columns: repeat(2, 1fr);
    gap: 4.375rem 1.75rem;
    padding-block: 3.75rem 5.75rem;
  }

  .catalog-section {
    grid-column: 1 / -1;
  }

  .catalog-section__head {
    column-gap: 1.125rem;
    margin-bottom: 1.75rem;
    padding: 0 0 0.875rem;
    border-top: 0;
    border-bottom: 1px solid var(--green-900);
  }

  .catalog-section__head h2 {
    font-size: 2.0625rem;
  }

  .catalog-section__count {
    font-size: 0.78125rem;
  }

  .catalog-section__note {
    display: block;
    margin-left: auto;
    font-size: 0.875rem;
    color: var(--ink-600);
  }

  .equipment-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
    margin-top: 0;
  }

  /* Two-item categories share a row. */
  .catalog-section--half {
    grid-column: auto;
  }

  .catalog-section--half .equipment-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* A three-item category puts its heading in the first column. */
  .catalog-section--aside {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: start;
    column-gap: 1.75rem;
  }

  .catalog-section--aside .catalog-section__head {
    display: block;
    margin: 0;
    padding: 1rem 0 0;
    border-top: 1px solid var(--green-900);
    border-bottom: 0;
  }

  .catalog-section--aside .catalog-section__count {
    display: block;
    margin-top: 0.625rem;
  }

  .catalog-section--aside .catalog-section__note {
    margin-top: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
  }

  .catalog-section--aside .equipment-grid {
    grid-column: span 3;
    grid-template-columns: repeat(3, 1fr);
  }

  .item-dialog__bar {
    padding: 1rem 2.5rem;
  }

  .item-detail {
    column-gap: 3.25rem;
    padding: 2.75rem 2.5rem;
  }

  .item-detail .gallery__stage {
    height: 25rem;
    padding: 1.875rem;
  }

  .item-detail .gallery__thumbs {
    grid-auto-columns: 6.25rem;
  }

  .item-detail__sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    column-gap: 3.5rem;
    margin-top: 3rem;
  }

  .item-detail__sections > *,
  .item-detail__sections > :nth-child(odd) {
    padding-top: 2.5rem;
  }

  .detail-block--wide {
    grid-column: 1 / -1;
  }

  .item-detail__sections h3 {
    margin-bottom: 1.25rem;
    font-size: 1.875rem;
  }

  .detail-block--wide .hex-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 3.5rem;
  }

  .detail-block--wide .hex-list li {
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }

  .item-detail__sections .detail-block--note {
    margin-top: 2.5rem;
    padding: 1.5rem 1.625rem;
    background: var(--cream-50);
    border: 1px solid var(--line);
    border-top: 3px solid var(--green-900);
  }

  .item-detail__sections .detail-block--note h3 {
    margin-bottom: 0.875rem;
    font-size: 1.375rem;
  }
}

@media (min-width: 75rem) {
  :root {
    --category-bar-height: 3.5rem;
  }

  .category-bar__count {
    font-size: 0.71875rem;
    letter-spacing: 0.06em;
    color: var(--ink-600);
  }

  .category-bar a[aria-current] .category-bar__count {
    color: var(--amber-700);
  }
}
