/* Categories page. Loaded by templates/categories/list.html and
   group_detail.html. Depends on the tokens in jobertrust.css.

   Every selector that could collide with @tailwindcss/forms base styles uses
   two classes, since the Play CDN's injection order is not something to rely
   on -- see the search input on the Browse page for what happens otherwise. */

.cg-page { padding-block: var(--jt-lg) var(--jt-2xl); }
@media (min-width: 768px) { .cg-page { padding-block: var(--jt-2xl) var(--jt-3xl); } }

/* ==========================================================================
   HERO
   Desktop: copy left, illustration right. Mobile: copy only, per the mobile
   reference -- the illustration is a desktop composition.
   ========================================================================== */

.cg-hero {
  display: flex;
  flex-direction: column;
  gap: var(--jt-xl);
  margin-bottom: var(--jt-2xl);
  min-width: 0;
}
@media (min-width: 1024px) {
  .cg-hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--jt-2xl);
  }
}

.cg-hero-copy { flex: 1 1 auto; min-width: 0; max-width: 40rem; }

.cg-title {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--jt-primary);
}
@media (min-width: 768px)  { .cg-title { font-size: 40px; } }
@media (min-width: 1024px) { .cg-title { font-size: 48px; line-height: 1.1; } }

.cg-lede {
  margin: 0 0 var(--jt-lg);
  font-size: 15px;
  line-height: 1.6;
  color: var(--jt-on-surface-variant);
}
@media (min-width: 768px) { .cg-lede { font-size: 18px; } }

/* --- Search --- */

.cg-search { display: flex; max-width: 32rem; min-width: 0; }
.cg-search-field { position: relative; display: flex; flex: 1 1 auto; min-width: 0; }

.cg-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--jt-outline);
  pointer-events: none;
}

/* Two classes: beats [type='text'] from the forms plugin regardless of order. */
.cg-search-field .cg-search-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 52px;
  padding-block: 0;
  padding-left: 46px;
  padding-right: var(--jt-md);
  font-family: inherit;
  font-size: 15px;
  color: var(--jt-on-surface);
  background-color: var(--jt-surface-container-lowest);
  border: 1px solid var(--jt-outline-variant);
  border-radius: var(--jt-radius);
  outline: none;
  box-shadow: var(--jt-shadow-sm);
  transition: border-color var(--jt-transition), box-shadow var(--jt-transition);
}
.cg-search-field .cg-search-input::placeholder { color: var(--jt-outline); }
.cg-search-field .cg-search-input:focus {
  border-color: var(--jt-secondary);
  box-shadow: var(--jt-focus-ring);
}

/* --- Illustration --- */

/* Hidden on mobile: the illustration is a desktop composition, per the
   mobile reference.

   Two steps rather than one. At the 1024px breakpoint the content well is
   960px, so a 560px image would leave only ~352px for the heading, lede and
   search field. `flex: 0 1` shrinks rather than overflows, so nothing breaks
   -- but the copy column gets cramped. 480px at 1024, 560px from 1280 where
   the shell is at its full 1216px and there is room for both. */
.cg-hero-media { display: none; }
@media (min-width: 1024px) {
  .cg-hero-media {
    display: block;
    flex: 0 1 480px;
    min-width: 0;
  }
}
@media (min-width: 1280px) {
  .cg-hero-media { flex: 0 1 560px; }
}
.cg-hero-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: var(--jt-radius-xl);
}

/* ==========================================================================
   SECTIONS
   ========================================================================== */

.cg-section { margin-bottom: var(--jt-2xl); min-width: 0; }
@media (min-width: 768px) { .cg-section { margin-bottom: var(--jt-3xl); } }

.cg-h2 {
  margin: 0 0 var(--jt-md);
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
  color: var(--jt-primary);
}
@media (min-width: 768px) { .cg-h2 { font-size: 22px; margin-bottom: var(--jt-lg); } }

