/* ==========================================================================
   Wizmoto — Homepage marketplace
   Loaded only by templates/home/index.html. Everything is scoped under .hm
   and built on the site tokens from style.css (--theme-color1,
   --theme-color-dark, --text-color2, --theme-light-background, DM Sans) so
   the page stays in the existing visual identity.
   ========================================================================== */

.hm {
  --hm-primary: var(--theme-color1, #405ff2);
  --hm-primary-hover: #2f4bd9;
  --hm-primary-soft: rgba(64, 95, 242, 0.08);
  --hm-primary-tint: #eef1ff;
  --hm-ring: 0 0 0 3px rgba(64, 95, 242, 0.35);
  --hm-ink: var(--theme-color-dark, #050b20);
  --hm-text: #2b3245;
  --hm-muted: var(--text-color2, #616670);
  --hm-surface: #ffffff;
  --hm-bg: var(--theme-light-background, #f2f3f5);
  --hm-border: rgba(5, 11, 32, 0.1);
  --hm-border-strong: rgba(5, 11, 32, 0.2);
  --hm-radius: 16px;
  --hm-radius-sm: 12px;
  --hm-shadow: 0 1px 2px rgba(5, 11, 32, 0.04), 0 8px 24px rgba(5, 11, 32, 0.06);
  --hm-shadow-hover: 0 2px 4px rgba(5, 11, 32, 0.06), 0 16px 32px rgba(5, 11, 32, 0.12);

  font-family: var(--text-font, "DM Sans", sans-serif);
  color: var(--hm-ink);
  -webkit-font-smoothing: antialiased;
}

.hm h1,
.hm h2,
.hm h3 {
  font-family: var(--title-font, "DM Sans", sans-serif);
  color: var(--hm-ink);
  margin: 0;
}

/* style.css makes every heading position: relative, which would trap the
   stretched card/article links (their ::after) inside the heading. */
.hm .hm-card__title,
.hm .hm-mag__title {
  position: static;
}

.hm p {
  margin: 0;
}

/* Anchored sections clear the sticky site header. */
.hm [id] {
  scroll-margin-top: 96px;
}

.hm a {
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

/* One visible focus style for every interactive element on the page.
   style.css removes outlines site-wide (":focus { outline: none !important }"
   and the same on every button), so these restate them with !important;
   the .hm scope wins on specificity. */
.hm a:focus-visible,
.hm button:focus-visible {
  outline: 3px solid var(--hm-primary) !important;
  outline-offset: 2px;
}

.hm .hm-card__fav:focus-visible {
  outline-color: #fff !important;
  box-shadow: 0 0 0 5px var(--hm-primary);
}

/* ── Sections ─────────────────────────────────────────────────────────── */
.hm-section {
  padding: 56px 0;
  background: var(--hm-surface);
}

.hm-section--tight {
  padding: 40px 0;
}

.hm-section--muted {
  background: var(--hm-bg);
}

.hm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.hm-head__title {
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hm-head__sub {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--hm-muted);
}

.hm-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--hm-primary);
  text-decoration: none;
  white-space: nowrap;
}

.hm-link:hover {
  color: var(--hm-primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.hm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: var(--hm-radius-sm);
  border: 2px solid transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.hm-btn--primary {
  background: var(--hm-primary);
  color: #fff;
}

.hm-btn--primary:hover {
  background: var(--hm-primary-hover);
  color: #fff;
}

.hm-btn--outline {
  background: var(--hm-surface);
  border-color: var(--hm-primary);
  color: var(--hm-primary);
}

.hm-btn--outline:hover {
  background: var(--hm-primary-tint);
  color: var(--hm-primary-hover);
}

.hm-btn[disabled] {
  cursor: progress;
  opacity: 0.85;
}

/* ══ 2. Search hero ══════════════════════════════════════════════════════ */
/* Solid brand blue (its darker shade, as --hm-primary-hover), set apart from
   the navy header. White title 6.7:1, the 86% white lead 5.4:1. */
.hm-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #2f4bd9;
  padding: 28px 0 26px;
}

.hm-hero__copy {
  max-width: 760px;
  margin-bottom: 14px;
}

.hm .hm-hero__title {
  color: #fff;
  font-size: clamp(28px, 3.1vw, 40px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.hm-hero__lead {
  margin-top: 6px !important;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.45;
}

/* Search panel.
   Wide screens: [keyword ×4 | submit] / [category brand model | price city]
   / extra filters / actions. Items are placed by column only, so the
   collapsed extra-filters row leaves no empty gap behind. */
.hm-search {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 18px;
  padding: 18px 22px 8px;
  background: var(--hm-surface);
  border-radius: 20px;
  box-shadow: 0 24px 48px rgba(5, 11, 32, 0.28);
}

.hm-field--q {
  grid-column: 1 / 5;
  grid-row: 1;
}

.hm-search__submit {
  grid-column: 5 / 6;
  grid-row: 1;
  align-self: end;
}

.hm-search__extra,
.hm-search__actions {
  grid-column: 1 / -1;
}

.hm-search__extra {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px dashed var(--hm-border-strong);
  min-width: 0;
}

.hm-search__extra[hidden] {
  display: none;
}

.hm-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hm-field__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--hm-ink);
  margin: 0;
}

.hm-field__label--q {
  font-size: 15px;
}

/* Price and location are refinements: quieter labels, set apart from
   category / brand / model by a hairline. */
.hm-field--more .hm-field__label {
  color: var(--hm-muted);
  font-weight: 600;
}

.hm-field--price::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: -10px;
  border-left: 1px solid var(--hm-border);
}

.hm-field__control {
  position: relative;
}

.hm-field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hm-muted);
  pointer-events: none;
}

/* Inputs and selects share one shape. style.css / custom-fix.css style every
   bare <select> with !important padding and radius, so ours restate theirs. */
.hm .hm-input,
.hm .hm-select {
  width: 100%;
  height: 46px;
  margin: 0;
  border: 1px solid var(--hm-border-strong);
  border-radius: var(--hm-radius-sm) !important;
  background-color: var(--hm-surface);
  color: var(--hm-ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.2;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.hm .hm-input {
  padding: 0 14px;
}

.hm .hm-field__control--icon .hm-input {
  padding-left: 42px;
}

/* The keyword field is the primary control. */
.hm .hm-input--q {
  height: 54px;
  font-size: 17px;
  border-width: 2px;
  border-color: rgba(64, 95, 242, 0.45);
}

.hm .hm-field__control--icon .hm-input--q {
  padding-left: 46px;
}

.hm-field--q .hm-field__icon {
  left: 16px;
  color: var(--hm-primary);
}

.hm .hm-input::placeholder {
  color: #7a8090;
  opacity: 1;
}

.hm .hm-select {
  padding: 0 40px 0 14px !important;
  background-position: right 14px center;
  background-size: 16px;
  text-overflow: ellipsis;
}

.hm .hm-input:hover,
.hm .hm-select:hover:not(:disabled) {
  border-color: rgba(5, 11, 32, 0.38);
}

.hm .hm-input--q:hover {
  border-color: rgba(64, 95, 242, 0.7);
}

.hm .hm-input:focus,
.hm .hm-select:focus {
  border-color: var(--hm-primary) !important;
  box-shadow: var(--hm-ring);
  outline: none;
}

.hm .hm-select:disabled {
  background-color: #f5f6f8;
  color: #8a8f9c;
  cursor: not-allowed;
}

.hm-search__submit {
  min-height: 54px;
  padding: 0 20px;
}

.hm-search__submit-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hm-search__actions {
  display: flex;
  align-items: center;
  gap: 4px 20px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.hm-search__more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--hm-primary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.hm-search__more:hover {
  color: var(--hm-primary-hover);
}

.hm-search__more[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.hm-search__more svg {
  transition: transform 0.2s ease;
}

.hm-search__more-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--hm-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.hm-search__more-count[hidden] {
  display: none;
}

.hm-search__advanced {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 15px;
  font-weight: 600;
  color: var(--hm-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hm-search__advanced:hover {
  color: var(--hm-ink);
}

/* ══ 3. Categories ═══════════════════════════════════════════════════════ */
/* Kept compact so the first listings start near the top of a desktop screen. */
.hm-categories {
  padding: 28px 0 32px;
}

.hm-categories .hm-head {
  margin-bottom: 16px;
}

.hm-categories + .hm-section {
  padding-top: 40px;
}

.hm-cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hm-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  height: 100%;
  padding: 16px 12px 14px;
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-surface);
  color: var(--hm-ink);
  text-align: center;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.hm-cat:hover {
  border-color: rgba(64, 95, 242, 0.45);
  box-shadow: var(--hm-shadow);
  transform: translateY(-2px);
  color: var(--hm-ink);
}

.hm-cat__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--hm-primary-tint);
  color: var(--hm-primary);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.hm-cat:hover .hm-cat__icon {
  background: var(--hm-primary);
  color: #fff;
}

.hm-cat__label {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.hm-cat__count {
  font-size: 13px;
  line-height: 1.35;
  color: var(--hm-muted);
}

.hm-cat__count--explore {
  color: var(--hm-primary);
  font-weight: 600;
  text-wrap: balance;
}

.hm-cat__count--explore svg {
  margin-left: 3px;
  vertical-align: -2px;
}

.hm-cat:hover .hm-cat__count--explore svg {
  transform: translateX(2px);
}

.hm-cat__count--explore svg {
  transition: transform 0.15s ease;
}

/* ══ 4. Listings grid + cards ════════════════════════════════════════════ */
.hm-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hm-grid__item {
  min-width: 0;
}

.hm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-surface);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.hm-card:hover {
  border-color: rgba(64, 95, 242, 0.35);
  box-shadow: var(--hm-shadow-hover);
}

.hm-card__media {
  position: relative;
  aspect-ratio: 3 / 2;
  background: linear-gradient(180deg, #f4f6fb 0%, #eceff6 100%);
  overflow: hidden;
}

.hm-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.hm-card:hover .hm-card__media img {
  transform: scale(1.03);
}

.hm-card__noimg {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #a3a9b8;
}

.hm-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--hm-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.hm-card__photos {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(5, 11, 32, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

/* The shared .wishlist-card-btn (components.css) sits top-left; on these
   cards it moves top-right and above the stretched card link. */
.hm .hm-card__fav {
  top: 10px;
  right: 10px;
  left: auto;
  z-index: 3;
  width: 40px;
  height: 40px;
  color: var(--hm-ink);
  box-shadow: 0 4px 12px rgba(5, 11, 32, 0.16);
}

.hm .hm-card__fav:hover {
  transform: scale(1.06);
}

.hm-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 12px;
}

.hm .hm-card__title {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
}

.hm-card__link {
  display: block;
  color: var(--hm-ink);
  text-decoration: none;
}

/* Stretched link: the whole card opens the listing; the wishlist button
   stays above it. */
.hm-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.hm .hm-card__link:focus-visible {
  outline: none !important;
}

.hm .hm-card__link:focus-visible::after {
  outline: 3px solid var(--hm-primary);
  outline-offset: -3px;
  border-radius: var(--hm-radius);
}

.hm-card__link:hover .hm-card__name {
  color: var(--hm-primary);
}

.hm-card__name,
.hm-card__version {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-card__version {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--hm-muted);
}

.hm-card__pricerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
}

/* "Negotiable" sits under the amount so the rating badge always fits on the
   right of the price row. */
.hm-card__price {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hm-card__amount {
  font-size: 21px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--hm-ink);
}

.hm-card__amount--request {
  font-size: 16px;
  font-weight: 700;
}

.hm-card__nego {
  margin-top: 1px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--hm-muted);
}

.hm-card__eval .price-evaluation-badge {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 4px 10px;
  gap: 6px;
  border-radius: 999px;
}

.hm-card__eval .price-evaluation-badge .badge-label {
  font-size: 12px;
  max-width: none;
}

.hm-card__eval .price-evaluation-badge .badge-dot {
  width: 7px;
  height: 7px;
}

/* Every spec carries a leading "·"; the list is shifted left by one separator
   width and that strip is clipped, so a line never starts with a dot. */
.hm-card__specs {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 0 -14px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.55;
  color: #4a5163;
  clip-path: inset(0 0 0 14px);
}

.hm-card__specs li {
  position: relative;
  padding-left: 14px;
  white-space: nowrap;
}

.hm-card__specs li::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: #9aa0ad;
}

.hm-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  border-top: 1px solid rgba(5, 11, 32, 0.07);
  font-size: 12.5px;
  color: var(--hm-muted);
}

.hm-card__seller {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--hm-text);
}

.hm-card__loc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-card__loc svg {
  flex-shrink: 0;
}

/* ══ 5. Load more ════════════════════════════════════════════════════════ */
.hm-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
  text-align: center;
}

.hm-more__btn {
  min-width: 260px;
}

.hm-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hm-spin 0.7s linear infinite;
}

