
/* =========================================================
   CS Developer - v2 components
   Mega menu, type hubs, facets, catalogue cards, pagination
   ========================================================= */

/* ---------- icons used by v2 ---------- */
.i-close   { -webkit-mask-image: url("../icons/x-circle.svg"); mask-image: url("../icons/x-circle.svg"); }
.i-filter  { -webkit-mask-image: url("../icons/funnel.svg"); mask-image: url("../icons/funnel.svg"); }
.i-trophy  { -webkit-mask-image: url("../icons/trophy.svg"); mask-image: url("../icons/trophy.svg"); }
.i-eye     { -webkit-mask-image: url("../icons/eye.svg"); mask-image: url("../icons/eye.svg"); }
.i-package { -webkit-mask-image: url("../icons/package.svg"); mask-image: url("../icons/package.svg"); }

/* ---------- mega menu ---------- */
.nav__item--mega { position: relative; }

.nav__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.92rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s var(--ease);
  white-space: nowrap;
}
.nav__trigger:hover { color: var(--text); }
.nav__trigger[aria-expanded="true"] { color: var(--accent); }
.nav__trigger .ico { width: 0.85em; height: 0.85em; transition: transform 0.25s var(--ease); }
.nav__trigger[aria-expanded="true"] .ico { transform: rotate(180deg); }

.mega {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 48px));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55);
  z-index: 45;
}
.mega[hidden] { display: none; }

.mega__inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  padding: 22px;
}

.mega__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}

.mega__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.mega__col a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  margin: 0 -9px;
  border-radius: var(--r);
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.mega__col a:hover { background: var(--surface-2); color: var(--text); }
.mega__col a .ico { color: var(--text-mute); }
.mega__col a:hover .ico { color: var(--accent); }

.mega__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
}

/* ---------- hero quick links ---------- */
.hero__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.hero__quick-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 0.86rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.015);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.hero__quick-link:hover { border-color: var(--accent-line); color: var(--text); }
.hero__quick-link .ico { color: var(--accent); width: 1.05em; height: 1.05em; }

/* ---------- section shell ---------- */
.section { padding: 72px 0; }
.section--tint { background: var(--bg-soft); border-block: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 34px;
}
.section-head h2 { margin-bottom: 0; }
.section-head .lead { margin-top: 14px; }

/* ---------- type grid ---------- */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 16px;
}
.type-grid--home { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.type-card:hover { border-color: var(--accent-line); transform: translateY(-3px); }
.type-card.is-current { border-color: var(--accent-line); }

.type-card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.type-card__media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.5; transition: opacity 0.35s var(--ease), transform 0.6s var(--ease); }
.type-card:hover .type-card__media img { opacity: 0.68; transform: scale(1.04); }

.type-card__body {
  padding: 18px 20px 20px;
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1;
}

.type-card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
  color: var(--accent);
  background: var(--accent-soft);
  margin-bottom: 4px;
}

.type-card__title { font-family: var(--font-display); font-weight: 700; font-size: 1.06rem; }
.type-card__count { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); }
.type-card__text { font-size: 0.86rem; color: var(--text-dim); line-height: 1.55; }

/* ---------- games grid ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s var(--ease);
}
.game-card:hover { border-color: var(--accent-line); }

.game-card__media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.game-card__media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.62; transition: opacity 0.35s var(--ease), transform 0.6s var(--ease); }
.game-card:hover .game-card__media img { opacity: 0.8; transform: scale(1.04); }

.game-card__engine {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: var(--r);
  background: rgba(10, 12, 13, 0.82);
  border: 1px solid var(--accent-line);
  color: var(--accent);
}

.game-card__body { padding: 18px 20px 20px; display: grid; gap: 10px; align-content: start; flex: 1; }
.game-card__title { font-size: 1.14rem; }
.game-card__text { margin: 0; font-size: 0.87rem; color: var(--text-dim); }
.game-card__list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 7px; }
.game-card__list li { font-size: 0.85rem; color: var(--text-mute); padding-left: 12px; position: relative; }
.game-card__list li::before { content: ""; position: absolute; left: 0; top: 9px; width: 4px; height: 4px; background: var(--accent-line); border-radius: 50%; }
.game-card__list a { color: var(--text-dim); transition: color 0.18s var(--ease); }
.game-card__list a:hover { color: var(--accent-hi); }

/* ---------- catalogue cards ---------- */
.card--catalog { display: flex; flex-direction: column; padding: 0; overflow: hidden; }

