/* ==========================================================================
   Genesis Chess Academy – Course duration page
   Scoped under .cd; colours come from the site theme in style.css
   (:root for GCA, body.hoc for House of Chess). Mobile-first.
   ========================================================================== */

.cd {
  --cd-ink: var(--primary-text-color, #000);
  --cd-text: var(--text-color, #5e5e5e);
  --cd-accent: var(--color1, #00bfa5);
  --cd-accent-3: var(--color3, #00a192);
  --cd-heading: var(--headingColor, #0d544f);
  --cd-muted: var(--color5, #8ebaa5);
  --cd-soft: color-mix(in srgb, var(--cd-muted) 16%, #fff);
  --cd-tint: color-mix(in srgb, var(--cd-accent) 16%, #fff);
  --cd-line: color-mix(in srgb, var(--cd-muted) 40%, #fff);
  --cd-serif: "Fraunces", Georgia, serif;
  --cd-radius: 1.25rem;
  --cd-section: clamp(3rem, 7vw, 4.5rem);
  --cd-badge: 3.25rem;

  display: block;
  color: var(--cd-text);
  background: #fff;
  line-height: 1.55;
  overflow-x: clip;
}
.cd *, .cd *::before, .cd *::after { box-sizing: border-box; }
.cd :where(h1, h2, h3, h4, p, ul, ol) { margin: 0; }
.cd :where(ul, ol) { list-style: none; padding: 0; }
.cd :where(h1, h2, h3, h4) { color: var(--cd-heading); line-height: 1.15; }
.cd :focus-visible { outline: 3px solid var(--cd-heading); outline-offset: 3px; }

/* ---------- Utilities ---------- */
.cd-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.cd-wrap { width: min(100% - 2rem, 75rem); margin-inline: auto; }
.cd-icon { width: 1.25rem; height: 1.25rem; flex: none; }
.cd-kicker { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cd-heading); }
.cd-h2 { margin: 0.5rem 0 1.5rem; font-family: var(--cd-serif); font-weight: 600; font-size: clamp(1.75rem, 4vw, 2.3rem); }

/* ---------- 1. Hero ---------- */
.cd-hero { padding-block: var(--cd-section) 2.5rem; background: var(--cd-soft); }
.cd-hero__title {
  max-width: 50rem; margin: 0.75rem 0;
  font-family: var(--cd-serif); font-weight: 600; letter-spacing: -0.01em;
  font-size: clamp(2rem, 5.5vw, 3rem);
}
.cd-hero__lead { max-width: 40rem; font-size: clamp(1rem, 2.2vw, 1.15rem); }
.cd-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1.75rem; }
.cd-facts li { display: grid; gap: 0.15rem; padding: 1rem 1.1rem; border: 1px solid var(--cd-line); border-radius: 1rem; background: #fff; }
.cd-facts strong { font-family: var(--cd-serif); font-size: clamp(1.4rem, 3vw, 1.85rem); line-height: 1.1; color: var(--cd-heading); }
.cd-facts span { font-size: 0.875rem; }

/* ---------- 2. Path + aside ---------- */
.cd-layout { display: grid; gap: 2rem; padding-block: var(--cd-section); }

.cd-road { position: relative; display: grid; gap: 1.25rem; }
/* The line joining every badge */
.cd-road::before {
  content: ""; position: absolute; top: 2.5rem; bottom: 1.5rem;
  left: calc(var(--cd-badge) / 2 + 0.5rem - 2px); width: 4px; border-radius: 2px;
  background: linear-gradient(var(--cd-accent), var(--cd-heading));
}
.cd-stage__title {
  margin: 0 0 0.75rem calc(var(--cd-badge) + 1.25rem);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.cd-stage__title span { font-weight: 600; color: var(--cd-text); }
.cd-levels { display: grid; gap: 0.75rem; }

.cd-level {
  position: relative;
  display: grid; grid-template-columns: calc(var(--cd-badge) + 1rem) 1fr; align-items: center; column-gap: 0.75rem; row-gap: 0.5rem;
  padding: 0.9rem 1rem 0.9rem 0;
  border: 1px solid var(--cd-line); border-radius: var(--cd-radius); background: #fff;
}
.cd-level__title { font-family: var(--cd-serif); font-weight: 600; font-size: 1.2rem; }
.cd-level__title small {
  margin-left: 0.4rem; font-family: inherit; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--cd-text);
}
.cd .cd-level__text p { font-size: 0.9rem; margin-top: 0.15rem; }
.cd-level__meta { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cd-level__meta span {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--cd-tint);
  color: var(--cd-heading); font-size: 0.85rem; font-weight: 600;
}
.cd-level__meta .cd-icon { width: 1rem; height: 1rem; }

/* Level badges: pawn (Beginner), knight (Intermediate), queen (Advanced), with a soft glow and ring */
.cd-badge {
  position: relative; z-index: 1;
  grid-row: span 2; justify-self: center;
  display: grid; place-items: center;
  width: var(--cd-badge); height: var(--cd-badge); border-radius: 50%;
  border: 4px solid #fff;
  background: var(--cd-heading); color: #fff;
  font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", serif;
  font-size: calc(var(--cd-badge) * 0.5); line-height: 1;
  animation: cd-glow 2.4s ease-in-out infinite;
}
.cd-level--b .cd-badge { background: var(--cd-accent-3); color: #fff; }
body.hoc .cd-level--b .cd-badge { color: #000; }
.cd-badge::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 3px solid var(--cd-accent); opacity: 0;
  animation: cd-ring 2.4s ease-out infinite;
}
/* Stagger so the glow travels up the path */
.cd-stage:nth-child(2) .cd-badge, .cd-stage:nth-child(2) .cd-badge::after { animation-delay: 0.6s; }
.cd-stage:nth-child(3) .cd-badge, .cd-stage:nth-child(3) .cd-badge::after { animation-delay: 1.2s; }
.cd-level:nth-child(2) .cd-badge, .cd-level:nth-child(2) .cd-badge::after { animation-delay: 0.3s; }
.cd-stage:nth-child(2) .cd-level:nth-child(2) .cd-badge, .cd-stage:nth-child(2) .cd-level:nth-child(2) .cd-badge::after { animation-delay: 0.9s; }
.cd-stage:nth-child(3) .cd-level:nth-child(2) .cd-badge, .cd-stage:nth-child(3) .cd-level:nth-child(2) .cd-badge::after { animation-delay: 1.5s; }
.cd-level:nth-child(3) .cd-badge, .cd-level:nth-child(3) .cd-badge::after { animation-delay: 0.6s; }

@keyframes cd-glow {
  0%, 100% { box-shadow: 0 0 0 2px var(--cd-line), 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 2px var(--cd-line), 0 0 1.4rem 0.4rem color-mix(in srgb, var(--cd-accent) 55%, transparent); }
}
@keyframes cd-ring {
  0% { transform: scale(0.9); opacity: 0.8; }
  80%, 100% { transform: scale(1.45); opacity: 0; }
}

.cd-goal {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; padding: 1rem 1.25rem;
  border-radius: var(--cd-radius); background: var(--cd-heading); color: #fff;
}
.cd-goal .cd-icon { width: 1.75rem; height: 1.75rem; color: var(--cd-accent); }
.cd-goal strong { font-size: 1.1rem; }

.cd-aside { align-self: start; padding: 1.5rem; border: 1px solid var(--cd-line); border-radius: 1.4rem; background: var(--cd-soft); }
.cd-aside__title { margin-bottom: 0.9rem; font-family: var(--cd-serif); font-weight: 600; font-size: 1.35rem; }
.cd-good { display: grid; gap: 0.85rem; }
.cd-good li { display: flex; gap: 0.65rem; font-size: 0.95rem; }
.cd-good .cd-icon { color: var(--cd-heading); margin-top: 0.1rem; }
.cd-good strong { color: var(--cd-ink); }

/* ---------- 3. Call to action ---------- */
.cd-cta { padding-bottom: var(--cd-section); }
.cd-cta__box {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem;
  padding: clamp(1.75rem, 4vw, 2.75rem); border-radius: 1.75rem;
  background: var(--cd-heading); color: rgb(255 255 255 / 0.88);
}
.cd-cta__title { color: #fff; font-family: var(--cd-serif); font-weight: 600; font-size: clamp(1.5rem, 3.5vw, 2rem); margin-bottom: 0.35rem; }
.cd-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.75rem 1.4rem; border-radius: 0.75rem;
  background: var(--cd-accent); color: #000; font-weight: 700; text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cd-btn:hover { transform: translateY(-1px); box-shadow: 0 0.5rem 1.25rem rgb(0 0 0 / 0.2); }

/* ---------- Breakpoints ---------- */
@media (min-width: 40rem) {
  .cd { --cd-badge: 3.6rem; }
  .cd-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cd-level { grid-template-columns: calc(var(--cd-badge) + 1rem) 1fr auto; }
  .cd-badge { grid-row: auto; }
  .cd-level__meta { grid-column: auto; justify-content: flex-end; }
}

@media (min-width: 64rem) {
  .cd-layout { grid-template-columns: minmax(0, 1fr) 20rem; gap: 2.5rem; }
  .cd-aside { position: sticky; top: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cd-badge, .cd-badge::after { animation: none; }
  .cd-btn { transition: none; }
  .cd-btn:hover { transform: none; }
}