.cg-sub { margin: -8px 0 var(--jt-md); font-size: 14px; color: var(--jt-on-surface-variant); }

/* ==========================================================================
   POPULAR CATEGORIES
   Mobile: horizontal scroll, contained. Desktop: 4-up grid.
   ========================================================================== */

.cg-pop-scroll {
  display: flex;
  gap: var(--jt-md);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--jt-sm);
  margin-inline: calc(var(--jt-margin-mobile) * -1);
  padding-inline: var(--jt-margin-mobile);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.cg-pop-scroll::-webkit-scrollbar { display: none; }

/* Cap at 4 columns, as in the desktop reference. auto-fit alone gave 5 on a
   1216px content width. */
@media (min-width: 1024px) {
  .cg-pop-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    max-width: 100%;
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
    padding-bottom: 0;
  }
}
@media (min-width: 1180px) {
  .cg-pop-scroll { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.cg-pop {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 0 0 auto;
  width: 210px;
  min-width: 0;
  padding: var(--jt-md);
  scroll-snap-align: start;
  background-color: var(--jt-surface-container-lowest);
  border: 1px solid var(--jt-outline-variant);
  border-radius: var(--jt-radius-xl);
  box-shadow: var(--jt-shadow-sm);
  transition: box-shadow var(--jt-transition), border-color var(--jt-transition);
}
@media (min-width: 1024px) {
  .cg-pop { width: auto; padding: var(--jt-lg); }
}
.cg-pop:hover { border-color: var(--jt-primary-fixed-dim); box-shadow: var(--jt-shadow); }

.cg-pop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  color: var(--jt-secondary);
  background-color: var(--jt-surface-container);
  border-radius: var(--jt-radius-full);
}
.cg-pop-icon .material-symbols-outlined { font-size: 24px; }
@media (min-width: 1024px) {
  .cg-pop-icon { width: 64px; height: 64px; margin-bottom: var(--jt-md); }
  .cg-pop-icon .material-symbols-outlined { font-size: 30px; }
}

.cg-pop-name {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--jt-primary);
  overflow-wrap: anywhere;
}
.cg-pop-count {
  margin: 0 0 var(--jt-md);
  font-size: 13px;
  color: var(--jt-on-surface-variant);
}

.cg-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--jt-md);
  min-width: 0;
}
.cg-chips-loose { justify-content: flex-start; }

.cg-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--jt-on-surface-variant);
  background-color: var(--jt-surface-container-low);
  border: 1px solid var(--jt-outline-variant);
  border-radius: var(--jt-radius-full);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color var(--jt-transition), background-color var(--jt-transition), border-color var(--jt-transition);
}
.cg-chip:hover {
  color: var(--jt-on-secondary-container);
  background-color: var(--jt-success-soft);
  border-color: var(--jt-success-line);
}
.cg-chip-more { font-weight: 600; }

.cg-pop-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--jt-secondary);
  text-decoration: none;
}
.cg-pop-link:hover { text-decoration: underline; }
.cg-pop-link .material-symbols-outlined { font-size: 16px; }

/* ==========================================================================
   ALL CATEGORIES
   Mobile: single column. Desktop: two columns, per the references.
   ========================================================================== */

.cg-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--jt-sm); }
@media (min-width: 768px) {
  .cg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--jt-md); }
}

.cg-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  background-color: var(--jt-surface-container-lowest);
  border: 1px solid var(--jt-outline-variant);
  border-radius: var(--jt-radius-lg);
  box-shadow: var(--jt-shadow-sm);
  transition: border-color var(--jt-transition), box-shadow var(--jt-transition);
}
@media (min-width: 768px) { .cg-row { padding: var(--jt-md); } }
.cg-row:hover { border-color: var(--jt-secondary); box-shadow: var(--jt-shadow); }
.cg-row:focus-visible { outline: 2px solid var(--jt-secondary); outline-offset: 2px; }