.hm-more__btn.is-loading .hm-spinner {
  display: inline-block;
}

@keyframes hm-spin {
  to {
    transform: rotate(360deg);
  }
}

.hm-more__error {
  max-width: 480px;
  padding: 10px 16px;
  border: 1px solid #f5c2bd;
  border-radius: var(--hm-radius-sm);
  background: #fef3f2;
  color: #b42318;
  font-size: 14px;
  font-weight: 600;
}

.hm-more__error[hidden],
.hm-more__all[hidden] {
  display: none;
}

.hm-more__all {
  font-size: 15px;
  font-weight: 700;
  color: var(--hm-primary);
}

.hm-more__all:hover {
  color: var(--hm-primary-hover);
}

/* Empty marketplace */
.hm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  border: 1px dashed var(--hm-border-strong);
  border-radius: var(--hm-radius);
  background: var(--hm-surface);
  color: var(--hm-primary);
  text-align: center;
}

.hm .hm-empty__title {
  font-size: 20px;
  font-weight: 800;
}

.hm-empty__text {
  max-width: 440px;
  margin-bottom: 8px !important;
  color: var(--hm-muted);
  font-size: 15px;
}

/* ══ 6. App download ═════════════════════════════════════════════════════ */
.hm-app {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding: 24px 36px;
  border-radius: 20px;
  background: var(--hm-primary-tint);
}

