/* Encounter Messages: /encounter/messages and each message's lesson page.
   Every colour is a theme token, so both themes are handled by theme.css. */
.emsg-page { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1rem 3rem; color: var(--thf-text); box-sizing: border-box; }
.emsg-page *, .emsg-page *::before, .emsg-page *::after { box-sizing: border-box; }

.emsg-hero { padding: 1.5rem 0 1rem; }
.emsg-eyebrow { margin: 0 0 .35rem; font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--thf-link); }
.emsg-page .emsg-hero h1 { margin: 0 0 .5rem; font-family: 'Playfair Display', Georgia, serif; font-size: clamp(2rem, 5vw, 2.9rem) !important; line-height: 1.15; color: var(--thf-heading); }
.emsg-lede { margin: 0; max-width: 44rem; font-size: 1.05rem; line-height: 1.6; color: var(--thf-text-2); }

/* Links between the Encounter pages */
.emsg-nav { margin: 1rem 0 1.5rem; border-bottom: 1px solid var(--thf-border); }
.emsg-nav ul { display: flex; flex-wrap: wrap; gap: .25rem .4rem; margin: 0; padding: 0; list-style: none; }
.emsg-nav-link { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .5rem .7rem; border-bottom: 2px solid transparent; font-size: .92rem; font-weight: 600; text-decoration: none; color: var(--thf-text-2); }
.emsg-nav-link:hover { color: var(--thf-link); }
.emsg-nav-link.is-active { border-bottom-color: var(--thf-link); color: var(--thf-link); }

.emsg-admin-bar { margin: 0 0 1rem; font-size: .9rem; }
.emsg-admin-bar a { color: var(--thf-link); }
.emsg-empty { padding: 2rem; border: 1px dashed var(--thf-border); border-radius: 12px; text-align: center; color: var(--thf-text-2); }

/* Message list */
.emsg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.emsg-card { min-width: 0; background: var(--thf-surface); border: 1px solid var(--thf-border); border-radius: 12px; overflow: hidden; transition: border-color .15s ease; }
.emsg-card:hover { border-color: var(--thf-link); }
.emsg-card-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.emsg-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--thf-surface-2); }
.emsg-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.emsg-thumb-empty { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2rem; color: var(--thf-text-2); }
.emsg-card-body { display: flex; flex: 1; flex-direction: column; gap: .35rem; padding: 1rem; }
.emsg-badge { align-self: flex-start; padding: .15rem .55rem; border: 1px solid var(--thf-link); border-radius: 999px; font-size: .72rem; font-weight: 700; color: var(--thf-link); }
.emsg-badge--draft { border-style: dashed; }
.emsg-card-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.2rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; color: var(--thf-heading); }
.emsg-card-speaker { font-size: .92rem; font-weight: 600; color: var(--thf-text); }
.emsg-card-meta { font-size: .82rem; color: var(--thf-text-2); }
.emsg-card-summary { display: -webkit-box; margin-top: .25rem; overflow: hidden; font-size: .9rem; line-height: 1.5; color: var(--thf-text-2); -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.emsg-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: auto; padding-top: .7rem; }
.emsg-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; background: var(--thf-surface-2); font-size: .74rem; font-weight: 600; color: var(--thf-text-2); }
.emsg-card-go { margin-left: auto; font-size: .88rem; font-weight: 700; color: var(--thf-link); }

.emsg-card--newest { grid-column: 1 / -1; }
.emsg-card--newest .emsg-card-link { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.emsg-card--newest .emsg-card-body { padding: 1.5rem; justify-content: center; }
.emsg-card--newest .emsg-card-title { font-size: 1.8rem; }
.emsg-card--newest .emsg-card-summary { -webkit-line-clamp: 4; font-size: .98rem; }
.emsg-card--newest .emsg-card-foot { margin-top: .5rem; }

/* Lesson page */
.emsg-crumbs { display: flex; gap: .45rem; margin-bottom: 1rem; font-size: .85rem; color: var(--thf-text-2); }
.emsg-crumbs a { color: var(--thf-link); }
.emsg-lesson { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; align-items: start; }
.emsg-player { position: relative; aspect-ratio: 16 / 9; margin-bottom: 1.25rem; overflow: hidden; border-radius: 12px; background: var(--thf-surface-2); }
.emsg-player-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; height: 100%; padding: 1rem; text-align: center; color: var(--thf-text-2); }
.emsg-player-empty i { font-size: 2rem; }
.emsg-player-empty p { margin: 0; }
.emsg-player-empty a { color: var(--thf-link); }
.emsg-lesson-title { margin: 0 0 .4rem; font-family: 'Playfair Display', Georgia, serif; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; overflow-wrap: anywhere; color: var(--thf-heading); }
.emsg-lesson-meta { margin: 0 0 1rem; font-size: .95rem; color: var(--thf-text-2); }
.emsg-lesson-meta strong { color: var(--thf-text); }

