.hw-body {
  --hw-bg: #0c0c0d;
  --hw-cell: #121213;
  --hw-ink: #ecebe6;
  --hw-dim: #8b8a85;
  --hw-faint: #5c5b57;
  --hw-rule: #242426;
  --hw-red: #e5432a;
  --hw-yellow: #f0be2c;
  --hw-blue: #3a66e0;
  background: var(--hw-bg);
}

.hw-body::before,
.hw-body::after {
  display: none;
}

.hw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header cart */
.hw-cart-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 5px 0 14px;
  border: 1px solid var(--hw-rule);
  color: var(--hw-ink);
  font-size: 14px;
  transition: border-color 0.15s;
}

.hw-cart-link:hover {
  border-color: var(--hw-ink);
}

.hw-cart-link span {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  background: var(--hw-red);
  color: #fff;
  font: 600 12px var(--font-mono);
}

/* Head */
.hw {
  padding-bottom: 96px;
}

.hw-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 132px;
  align-items: end;
  gap: 28px;
  padding: 52px 0 28px;
}

.hw-head h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.hw-head h1::after {
  content: '';
  display: inline-block;
  width: 0.17em;
  height: 0.17em;
  margin-left: 0.06em;
  background: var(--hw-red);
}

.hw-search,
.hw-sort {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
  border-bottom: 1px solid var(--hw-rule);
  transition: border-color 0.15s;
}

.hw-search:focus-within,
.hw-sort:focus-within {
  border-color: var(--hw-ink);
}

.hw-search {
  gap: 12px;
}

.hw-search svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--hw-dim);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.hw-search input,
.hw-sort select {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--hw-ink);
  font-size: 15px;
  outline: none;
}

.hw-search input::placeholder {
  color: var(--hw-faint);
}

.hw-search input::-webkit-search-cancel-button {
  filter: grayscale(1) invert(1);
}

.hw-search kbd {
  padding: 1px 7px;
  border: 1px solid var(--hw-rule);
  color: var(--hw-faint);
  font: 11px var(--font-mono);
}

.hw-sort select {
  appearance: none;
  padding-right: 20px;
  cursor: pointer;
}

.hw-sort select option {
  background: var(--hw-cell);
}

.hw-sort::after {
  content: '';
  position: absolute;
  right: 2px;
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border: solid var(--hw-dim);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}

/* Category tabs */
.hw-tabs {
  display: flex;
  border-bottom: 1px solid var(--hw-rule);
  overflow-x: auto;
  scrollbar-width: none;
}

.hw-tabs::-webkit-scrollbar {
  display: none;
}

.hw-tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 14px 18px 13px;
  border: 0;
  background: none;
  color: var(--hw-dim);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s;
}

.hw-tabs button:first-child {
  padding-left: 0;
}

.hw-tabs button:hover,
.hw-tabs button[aria-pressed="true"] {
  color: var(--hw-ink);
}

.hw-tabs button[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  background: var(--hw-ink);
}

.hw-tabs button:first-child[aria-pressed="true"]::after {
  left: 0;
}

.hw-tabs sup {
  color: var(--hw-faint);
  font: 10px var(--font-mono);
}

.hw-tabs button:focus-visible {
  outline-offset: -2px;
}

/* Bauhaus category marks */
.hw-glyph {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
}

.hw-glyph[data-g="cpu"] { background: var(--hw-red); }
.hw-glyph[data-g="gpu"] { background: var(--hw-blue); border-radius: 50%; }
.hw-glyph[data-g="ram"] { height: 4px; width: 12px; background: var(--hw-yellow); }
.hw-glyph[data-g="storage"] { width: 12px; height: 6px; border-radius: 12px 12px 0 0; background: var(--hw-ink); }
.hw-glyph[data-g="motherboard"] { box-shadow: inset 0 0 0 2px var(--hw-ink); }
.hw-glyph[data-g="psu"] { width: 11px; background: var(--hw-yellow); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.hw-glyph[data-g="cooling"] { border-radius: 50%; box-shadow: inset 0 0 0 2px var(--hw-blue); }
.hw-glyph[data-g="fans"] { border-radius: 0 100% 0 0; background: var(--hw-red); }

/* Notices */
.hw-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 0;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--hw-rule);
  border-left: 3px solid var(--hw-red);
  background: var(--hw-cell);
  font-size: 14px;
}

