/* CPD Library — clinical archive look.
   Display: Bitter (slab serif) · Body: IBM Plex Sans · Data: IBM Plex Mono
   Palette: paper #FBFCFC, ink #14232B, teal #0F766E, amber #B45309, line #DCE4E6 */

:root {
  --paper: #FBFCFC;
  --ink: #14232B;
  --teal: #0F766E;
  --teal-dark: #0B5A54;
  --amber: #B45309;
  --line: #DCE4E6;
  --muted: #5B6B72;
  --panel: #FFFFFF;
  --danger: #B3261E;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 "IBM Plex Sans", system-ui, sans-serif;
}
h1, h2, h3 { font-family: "Bitter", Georgia, serif; line-height: 1.2; }
a { color: var(--teal); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}

/* layout */
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
.narrow { max-width: 640px; }

.topbar {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 14px 20px; border-bottom: 2px solid var(--ink); background: var(--panel);
}
.brand {
  font-family: "Bitter", serif; font-weight: 700; font-size: 20px;
  color: var(--ink); text-decoration: none; letter-spacing: 0.01em;
}
.brand span { color: var(--teal); }
.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; font-weight: 500; font-size: 14px; }

.foot {
  max-width: 880px; margin: 0 auto; padding: 16px;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--line);
}

/* intro */
.intro { padding: 8px 0 20px; border-bottom: 1px solid var(--line); }
.prose h1 { font-size: 34px; margin: 0.2em 0 0.4em; }
.prose h2 { font-size: 24px; }
.prose p { max-width: 64ch; }

/* toc */
.toc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.toc h2 { margin-bottom: 8px; }
.search input {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px;
  min-width: 240px; font: inherit; background: var(--panel);
}
.legend { font-size: 12px; color: var(--muted); margin: 4px 0 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; }

.lecture-list { list-style: none; margin: 0; padding: 0; }
.lecture-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 12px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.lecture-row:hover { background: #F1F6F5; }
.lecture-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lecture-date { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); }
.lecture-title { font-family: "Bitter", serif; font-weight: 500; font-size: 18px; }
.lecture-meta { font-size: 13px; color: var(--muted); }

/* signature: artefact completeness strip */
.strip { display: grid; grid-template-columns: repeat(8, 12px); gap: 3px; flex-shrink: 0; }
.cell {
  width: 12px; height: 12px; border-radius: 2px;
  border: 1px solid var(--line); background: var(--panel); display: inline-block;
}
.cell.filled { background: var(--teal); border-color: var(--teal-dark); }

/* panels & forms */
.sections { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 18px 20px;
}
.panel h2 { margin: 0 0 12px; font-size: 20px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }
input[type="text"], input[type="date"], input[type="search"], input[type="password"],
input:not([type]), textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper); width: 100%;
}
textarea { resize: vertical; }
button {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--teal); color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; align-self: flex-start;
}
button:hover { background: var(--teal-dark); }
button.secondary { background: var(--panel); color: var(--teal); border: 1px solid var(--teal); }
button.danger { background: var(--danger); }
button.link-danger {
  background: none; color: var(--danger); padding: 0; font-weight: 500; font-size: 13px;
  text-decoration: underline;
}
.row { display: flex; gap: 10px; align-items: center; }

/* assets */
.asset { border-top: 1px dashed var(--line); padding: 10px 0; }
.asset:first-of-type { border-top: none; }
.asset-line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.asset audio, .asset video { width: 100%; margin-top: 8px; border-radius: 6px; }
.asset video { max-height: 420px; background: #000; }
.pdf { width: 100%; height: 540px; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
.upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.upload input[type="file"] { font-size: 14px; max-width: 100%; }

/* lecture header */
.lecture-header { border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.lecture-header h1 { font-size: 30px; margin: 6px 0 4px; }
.back { font-size: 14px; text-decoration: none; }
.edit-details { margin-top: 10px; font-size: 14px; }
.edit-details summary { cursor: pointer; color: var(--muted); }
.edit-details form + form { margin-top: 10px; }

/* recorder */
.recorder { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
#rec-btn.recording { background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { #rec-btn.recording { animation: none; } }

/* misc */
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-weight: 500; }
.empty { padding: 32px 0; color: var(--muted); }

/* login */
.login-body {
  display: grid; place-items: center; min-height: 100vh; margin: 0;
  background: var(--ink); font-family: "IBM Plex Sans", system-ui, sans-serif;
}
.login-card {
  background: var(--panel); border-radius: 10px; padding: 32px 36px; width: min(360px, 90vw);
  text-align: center;
}
.login-card h1 { font-family: "Bitter", serif; margin: 0 0 4px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.login-card button { align-self: stretch; }

@media (max-width: 560px) {
  .lecture-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .strip { grid-template-columns: repeat(8, 14px); }
}
