/**
 * CourseGlade Learning Mode Styles
 * Editorial "Digital Curator" design language.
 * Aligns with docs/superpowers/specs/2026-04-20-learning-mode-redesign-design.md
 */

/* ==========================================================================
   Tokens (scoped to learning mode — do not leak to the rest of the site)
   ========================================================================== */
.courseglade-learning-mode {
  --courseglade-primary: #004bca;
  --courseglade-primary-container: #0061ff;
  --courseglade-primary-gradient: linear-gradient(135deg, #004bca 0%, #0061ff 100%);

  --courseglade-surface: #f9f9fc;
  --courseglade-surface-low: #f3f3f6;
  --courseglade-surface-lowest: #ffffff;
  --courseglade-surface-high: #e8e8ea;

  --courseglade-on-surface: #1a1c1e;
  --courseglade-on-surface-muted: #5a5e66;

  --courseglade-outline-ghost: rgba(194, 198, 217, 0.15);

  --courseglade-radius-pill: 999px;
  --courseglade-radius-nav: 1rem;
  --courseglade-radius-card: 2rem;

  --courseglade-transition: 0.2s ease;

  background: var(--courseglade-surface);
  color: var(--courseglade-on-surface);
  margin: 0 !important;
  min-height: 100vh;
}

html:has(body.courseglade-learning-mode) { margin-top: 0 !important; }
#wpadminbar                            { display: none !important; }

/* ==========================================================================
   Page shell
   ========================================================================== */
.courseglade-learning-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.courseglade-learning-body {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-start;
}

.courseglade-learning-main {
  flex: 1;
  min-width: 0;
  padding: 56px 24px 120px;
}

.courseglade-learning-content {
  max-width: 820px;
  margin: 0 auto;
}

/* ==========================================================================
   Top bar (glass-morph, sticky)
   ========================================================================== */
.courseglade-learning-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 56px;
  padding: 0 24px;
  background: rgba(249, 249, 252, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: box-shadow var(--courseglade-transition), border-color var(--courseglade-transition);
  border-bottom: 1px solid var(--courseglade-outline-ghost);
}

.courseglade-learning-header.is-scrolled {
  border-bottom-color: var(--courseglade-outline-ghost);
}

.courseglade-learning-header__left,
.courseglade-learning-header__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.courseglade-learning-header__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--courseglade-radius-pill);
  background: transparent;
  color: var(--courseglade-on-surface);
  transition: background var(--courseglade-transition);
}

.courseglade-learning-header__back:hover {
  background: var(--courseglade-surface-high);
}

.courseglade-learning-header__titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 42vw;
}

.courseglade-learning-header__course-title {
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.courseglade-learning-header__section-title {
  font-size: 0.75rem;
  color: var(--courseglade-on-surface-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.courseglade-learning-header__progress-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--courseglade-radius-pill);
  background: var(--courseglade-surface-low);
  color: var(--courseglade-primary);
  font-size: 0.8125rem;
  font-weight: 600;
}

.courseglade-learning-header__progress-label {
  color: var(--courseglade-on-surface-muted);
  font-weight: 500;
}

.courseglade-learning-header__drawer-toggle {
  border-radius: var(--courseglade-radius-nav);
}

.courseglade-learning-header__drawer-toggle[aria-expanded="true"] {
  background: var(--courseglade-primary);
  color: #fff;
}


.courseglade-hamburger-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 16px;
  height: 12px;
}
.courseglade-hamburger-icon span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

/* ==========================================================================
   Curriculum slide panel (right-side, layout-integrated)
   ========================================================================== */

/* Scrim: desktop hidden — only used on mobile bottom-sheet */
.courseglade-learning-drawer-scrim {
  display: none;
}

/* Outer shell: animates width to slide-in/out without overlaying content */
.courseglade-learning-drawer {
  order: 2;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  flex-shrink: 0;
  width: 0;
  overflow: hidden;
  transition: width 0.25s ease;
}

.courseglade-learning-drawer.is-open {
  width: 380px;
}

