/* ============================================================
   DAILY OPPORTUNITIES — category.css  (v2)
   Category listing page — fully aligned with index.css tokens.
   Shared by: category.html, tag.html, search.html, author_detail.html
   Inherits all design tokens from index.css (:root).
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   GLOBAL UTILITY
   ───────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.hide-mobile { display: revert; }

/* ─────────────────────────────────────────────────────────────
   CATEGORY HERO
   ───────────────────────────────────────────────────────────── */
.cat-hero {
  background: var(--green-deep);
  position: relative;
  overflow: hidden;
  padding: clamp(40px, 6vw, 72px) 5% clamp(52px, 7vw, 88px);
}

/* Gradient overlays */
.cat-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 90% at 90% 50%, rgba(46,125,50,.40) 0%, transparent 65%),
    radial-gradient(ellipse 40% 50% at 5%  90%, rgba(255,179,0,.08) 0%, transparent 55%);
  pointer-events: none;
}

/* Dot-grid overlay — matches hero-section in index.css */
.cat-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.cat-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  animation: catHeroUp .6s cubic-bezier(.22,.61,.36,1) both;
}

@keyframes catHeroUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Breadcrumb */
.cat-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  flex-wrap: wrap;
}
.cat-breadcrumb a {
  color: rgba(255,255,255,.70);
  text-decoration: none;
  transition: color .2s;
}
.cat-breadcrumb a:hover { color: #fff; }
.cat-breadcrumb-sep     { color: rgba(255,255,255,.30); }
.cat-breadcrumb-current { color: rgba(255,255,255,.85); font-weight: 500; }

/* Hero title row */
.cat-hero-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cat-hero-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
}
.cat-hero-title {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: -.025em;
  line-height: 1.15;
}
.cat-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 30px;
  padding: 5px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  backdrop-filter: blur(6px);
}
.cat-hero-desc {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(15px, 1.8vw, 17px);
  color: rgba(255,255,255,.72);
  margin: 0 0 28px;
  max-width: 560px;
  line-height: 1.65;
}

/* In-hero search */
.cat-hero-search {
  display: flex;
  max-width: 540px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.cat-hero-search:focus-within {
  border-color: rgba(255,255,255,.45);
  box-shadow: 0 0 0 3px rgba(255,255,255,.07);
}
.cat-hero-search-icon {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: rgba(255,255,255,.45);
  flex-shrink: 0;
  pointer-events: none;
}
.cat-hero-search input {
  flex: 1;
  padding: 12px 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  color: #fff;
  min-width: 0;
}
.cat-hero-search input::placeholder { color: rgba(255,255,255,.40); }
.cat-hero-search button {
  padding: 12px 20px;
  background: var(--amber);
  border: none;
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: background .2s;
}
.cat-hero-search button:hover { background: #E65100; }
.cat-hero-search button:focus-visible {
  outline: 3px solid var(--amber-bright);
  outline-offset: -2px;
}

/* ─────────────────────────────────────────────────────────────
   CATEGORY FILTER TABS  (sticky below navbar)
   ───────────────────────────────────────────────────────────── */
.cat-tabs-wrapper {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-h);
  z-index: 100;
}
.cat-tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5%;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-tabs-inner::-webkit-scrollbar { display: none; }

.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 14px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted-text);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2.5px solid transparent;
  transition: color .2s, border-color .2s;
  flex-shrink: 0;
}
.cat-tab:hover { color: var(--green-deep); }
.cat-tab.active {
  color: var(--green-deep);
  font-weight: 600;
  border-bottom-color: var(--green-deep);
}
.cat-tab:focus-visible {
  outline: 3px solid var(--green-bright);
  outline-offset: -2px;
}
.cat-tab-emoji { font-size: 1rem; }
.cat-tab-count {
  font-size: .72rem;
  font-weight: 600;
  background: var(--green-light);
  color: var(--green-mid);
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
  line-height: 1.6;
}
.cat-tab.active .cat-tab-count {
  background: var(--green-deep);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────────
   PAGE BODY
   ───────────────────────────────────────────────────────────── */
.cat-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 5% 80px;
}

