/*
Theme Name: KRCTI
Theme URI: https://www.krcti.ac.ke/
Author: KRCTI
Description: Native WordPress presentation layer for the approved KRCTI website. Phase 1 establishes the global visual system, header, navigation, footer, accessibility/cookie utilities and direct integration with KRCTI Website Manager settings.
Version: 0.6.1
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: krcti
*/

/*
 * The approved frontend CSS is enqueued separately from assets/css/approved-site.css.
 * Keep this file limited to WordPress integration corrections.
 */

body.admin-bar .site-header {
  top: 32px;
}

@media (max-width: 782px) {
  body.admin-bar .site-header {
    top: 46px;
  }
}

.krcti-phase1-content {
  min-height: 32vh;
}

.krcti-phase1-content > .section:first-child {
  margin-top: 0;
}


/* --------------------------------------------------------------------------
   KRCTI NATIVE WORDPRESS FRONTEND — PHASE 2 HOMEPAGE
   The approved Astro homepage classes are retained exactly.
   -------------------------------------------------------------------------- */

body.krcti-home-editorial .krcti-phase1-content {
  min-height: 0;
}

/* WordPress sometimes inserts automatic paragraph spacing around empty
   front-page content. Phase 2 renders the approved homepage explicitly. */
body.krcti-home-editorial .krcti-phase1-content > :first-child {
  margin-top: 0;
}

/* KRCTI-PHASE-2-STATS-BACKGROUND-ASSET-PATH-FIX-V1 */
body.krcti-home-editorial .stats-band {
  background:
    linear-gradient(rgba(17, 19, 24, 0.78), rgba(17, 19, 24, 0.78)),
    url("assets/images/home/home-counterbox_1920x322.jpg") center / cover;
}

/* KRCTI-NATIVE-WORDPRESS-PHASE-3-INSTITUTIONAL-V1 */
body.krcti-theme-phase-3 .krcti-phase1-content {
  min-height: 0;
}


/* KRCTI-NATIVE-WORDPRESS-PHASE-4-CATALOGUE-V1 */
body.krcti-courses-index-editorial .krcti-phase1-content,
body.krcti-academic-programmes-editorial .krcti-phase1-content,
body.krcti-course-category-editorial .krcti-phase1-content,
body.krcti-course-detail-editorial .krcti-phase1-content {
  min-height: 0;
}

/* Preserve the approved OHS Committee Course facts treatment from the
   final Astro catalogue fallback. */
.krcti-ohs-native-detail .course-sidebar.krcti-ohs-course-facts {
  padding: 0;
  background: transparent;
  border-top: 0;
}
.krcti-ohs-native-detail .krcti-ohs-course-facts > h2 {
  margin-bottom: 1.25rem;
  font-size: clamp(1.65rem, 2.4vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}
.krcti-ohs-native-detail .krcti-ohs-course-facts .course-facts.compact {
  display: block;
  margin: 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
}
.krcti-ohs-native-detail .krcti-ohs-course-facts .course-facts.compact > div {
  display: grid;
  grid-template-columns: minmax(7.5rem, 0.65fr) minmax(0, 1.35fr);
  gap: 1.25rem;
  align-items: start;
  padding: 0.95rem 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.krcti-ohs-native-detail .krcti-ohs-course-facts .course-facts.compact dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.krcti-ohs-native-detail .krcti-ohs-course-facts .course-facts.compact dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.45;
}
.krcti-ohs-native-detail .krcti-ohs-course-facts .notice {
  margin: 1.25rem 0 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}
@media (max-width: 620px) {
  .krcti-ohs-native-detail .krcti-ohs-course-facts .course-facts.compact > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.3rem;
  }
}


/* KRCTI-NATIVE-WORDPRESS-PHASE-5-FUNCTIONAL-V1 */
body.krcti-course-calendar-editorial .krcti-phase1-content,
body.krcti-alumni-editorial .krcti-phase1-content,
body.krcti-rpl-editorial .krcti-phase1-content,
body.krcti-thank-you-editorial .krcti-phase1-content {
  min-height: 0;
}