/* Brand-book quarter-circle pattern, faded out toward the copy. */
.hm-app__pattern {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  -webkit-mask-image: linear-gradient(270deg, #000 0%, rgba(0, 0, 0, 0.5) 35%, transparent 65%);
  mask-image: linear-gradient(270deg, #000 0%, rgba(0, 0, 0, 0.5) 35%, transparent 65%);
}

.hm-app__pattern path {
  fill: #c1d8ff;
}

.hm-app__copy {
  max-width: 560px;
}

.hm .hm-app__title {
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hm-app__text {
  margin-top: 6px !important;
  font-size: 16px;
  line-height: 1.5;
  color: var(--hm-text);
}

.hm-app__stores {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hm-store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 8px 18px 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--hm-radius-sm);
  background: var(--hm-ink);
  color: #fff;
  text-decoration: none;
}

a.hm-store:hover {
  background: #1a2140;
  color: #fff;
}

.hm-store__lines {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.hm-store__lines small {
  font-size: 11px;
  font-weight: 500;
  color: inherit;
  opacity: 0.85;
}

.hm-store__lines strong {
  font-size: 18px;
  font-weight: 700;
  color: inherit;
}

.hm-store--soon {
  border: 1px dashed rgba(5, 11, 32, 0.3);
  background: rgba(255, 255, 255, 0.6);
  color: var(--hm-muted);
  cursor: default;
}

/* ══ 7. Popular searches ═════════════════════════════════════════════════ */
.hm-popular {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 48px;
}

.hm .hm-popular__title {
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
}

.hm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Compact search tags; 32px tall is still a comfortable touch target. */
.hm-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--hm-border);
  border-radius: 999px;
  background: var(--hm-surface);
  color: var(--hm-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
}

.hm-tag:hover {
  border-color: var(--hm-primary);
  color: var(--hm-primary);
}

/* ══ 8. Magazine ═════════════════════════════════════════════════════════ */
.hm-mag {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: start;
}

.hm-mag--single {
  grid-template-columns: minmax(0, 760px);
}

.hm-mag__feature,
.hm-mag__item {
  position: relative;
}

.hm-mag__media,
.hm-mag__thumb {
  overflow: hidden;
  border-radius: var(--hm-radius);
  background: #eceff6;
}

.hm-mag__media {
  aspect-ratio: 16 / 9;
  max-height: 340px;
}

.hm-mag__thumb {
  aspect-ratio: 370 / 220;
  border-radius: var(--hm-radius-sm);
}

/* Articles without a cover image get a quiet brand tile instead. */
.hm-mag__ph {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 100% 0, #c1d8ff 0 22%, transparent 22.5%),
    radial-gradient(circle at 0 100%, #c1d8ff 0 22%, transparent 22.5%),
    var(--hm-primary-tint);
}

.hm-mag__media img,
.hm-mag__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.hm-mag__feature:hover img,
.hm-mag__item:hover img {
  transform: scale(1.03);
}

.hm-mag__feature .hm-mag__body {
  padding-top: 16px;
}

.hm-mag__list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hm-mag__item {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.hm-mag__cat {
  margin-bottom: 4px !important;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hm-primary);
}

.hm .hm-mag__title {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
}

.hm .hm-mag__title--lg {
  font-size: clamp(19px, 1.7vw, 22px);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.hm-mag__link {
  color: var(--hm-ink);
  text-decoration: none;
}

.hm-mag__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hm-mag__link:hover {
  color: var(--hm-primary);
}

.hm .hm-mag__link:focus-visible {
  outline: none !important;
}

.hm .hm-mag__link:focus-visible::after {
  outline: 3px solid var(--hm-primary);
  outline-offset: 4px;
  border-radius: var(--hm-radius-sm);
}

.hm-mag__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-bottom: 8px !important;
  font-size: 15px;
  line-height: 1.55;
  color: var(--hm-text);
}

.hm-mag__meta {
  font-size: 13px;
  color: var(--hm-muted);
}

/* ══ Responsive ══════════════════════════════════════════════════════════ */
@media (max-width: 1199.98px) {
  .hm-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .hm-section {
    padding: 44px 0;
  }

  .hm-section--tight {
    padding: 32px 0;
  }

  /* Tablet: [keyword ×4 | submit ×2] / [category brand model] / [price city] */
  .hm-search {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .hm-search > .hm-field {
    grid-column: span 2;
  }

  .hm-search > .hm-field--more {
    grid-column: span 3;
  }

  .hm-search > .hm-field--q {
    grid-column: 1 / 5;
  }

  .hm-search__submit {
    grid-column: 5 / 7;
  }

  .hm-field--price::before {
    display: none;
  }

  .hm-search__extra {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .hm-popular {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .hm-mag {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .hm-app {
    padding: 28px;
  }
}

@media (max-width: 767.98px) {
  .hm-hero {
    padding: 20px 0 20px;
  }

  .hm-hero__copy {
    margin-bottom: 14px;
  }

  /* Phone: one column of controls in reading order, submit after the
     fields it applies to. */
  .hm-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 16px 8px;
    border-radius: 16px;
  }

  .hm-search > .hm-field,
  .hm-search > .hm-field--more {
    grid-column: span 1;
  }

  .hm-search > .hm-field--q,
  .hm-search > .hm-field--type,
  .hm-search__submit {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .hm-search__extra {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 12px;
  }

  .hm-field__label {
    font-size: 13px;
  }

  .hm .hm-input,
  .hm .hm-select {
    height: 46px;
    font-size: 16px; /* 16px stops iOS from zooming into the field */
  }

  .hm .hm-input--q {
    height: 50px;
  }

  .hm-search__submit {
    width: 100%;
    min-height: 50px;
  }

  .hm-search__actions {
    margin-top: -4px;
  }

  /* Categories become a swipeable row. */
  .hm-cats {
    display: flex;
    gap: 10px;
    margin: 0 -16px;
    padding: 2px 16px 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .hm-cats::-webkit-scrollbar {
    display: none;
  }

  .hm-cats > li {
    flex: 0 0 128px;
    scroll-snap-align: start;
  }

  .hm-cat {
    padding: 14px 8px 12px;
  }

  .hm-cat__icon {
    width: 52px;
    height: 52px;
    margin-bottom: 6px;
  }

  .hm-cat__icon svg {
    width: 32px;
    height: 32px;
  }

  .hm-cat__label {
    font-size: 15px;
  }

  .hm-cat__count {
    font-size: 12px;
  }

  .hm-head {
    margin-bottom: 18px;
  }

  .hm-head__sub {
    font-size: 14px;
  }

  .hm-app {
    padding: 24px 20px;
    border-radius: 20px;
  }

  /* Stacked layout: keep the pattern behind the store badges, not the copy. */
  .hm-app__pattern {
    -webkit-mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0.4) 30%, transparent 50%);
    mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0.4) 30%, transparent 50%);
  }

  .hm-app__stores {
    width: 100%;
  }

  .hm-store {
    flex: 1 1 180px;
    justify-content: center;
  }

  /* Magazine: the lead article as one compact card, the others as a
     two-column grid of small cards instead of a long list. */
  .hm-mag {
    gap: 14px;
  }

  /* Lead article: photo beside the text, like a wide compact card. */
  .hm-mag__feature {
    display: grid;
    grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .hm-mag__media {
    aspect-ratio: 16 / 10;
    max-height: none;
    border-radius: var(--hm-radius-sm);
  }

  .hm-mag__feature .hm-mag__body {
    padding-top: 0;
  }

  .hm-mag__excerpt {
    margin-bottom: 4px !important;
    font-size: 13px;
    line-height: 1.45;
  }

  .hm-mag__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }

  .hm-mag__item {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .hm-mag__thumb {
    aspect-ratio: 16 / 9;
  }

  .hm-mag__cat {
    margin-bottom: 2px !important;
    font-size: 10px;
  }

  .hm .hm-mag__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-bottom: 2px;
    font-size: 14px;
    line-height: 1.3;
  }

  .hm .hm-mag__title--lg {
    -webkit-line-clamp: 3;
    font-size: 15px;
  }

  .hm-mag__meta {
    font-size: 11px;
  }
}

/* Phones: listings switch to compact rows (photo left, details right) so
   twenty cards stay quick to scan instead of a very long single column. */
@media (max-width: 575.98px) {
  .hm-section {
    padding: 32px 0;
  }

  /* Search first: price and location join "More filters" on phones. */
  .hm-search:not(.is-expanded) > .hm-field--more {
    display: none;
  }

  .hm-hero {
    padding: 16px 0 18px;
  }

  .hm .hm-hero__title {
    font-size: clamp(23px, 6.6vw, 28px);
  }

  .hm-hero__lead {
    font-size: 15px;
  }

  /* Two selects per row: leave room for "Qualsiasi" at 320px. */
  .hm .hm-select {
    padding: 0 28px 0 12px !important;
    background-position: right 10px center;
  }

  .hm-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  /* Two compact cards per row: photo on top, then name, price, specs. */
  .hm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hm-card {
    border-radius: var(--hm-radius-sm);
  }

  .hm-card__body {
    gap: 3px;
    padding: 8px 10px 4px;
  }

  .hm-card__foot {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0 8px;
    padding: 0 10px 8px;
    border-top: 0;
    font-size: 11px;
  }

  .hm .hm-card__title {
    font-size: 13px;
  }

  .hm-card__version {
    margin-top: 0;
    font-size: 12px;
  }

  .hm-card__pricerow {
    gap: 3px 6px;
  }

  .hm-card__amount {
    font-size: 16px;
  }

  .hm-card__amount--request {
    font-size: 13px;
  }

  .hm-card__nego {
    font-size: 11px;
  }

  .hm-card__specs {
    margin-left: -10px;
    font-size: 11px;
    line-height: 1.45;
    clip-path: inset(0 0 0 10px);
  }

  .hm-card__specs li {
    padding-left: 10px;
  }

  .hm-card__specs li::before {
    left: 3px;
  }

  .hm-card__eval .price-evaluation-badge {
    padding: 2px 6px;
    gap: 4px;
  }

  .hm-card__eval .price-evaluation-badge .badge-label {
    font-size: 10px;
  }

  .hm-card__eval .price-evaluation-badge .badge-dot {
    width: 5px;
    height: 5px;
  }

  .hm .hm-card__fav {
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
  }

  .hm .hm-card__fav svg {
    width: 15px;
    height: 15px;
  }

  .hm-card__badge {
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    font-size: 10px;
  }

  .hm-card__photos {
    left: 6px;
    bottom: 6px;
    padding: 2px 7px;
    font-size: 10px;
  }

  .hm-more__btn {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hm *,
  .hm *::before,
  .hm *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .hm-card:hover .hm-card__media img,
  .hm-mag__feature:hover img,
  .hm-mag__item:hover img,
  .hm-cat:hover {
    transform: none;
  }
}