.hw-notice p {
  flex: 1;
  margin: 0;
  line-height: 1.7;
}

.hw-notice button {
  flex: none;
  padding: 6px 12px;
  border: 1px solid var(--hw-rule);
  background: none;
  color: var(--hw-ink);
  cursor: pointer;
}

.hw-notice button[aria-label] {
  border: 0;
  padding: 0 4px;
  font-size: 20px;
  color: var(--hw-dim);
}

.hw-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 11px 16px;
  background: var(--hw-ink);
  color: var(--hw-bg);
  font-size: 13px;
  transform: translateX(-50%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: hw-toast 0.2s ease-out;
}

@keyframes hw-toast {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

/* Layout */
.hw-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 36px;
  align-items: start;
}

.hw-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  margin: 0;
  color: var(--hw-dim);
  font-size: 13px;
}

#hardwareResults {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

#hardwareTip a {
  margin-left: 12px;
  color: var(--hw-ink);
  border-bottom: 1px solid var(--hw-faint);
}

#hardwareTip a:hover {
  border-color: var(--hw-ink);
}

/* Product ledger */
.hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  border-top: 1px solid var(--hw-rule);
  border-left: 1px solid var(--hw-rule);
}

.hardware-product {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 156px;
  padding: 16px 16px 14px 18px;
  border-right: 1px solid var(--hw-rule);
  border-bottom: 1px solid var(--hw-rule);
  transition: background-color 0.15s;
}

.hardware-product:hover {
  background: var(--hw-cell);
}

.hardware-product[data-in-cart] {
  background: var(--hw-cell);
  box-shadow: inset 3px 0 0 var(--hw-red);
}

.hw-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--hw-dim);
  font-size: 12px;
}

.hw-tag span {
  margin-left: auto;
  color: var(--hw-faint);
  font: 11px var(--font-mono);
}

.hardware-product[data-in-cart] .hw-tag span {
  color: var(--hw-red);
  font-weight: 600;
}

.hardware-product h3 {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.hw-buy {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hw-buy strong {
  margin-right: auto;
  font: 600 21px var(--font-mono);
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.hw-buy small {
  font-size: 11px;
  font-weight: 400;
  color: var(--hw-dim);
  letter-spacing: 0;
}

.hw-buy small:first-child {
  margin-right: 4px;
}

.hw-add,
.hw-now {
  height: 36px;
  border: 1px solid var(--hw-rule);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.hw-add {
  width: 36px;
  background: none;
  color: var(--hw-ink);
  font-size: 19px;
  line-height: 1;
}

.hw-add:hover {
  border-color: var(--hw-ink);
}

.hw-now {
  padding: 0 14px;
  border-color: var(--hw-ink);
  background: var(--hw-ink);
  color: var(--hw-bg);
  font-size: 13px;
  font-weight: 700;
}

.hw-now:hover {
  border-color: var(--hw-red);
  background: var(--hw-red);
  color: #fff;
}

.hw-add:disabled,
.hw-now:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.hw-empty {
  padding: 56px 0;
  text-align: center;
  color: var(--hw-dim);
}

.hw-empty button {
  border: 0;
  border-bottom: 1px solid var(--hw-faint);
  background: none;
  color: var(--hw-ink);
  cursor: pointer;
}

/* Cart */
.hw-cart {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 116px);
  margin-top: 48px;
  overflow-y: auto;
  border: 1px solid var(--hw-rule);
  background: var(--hw-cell);
  scroll-margin-top: 96px;
}

.hw-cart h2 {
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--hw-rule);
  font-size: 15px;
}

.hw-cart-empty {
  margin: 0;
  padding: 26px 18px;
  color: var(--hw-dim);
  font-size: 13px;
}

.hw-cart-empty b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--hw-rule);
  color: var(--hw-ink);
  font-weight: 400;
}

.hw-line {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  grid-template-areas: "g name rm" ". qty price";
  gap: 10px 10px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hw-rule);
}

.hw-line .hw-glyph { grid-area: g; align-self: start; margin-top: 6px; }

.hw-line h3 {
  grid-area: name;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.hw-line strong {
  grid-area: price;
  font: 600 13px var(--font-mono);
  text-align: right;
}

.hw-remove {
  grid-area: rm;
  align-self: start;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--hw-faint);
  font-size: 12px;
  cursor: pointer;
}