.emsg-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.25rem; }
.emsg-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 46px; padding: .6rem 1.2rem; border: 1px solid var(--thf-border); border-radius: 999px; background: var(--thf-surface-2); font-weight: 700; text-decoration: none; color: var(--thf-text); }
.emsg-btn:hover { border-color: var(--thf-link); color: var(--thf-text); }
.emsg-btn--primary, .emsg-btn--primary:hover { border-color: transparent; background: var(--primary-btn-bg); color: var(--primary-btn-text); }

/* theme.css recolours links inside the content area in dark mode; a filled button keeps its own text colour. */
html[data-theme="dark"] .emsg-page a.emsg-btn--primary,
html[data-theme="dark"] .emsg-page a.emsg-btn--primary * { color: var(--primary-btn-text) !important; }

.emsg-section { padding: 1rem 0; border-top: 1px solid var(--thf-border); }
.emsg-section h2, .emsg-lesson-side h2 { margin: 0 0 .6rem; font-size: 1.05rem; font-weight: 700; color: var(--thf-heading); }
.emsg-section p { margin: 0; line-height: 1.65; }
.emsg-chapters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem 1rem; margin: 0; padding: 0; list-style: none; }
.emsg-chapter { display: flex; gap: .6rem; width: 100%; min-height: 40px; padding: .4rem .5rem; border: 0; border-radius: 8px; background: none; font: inherit; font-size: .92rem; text-align: left; color: var(--thf-text); cursor: pointer; }
.emsg-chapter:hover:not(:disabled) { background: var(--thf-surface-2); }
.emsg-chapter:disabled { cursor: default; }
.emsg-chapter-time { flex: 0 0 3.2rem; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--thf-link); }

.emsg-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--thf-border); }
.emsg-pager a { display: block; font-weight: 600; text-decoration: none; color: var(--thf-text); }
.emsg-pager a span { display: block; margin-bottom: .15rem; font-size: .8rem; color: var(--thf-link); }
.emsg-pager-next { grid-column: 2; text-align: right; }

.emsg-lesson-side { position: sticky; top: 90px; padding: 1rem; border: 1px solid var(--thf-border); border-radius: 12px; background: var(--thf-surface); }
.emsg-lesson-side ul { margin: 0; padding: 0; list-style: none; }
.emsg-side-link { display: block; padding: .55rem .6rem; border-radius: 8px; text-decoration: none; }
.emsg-side-link:hover { background: var(--thf-surface-2); }
.emsg-side-link.is-current { background: var(--thf-surface-2); box-shadow: inset 3px 0 0 var(--thf-link); }
.emsg-side-title { display: block; font-size: .92rem; font-weight: 600; line-height: 1.3; color: var(--thf-heading); }
.emsg-side-speaker { display: block; font-size: .8rem; color: var(--thf-text-2); }

@media (max-width: 1024px) {
  .emsg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emsg-lesson { grid-template-columns: minmax(0, 1fr); }
  .emsg-lesson-side { position: static; }
}

@media (max-width: 640px) {
  .emsg-page { padding: 1rem 1rem 2.5rem; }
  .emsg-grid { grid-template-columns: minmax(0, 1fr); }
  .emsg-card--newest .emsg-card-link { display: flex; }
  .emsg-card--newest .emsg-card-title { font-size: 1.4rem; }
  .emsg-card--newest .emsg-card-body { padding: 1rem; }
  .emsg-nav ul { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .emsg-nav-link { white-space: nowrap; }
  .emsg-chapters { grid-template-columns: minmax(0, 1fr); }
  .emsg-actions .emsg-btn { flex: 1 1 100%; justify-content: center; }
}
