/* µCPD — Main Stylesheet
   Typography: Lora (headings) + IBM Plex Sans (body)
   Palette: deep navy · amber accent · warm off-white
*/

:root {
  --navy:        #1b3040;
  --navy-light:  #253f52;
  --amber:       #c97b2a;
  --amber-pale:  #fdf0dc;
  --amber-mid:   #f0c57a;
  --bg:          #f6f3ee;
  --surface:     #ffffff;
  --text:        #1e1c18;
  --muted:       #5c5a52;
  --border:      #dedad2;
  --border-mid:  #ccc9c0;
  --success:     #2d7a4f;
  --success-bg:  #edf7f1;
  --error:       #a8291a;
  --error-bg:    #fdf0ee;
  --warn-bg:     #fdf5e0;
  --warn:        #8a6000;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --shadow-card: 0 2px 8px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--amber); }

/* ─── Type ────────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--navy);
}
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin-bottom: 1rem; }
small { font-size: 0.8rem; }
code { font-family: monospace; font-size: .9em; background: var(--bg); padding: 1px 5px; border-radius: 3px; }

/* ─── Logo ────────────────────────────────────────────────────────────────── */
.logo-mu {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1em;
  color: var(--amber);
}
.logo-text { font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; }

/* ─── Site header ─────────────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,.08);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  font-size: 1.3rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.site-logo:hover { color: var(--amber-mid); }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: rgba(255,255,255,.75); text-decoration: none; font-size: .9rem; }
.nav-links a:hover { color: #fff; }
.nav-user { color: rgba(255,255,255,.5); font-size: .8rem; }
.nav-btn {
  background: var(--amber); color: #fff !important;
  padding: 6px 16px; border-radius: 6px; font-weight: 500;
  text-decoration: none !important;
}
.nav-btn:hover { background: #b56b22 !important; }
.nav-btn-ghost { color: rgba(255,255,255,.75) !important; }

/* ─── Main / Footer ──────────────────────────────────────────────────────── */
.site-main { flex: 1; }
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 32px 24px;
  margin-top: 80px;
}
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer-logo { font-size: 1.2rem; color: rgba(255,255,255,.8); margin-bottom: 6px; }
.footer-tagline { font-size: .9rem; margin-bottom: 4px; }
.footer-copy { font-size: .8rem; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: .9rem; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-light); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .82rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Form elements ──────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .85rem; font-weight: 500; color: var(--navy); }
.field input, .field textarea, .field select {
  padding: 9px 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  font-family: inherit; font-size: .95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27,48,64,.12);
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .9rem; margin-bottom: 20px; border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #b8dfc9; }
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: #f0bdb7; }
.alert-warn    { background: var(--warn-bg);     color: var(--warn);    border-color: #e8d08a; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 100px;
  font-size: .75rem; font-weight: 600;
  text-transform: lowercase;
}
.badge-draft      { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.badge-processing { background: var(--warn-bg); color: var(--warn); }
.badge-published  { background: var(--success-bg); color: var(--success); }
.badge-archived   { background: var(--bg); color: var(--muted); }
.badge-warn       { background: var(--warn-bg); color: var(--warn); }
.badge-info       { background: #e8f0f8; color: #2a5a8a; }

/* ─── Tags ────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block; padding: 2px 8px;
  background: var(--amber-pale); color: #7a4c12;
  border-radius: 4px; font-size: .75rem; font-weight: 500;
}

/* ─── Course listing ──────────────────────────────────────────────────────── */
.courses-wrap { max-width: 1160px; margin: 0 auto; padding: 48px 24px; }
.courses-hero { margin-bottom: 48px; text-align: center; }
.courses-title { font-size: clamp(2rem, 4vw, 3rem); color: var(--navy); margin-bottom: 12px; }
.courses-subtitle { font-size: 1.1rem; color: var(--muted); max-width: 560px; margin: 0 auto; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.course-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-stripe { height: 5px; background: var(--card-color, var(--navy)); }
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 8px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.completion-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 500; white-space: nowrap;
  color: var(--success);
}
.completion-badge.in-progress { color: var(--amber); }
.card-title { font-size: 1.05rem; margin-bottom: 6px; font-family: 'Lora', serif; line-height: 1.4; }
.card-title a { text-decoration: none; color: var(--navy); }
.card-title a:hover { color: var(--amber); }
.card-authors { font-size: .82rem; color: var(--muted); margin-bottom: 10px; }
.card-excerpt { font-size: .88rem; color: var(--muted); line-height: 1.55; flex: 1; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.card-meta { display: flex; gap: 12px; font-size: .8rem; color: var(--muted); }
.card-meta span { display: flex; align-items: center; gap: 4px; }
.card-cta { font-size: .88rem; font-weight: 500; color: var(--navy); text-decoration: none; display: flex; align-items: center; gap: 4px; }
.card-cta:hover { color: var(--amber); }

.login-nudge { background: var(--amber-pale); border: 1px solid var(--amber-mid); border-radius: var(--radius-lg); padding: 20px 24px; }
.nudge-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; max-width: 860px; margin: 0 auto; }
.nudge-icon { color: var(--amber); flex-shrink: 0; }
.nudge-inner > div { flex: 1; min-width: 220px; }
.nudge-inner > div p { margin-bottom: 4px; font-size: .9rem; }
.nudge-inner > div p:last-child { margin: 0; }
.empty-courses { text-align: center; padding: 80px 0; color: var(--muted); }

/* ─── Auth pages ─────────────────────────────────────────────────────────── */
.auth-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-header { margin-bottom: 28px; }
.auth-header h1 { margin-bottom: 8px; }
.auth-header p { color: var(--muted); font-size: .95rem; margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-note { font-size: .8rem; color: var(--muted); margin-top: 16px; text-align: center; }
.auth-sent { text-align: center; padding: 8px 0; }
.auth-sent svg { color: var(--success); margin: 0 auto 16px; }
.auth-sent h2 { margin-bottom: 10px; }
.auth-sent p { color: var(--muted); margin-bottom: 6px; }
.auth-spam { font-size: .82rem; }
.auth-back { margin-top: 20px; text-align: center; font-size: .85rem; }

/* ─── Course player ──────────────────────────────────────────────────────── */
.course-view-body .site-main { display: block; }
.course-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 60px);
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
}
.course-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-stripe { height: 4px; flex-shrink: 0; }
.sidebar-course-info { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.sidebar-title { font-size: .95rem; line-height: 1.4; margin-bottom: 4px; }
.sidebar-authors { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.progress-bar-wrap { margin-top: 10px; }
.progress-bar-track { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.progress-bar-fill { height: 100%; background: var(--amber); border-radius: 2px; transition: width .4s; }
.progress-label { font-size: .75rem; color: var(--muted); }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; text-decoration: none;
  color: var(--muted); font-size: .88rem; border-left: 3px solid transparent;
  transition: all .15s;
}
.sidebar-item:hover { background: var(--bg); color: var(--text); }
.sidebar-item.active { background: var(--amber-pale); color: var(--navy); border-left-color: var(--amber); font-weight: 500; }
.sidebar-item.done { color: var(--success); }
.sidebar-icon { flex-shrink: 0; opacity: .7; }
.sidebar-label { flex: 1; line-height: 1.3; }
.sidebar-check { color: var(--success); flex-shrink: 0; }
.sidebar-meta { padding: 12px 18px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--muted); }
.sidebar-meta p { margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.sidebar-meta a { color: var(--muted); }

.course-content { padding: 40px 48px; max-width: 820px; }
.component-header { margin-bottom: 32px; }
.component-type-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 8px;
}
.component-title { font-size: clamp(1.4rem, 2.5vw, 2rem); }
.component-body { max-width: 680px; }

.section-heading { font-size: 1.15rem; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.summary-section { margin-bottom: 40px; }
.summary-text { font-size: 1rem; line-height: 1.8; color: var(--text); }
.summary-text p:last-child { margin-bottom: 0; }
.ai-note { font-size: .78rem; color: var(--muted); margin-top: 12px; font-style: italic; }

.learnings-section { margin-bottom: 40px; }
.learnings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.learning-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: border-color .15s, box-shadow .15s;
}
.learning-card:hover { border-color: var(--amber-mid); box-shadow: 0 2px 10px rgba(201,123,42,.1); }
.learning-icon { color: var(--amber); flex-shrink: 0; margin-top: 2px; }
.learning-content h3 { font-size: .95rem; margin-bottom: 5px; font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; }
.learning-content p { font-size: .85rem; color: var(--muted); line-height: 1.5; margin: 0; }

.fulltext-section, .transcript-section { margin-top: 32px; }
.fulltext-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 12px 16px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer;
  font-family: inherit; font-size: .9rem; font-weight: 500;
  color: var(--navy); transition: all .15s;
  justify-content: space-between;
}
.fulltext-toggle:hover { background: var(--amber-pale); border-color: var(--amber-mid); }
.toggle-chevron { font-size: .75rem; transition: transform .2s; }
.fulltext-toggle[aria-expanded="true"] .toggle-chevron { transform: rotate(180deg); }
.fulltext-body { margin-top: 1px; }
.fulltext-inner { max-height: 600px; overflow-y: auto; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: .88rem; line-height: 1.8; color: var(--muted); }

.podcast-desc { color: var(--muted); margin-bottom: 20px; }
.podcast-embed-wrap { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); margin-bottom: 20px; }
.embed-wrap { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); }

