/* =========================================================
   4HE / CATEGORY HEAD
   Category headers and small page headers
   ========================================================= */

/* =========================
   CATEGORY HEAD
   ========================= */

.category-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: none;
  overflow: hidden;
}

.category-head__cover {
  min-height: 148px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 14% 22%, rgba(45, 123, 255, 0.12), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(155, 234, 60, 0.14), transparent 22%),
    linear-gradient(135deg, var(--brand-blue-soft) 0%, var(--brand-lime-soft) 52%, var(--surface-2) 100%);
}

.category-head__cover img {
  width: 100%;
  height: 148px;
  object-fit: cover;
  display: block;
}

.category-head__body {
  padding: 0 20px 16px;
}

.category-head__identity {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: -34px;
}

.category-head__avatar {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 4px solid var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
}

.category-head__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.category-head__main {
  min-width: 0;
  padding-top: 40px;
}

.category-head__title {
  margin: 0;
  color: var(--text);
  font-size: 34px;
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.category-head__desc {
  max-width: 760px;
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.68;
}

.category-head__desc:empty {
  display: none;
}

.category-head__meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
}

.category-head__nav {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-head__nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.category-head__nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.category-head__nav a.is-active,
.category-head__nav .sort__item--active,
.category-head__nav .selected {
  background: var(--accent-main-soft);
  color: var(--accent-main);
}

.category-head__nav select {
  min-height: 38px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  outline: none;
  box-shadow: none;
}

.category-head__nav select:focus {
  border-color: var(--accent-main);
  box-shadow: 0 0 0 3px var(--accent-main-soft);
}

/* =========================
   PAGE HEAD
   ========================= */

.page-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: none;
  overflow: hidden;
}

.page-head__body {
  padding: 16px 18px;
}

.page-head__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-head__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--accent-main);
}

.page-head__icon .i-svg {
  width: 18px;
  height: 18px;
}

.page-head__title {
  margin: 0;
  min-width: 0;
  color: var(--text);
  font-size: 21px;
  line-height: 1.18;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.page-head__desc {
  max-width: 760px;
  margin: 10px 0 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.page-head__desc:empty {
  display: none;
}

/* =========================
   DARK
   ========================= */

.theme-dark .category-head__cover {
  background:
    radial-gradient(circle at 14% 22%, rgba(45, 123, 255, 0.18), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(155, 234, 60, 0.10), transparent 22%),
    linear-gradient(135deg, #273142 0%, #263224 52%, var(--surface) 100%);
}

.theme-dark .category-head__avatar {
  border-color: var(--surface);
}

/* =========================
   RESPONSIVE
   ========================= */

@media screen and (max-width: 768px) {
  .category-head {
    border-radius: 20px;
  }

  .category-head__cover {
    min-height: 118px;
  }

  .category-head__cover img {
    height: 118px;
  }

  .category-head__body {
    padding: 0 16px 14px;
  }

  .category-head__identity {
    gap: 12px;
    margin-top: -22px;
  }

  .category-head__avatar {
    width: 64px;
    height: 64px;
    border-radius: 18px;
  }

  .category-head__main {
    padding-top: 34px;
  }

  .category-head__title {
    font-size: 26px;
  }

  .category-head__desc {
    font-size: 14px;
    line-height: 1.6;
  }

  .page-head {
    border-radius: 18px;
  }

  .page-head__body {
    padding: 14px 16px;
  }

  .page-head__icon {
    width: 32px;
    height: 32px;
    border-radius: 11px;
  }

  .page-head__icon .i-svg {
    width: 17px;
    height: 17px;
  }

  .page-head__title {
    font-size: 21px;
  }

  .page-head__desc {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.55;
  }
}

@media screen and (max-width: 640px) {
  .category-head {
    border-radius: 0;
  }

  .category-head__cover {
    min-height: 108px;
  }

  .category-head__cover img {
    height: 108px;
  }

  .category-head__body {
    padding: 0 14px 14px;
  }

  .category-head__identity {
    gap: 10px;
    margin-top: -16px;
  }

  .category-head__avatar {
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }

  .category-head__main {
    padding-top: 30px;
  }

  .category-head__title {
    font-size: 22px;
    line-height: 1.08;
  }

  .category-head__desc {
    margin-top: 8px;
    font-size: 13px;
  }

  .category-head__meta {
    margin-top: 10px;
    font-size: 13px;
  }

  .category-head__nav {
    gap: 8px;
  }

  .category-head__nav a,
  .category-head__nav select {
    min-height: 34px;
    font-size: 13px;
  }

  .category-head__nav a {
    padding: 0 12px;
  }

  .category-head__nav select {
    padding-left: 12px;
    padding-right: 34px;
  }

  .page-head {
    border-radius: 0;
  }

  .page-head__body {
    padding: 13px 14px;
  }

  .page-head__row {
    gap: 9px;
  }

  .page-head__icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .page-head__icon .i-svg {
    width: 16px;
    height: 16px;
  }

  .page-head__title {
    font-size: 19px;
    line-height: 1.15;
  }

  .page-head__desc {
    font-size: 13px;
    line-height: 1.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-head__nav a,
  .category-head__nav select {
    transition: none !important;
  }
}