/* Landing page sections. Colours and spacing come from tokens.css. */

/* --- hero ----------------------------------------------------------------- */
.hero { padding-block: clamp(3.5rem, 9vw, 6.5rem); }
.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-5);
}
/* Figma's hero text sits in its own 880px column (frame 7:19), narrower
   than the page's regular 1160px container but wider than --container-narrow
   (760px) — at 760px this wrapped to 3 lines instead of Figma's 2. Title and
   lead each get their own width instead, matching the design's own nested
   widths (880px / 720px) rather than one shared container width. */
.hero__title { font-size: var(--step-6); letter-spacing: -0.02em; max-width: 880px; }
.hero__lead { color: var(--ink-2); font-size: var(--step-2); max-width: 720px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }

/* --- promises ------------------------------------------------------------- */
.promise-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
/* Figma TwoPromises card: 40px padding, 20px radius. */
.promise {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-7);
  border-radius: var(--radius-xl);
}
.promise__title { font-size: var(--step-3); }
.promise__body { color: var(--ink-2); font-size: var(--step-0); }

/* --- components ----------------------------------------------------------- */
.component-grid {
  display: grid;
  gap: var(--space-4);
  /* 210px silently dropped to 4 columns at the real 1112px content width
     (--container minus its own padding) — 5 columns at 210px need 1114px,
     2px more than there is. Figma shows exactly 5 in one row; 200px leaves
     real margin instead of sitting on the edge of the same bug again. */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
/* Figma Curriculum card: 24px padding, 16px radius. */
.component {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-5);
  border-radius: 16px;
}
.component__num {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding-inline: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.component__body { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.component__name { font-size: var(--step-2); }
.component__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--step--1);
}
.component__format {
  background: var(--bg-alt);
  color: var(--ink-2);
  border-radius: var(--radius-pill);
  padding: .15em .6em;
}
.component__summary { color: var(--ink-2); font-size: var(--step-0); }

/* Below 860px the design turns each card into a single row: number badge on
   the left, name and meta stacked beside it. */
@media (max-width: 860px) {
  .component-grid { grid-template-columns: 1fr; gap: var(--space-3); }
  .component {
    flex-direction: row;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }
  .component__summary { display: none; }
  .component__meta { gap: var(--space-2); font-size: var(--step--1); }
}

/* --- audience ------------------------------------------------------------- */
.audience-list {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.audience-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
}
.audience-row:last-child { border-bottom: none; }
/* Figma Personas row: the sector reads in brand/primary. */
.audience-row__sector { color: var(--accent); font-weight: var(--weight-normal); margin: 0; }
.audience-row__examples { color: var(--ink-2); font-size: var(--step-0); margin: 0; }

@media (max-width: 600px) {
  .audience-row { grid-template-columns: 1fr; gap: var(--space-1); }
}

/* --- instructor ----------------------------------------------------------- */
.instructor-block {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: var(--space-7);
  align-items: center;
}
.instructor-block__portrait img,
.portrait-placeholder {
  border-radius: var(--radius-lg);
  aspect-ratio: 4 / 5;
  width: 100%;
  object-fit: cover;
}
/* The design shows a 360x460 panel carrying the person's name and a note that
   the photograph is still to come. */
.portrait-placeholder {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}
.portrait-placeholder__name {
  color: var(--accent);
  font-size: var(--step-5);
  font-weight: var(--weight-bold);
}
.portrait-placeholder__note { color: var(--muted); font-size: var(--step--1); }

.instructor-block__name { font-size: var(--step-5); }
.instructor-block__para { color: var(--ink-2); }
.instructor-block__headline { font-size: var(--step-2); color: var(--ink); }

.instructor-block + .instructor-block { margin-top: var(--space-8); }

@media (max-width: 760px) {
  .instructor-block { grid-template-columns: 1fr; gap: var(--space-5); }
  .instructor-block__portrait { max-width: 260px; }
}

/* --- closing band --------------------------------------------------------- */
.closing {
  background: var(--dark);
  color: var(--dark-ink);
  padding-block: var(--section-y);
}
.closing__title { color: var(--dark-ink); font-size: var(--step-5); }
.closing__sub { color: var(--dark-muted); }

/* --- video cards (shared with the library) -------------------------------- */
.video-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.video-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, border-color .15s ease;
  display: flex;
  flex-direction: column;
}
.video-card:hover { box-shadow: var(--shadow); border-color: var(--accent-line); }
.video-card[hidden] { display: none; }