.cg-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  color: var(--jt-secondary);
  background-color: var(--jt-surface-container);
  border-radius: var(--jt-radius);
}
.cg-row-icon .material-symbols-outlined { font-size: 22px; }
@media (min-width: 768px) { .cg-row-icon { width: 48px; height: 48px; border-radius: var(--jt-radius-lg); } }

.cg-row-body { display: block; flex: 1 1 auto; min-width: 0; }

.cg-row-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--jt-primary);
  overflow-wrap: anywhere;
}
.cg-row:hover .cg-row-name { color: var(--jt-secondary); }

.cg-row-desc {
  display: none;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--jt-on-surface-variant);
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
@media (min-width: 768px) { .cg-row-desc { display: -webkit-box; } }

.cg-row-count {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--jt-secondary);
}

.cg-row-specs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; min-width: 0; }
.cg-spec {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 9px;
  font-size: 11px;
  color: var(--jt-on-surface-variant);
  background-color: var(--jt-surface-container-low);
  border: 1px solid var(--jt-outline-variant);
  border-radius: var(--jt-radius-full);
  overflow-wrap: anywhere;
}
.cg-spec-more { font-weight: 600; }

.cg-row-chevron { flex: 0 0 auto; align-self: center; font-size: 20px; color: var(--jt-outline-variant); }
.cg-row:hover .cg-row-chevron { color: var(--jt-secondary); }

/* ==========================================================================
   GROUP DETAIL
   ========================================================================== */

.cg-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: var(--jt-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--jt-on-surface-variant);
  text-decoration: none;
}
.cg-back:hover { color: var(--jt-primary); }
.cg-back .material-symbols-outlined { font-size: 18px; }

.cg-detail-head {
  display: flex;
  align-items: flex-start;
  gap: var(--jt-md);
  margin-bottom: var(--jt-xl);
  min-width: 0;
}
.cg-detail-icon { width: 56px; height: 56px; border-radius: var(--jt-radius-lg); }
.cg-detail-icon .material-symbols-outlined { font-size: 28px; }
.cg-detail-title {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--jt-primary);
  overflow-wrap: anywhere;
}
@media (min-width: 768px) { .cg-detail-title { font-size: 34px; } }
.cg-detail-head .cg-lede { margin-bottom: 6px; }

.cg-grid-prof .cg-row-desc { display: -webkit-box; }

/* ==========================================================================
   CTA
   ========================================================================== */

.cg-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--jt-md);
  text-align: center;
  padding: var(--jt-lg);
  min-width: 0;
  background-color: var(--jt-surface-container);
  border: 1px solid var(--jt-outline-variant);
  border-radius: var(--jt-radius-xl);
}
@media (min-width: 768px) {
  .cg-cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: var(--jt-lg);
    padding: var(--jt-xl);
  }
}

.cg-cta-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--jt-sm);
  min-width: 0;
}
@media (min-width: 768px) {
  .cg-cta-body { flex-direction: row; align-items: center; gap: var(--jt-md); }
}

.cg-cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  color: var(--jt-secondary);
  background-color: rgba(0, 108, 73, 0.1);
  border-radius: var(--jt-radius-full);
}
.cg-cta-icon .material-symbols-outlined { font-size: 26px; }

.cg-cta-title {
  margin: 0 0 3px;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--jt-primary);
}
@media (min-width: 768px) { .cg-cta-title { font-size: 20px; } }
.cg-cta-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--jt-on-surface-variant); }
.cg-cta-btn { flex: 0 0 auto; width: 100%; }
@media (min-width: 640px) { .cg-cta-btn { width: auto; } }

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.cg-empty {
  padding-block: var(--jt-3xl);
  margin-bottom: var(--jt-2xl);
  text-align: center;
  color: var(--jt-on-surface-variant);
}
.cg-empty-title { margin: var(--jt-md) 0 6px; font-size: 20px; font-weight: 700; color: var(--jt-on-surface); }
.cg-empty-text { margin: 0 0 var(--jt-lg); font-size: 14px; }
