/* ---------------------------------------------------------------------------
   Video course platform — hand-written CSS, no framework.
   Palette: bg #F9FAFB, text #111827, muted #6B7280, accent #4F46E5
--------------------------------------------------------------------------- */

:root {
  --bg: #F9FAFB;
  --text: #111827;
  --muted: #6B7280;
  --accent: #4F46E5;
  --accent-dark: #4338CA;
  --sidebar-bg: #F3F4F6;
  --border: #E5E7EB;
  --header-h: 56px;
  --sidebar-w: 280px;
  --content-w: 780px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { color: var(--text); }
.btn--lg { padding: 14px 30px; font-size: 16px; border-radius: 10px; }
.btn--small { padding: 7px 14px; font-size: 14px; }

/* ---- Landing / centered hero ------------------------------------------- */
.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.landing__card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
}
.landing__title { margin: 0 0 12px; font-size: 26px; }
.landing__desc { margin: 0 0 12px; color: var(--muted); }
.landing__price { font-size: 20px; font-weight: 700; margin: 0 0 24px; }
.landing__note { margin-top: 20px; font-size: 13px; color: var(--muted); }

.checkmark {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #ECFDF5;
  color: #059669;
  font-size: 34px;
  line-height: 64px;
}

/* ---- Buy form ----------------------------------------------------------- */
.buy-form { text-align: left; }
.buy-form__label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.buy-form__input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 14px;
}
.buy-form__input:focus { outline: none; border-color: var(--accent); }
.buy-form__button { width: 100%; }
.buy-form__error { color: #DC2626; font-size: 14px; min-height: 20px; margin: 10px 0 0; }
.landing__divider { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---- Global site header -------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-header__brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__brand:hover { text-decoration: none; }
.site-header__nav { display: flex; align-items: center; gap: 20px; }
.site-header__link {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.site-header__link:hover { color: var(--text); text-decoration: none; }
.site-header__link--member { color: var(--accent); font-weight: 600; }

/* ---- Course page layout -------------------------------------------------- */
.course-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, var(--content-w));
  justify-content: center;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - var(--header-h));
  padding: 16px 0;
}
.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  font-weight: 700;
}
.sidebar__close { display: none; background: none; border: none; font-size: 24px; cursor: pointer; }
.sidebar__list { display: flex; flex-direction: column; }