/* Inner wrapper: fixed 380px so content never reflows during animation */
.courseglade-learning-drawer__inner {
  width: 380px;
  min-width: 380px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--courseglade-surface-lowest);
  border-left: 1px solid var(--courseglade-surface-high);
  overflow: hidden;
}

.courseglade-learning-drawer__grip { display: none; }
.courseglade-learning-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
}

.courseglade-learning-drawer__title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.courseglade-learning-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
  background: var(--courseglade-surface-low);
  border: none;
  border-radius: var(--courseglade-radius-pill);
  color: var(--courseglade-on-surface);
  cursor: pointer;
  transition: background var(--courseglade-transition), color var(--courseglade-transition);
}
.courseglade-learning-drawer__close svg {
  display: block;
  stroke: currentColor;
}
.courseglade-learning-drawer__close:hover {
  background: var(--courseglade-surface-high);
  color: var(--courseglade-on-surface);
}
.courseglade-learning-drawer__close:focus,
.courseglade-learning-drawer__close:focus-visible { outline: none; }

.courseglade-learning-drawer__nav {
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.courseglade-drawer-section {
  border-top: 1px solid var(--courseglade-border);
}
.courseglade-drawer-section:has([aria-expanded="true"]) .courseglade-drawer-section__header {
  background: var(--courseglade-primary);
  color: var(--courseglade-surface-lowest);
}

.courseglade-drawer-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.courseglade-drawer-section__header:hover,
.courseglade-drawer-section__header:focus {
  background: transparent;
  color: var(--courseglade-on-surface);
  outline: none;
}

.courseglade-drawer-section__title {
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}

.courseglade-drawer-section__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.courseglade-drawer-section__progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--courseglade-radius-pill);
  color: currentColor;
}
.courseglade-drawer-section__progress.is-complete {
  background: var(--courseglade-primary);
  color: var(--courseglade-surface-lowest);
}

.courseglade-drawer-section__chevron {
  color: currentColor;
  transition: transform var(--courseglade-transition);
}
.courseglade-drawer-section__header[aria-expanded="true"] .courseglade-drawer-section__chevron {
  transform: rotate(180deg);
}

.courseglade-drawer-section__items {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.courseglade-drawer-section__items.is-collapsed {
  display: none;
}

.courseglade-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  color: var(--courseglade-on-surface);
  text-decoration: none;
  transition: background var(--courseglade-transition);
}
.courseglade-drawer-item:not(:first-child) {
  border-top: 1px solid var(--courseglade-border);
}
.courseglade-drawer-item--current {
  background: var(--courseglade-surface-low);
}
.courseglade-drawer-item--completed .courseglade-drawer-item__icon { color: var(--courseglade-primary); }

/* Locked items: slightly muted but still readable; no pointer-events */
.courseglade-drawer-item--locked {
  opacity: 0.72;
  pointer-events: none;
}
.courseglade-drawer-item--locked .courseglade-drawer-item__icon {
  background: var(--courseglade-lock-bg-strong);
  color: var(--courseglade-lock-text);
}

.courseglade-drawer-item__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--courseglade-on-surface-muted);
  transition: background var(--courseglade-transition), color var(--courseglade-transition);
}

.courseglade-drawer-item__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.courseglade-drawer-item__title {
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courseglade-drawer-item__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.6875rem;
  color: var(--courseglade-on-surface-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.courseglade-drawer-item__type { color: var(--courseglade-primary); }
.courseglade-drawer-item__duration {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--courseglade-on-surface-muted);
}

/* Lock / drip-date message pill — compact badge below the meta row */
.courseglade-drawer-item__lock-message {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: var(--courseglade-lock-bg);
  color: var(--courseglade-lock-text);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
  align-self: flex-start;
}

/* Tiny calendar icon before the message, injected via ::before */
.courseglade-drawer-item__lock-message::before {
  content: '';
  display: inline-block;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* ==========================================================================
   Content column (lesson body)
   ========================================================================== */
.courseglade-lesson__header { margin-bottom: 28px; }

.courseglade-lesson__kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--courseglade-primary);
}
.courseglade-lesson__kicker-sep { color: rgba(0, 75, 202, 0.35); }
.courseglade-lesson__kicker-meta { color: var(--courseglade-on-surface-muted); font-weight: 600; }