/* Results bar */
.cat-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.cat-results-count {
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  color: var(--muted-text);
  margin: 0;
}
.cat-results-count strong { color: var(--dark-text); font-weight: 600; }

.cat-sort-select {
  padding: 8px 32px 8px 14px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239CA3AF' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center / 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  color: var(--dark-text);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .2s, box-shadow .2s;
}
.cat-sort-select:focus {
  border-color: var(--green-bright);
  box-shadow: 0 0 0 3px rgba(27,94,32,.08);
}

/* ─────────────────────────────────────────────────────────────
   CATEGORY BADGES
   ───────────────────────────────────────────────────────────── */
.badge-cat {
  display: inline-block;
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  white-space: nowrap;
  line-height: 1.5;
  letter-spacing: .02em;
}
.badge-learnerships    { background: #DBEAFE; color: #1E40AF; }
.badge-apprenticeships { background: #EDE9FE; color: #5B21B6; }
.badge-training        { background: #E0E7FF; color: #3730A3; }
.badge-internships     { background: #D1FAE5; color: #065F46; }
.badge-vacancies       { background: #FEF3C7; color: #92400E; }
.badge-yes4youth       { background: #DCFCE7; color: #14532D; }

.badge-new {
  display: inline-block;
  background: var(--amber-bright);
  color: #1A1100;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────
   LISTING GRID
   ───────────────────────────────────────────────────────────── */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
  align-items: start;
}

/* ─────────────────────────────────────────────────────────────
   LISTING CARD
   ───────────────────────────────────────────────────────────── */
.listing-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .22s var(--ease-out, cubic-bezier(.22,.61,.36,1)),
              box-shadow .22s, border-color .22s;
  box-shadow: var(--shadow-card);
  animation: cardIn .4s cubic-bezier(.22,.61,.36,1) backwards;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.listing-card:nth-child(1) { animation-delay: .04s; }
.listing-card:nth-child(2) { animation-delay: .08s; }
.listing-card:nth-child(3) { animation-delay: .12s; }
.listing-card:nth-child(4) { animation-delay: .16s; }
.listing-card:nth-child(5) { animation-delay: .20s; }
.listing-card:nth-child(6) { animation-delay: .24s; }
.listing-card:nth-child(n+7) { animation-delay: .28s; }

.listing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #D1FAE5;
}

/* ─────────────────────────────────────────────────────────────
   ACCENT LINE
   ───────────────────────────────────────────────────────────── */
.listing-accent { height: 3px; width: 100%; flex-shrink: 0; }
.listing-accent-learnerships    { background: #3B8BD4; }
.listing-accent-apprenticeships { background: #7C3AED; }
.listing-accent-training        { background: #534AB7; }
.listing-accent-internships     { background: #1D9E75; }
.listing-accent-vacancies       { background: #BA7517; }
.listing-accent-yes4youth       { background: #3B6D11; }
.listing-accent-                { background: var(--green-bright); }

/* ─────────────────────────────────────────────────────────────
   CARD BODY
   ───────────────────────────────────────────────────────────── */
.listing-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.listing-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.listing-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Logo box */
.listing-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.listing-logo-learnerships    { background: #DBEAFE; }
.listing-logo-apprenticeships { background: #EDE9FE; }
.listing-logo-training        { background: #E0E7FF; }
.listing-logo-internships     { background: #D1FAE5; }
.listing-logo-vacancies       { background: #FEF3C7; }
.listing-logo-yes4youth       { background: #DCFCE7; }
.listing-logo-                { background: var(--green-light); }

/* Featured image */
.listing-image-wrap {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--green-pale);
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}
.listing-featured-image {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.listing-card:hover .listing-featured-image { transform: scale(1.02); }

/* Card text */
.listing-title {
  font-family: 'Poppins', sans-serif;
  font-size: .97rem;
  font-weight: 600;
  color: var(--dark-text);
  line-height: 1.4;
  margin: 0;
}
.listing-title a {
  color: inherit;
  text-decoration: none;
  transition: color .2s;
}
.listing-title a:hover { color: var(--green-deep); }
.listing-title a:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
  border-radius: 2px;
}

.listing-org {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: .825rem;
  color: var(--muted-text);
  margin: 0;
}

.listing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: .775rem;
  color: var(--light-text);
}
.listing-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.listing-excerpt {
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  color: var(--muted-text);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────
   CARD FOOTER
   ───────────────────────────────────────────────────────────── */
.listing-footer {
  padding: 12px 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--green-pale);
  gap: 10px;
  margin-top: auto;
}
.listing-closing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: .75rem;
  color: var(--light-text);
}
/* Legacy alias */
.listing-date {
  font-family: 'DM Sans', sans-serif;
  font-size: .78rem;
  color: var(--light-text);
  font-weight: 500;
}

.btn-apply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--green-deep);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: .775rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  min-height: 34px;
  transition: background .2s, transform .2s, box-shadow .2s;
}
.btn-apply:hover {
  background: var(--green-mid);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27,94,32,.25);
}
.btn-apply:focus-visible {
  outline: 3px solid var(--green-bright);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────
   AD SLOTS
   ───────────────────────────────────────────────────────────── */
.grid-ad {
  grid-column: 1 / -1;
  border-radius: var(--radius-card);
  overflow: hidden;
  min-height: 60px;
  background: var(--green-pale);
}
.grid-ad iframe,
.grid-ad img,
.grid-ad ins,
.grid-ad > * { max-width: 100% !important; }

/* ─────────────────────────────────────────────────────────────
   NO RESULTS / EMPTY STATE
   ───────────────────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 72px 24px;
  background: var(--white);
  border-radius: var(--radius-card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
}
.no-results-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: .35;
  display: block;
}
.no-results-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dark-text);
  margin: 0 0 8px;
}
.no-results-desc {
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  color: var(--muted-text);
  line-height: 1.6;
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   PAGINATION
   ───────────────────────────────────────────────────────────── */
.pagination-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.pagination {
  display: flex;
  list-style: none;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0; margin: 0;
}
.pagination-item { display: flex; }
.pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--muted-text);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.pagination-link:hover:not(.disabled) {
  background: var(--green-light);
  border-color: var(--green-bright);
  color: var(--green-deep);
}
.pagination-link.active {
  background: var(--green-deep);
  border-color: var(--green-deep);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(27,94,32,.25);
}
.pagination-link.disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}
.pagination-link:focus-visible {
  outline: 3px solid var(--green-bright);
  outline-offset: 2px;
}
.pagination-ellipsis {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 4px;
  color: var(--light-text);
  font-size: .875rem;
}
.pagination-info {
  font-family: 'DM Sans', sans-serif;
  font-size: .825rem;
  color: var(--light-text);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .listings-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .cat-hero        { padding: 32px 5% 52px; }
  .cat-hero-icon   { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 12px; }
  .cat-hero-search { max-width: 100%; }
  .cat-tabs-wrapper { top: 60px; }
  .cat-body        { padding: 24px 5% 60px; }
  .listings-grid   { grid-template-columns: 1fr; gap: 14px; }
  .cat-results-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .listing-body    { padding: 16px; }
  .listing-footer  { padding: 10px 16px 14px; }
  .hide-mobile     { display: none; }
}

@media (max-width: 480px) {
  .cat-hero-title-row { gap: 10px; }
  .cat-hero-badge     { display: none; }
  .listing-card       { border-radius: 14px; }
}

/* ─────────────────────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cat-hero-inner,
  .listing-card,
  .listing-featured-image,
  .btn-apply,
  .cat-hero-search,
  .cat-tab {
    animation: none !important;
    transition: none !important;
  }
}