.lesson-item {
  text-align: left;
  border: none;
  background: transparent;
  padding: 11px 16px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
  border-left: 3px solid transparent;
  min-width: 0;
  overflow-wrap: break-word;
}
.lesson-item:hover { background: rgba(0, 0, 0, 0.03); }
.lesson-item--active {
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.lesson-group { border-bottom: 1px solid var(--border); }
.lesson-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.lesson-group__header:hover { background: rgba(0, 0, 0, 0.03); }
.lesson-group__title { min-width: 0; overflow-wrap: break-word; }
.lesson-group__chevron {
  flex: none;
  width: 0;
  height: 0;
  margin-left: 8px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transition: transform 0.15s ease;
}
.lesson-group--open .lesson-group__chevron { transform: rotate(180deg); }
.lesson-group__items { display: none; }
.lesson-group--open .lesson-group__items { display: flex; flex-direction: column; }

.course-main { min-width: 0; padding: 24px; }
.sidebar-open { display: none; margin-bottom: 16px; }

.player {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.player__iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player--pdf {
  aspect-ratio: auto;
  background: #fff;
  height: calc(100vh - var(--header-h) - 48px);
  min-height: 480px;
}
.player--hidden { display: none; }
.player__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #D1D5DB;
  font-size: 15px;
}

.lesson-body { color: var(--muted); width: 100%; margin: 14px 0 0; }
.lesson-body h1, .lesson-body h2, .lesson-body h3,
.lesson-body h4, .lesson-body h5, .lesson-body h6 {
  color: var(--text);
  margin: 1.4em 0 0.5em;
  line-height: 1.25;
}
.lesson-body h1 { font-size: 1.6em; }
.lesson-body h2 { font-size: 1.35em; }
.lesson-body h3 { font-size: 1.15em; }
.lesson-body p { margin: 0 0 1em; }
.lesson-body ul, .lesson-body ol { margin: 0 0 1em; padding-left: 1.5em; }
.lesson-body li { margin: 0.25em 0; }
.lesson-body a { color: var(--accent); }
.lesson-body code { background: var(--sidebar-bg); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.lesson-body pre {
  background: var(--sidebar-bg);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 1em;
}
.lesson-body pre code { background: none; padding: 0; }
.lesson-body blockquote {
  border-left: 3px solid var(--border);
  margin: 0 0 1em;
  padding-left: 1em;
  color: var(--muted);
}
.lesson-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 5;
}
.overlay--visible { display: block; }

/* ---- Mobile ------------------------------------------------------------- */
@media (max-width: 768px) {
  .course-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    min-height: 100vh;
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar__close { display: block; }
  .sidebar-open { display: inline-block; }
  .course-main { padding: 16px; }
  .site-header__inner { padding: 0 14px; }
  .site-header__nav { gap: 12px; }
  .site-header__link { font-size: 14px; }
  .sales__title { font-size: 30px; }
  .sales__hero { padding: 48px 20px 40px; }
  .sales__hero-cover { width: 200px; height: 200px; margin-bottom: 20px; }
  .sales__section { padding: 40px 20px; }
}

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.site-footer a { color: var(--accent); }
.footer-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
.footer-link:hover { text-decoration: underline; }

/* ---- GDPR consent banner -------------------------------------------------- */
.gdpr {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 16px;
  pointer-events: none;
}
.gdpr__card {
  pointer-events: auto;
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.gdpr__text {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  flex: 1 1 320px;
}
.gdpr__text a { color: var(--accent); }
.gdpr__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Legal / privacy policy page ------------------------------------------ */
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.legal h1 { font-size: 28px; margin-bottom: 8px; }
.legal h2 { font-size: 20px; margin: 32px 0 8px; }
.legal p, .legal li { color: var(--muted); }
.legal__updated { font-size: 14px; color: var(--muted); }
.legal a { color: var(--accent); }

/* ---- Layout overrides (sticky footer via flex column) --------------------- */
body { display: flex; flex-direction: column; min-height: 100vh; }
.landing { min-height: 0; flex: 1 1 auto; }

/* ---- Catalog (home) ------------------------------------------------------ */
.catalog {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  flex: 1 1 auto;
}
.catalog__hero { text-align: center; margin: 0 0 32px; }
.catalog__title { font-size: 32px; margin: 0 0 8px; }
.catalog__subtitle { margin: 0; color: var(--muted); font-size: 16px; }
.catalog__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.catalog__card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.catalog__card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.catalog__card-cover {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
  background: #EEF2FF;
}
.catalog__card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
  text-decoration: none;
}
.catalog__card-title { margin: 0; font-size: 19px; }
.catalog__card-tagline { margin: 0; color: var(--accent); font-size: 13px; font-weight: 600; }
.catalog__card-desc { margin: 0; color: var(--muted); font-size: 14px; }
.catalog__card-price { margin-top: auto; font-weight: 700; color: var(--text); display: inline-flex; align-items: baseline; gap: 8px; }
.catalog__card-price--compare { font-weight: 500; color: var(--muted); font-size: 14px; text-decoration: line-through; }

/* ---- Member home --------------------------------------------------------- */
.member__courses { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.member__course {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.member__course:hover { border-color: var(--accent); background: #FAFAFA; }
.member__course-date { font-weight: 400; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---- Member home (login + purchased courses) ----------------------------- */
.member {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  flex: 1 1 auto;
}
.member__loading { text-align: center; color: var(--muted); padding: 40px 0; }
.member__panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
}
.member__title { margin: 0 0 8px; font-size: 24px; }
.member__desc { margin: 0 0 20px; color: var(--muted); }
.member__note { color: var(--muted); font-size: 14px; }
.member__status { color: #059669; font-size: 14px; margin-top: 10px; }

/* ---- Sales page (course landing) ----------------------------------------- */
.sales { flex: 1 1 auto; }
.sales__hero {
  background: linear-gradient(180deg, #EEF2FF 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 72px 24px 64px;
  text-align: center;
}
.sales__hero-inner { max-width: 720px; margin: 0 auto; }
.sales__hero-cover {
  width: 320px;
  height: 320px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.10);
  margin: 0 auto 32px;
  display: block;
}
.sales__hero-video {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 32px;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.10);
}
.sales__hero-video-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.sales__eyebrow {
  display: inline-block;
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.sales__title { font-size: 40px; line-height: 1.15; margin: 0 0 16px; }
.sales__lead { font-size: 18px; color: var(--muted); margin: 0 auto 28px; max-width: 560px; }
.sales__buy { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sales__price { font-size: 24px; font-weight: 700; display: inline-flex; align-items: baseline; gap: 12px; }
.sales__price--compare { font-weight: 500; color: var(--muted); font-size: 16px; text-decoration: line-through; }
.sales__note { font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.sales__error { min-height: 20px; }

.sales__section {
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 24px;
}
.sales__section h2 { font-size: 26px; margin: 0 0 20px; text-align: center; }

.sales__outcomes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.sales__outcomes li {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  font-weight: 500;
}
.sales__outcomes li::before { content: "\2713 "; color: #059669; font-weight: 700; }

.sales__features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.sales__feature { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.sales__feature h3 { margin: 0 0 8px; font-size: 17px; }
.sales__feature p { margin: 0; color: var(--muted); font-size: 14px; }

.sales__curriculum {
  list-style: none;
  counter-reset: lesson;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sales__curriculum-groups { display: flex; flex-direction: column; gap: 10px; }
.sales__group { background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sales__group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  font-weight: 600;
}
.sales__group-title { margin-right: auto; }
.sales__group-count { color: var(--muted); font-weight: 500; font-size: 13px; }
.sales__group .sales__curriculum { padding: 0 20px 20px; }
.sales__curriculum li {
  counter-increment: lesson;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 500;
}
.sales__curriculum li::before {
  content: counter(lesson, decimal-leading-zero);
  color: var(--accent);
  font-weight: 700;
  margin-right: 14px;
}

.sales__testimonials { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.sales__testimonial { margin: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.sales__testimonial blockquote { margin: 0 0 12px; color: var(--text); font-size: 15px; }
.sales__testimonial figcaption { color: var(--muted); font-size: 14px; }

.sales__faq { display: flex; flex-direction: column; gap: 10px; }
.sales__faq-item { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px 18px; }
.sales__faq-item summary { cursor: pointer; font-weight: 600; padding: 14px 0; }
.sales__faq-item p { color: var(--muted); margin: 0 0 16px; }

.sales__cta {
  text-align: center;
  background: #EEF2FF;
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 720px;
  margin: 56px auto;
  padding: 48px 24px;
}
.sales__cta h2 { font-size: 26px; margin: 0 0 8px; }
.sales__cta p { color: var(--muted); margin: 0 0 20px; }

/* ---- Local preview (serve.py --preview) ---------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge--draft { background: #fef3c7; color: #92400e; }
.sales__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.catalog__card .badge { align-self: flex-start; }

/* ---- Free-flow landing sections (index.yml `sections`) -------------------- */
.sales__prose { max-width: 720px; }
.sales__prose > :first-child { margin-top: 0; }
.sales__prose > :last-child { margin-bottom: 0; }
.sales__prose h2 { font-size: 24px; margin: 24px 0 12px; text-align: center; }
.sales__prose h3 { font-size: 19px; margin: 20px 0 10px; text-align: center; }
.sales__prose p { line-height: 1.7; margin: 0 0 16px; }
.sales__prose ul, .sales__prose ol { margin: 0 0 16px; padding-left: 22px; }
.sales__prose li { margin: 6px 0; line-height: 1.6; }
.sales__prose blockquote {
  margin: 16px 0; padding: 12px 20px;
  border-left: 4px solid var(--accent);
  background: var(--sidebar-bg);
  border-radius: 6px;
  color: var(--muted);
}
.sales__prose hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.sales__figure {
  max-width: 860px; margin: 24px auto; text-align: center;
}
/* Tighten the alternating prose/image rhythm: a section is padded 56px and a
   figure adds its own 24px margin, so adjacent pairs stack to ~80px. */
.sales__section + .sales__figure { margin-top: -32px; }
.sales__figure + .sales__section { padding-top: 0; }
.sales__figure-img {
  max-width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--border);
}
/* A captionless image drops the card border so it sits flush with the prose. */
.sales__figure--bare .sales__figure-img { border: 0; border-radius: 0; }
.sales__figure figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); }
