/* ==========================================================================
   BFFI · courses.css
   Homepage workshop/course cards and the generated course & workshop pages
   (scripts/build-pages.mjs). Loaded after styles.css and uses its tokens;
   it adds new classes only and does not change any existing rule.
   ========================================================================== */

/* ---------- Homepage cards ----------
   Same look as the Foundation Diploma and the original course cards (styles.css:
   .course-badge, .course-pill, .course-arrow, .course-title, .course-excerpt,
   .course-metas, .course-more), with the course photo on top. The whole card is
   one real link: the title link is stretched over the card, so click, middle-click,
   "open in new tab" and keyboard all work. No class or data attribute here opens
   a pop-up. */
.page-cards + .courses-label--courses { margin-top: 72px; }

.page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(155deg, #2a3b49 0%, #16202a 55%, #0D0D0D 100%);
  color: var(--paper);
  border: 1px solid rgba(234, 224, 200, 0.16);
  box-shadow: 0 16px 38px rgba(13, 13, 13, 0.18);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.page-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 60px rgba(13, 13, 13, 0.3);
}
.page-card:hover .course-arrow { transform: translate(3px, -3px); }

.page-card-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--charcoal-blue);
}
.page-card-media img { width: 100%; height: 100%; object-fit: cover; }

.page-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 26px 28px 28px;
}
.page-card .course-card-top { margin-bottom: 22px; }

.page-card-link { color: inherit; text-decoration: none; }
.page-card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
/* Keyboard focus: a ring around the whole card where supported, otherwise around the title */
.page-card-link:focus-visible { outline: 2px solid var(--pearl); outline-offset: 4px; }
@supports selector(:has(*)) {
  .page-card-link:focus-visible { outline: none; }
  .page-card:has(.page-card-link:focus-visible) { outline: 3px solid var(--charcoal-blue); outline-offset: 4px; }
}

/* ---------- Course & workshop pages ---------- */
html.cp-root { scroll-padding-top: calc(var(--header-h) + var(--cp-tabbar-h, 66px) + 20px); }

/* The site-wide focus ring is Pearl, made for dark backgrounds. On these light pages use Charcoal Blue. */
.cp-page main a:focus-visible,
.cp-page main .btn:focus-visible,
.cp-page main [tabindex]:focus-visible { outline: 2px solid var(--charcoal-blue); outline-offset: 3px; }

.cp-head { background: var(--paper); padding: 36px 0 40px; }

.cp-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-family: var(--font-label);
  font-size: 0.78rem;
  color: var(--steel-ink);
  margin-bottom: 44px;
}
.cp-breadcrumb li + li::before { content: "›"; content: "›" / ""; margin-right: 10px; }
.cp-breadcrumb a {
  color: var(--void);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.cp-breadcrumb a:hover { color: var(--charcoal-blue); }
.cp-breadcrumb [aria-current] { color: var(--steel-ink); }

.cp-eyebrow {
  font-family: var(--font-label);
  font-size: 1rem;
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.1em;
  color: var(--steel-ink);
  margin-bottom: 10px;
}
.cp-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 6.2vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--void);
  max-width: 15em;
}

/* Sticky tab bar */
.cp-tabbar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: var(--paper);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}
.cp-tabbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 66px;
}
.cp-tabs {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.cp-tabs ul { display: flex; gap: 28px; white-space: nowrap; }
.cp-tab {
  display: block;
  padding: 21px 0 19px;
  font-family: var(--font-label);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--steel-ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 200ms ease, border-color 200ms ease;
}
.cp-tab:hover { color: var(--void); }
.cp-tab[aria-current="true"] { color: var(--void); border-bottom-color: var(--charcoal-blue); }
.cp-page main .cp-tab:focus-visible { outline-offset: -2px; }
.cp-tabbar-cta { flex: 0 0 auto; padding: 14px 26px; }

/* Hero */
.cp-hero {
  display: block;
  margin: 0;
  width: 100%;
  aspect-ratio: 21 / 9;
  max-height: 460px;
  overflow: hidden;
  background: var(--charcoal-blue);
}
.cp-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }

