/* ==========================================================================
   DeviceHub — Categories Showcase Section
   Path: assets/css/home/categories.css
   Depends on: global.css
   ========================================================================== */

/* ==========================================================================
   1. Layout
   ========================================================================== */

.devhub-categories__inner {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--devhub-border);
  border-radius: var(--devhub-radius-md);
  overflow: hidden;
  background: var(--devhub-white);
  min-height: 226px;
}

.devhub-categories__left {
  width: 280px;
  min-width: 280px;
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  background: #dbe9f4;
}

.devhub-categories__left img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

/* Category grid */
.devhub-categories__grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(112px, 1fr);
  border-left: 1px solid var(--devhub-border);
}

/* ==========================================================================
   2. Category item
   ========================================================================== */

.devhub-categories__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 112px;
  padding: 11px 13px;
  border-right: 1px solid var(--devhub-border);
  border-bottom: 1px solid var(--devhub-border);
  text-decoration: none;
  overflow: hidden;
  transition:
    background var(--devhub-transition),
    transform 0.24s ease;
}

.devhub-categories__item:hover {
  background: #fff5f0;
  transform: translateY(-2px);
}

/* Remove right border on last column item */
.devhub-categories__item:nth-child(4n) {
  border-right: none;
}

/* Remove bottom border on last row items */
.devhub-categories__item:nth-child(n + 5) {
  border-bottom: none;
}

.devhub-categories__item-info {
  align-self: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}

.devhub-categories__item-img {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  align-self: flex-end;
}

.devhub-categories__item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

.devhub-categories__item-name {
  font-size: var(--devhub-text-3xl);
  font-weight: 600;
  color: var(--devhub-dark);
  margin-bottom: 4px;
  line-height: 1.2;
}

.devhub-categories__item-from {
  font-size: var(--devhub-text-xl);
  color: var(--devhub-mid);
  line-height: 1.5;
}

/* ==========================================================================
   4. Responsive
   ========================================================================== */

@media (max-width: 1199px) {
  .devhub-categories__inner {
    min-height: 212px;
  }

  .devhub-categories__left {
    width: 240px;
    min-width: 240px;
  }

  .devhub-categories__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .devhub-categories__item:nth-child(4n) {
    border-right: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(n + 5) {
    border-bottom: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(3n) {
    border-right: none;
  }

  .devhub-categories__item:nth-child(n + 7) {
    border-bottom: none;
  }
}

@media (max-width: 991px) {
  .devhub-categories__inner {
    min-height: 0;
    flex-direction: column;
  }

  .devhub-categories__left {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 146px;
  }

  .devhub-categories__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(112px, 1fr);
    border-left: none;
    border-top: 1px solid var(--devhub-border);
  }

  .devhub-categories__item {
    min-height: 112px;
    padding: 11px 13px;
  }

  .devhub-categories__item:nth-child(3n) {
    border-right: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(n + 7) {
    border-bottom: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(4n) {
    border-right: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(2n) {
    border-right: none;
  }

  .devhub-categories__item:nth-child(n + 5) {
    border-bottom: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(n + 7) {
    border-bottom: none;
  }
}

@media (max-width: 575px) {
  .devhub-categories__left {
    height: 136px;
  }

  .devhub-categories__grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .devhub-categories__item {
    min-height: 104px;
  }

  .devhub-categories__item:nth-child(2n) {
    border-right: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(n + 7) {
    border-bottom: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:nth-child(n) {
    border-right: none;
    border-bottom: 1px solid var(--devhub-border);
  }

  .devhub-categories__item:last-child {
    border-bottom: none;
  }
}

@media (max-width: 480px) {
  .devhub-categories__item {
    gap: 12px;
    padding: 10px 12px;
  }

  .devhub-categories__item-img {
    width: 60px;
    height: 60px;
  }

  .devhub-categories__item-name {
    font-size: var(--devhub-text-2xl);
  }

  .devhub-categories__item-from {
    font-size: var(--devhub-text-lg);
  }
}