.video-card__player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-alt);
}
.video-card__player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-card__facade {
  display: block;
  cursor: pointer;
}
.video-card__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-card__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  transition: background .15s ease, transform .15s ease;
}
.video-card__play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #fff;
}
.video-card__facade:hover .video-card__play,
.video-card__facade:focus-visible .video-card__play {
  background: var(--accent);
  transform: scale(1.08);
}

.video-card__badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  background: rgba(0, 0, 0, .7);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.2em 0.6em;
  font-size: var(--step--1);
  font-weight: var(--weight-medium);
}

/* --- favoriting (client-side only, see static/js/favorites.js) ------------ */
.video-card__favorite {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
.video-card__favorite:hover,
.video-card__favorite:focus-visible {
  background: rgba(0, 0, 0, .75);
  transform: scale(1.08);
}
.video-card__favorite span::before {
  content: "♡";
  font-size: 16px;
  line-height: 1;
}
.video-card__favorite.is-favorite {
  background: var(--accent);
}
.video-card__favorite.is-favorite span::before {
  content: "♥";
}

.favorite-toggle__icon::before {
  content: "♡";
  margin-right: 0.35em;
}
.favorite-toggle.is-favorite {
  color: var(--accent);
}
.favorite-toggle.is-favorite .favorite-toggle__icon::before {
  content: "♥";
}

.video-card__paywall {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-5);
  background: var(--dark);
}
.video-card__paywall-text {
  margin: 0;
  max-width: 32ch;
  color: var(--dark-muted);
  font-size: var(--step-0);
}

.video-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-4) var(--space-5) var(--space-5);
}
.video-card__title {
  color: var(--ink);
  font-weight: var(--weight-medium);
  font-size: var(--step-0);
  line-height: 1.5;
  text-decoration: none;
}
.video-card__title:hover { color: var(--accent); text-decoration: underline; }

/* --- player --------------------------------------------------------------- */
/* YouTube's own player, embedded directly. Nothing to style inside it — we
   only own the frame it sits in. */
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--dark);
}
.player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* --- small screens -------------------------------------------------------- */
@media (max-width: 860px) {
  .hero { padding-block: var(--space-8) var(--space-7); }
  .hero__inner { gap: var(--space-4); }
  .hero__title { font-size: var(--step-5); }        /* 48 -> 36, per the design */
  .hero__lead { font-size: var(--step-1); }         /* 18 -> 16 */

  .hero__actions { flex-direction: column; align-items: stretch; width: 100%; gap: var(--space-2); }
  .hero__actions .btn { width: 100%; }

  .section__head { margin-bottom: var(--space-5); }
  .section__title { font-size: var(--step-4); }

  .promise-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .promise { padding: var(--space-5); }
  .promise__title { font-size: var(--step-3); }
  .promise__body { font-size: var(--step-0); }

  .closing__title { font-size: var(--step-4); }     /* 36 -> 28, per the design */

  .video-grid { grid-template-columns: 1fr; gap: var(--space-4); }
}

@media (max-width: 480px) {
  .container { padding-inline: var(--space-5); }
  .hero__title { font-size: 1.9rem; }
}

/* Below-the-fold sections need not be laid out until they are near the
   viewport. The contain-intrinsic-size keeps the scrollbar honest so this
   costs no layout shift. */
@supports (content-visibility: auto) {
  .section:not(:first-of-type) {
    content-visibility: auto;
    contain-intrinsic-size: auto 600px;
  }
}

/* --- StreamField content blocks (video write-ups, blog posts) ------------- */
.content-block { margin: var(--space-6) 0; }
.content-block--image img {
  width: 100%;
  border-radius: var(--radius-lg);
  display: block;
}
.content-block--image figcaption {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--step--1);
}
.content-block--quote {
  margin: var(--space-6) 0;
  padding-left: var(--space-5);
  border-left: 3px solid var(--accent);
}
.content-block--quote p { font-style: italic; font-size: var(--step-2); }
.content-block--quote cite {
  display: block;
  margin-top: var(--space-2);
  font-style: normal;
  font-size: var(--step--1);
  color: var(--muted);
}
/* Wagtail's own embed_frontend.html wraps a responsive oEmbed in
   .responsive-object with an inline padding-bottom for the aspect ratio —
   but ships no CSS of its own to make the iframe fill that box, so without
   this the iframe just renders at the provider's literal width/height
   attributes (YouTube's oEmbed default is a ~200px-wide iframe). */
.content-block--embed .responsive-object {
  position: relative;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.content-block--embed .responsive-object iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.content-block--columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}
.content-block--columns .content-block__column > :first-child { margin-top: 0; }
.content-block--columns .content-block__column > :last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .content-block--columns { grid-template-columns: 1fr; }
}
.content-block--button { text-align: center; }
.content-block--divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-6) auto;
  width: 100%;
}