.courseglade-lesson__title {
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}

.courseglade-lesson__video {
  margin: 28px 0;
  background: var(--courseglade-surface-lowest);
  border-radius: 1.25rem;
  overflow: hidden;
  transition: box-shadow var(--courseglade-transition);
}
.courseglade-lesson__video:hover { box-shadow: var(--courseglade-shadow-lg); }

.courseglade-video-wrapper {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
}
.courseglade-video-wrapper iframe,
.courseglade-video-wrapper video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.courseglade-lesson__content {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--courseglade-on-surface);
}
.courseglade-lesson__content > * + * { margin-top: 1.25em; }
.courseglade-lesson__content h2,
.courseglade-lesson__content h3,
.courseglade-lesson__content h4 {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--courseglade-on-surface);
  margin-top: 2em;
}
.courseglade-lesson__content h2 { font-size: 1.75rem; }
.courseglade-lesson__content h3 { font-size: 1.25rem; }
.courseglade-lesson__content h4 { font-size: 1.0625rem; }
.courseglade-lesson__content code,
.courseglade-lesson__content pre {
  background: var(--courseglade-surface-low);
  border-radius: 8px;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.9375rem;
}
.courseglade-lesson__content code { padding: 2px 6px; }
.courseglade-lesson__content pre  { padding: 16px 18px; overflow-x: auto; }
.courseglade-lesson__content blockquote {
  margin: 1.5em 0;
  padding: 4px 20px;
  border-left: 3px solid var(--courseglade-primary);
  color: var(--courseglade-on-surface-muted);
  font-style: italic;
}
.courseglade-lesson__content a { color: var(--courseglade-primary); }

.courseglade-lesson__content-overlay {
  position: absolute;
  width: 100%;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}
.courseglade-lesson__content-overlay.is-collapsed {
  height: 100px;
  padding-bottom: 12px;
  background: linear-gradient(to bottom, transparent, var(--courseglade-surface));
}
.courseglade-lesson__content-overlay.is-expanded {
  position: static;
  height: auto;
  padding-top: 10px;
  background: transparent;
}
.courseglade-lesson__content-toggle {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid var(--courseglade-border);
  border-radius: var(--courseglade-radius-pill);
  background: var(--courseglade-surface);
  color: var(--courseglade-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--courseglade-shadow-sm);
  transition: background var(--courseglade-transition), border-color var(--courseglade-transition);
}
.courseglade-lesson__content-toggle:hover {
  background: var(--courseglade-surface-low);
  border-color: var(--courseglade-primary);
}
.courseglade-lesson__content-toggle svg {
  transition: transform var(--courseglade-transition);
}
.courseglade-lesson__content-toggle.is-expanded svg {
  transform: rotate(180deg);
}

/* Attachments */
.courseglade-lesson__attachments { margin: 40px 0; }
.courseglade-lesson__attachments-title {
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.courseglade-lesson__attachments-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.courseglade-lesson__attachment a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--courseglade-radius-nav);
  background: var(--courseglade-surface-low);
  color: var(--courseglade-on-surface);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: background var(--courseglade-transition), transform var(--courseglade-transition);
}
.courseglade-lesson__attachment a:hover {
  background: var(--courseglade-surface-lowest);
  box-shadow: var(--courseglade-shadow-lg);
}
.courseglade-lesson__attachment a svg { color: var(--courseglade-primary); }

/* ==========================================================================
   Footer navigation
   ========================================================================== */
.courseglade-learning-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: stretch;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--courseglade-outline-ghost);
}

.courseglade-learning-footer__nav {
  white-space: normal;
  padding: 14px 18px;
  gap: 12px;
  border-radius: var(--courseglade-radius-nav);
  min-width: 200px;
}
.courseglade-learning-footer__nav--prev   { justify-self: start; width: 100%; }
.courseglade-learning-footer__nav--next   { justify-self: end; width: 100%; justify-content: flex-end; text-align: right; }
.courseglade-learning-footer__nav--empty  { visibility: hidden; }
.courseglade-learning-footer__nav--finish {
  justify-self: end;
  width: 100%;
  justify-content: flex-end;
  text-align: right;
}