.card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.66; transition: opacity 0.35s var(--ease), transform 0.6s var(--ease); }
.card:hover .card__media img { opacity: 0.85; transform: scale(1.04); }

.card__badge {
  position: absolute;
  left: 12px;
  top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: var(--r);
  background: rgba(10, 12, 13, 0.84);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  backdrop-filter: blur(6px);
}

.card__rating {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  flex: none;
}

.card--catalog .card__body { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card--catalog .card__desc { flex: 1; }
.card--catalog .card__foot { flex-wrap: wrap; }

.cards--featured { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ---------- catalogue layout + facets ---------- */
.catalog-layout {
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  gap: 32px;
  padding-top: 34px;
  padding-bottom: 96px;
  align-items: start;
}

.facets { position: sticky; top: calc(var(--header-h) + 20px); }
.facets__mobile-bar { display: none; }

.facet { padding: 0 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.facet:last-of-type { border-bottom: 0; }

.facet__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 12px;
}

.facet__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.facet__item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  margin: 0 -10px;
  background: transparent;
  border: 0;
  border-radius: var(--r);
  font-size: 0.88rem;
  color: var(--text-dim);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.facet__item:hover { background: var(--surface-2); color: var(--text); }
.facet__item[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-hi); }
.facet__item[aria-pressed="true"] .ico { color: var(--accent); }

.facet__label { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.facet__label .ico { color: var(--text-mute); flex: none; }
.facet__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  flex: none;
}
.facet__item[aria-pressed="true"] .facet__count { color: var(--accent); }

.facet__reset { width: 100%; justify-content: center; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-cloud__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: transparent;
  font-size: 0.79rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.tag-cloud__item:hover { border-color: var(--accent-line); color: var(--text); }
.tag-cloud__item[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-hi); background: var(--accent-soft); }

.facets__badge {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--r);
  background: var(--accent);
  color: #0b0d0e;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

/* ---------- active filters ---------- */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.active-filters__label { margin-right: 4px; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
  background: var(--accent-soft);
  font-size: 0.82rem;
  color: var(--accent-hi);
  cursor: pointer;
  transition: background-color 0.18s var(--ease);
}
.filter-chip:hover { background: rgba(226, 160, 60, 0.2); }
.filter-chip .ico { width: 0.95em; height: 0.95em; }
.filter-chip--reset { border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--text-dim); }
.filter-chip--reset:hover { color: var(--text); }

/* ---------- search ---------- */
.search--wide { flex: 1; min-width: 260px; }
.search { position: relative; display: flex; align-items: center; }
.search__clear {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 0;
  border-radius: var(--r);
  color: var(--text-mute);
  cursor: pointer;
}
.search__clear:hover { color: var(--accent-hi); }
.search__clear[hidden] { display: none; }
.search input { padding-right: 40px; }

.sort-select-wrap { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }

/* ---------- pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
}
.pagination[hidden] { display: none; }

.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.page-btn:hover:not(:disabled) { border-color: var(--accent-line); color: var(--accent-hi); }
.page-btn.is-active { background: var(--accent); border-color: var(--accent); color: #0b0d0e; font-weight: 700; }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-gap { color: var(--text-mute); font-family: var(--font-mono); padding: 0 4px; }

.load-more { display: block; margin: 26px auto 0; }
.load-more[hidden] { display: none; }

/* ---------- hub (category) page ---------- */
.hub-hero { padding: 40px 0 30px; border-bottom: 1px solid var(--line); }
.hub-hero .breadcrumbs { margin-bottom: 26px; }