.hw-remove:hover {
  color: var(--hw-red);
}

.hw-qty {
  grid-area: qty;
  display: inline-flex;
  justify-self: start;
  border: 1px solid var(--hw-rule);
}

.hw-qty button,
.hw-qty input {
  height: 28px;
  border: 0;
  background: none;
  color: var(--hw-ink);
}

.hw-qty button {
  width: 28px;
  cursor: pointer;
}

.hw-qty button:disabled {
  color: var(--hw-faint);
  cursor: default;
}

.hw-qty input {
  width: 36px;
  border-inline: 1px solid var(--hw-rule);
  text-align: center;
  font: 13px var(--font-mono);
  -moz-appearance: textfield;
}

.hw-qty input::-webkit-outer-spin-button,
.hw-qty input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.hw-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
}

.hw-total span {
  color: var(--hw-dim);
  font-size: 12px;
}

.hw-total strong {
  font: 600 20px var(--font-mono);
  letter-spacing: -0.02em;
}

.hw-cart form {
  padding: 0 18px 18px;
}

.hw-cart fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
  min-width: 0;
  margin: 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--hw-rule);
}

.hw-cart legend {
  float: left;
  grid-column: 1 / -1;
  padding: 0;
  color: var(--hw-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.hw-wide {
  grid-column: 1 / -1;
}

.hw-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--hw-dim);
  font-size: 12px;
}

.hw-field input,
.hw-field textarea {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--hw-rule);
  background: var(--hw-bg);
  color: var(--hw-ink);
  font-size: 14px;
  resize: vertical;
  transition: border-color 0.15s;
}

.hw-field input:focus,
.hw-field textarea:focus {
  border-color: var(--hw-ink);
  outline: none;
}

.hw-error {
  margin: 0;
  color: #ff8b6e;
  font-size: 13px;
  line-height: 1.6;
}

.hw-pay {
  height: 48px;
  border: 0;
  background: var(--hw-red);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.15s;
}

.hw-pay:hover {
  background: #f4532f;
}

.hw-pay:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hw-fine {
  margin: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--hw-rule);
  color: var(--hw-faint);
  font-size: 12px;
  line-height: 1.7;
}

.hw-fine a {
  color: var(--hw-dim);
  border-bottom: 1px solid var(--hw-faint);
}

/* Mobile checkout bar */
.hw-bar {
  display: none;
}

@media (max-width: 1100px) {
  .hw-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .hw-cart {
    position: static;
    max-height: none;
    width: 100%;
    max-width: 560px;
    margin: 32px auto 0;
    scroll-margin-top: 170px;
  }

  .hw-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px max(20px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: var(--hw-ink);
    color: var(--hw-bg);
  }

  .hw-bar span {
    font: 13px var(--font-mono);
  }

  .hw-bar strong {
    margin-right: auto;
    font: 700 16px var(--font-mono);
  }

  .hw-bar em {
    padding: 9px 18px;
    background: var(--hw-red);
    color: #fff;
    font-style: normal;
    font-weight: 700;
    font-size: 14px;
  }

  .hw-toast {
    bottom: 84px;
  }
}

@media (max-width: 720px) {
  .hw-head {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 20px 16px;
    padding-top: 28px;
  }

  .hw-head h1 {
    grid-column: 1 / -1;
  }

  .hw-search kbd {
    display: none;
  }

  .hw-cart-link {
    height: 34px;
    padding-left: 10px;
    font-size: 13px;
  }

  .hw-tabs button {
    padding-inline: 12px;
  }

  .hw-tabs button[aria-pressed="true"]::after {
    left: 12px;
    right: 12px;
  }

  .hw-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .hardware-product {
    padding: 14px;
  }

  .hardware-product h3 {
    font-size: 14px;
  }

  .hw-buy {
    flex-wrap: wrap;
  }

  .hw-buy strong {
    flex-basis: 100%;
    font-size: 19px;
  }

  .hw-now {
    flex: 1;
  }

  .hw-meta {
    flex-wrap: wrap;
    gap: 4px 16px;
    padding: 10px 0;
  }
}

@media (max-width: 340px) {
  .hw-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hw-toast {
    animation: none;
  }
}