.krcti-field-error {
  display: block;
  margin-top: 0.35rem;
  color: #a30f16;
  font-size: 0.86rem;
  line-height: 1.35;
}

.krcti-form-status {
  margin-top: 0.75rem;
}

.krcti-form-status.error {
  color: #a30f16;
}

.krcti-form-status.success {
  color: #176b39;
}


/* KRCTI-CATALOGUE-EDITORIAL-PARITY-V1-20260902
   Presentation-only parity pass for catalogue listing surfaces.
   Preserves all WordPress data, links, data-* hooks and course-detail rendering.
*/

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main {
  --krcti-catalogue-rule: rgba(20, 20, 20, 0.16);
  --krcti-catalogue-rule-strong: rgba(20, 20, 20, 0.30);
}

/* Match the editorial section rhythm used by Home/About. */
body.krcti-courses-index-editorial main
  :is(.krcti-courses-index-categories, .krcti-courses-index-frequent),
body.krcti-academic-programmes-editorial main
  .krcti-academic-programmes-list,
body.krcti-course-category-editorial main
  .krcti-course-category-list {
  padding-block: clamp(3.5rem, 7vw, 6.25rem);
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories + .krcti-courses-index-frequent {
  border-top: 1px solid var(--krcti-catalogue-rule);
}

/* Courses index: category cards become institutional navigation rows. */
body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--krcti-catalogue-rule-strong);
  border-bottom: 1px solid var(--krcti-catalogue-rule-strong);
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  min-width: 0;
  margin: 0;
  padding: clamp(1.55rem, 3vw, 2.3rem) 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--krcti-catalogue-rule);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card:last-child {
  border-bottom: 0;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card :where(h3, h4) {
  max-width: 48rem;
  margin-top: 0.25rem;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card p:not(.card-kicker) {
  max-width: 60rem;
  margin-bottom: 0;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card .card-link {
  white-space: nowrap;
  align-self: center;
}

/* Course tiles: convert floating cards into ruled prospectus rows. */
body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--krcti-catalogue-rule-strong);
  border-bottom: 1px solid var(--krcti-catalogue-rule-strong);
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(14rem, 0.85fr) auto;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: clamp(1.65rem, 3.2vw, 2.45rem) 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--krcti-catalogue-rule);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile:last-child {
  border-bottom: 0;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile > div:first-child {
  min-width: 0;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile h3 {
  max-width: 50rem;
  margin-top: 0;
  margin-bottom: 0.65rem;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile > div:first-child p {
  max-width: 58rem;
  margin-bottom: 0;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile dl {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--krcti-catalogue-rule);
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile dl > div {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--krcti-catalogue-rule);
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 650;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  min-width: 10.5rem;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-actions .button {
  width: 100%;
  justify-content: center;
  text-align: center;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-actions .text-link {
  text-align: center;
}

/* The old soft catalogue band made /courses feel like a separate design system. */
body.krcti-courses-index-editorial main
  .krcti-courses-index-frequent {
  background: transparent;
}

/* Neutralise legacy hover elevation only on catalogue listings. */
@media (hover: hover) and (pointer: fine) {
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main :is(.card, .course-tile):hover {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }
}

@media (max-width: 980px) {
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-tile {
    grid-template-columns: minmax(0, 1fr) minmax(13rem, 0.75fr);
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-actions .button {
    width: auto;
  }
}

@media (max-width: 700px) {
  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .section-heading {
    display: block;
  }

  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .section-heading > a {
    display: inline-block;
    margin-top: 0.8rem;
  }

  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .card {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .card .card-link {
    white-space: normal;
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-tile {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.15rem;
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-actions {
    grid-column: auto;
    flex-direction: column;
    align-items: stretch;
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-actions .button {
    width: 100%;
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-actions .text-link {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main :is(.card, .course-tile) {
    transition: none;
    transform: none;
  }
}


/* KRCTI-CATALOGUE-EDITORIAL-GRID-V2-20260902
   Presentation-only refinement of the GREEN v0.5.1 catalogue parity pass.
   Converts catalogue listings from ruled single-column rows to a flat
   editorial grid. No WordPress data, templates, links, forms or hooks change.
*/

/* -------------------------------------------------------------------------
   Category navigation: two-column editorial grid, not floating cards.
   ------------------------------------------------------------------------- */
body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--krcti-catalogue-rule-strong);
  border-bottom: 1px solid var(--krcti-catalogue-rule-strong);
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  padding: clamp(1.7rem, 3vw, 2.45rem) clamp(1.4rem, 2.6vw, 2.35rem);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--krcti-catalogue-rule);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card:nth-child(odd) {
  border-right: 1px solid var(--krcti-catalogue-rule);
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card:nth-last-child(-n + 2) {
  border-bottom: 0;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card:nth-last-child(1):nth-child(odd) {
  border-bottom: 0;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card > div {
  flex: 1 1 auto;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card :where(h3, h4) {
  max-width: 34rem;
  margin-top: 0.25rem;
  margin-bottom: 0.7rem;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card p:not(.card-kicker) {
  max-width: 38rem;
  margin-bottom: 1.25rem;
}

body.krcti-courses-index-editorial main
  .krcti-courses-index-categories .card .card-link {
  align-self: flex-start;
  white-space: normal;
  margin-top: auto;
}

/* -------------------------------------------------------------------------
   Course listings: two-column prospectus-style editorial grid.
   ------------------------------------------------------------------------- */
body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--krcti-catalogue-rule-strong);
  border-bottom: 1px solid var(--krcti-catalogue-rule-strong);
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  padding: clamp(1.8rem, 3.25vw, 2.55rem) clamp(1.45rem, 2.7vw, 2.4rem);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--krcti-catalogue-rule);
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile:nth-child(odd) {
  border-right: 1px solid var(--krcti-catalogue-rule);
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile:nth-last-child(-n + 2) {
  border-bottom: 0;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile:nth-last-child(1):nth-child(odd) {
  border-bottom: 0;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile h3 {
  max-width: 34rem;
  margin: 0 0 0.7rem;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile > div:first-child p {
  max-width: 38rem;
  margin-bottom: 1.35rem;
}

/* Facts sit as a compact two-row information block inside each grid cell. */
body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  width: 100%;
  margin: auto 0 0;
  border-top: 1px solid var(--krcti-catalogue-rule);
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-tile dl > div {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.68rem 0;
  border-bottom: 1px solid var(--krcti-catalogue-rule);
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.9rem;
  width: 100%;
  min-width: 0;
  margin-top: 1.2rem;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-actions .button {
  width: auto;
  justify-content: center;
  text-align: center;
}

body:is(
  .krcti-courses-index-editorial,
  .krcti-academic-programmes-editorial,
  .krcti-course-category-editorial
) main .course-actions .text-link {
  text-align: left;
}

/* Keep the grid restrained and institutional on hover. */
@media (hover: hover) and (pointer: fine) {
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main :is(.card, .course-tile):hover {
    background: rgba(0, 0, 0, 0.018);
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }
}

/* -------------------------------------------------------------------------
   Responsive collapse: one-column editorial grid.
   ------------------------------------------------------------------------- */
@media (max-width: 860px) {
  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .card-grid,
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .card,
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-tile {
    border-right: 0;
    border-bottom: 1px solid var(--krcti-catalogue-rule);
  }

  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .card:last-child,
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-tile:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  body.krcti-courses-index-editorial main
    .krcti-courses-index-categories .card,
  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-tile {
    padding-inline: 0;
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body:is(
    .krcti-courses-index-editorial,
    .krcti-academic-programmes-editorial,
    .krcti-course-category-editorial
  ) main .course-actions .button {
    width: 100%;
  }
}

/* KRCTI-NATIVE-WORDPRESS-PHASE-6-CLOSURE-V1 */
body.krcti-resources-editorial .krcti-phase1-content,
body.krcti-resource-detail-editorial .krcti-phase1-content,
body.krcti-article-editorial .krcti-phase1-content,
body.krcti-legal-editorial .krcti-phase1-content {
  min-height: 0;
}

.krcti-resource-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.4rem;
}

.krcti-resource-file-note {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}