/* White card over the bottom of the hero */
.cp-summary { position: relative; z-index: 2; margin-top: -60px; }
.cp-summary-card {
  max-width: 1000px;
  margin: 0 auto;
  background: var(--white);
  padding: 44px 56px 40px;
  box-shadow: 0 18px 40px rgba(13, 13, 13, 0.06);
}
.cp-tagline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--void);
  max-width: 32em;
}
.cp-summary-rule { height: 1px; background: var(--border-light); margin: 30px 0 26px; }
.cp-summary-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }

.cp-summary-facts dt,
.cp-keyfacts dt {
  font-family: var(--font-label);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel-ink);
}
.cp-summary-facts dd {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.08rem;
  line-height: 1.35;
  color: var(--void);
}

/* Two columns: copy + sticky Key facts.
   Only the copy and the sidebar live in this grid. A sticky grid item stays stuck
   until the end of its whole grid container, so anything placed in this grid below
   the copy would slide under the sidebar; the "Continue..." section is therefore a
   separate full-width section after it. No ancestor of the sidebar sets overflow. */
.cp-layout {
  --cp-sticky-top: calc(var(--header-h) + var(--cp-tabbar-h, 66px) + 24px);
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-areas:
    "intro aside"
    "body  aside";
  column-gap: clamp(40px, 6vw, 88px);
  padding-top: 72px;
  padding-bottom: 96px;
}
.cp-intro { grid-area: intro; }
.cp-body { grid-area: body; }
.cp-aside {
  grid-area: aside;
  align-self: start;
  position: sticky;
  top: var(--cp-sticky-top);
  /* Taller than the space left on screen: the panel scrolls inside itself, so every row
     and the button stay reachable. The shadows at its top/bottom edge show there is more. */
  max-height: calc(100vh - var(--cp-sticky-top) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(var(--white) 30%, rgba(255, 255, 255, 0)) top / 100% 36px no-repeat local,
    linear-gradient(rgba(255, 255, 255, 0), var(--white) 70%) bottom / 100% 36px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(13, 13, 13, 0.14), rgba(13, 13, 13, 0)) top / 100% 12px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(13, 13, 13, 0.14), rgba(13, 13, 13, 0)) bottom / 100% 12px no-repeat scroll,
    var(--white);
  border: 1px solid var(--border-light);
  padding: 28px 26px 26px;
}

/* Copy */
.cp-prose { color: var(--void); }
.cp-prose p,
.cp-prose ul,
.cp-prose ol,
.cp-prose h3,
.cp-prose h4 { max-width: 70ch; }
.cp-prose p { margin: 0 0 1.1em; }
.cp-prose ul { list-style: disc; padding-left: 1.25em; margin: 0 0 1.3em; }
.cp-prose ol { list-style: decimal; padding-left: 1.4em; margin: 0 0 1.3em; }
.cp-prose li { margin-bottom: 0.45em; padding-left: 0.2em; }
.cp-prose li::marker { color: var(--steel-ink); }
.cp-prose strong { font-weight: 700; }
.cp-prose h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
}
.cp-prose h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.3;
  margin: 30px 0 10px;
}
.cp-intro p { font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.55; }
.cp-spacer { height: 12px; }

.cp-section { padding-top: 64px; }
.cp-section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--void);
  margin-bottom: 28px;
}
.cp-section-title + h3 { margin-top: 0; }

.cp-table-wrap { overflow-x: auto; margin: 8px 0 28px; }
.cp-table-wrap table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 0.95rem; line-height: 1.45; }
.cp-table-wrap th,
.cp-table-wrap td { text-align: left; vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--border-light); }
.cp-table-wrap thead th { font-family: var(--font-heading); font-weight: 700; border-bottom: 2px solid var(--void); }