.courseglade-learning-footer__nav-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.courseglade-learning-footer__nav-kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.courseglade-learning-footer__nav-title {
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courseglade-learning-footer__complete {
  align-self: center;
  margin: 0 12px;
}

.courseglade-learning-footer__complete--enroll { background: var(--courseglade-primary); }
.courseglade-learning-footer__complete--empty  { visibility: hidden; padding: 0; }

/* ==========================================================================
   Access-denied centered card
   ========================================================================== */
.courseglade-learning-main--denied {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 72px);
}

.courseglade-learning-denied {
  max-width: 460px;
  width: 100%;
  text-align: center;
  background: var(--courseglade-surface-lowest);
  border-radius: var(--courseglade-radius-card);
  box-shadow: var(--courseglade-shadow-lg);
  overflow: hidden;
}
.courseglade-learning-denied__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 40px 36px;
  background: var(--courseglade-primary-gradient);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.courseglade-learning-denied__icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.12) 0%, transparent 60%),
              radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 50%);
}
.courseglade-learning-denied__icon svg {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}
.courseglade-learning-denied__body {
  padding: 32px 36px 36px;
}
.courseglade-learning-denied__heading {
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--courseglade-text);
}
.courseglade-learning-denied__message {
  color: var(--courseglade-on-surface-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0 0 28px;
}
.courseglade-learning-denied__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  background: var(--courseglade-primary-gradient);
  color: #fff;
  border-radius: var(--courseglade-radius-nav);
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: box-shadow var(--courseglade-transition);
}
.courseglade-learning-denied__cta:hover { box-shadow: var(--courseglade-shadow-lg); color: #fff; }

/* ==========================================================================
   Mobile
   ========================================================================== */
@media (max-width: 1024px) {
  .courseglade-learning-header__section-title { display: none; }
  .courseglade-learning-header__progress-pill  { display: none; }
  .courseglade-learning-header__drawer-toggle-label { display: none; }

  .courseglade-learning-body { align-items: stretch; }
  .courseglade-learning-main { padding: 32px 20px 80px; }

  /* Mobile: restore scrim overlay */
  .courseglade-learning-drawer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(26, 28, 30, 0.4);
    z-index: 45;
    transition: opacity var(--courseglade-transition);
    opacity: 0;
    pointer-events: none;
  }
  .courseglade-drawer-open .courseglade-learning-drawer-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  /* Mobile: bottom sheet */
  .courseglade-learning-drawer {
    position: fixed;
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    height: auto;
    width: 100%;
    max-height: 80vh;
    border-radius: var(--courseglade-radius-card) var(--courseglade-radius-card) 0 0;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    z-index: 46;
  }
  .courseglade-learning-drawer.is-open {
    width: 100%;
    transform: translateY(0);
  }
  .courseglade-learning-drawer__inner {
    width: 100%;
    min-width: 0;
    border-left: none;
    border-radius: var(--courseglade-radius-card) var(--courseglade-radius-card) 0 0;
    box-shadow: var(--courseglade-shadow-lg);
    max-height: 80vh;
    overflow-y: auto;
  }

  .courseglade-learning-drawer__grip {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--courseglade-surface-high);
    margin: 10px auto 0;
  }

  .courseglade-learning-content .courseglade-lesson__title { font-size: 1.75rem; }

  .courseglade-learning-footer {
    grid-template-columns: 1fr;
    grid-template-areas:
      "complete"
      "next"
      "prev";
    gap: 12px;
  }
  .courseglade-learning-footer__nav--prev { grid-area: prev; width: 100%; justify-content: flex-start; }
  .courseglade-learning-footer__nav--next,
  .courseglade-learning-footer__nav--finish { grid-area: next; width: 100%; }
  .courseglade-learning-footer__complete,
  .courseglade-learning-footer__complete--empty { grid-area: complete; width: 100%; justify-content: center; }
  .courseglade-learning-footer__complete--empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .courseglade-learning-header,
  .courseglade-learning-drawer { backdrop-filter: none; transition: none; }
  .courseglade-learning-drawer { transition: transform 0.15s linear; }
}