.hub-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: 40px;
  align-items: center;
}

.hub-hero__copy > * { max-width: 620px; }
.hub-hero__note {
  margin: 14px 0 0;
  font-size: 0.92rem;
  color: var(--text-mute);
  padding-left: 14px;
  border-left: 2px solid var(--accent-line);
}

.hub-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.hub-hero__media { margin: 0; }
.hub-hero__media img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r);
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.hub-hero__media figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-mute);
}

.hub-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.hub-stat { display: grid; gap: 4px; }
.hub-stat strong { font-family: var(--font-display); font-size: 1.5rem; color: var(--accent); line-height: 1; }
.hub-stat span { font-size: 0.8rem; color: var(--text-mute); }

.hub-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.hub-sub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 0.87rem;
  color: var(--text-dim);
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.hub-sub:hover { border-color: var(--accent-line); color: var(--text); }
.hub-sub.is-active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
.hub-sub__count { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }
.hub-sub.is-active .hub-sub__count { color: var(--accent); }

.hub-section { padding: 56px 0; }
.hub-section + .hub-section { padding-top: 0; }

/* ---------- guide cards ---------- */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(288px, 1fr));
  gap: 16px;
}

.guide-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.guide-card:hover { border-color: var(--accent-line); transform: translateY(-3px); }

.guide-card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.guide-card__media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; transition: opacity 0.35s var(--ease), transform 0.6s var(--ease); }
.guide-card:hover .guide-card__media img { opacity: 0.75; transform: scale(1.04); }

.guide-card__body { padding: 18px 20px 20px; display: grid; gap: 9px; align-content: start; flex: 1; }
.guide-card__meta { display: flex; gap: 10px; align-items: center; font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }
.guide-card__title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.28; }
.guide-card__text { font-size: 0.86rem; color: var(--text-dim); line-height: 1.55; }
.guide-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--text-mute);
}
.guide-card:hover .guide-card__foot { color: var(--accent); }

/* ---------- page head (catalog) ---------- */
.page-head--catalog { padding-bottom: 26px; }
.page-head__stats { display: flex; gap: 28px; flex: none; }
.page-head__stat { display: grid; gap: 4px; }
.page-head__stat strong { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent); line-height: 1; }

/* ---------- tag as link ---------- */
a.tag { transition: border-color 0.18s var(--ease), color 0.18s var(--ease); }
a.tag:hover { border-color: var(--accent-line); color: var(--accent-hi); }

.footer__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  margin-left: 4px;
}

/* ---------- guide download card ---------- */
.download-card--guide .download-card__file .ico { color: var(--accent); }

/* =========================================================
   v2 responsive
   ========================================================= */
@media (max-width: 1023px) {
  .mega__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-layout { grid-template-columns: 1fr; }

  .facets {
    position: static;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    padding: 16px;
  }
  .facets__mobile-bar { display: flex; gap: 10px; margin-bottom: 0; }
  .facets__body { display: none; margin-top: 18px; }
  .facets__body[data-open="true"] { display: block; }
  .facet { display: inline-block; width: 100%; }

  .hub-hero__grid { grid-template-columns: 1fr; gap: 28px; }
  .hub-hero__media { max-width: 520px; }
  .hub-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .section { padding: 52px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .mega { position: static; transform: none; width: 100%; margin-top: 8px; }
  .mega__inner { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
  .page-head__stats { gap: 20px; }
  .page-head__stat strong { font-size: 1.35rem; }
  .hub-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-stat strong { font-size: 1.28rem; }
  .catalog__tools { flex-direction: column; align-items: stretch; }
  .sort-select-wrap { justify-content: space-between; }
}