.cp-btn-block { margin: 28px 0 32px; }
.cp-prose .cp-smallprint,
.cp-smallprint {
  margin: 12px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--steel-ink);
  max-width: 46em;
}

/* Key facts sidebar (compact rows) */
.cp-aside-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.cp-keyfacts div { padding: 8px 0; border-top: 1px solid var(--border-light); }
.cp-keyfacts dd { margin: 2px 0 0; font-size: 0.94rem; line-height: 1.4; color: var(--void); }
.cp-aside .cp-btn-block { margin: 18px 0 0; }
.cp-aside .btn { display: block; width: 100%; }
.cp-questions { margin-top: 18px; font-size: 0.95rem; line-height: 1.4; }
.cp-questions a { font-weight: 700; color: var(--void); text-underline-offset: 3px; }
.cp-questions span { display: block; color: var(--steel-ink); font-size: 0.9rem; }

/* "Continue ..." next-step cards: a full-width section after the two-column area */
.cp-more { padding: 72px 0 120px; border-top: 1px solid var(--border-light); }
.cp-more .cp-section-title { max-width: 18em; }
.cp-next-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 12px 0 28px;
}
.cp-next-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 28px 26px 24px;
}
.cp-next-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}
.cp-next-card p { font-size: 0.98rem; line-height: 1.5; color: rgba(13, 13, 13, 0.78); margin-bottom: 18px; }
.cp-next-card--link { transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease; }
.cp-next-card--link:hover { transform: translateY(-4px); box-shadow: 0 18px 36px rgba(13, 13, 13, 0.1); border-color: var(--charcoal-blue); }
.cp-next-card--link h3 a { color: inherit; text-decoration: none; }
.cp-next-card--link h3 a::after { content: ""; position: absolute; inset: 0; }
@supports selector(:has(*)) {
  .cp-page main .cp-next-card--link h3 a:focus-visible { outline: none; }
  .cp-next-card--link:has(a:focus-visible) { outline: 2px solid var(--charcoal-blue); outline-offset: 3px; }
}
.cp-next-more {
  margin-top: auto;
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--charcoal-blue);
}

/* Below 1024px: one column, the sidebar is not sticky and sits in the flow below the intro */
@media (max-width: 1023px) {
  .cp-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "aside" "body";
    padding-top: 56px;
  }
  .cp-aside { position: static; max-height: none; overflow: visible; margin: 32px 0 8px; }
}

/* Tablet */
@media (max-width: 960px) {
  .cp-hero { aspect-ratio: 16 / 9; max-height: none; }
  .cp-next-grid { grid-template-columns: 1fr 1fr; }
}

/* Phone */
@media (max-width: 720px) {
  .cp-head { padding: 26px 0 30px; }
  .cp-breadcrumb ol { margin-bottom: 30px; }
  .cp-hero { aspect-ratio: 4 / 3; }
  .cp-summary { margin-top: -40px; }
  .cp-summary-card { padding: 28px 22px 26px; }
  .cp-summary-rule { margin: 22px 0 18px; }
  .cp-summary-facts { grid-template-columns: 1fr; gap: 14px; }
  .cp-layout { padding-bottom: 64px; }
  .cp-section { padding-top: 48px; }
  .cp-aside { padding: 24px 22px; }
  .cp-next-grid { grid-template-columns: 1fr; }
  .cp-more { padding: 56px 0 80px; }

  .cp-tabbar-inner { min-height: 52px; }
  .cp-tabs { scrollbar-width: none; }
  .cp-tabs::-webkit-scrollbar { display: none; }
  .cp-tabs ul { gap: 24px; }
  .cp-tab { padding: 15px 0 13px; }
  /* The primary button becomes a full-width bar fixed to the bottom of the screen */
  .cp-tabbar-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    border-radius: 0;
    padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  }
  .cp-page--course { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  /* keep the back-to-top arrow above that bar */
  .cp-page--course .back-to-top { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
