/**
 * Course home — Constitution of Kenya, 2010 (graded course landing).
 * Loaded after course.css; scoped to body.course-home.
 */
body.course-home {
  --home-green: #143d32;
  --home-green-deep: #0c2820;
  --home-green-mid: #1e5c4a;
  --home-cream: #f7f3e8;
  --home-gold: #c9a227;
  --home-red: #9f1b1b;
  --home-paper: #fffdf8;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Flag-inspired accent (decorative, not a reproduction of national symbols) */
body.course-home::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(
    90deg,
    #000 0%,
    #000 20%,
    #b91c1c 20%,
    #b91c1c 40%,
    #fff 40%,
    #fff 60%,
    #b91c1c 60%,
    #b91c1c 80%,
    #198754 80%,
    #198754 100%
  );
}

/* ----- Hero ----- */
body.course-home .home-hero {
  display: grid;
  gap: 1.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 52rem) {
  body.course-home .home-hero {
    grid-template-columns: 1fr minmax(16rem, 24rem);
    align-items: start;
    column-gap: 2rem;
  }
}

body.course-home .home-hero__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-size: clamp(1.55rem, 3.2vw, 2rem);
  font-weight: 600;
  color: var(--home-green-deep);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

body.course-home .home-hero__tagline {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 40rem;
}

body.course-home .home-hero__notice {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  background: rgba(20, 61, 50, 0.06);
  border: 1px solid rgba(20, 61, 50, 0.12);
  border-radius: 10px;
  border-left: 4px solid var(--home-gold);
}

/* Summary strip when DB progress loads */
body.course-home .home-course-stats {
  padding: 1rem 1.15rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(12, 40, 32, 0.06);
}

body.course-home .home-course-stats[data-state="ready"] {
  border-color: rgba(30, 92, 74, 0.25);
  background: linear-gradient(135deg, #fff 0%, rgba(247, 243, 232, 0.65) 100%);
}

body.course-home .home-course-stats[data-state="error"] {
  border-color: rgba(159, 27, 27, 0.35);
  background: rgba(159, 27, 27, 0.05);
}

body.course-home .home-course-stats__body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

body.course-home .home-course-stats__body strong {
  color: var(--home-green-deep);
  font-weight: 700;
}

/* Auth gate modal — align with home palette */
body.course-home .auth-modal-box {
  background: var(--home-paper);
  border-radius: 12px;
  border-top: 4px solid var(--home-green);
  box-shadow: 0 24px 60px rgba(12, 40, 32, 0.35);
}

body.course-home .auth-modal-box h2 {
  font-family: var(--font-heading);
  color: var(--home-green-deep);
}

body.course-home .auth-modal-actions a.primary {
  background: var(--home-green);
}

body.course-home .auth-modal-actions a.primary:hover {
  background: var(--home-green-mid);
}

body.course-home .auth-modal-actions a.secondary {
  color: var(--home-green) !important;
}

/* ----- Outline + grid ----- */
body.course-home .home-main {
  flex: 1 1 auto;
  background: var(--home-paper);
  color: var(--text);
  padding: clamp(1.75rem, 4vw, 2.75rem) 0 clamp(2.5rem, 5vw, 3.5rem);
}

body.course-home .home-main-inner {
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 4vw, 2.75rem);
}

body.course-home .home-outline__intro {
  margin-bottom: 0.25rem;
}

body.course-home .home-outline__heading {
  margin: 0 0 0.4rem;
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  color: var(--home-green-deep);
}

body.course-home .home-outline__lead {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 36rem;
}

body.course-home .home-lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
  gap: 1rem 1.1rem;
  margin-top: 1.25rem;
}

body.course-home .home-lesson-card {
  display: flex;
  flex-direction: column;
  min-height: 10.5rem;
  gap: 0.35rem;
  padding: 1rem 1.1rem 0.9rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

body.course-home .home-lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(12, 40, 32, 0.1);
  border-color: rgba(30, 92, 74, 0.3);
  text-decoration: none;
}

body.course-home .home-lesson-card:focus-visible {
  outline: 2px solid var(--home-green-mid);
  outline-offset: 2px;
}

body.course-home .home-lesson-card--hub {
  border-left: 4px solid var(--home-gold);
}

body.course-home .home-lesson-card__kind {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

body.course-home .home-lesson-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--home-green-deep);
  line-height: 1.3;
}

body.course-home .home-lesson-card__sub {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Footer: progress integrated into card */
body.course-home .home-lesson-card__footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

body.course-home .home-lesson-card__quiz-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

body.course-home .home-lesson-card__progress {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.25rem 0.5rem;
  align-items: center;
}

body.course-home .home-lesson-card__progress-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

body.course-home .home-lesson-card__stat {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--text);
  text-align: right;
}

body.course-home .home-lesson-card__stat strong {
  color: var(--home-green-deep);
  font-weight: 700;
}

body.course-home .home-lesson-card__not-started {
  color: var(--muted);
  font-style: italic;
}

body.course-home .home-lesson-card__bar {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 61, 50, 0.1);
  overflow: hidden;
}

body.course-home .home-lesson-card__bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--home-green-mid), var(--home-green));
  transition: width 0.35s ease;
}

body.course-home .home-lesson-card__progress--empty .home-lesson-card__bar-fill {
  width: 0% !important;
}

/* Quiz score bands on outline cards (90+ / 75–89 / 60–74 / under 60) */
body.course-home .home-lesson-card__progress--tier-strong .home-lesson-card__bar-fill {
  background: linear-gradient(90deg, #15803d, #22c55e);
}

body.course-home .home-lesson-card__progress--tier-strong .home-lesson-card__stat strong {
  color: #166534;
}

body.course-home .home-lesson-card__progress--tier-solid .home-lesson-card__bar-fill {
  background: linear-gradient(90deg, var(--home-green-mid), #2a8f6f);
}

body.course-home .home-lesson-card__progress--tier-solid .home-lesson-card__stat strong {
  color: var(--home-green-deep);
}

body.course-home .home-lesson-card__progress--tier-okay .home-lesson-card__bar-fill {
  background: linear-gradient(90deg, #b45309, #eab308);
}

body.course-home .home-lesson-card__progress--tier-okay .home-lesson-card__stat strong {
  color: #92400e;
}

body.course-home .home-lesson-card__progress--tier-weak .home-lesson-card__bar-fill {
  background: linear-gradient(90deg, #991b1b, #dc2626);
}

body.course-home .home-lesson-card__progress--tier-weak .home-lesson-card__stat strong {
  color: var(--home-red);
}

body.course-home .home-footer {
  margin-top: auto;
  padding: 1rem 0;
  background: var(--home-green-deep);
  color: rgba(247, 243, 232, 0.88);
  font-size: 0.88rem;
  text-align: center;
}

body.course-home .home-footer .wrap {
  max-width: var(--wrap-wide, 72rem);
  margin: 0 auto;
  padding: 0 min(1.25rem, 4vw);
}

body.course-home #auth-gate-modal .auth-modal-box {
  position: relative;
  padding-top: 2.5rem;
}

body.course-home #auth-gate-modal .auth-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: auto;
  margin: 0;
  padding: 0.25rem 0.5rem;
  font-size: 1.35rem;
  line-height: 1;
}