.component-placeholder {
  background: var(--bg); border: 2px dashed var(--border-mid);
  border-radius: var(--radius-lg); padding: 48px 32px;
  text-align: center; color: var(--muted);
}
.component-placeholder svg { margin: 0 auto 16px; opacity: .4; }
.component-placeholder h3 { font-size: 1.1rem; margin-bottom: 8px; }
.component-placeholder p { font-size: .9rem; margin-bottom: 16px; }
.placeholder-pill { display: inline-block; padding: 4px 12px; background: var(--amber-pale); color: var(--amber); border-radius: 100px; font-size: .78rem; font-weight: 600; }
.placeholder-fun { border-color: var(--amber-mid); }

.reflection-prompts { display: flex; flex-direction: column; gap: 12px; }
.reflection-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; }
.reflection-icon { color: var(--amber); flex-shrink: 0; margin-top: 2px; }
.reflection-card p { font-size: .95rem; margin: 0; line-height: 1.6; }

.further-reading-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.further-reading-list a { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; font-size: .9rem; transition: border-color .15s; }
.further-reading-list a:hover { border-color: var(--amber-mid); color: var(--amber); }

.component-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); gap: 12px; }
.nav-middle { flex: 0; white-space: nowrap; }
.mark-complete-btn { background: var(--amber); color: #fff; border-color: var(--amber); }
.mark-complete-btn:hover { background: #b56b22; }
.completed-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: .9rem; font-weight: 500; }

.not-found { padding: 80px 24px; text-align: center; color: var(--muted); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .course-layout { grid-template-columns: 1fr; }
  .course-sidebar { position: static; height: auto; }
  .course-content { padding: 24px 20px; }
  .learnings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .course-grid { grid-template-columns: 1fr; }
  .component-nav { flex-wrap: wrap; justify-content: center; }
  .nudge-inner { flex-direction: column; }
}
