/* ==========================================================================
   Epilepsy Board Review hub
   Long-form reading: a contents rail, a filter toolbar, and dense notes.
   Light and dark are both first-class (the site toggles body.dark).
   ========================================================================== */

.page-board_review .container {
  max-width: 1180px;
}

.br-intro {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #4a5560;
  max-width: 78ch;
  margin: 0 0 1.25rem;
}

body.dark .br-intro { color: #c7c7cc; }

/* ------------------------------------------------------------- toolbar */

.br-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0 0.85rem;
  border-bottom: 1px solid #e3e8ee;
  margin-bottom: 0.5rem;
}

body.dark .br-toolbar { border-bottom-color: #3a3a3c; }

.br-parts,
.br-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  min-width: 0;
}

.br-chip {
  border: 1px solid #d7dee6;
  background: #fff;
  color: #48535f;
  border-radius: 999px;
  padding: 0.34rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.br-chip:hover { background: #f2f6fa; }

.br-chip.is-active {
  background: #0b6ab8;
  border-color: #0b6ab8;
  color: #fff;
}

/* The revision view is the differentiated one - give it its own colour so it
   never reads as just another part filter. */
.br-chip-updated { border-color: #c0894a; color: #97601f; }
.br-chip-updated:hover { background: #fbf3e8; }
.br-chip-updated.is-active { background: #a8641c; border-color: #a8641c; color: #fff; }

body.dark .br-chip { background: #2c2c2e; border-color: #48484a; color: #e5e5ea; }
body.dark .br-chip:hover { background: #3a3a3c; }
body.dark .br-chip.is-active { background: #1a6bb5; border-color: #1a6bb5; color: #fff; }
body.dark .br-chip-updated { border-color: #a9762f; color: #f0c489; }
body.dark .br-chip-updated.is-active { background: #b5762a; border-color: #b5762a; color: #fff; }

.br-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.br-search-wrap i {
  position: absolute;
  left: 0.65rem;
  font-size: 0.78rem;
  color: #8a95a1;
  pointer-events: none;
}

#br-search {
  border: 1px solid #d7dee6;
  border-radius: 999px;
  padding: 0.36rem 0.8rem 0.36rem 1.9rem;
  font-size: 0.82rem;
  min-width: 210px;
  background: #fff;
  color: #26313c;
}

#br-search:focus { outline: 2px solid #0b6ab8; outline-offset: 1px; }

body.dark #br-search { background: #2c2c2e; border-color: #48484a; color: #f5f5f7; }
body.dark .br-search-wrap i { color: #aeaeb2; }

.br-count {
  font-size: 0.76rem;
  color: #5a6570;   /* 4.2:1 at #6b7783 - under AA on the #f5f5f7 canvas */
  margin: 0 0 1rem;
}

body.dark .br-count { color: #aeaeb2; }

/* -------------------------------------------------------------- layout */

.br-layout {
  display: grid;
  grid-template-columns: minmax(0, 230px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .br-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
}

.br-toc {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  font-size: 0.8rem;
  padding-right: 0.35rem;
}

@media (max-width: 900px) {
  .br-toc {
    position: static;
    max-height: 260px;
    border: 1px solid #e3e8ee;
    border-radius: 10px;
    padding: 0.75rem;
  }
  body.dark .br-toc { border-color: #333d49; }
}

.br-toc-group { margin-bottom: 1rem; }

.br-toc-part {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #55616d;
}

.br-roman {
  display: inline-block;
  min-width: 1.5em;
  color: #0b6ab8;
}

.br-toc ul { list-style: none; margin: 0; padding: 0; }

.br-toc li a {
  display: block;
  padding: 0.2rem 0 0.2rem 1.6rem;
  color: #5c6874;
  text-decoration: none;
  border-left: 2px solid #e6ebf1;
  line-height: 1.35;
}

.br-toc li a:hover { color: #0b6ab8; border-left-color: #0b6ab8; background: #f5f9fc; }

.br-toc-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #c0894a;
  vertical-align: middle;
}

body.dark .br-toc-part { color: #aab5c0; }
body.dark .br-roman { color: #58a9ec; }
body.dark .br-toc li a { color: #aeaeb2; border-left-color: #3a3a3c; }
body.dark .br-toc li a:hover { color: #6cb6f0; border-left-color: #2a86d8; background: #2c2c2e; }

/* --------------------------------------------------------------- notes */

.br-part { margin-bottom: 2.5rem; }

.br-part-head {
  border-bottom: 2px solid #0b6ab8;
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
}

.br-part-roman {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #0b6ab8;
}

.br-part-head h2 {
  margin: 0.15rem 0 0;
  font-size: 1.45rem;
  color: #1d2a36;
}

body.dark .br-part-head { border-bottom-color: #2a86d8; }
body.dark .br-part-roman { color: #58a9ec; }
body.dark .br-part-head h2 { color: #f5f5f7; }

.br-section {
  margin-bottom: 1.9rem;
  scroll-margin-top: 1rem;
}

.br-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 1.06rem;
  margin: 0 0 0.6rem;
  color: #1d2a36;
}

.br-secnum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  border-radius: 6px;
  background: #eaf2fa;
  color: #0b6ab8;
  font-size: 0.8rem;
  font-weight: 700;
}

.br-tag-updated {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b5a17;
  background: #fbf0dd;
  border: 1px solid #e6cfa8;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

body.dark .br-section-title { color: #f5f5f7; }
body.dark .br-secnum { background: #1c3a52; color: #6cb6f0; }
body.dark .br-tag-updated { color: #f0c489; background: #3a2f1d; border-color: #6a5327; }

.br-sub {
  font-size: 0.92rem;
  font-weight: 700;
  color: #35424f;
  margin: 1.1rem 0 0.4rem;
}

body.dark .br-sub { color: #e5e5ea; }

.br-p,
.br-list li {
  font-size: 0.9rem;
  line-height: 1.62;
  color: #48484a;
}

.br-p { margin: 0 0 0.6rem; }

.br-list {
  margin: 0 0 0.7rem;
  padding-left: 1.1rem;
}

.br-list li { margin-bottom: 0.3rem; }

body.dark .br-p,
body.dark .br-list li { color: #e5e5ea; }

mark {
  background: #ffe9a8;
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
}

body.dark mark { background: #6a5a20; color: #fff6d9; }

/* The revision callouts: the reason to read these notes rather than the 2017
   text, so they are styled to be findable while scrolling. */
.br-updated {
  border-left: 3px solid #c0894a;
  background: #fdf8f0;
  border-radius: 0 8px 8px 0;
  padding: 0.65rem 0.9rem;
  margin: 0.8rem 0;
}

.br-updated p {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #48484a;
}

.br-updated-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #8b5a17;
}

body.dark .br-updated { background: #2c2519; border-left-color: #b5762a; }
body.dark .br-updated p { color: #d5ddE6; color: #e5e5ea; }
body.dark .br-updated-badge { color: #f0c489; }

/* --------------------------------------------------------------- tables */

.br-table-wrap {
  overflow-x: auto;
  margin: 0.8rem 0 1rem;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
}

.br-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 460px;
}

.br-table th {
  text-align: left;
  background: #f2f6fa;
  color: #45515e;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid #dce3ea;
  white-space: nowrap;
}

.br-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid #eef2f6;
  color: #48484a;
  line-height: 1.5;
  vertical-align: top;
}

.br-table tbody tr:nth-child(even) { background: #fafcfe; }
.br-table tbody tr:last-child td { border-bottom: 0; }
.br-cell-key { font-weight: 600; color: #26313c; }

body.dark .br-table-wrap { border-color: #3a3a3c; }
body.dark .br-table th { background: #2c2c2e; color: #c7c7cc; border-bottom-color: #3a3a3c; }
body.dark .br-table td { color: #e5e5ea; border-bottom-color: #3a3a3c; }
body.dark .br-table tbody tr:nth-child(even) { background: #323234; }
body.dark .br-cell-key { color: #f5f5f7; }

/* -------------------------------------------------------------- figures */

.br-figure {
  margin: 1rem 0 1.2rem;
  text-align: center;
}

.br-figure-img {
  max-width: 100%;
  height: auto;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  background: #fff;      /* the figures are drawn on white */
  cursor: zoom-in;
}

.br-figure figcaption {
  font-size: 0.78rem;
  color: #64707c;
  margin-top: 0.45rem;
  line-height: 1.5;
  text-align: left;
}

body.dark .br-figure-img { border-color: #3a3a3c; }
body.dark .br-figure figcaption { color: #aeaeb2; }

/* ------------------------------------------------------------ self-test */

.br-selftest {
  margin-top: 1.75rem;
  padding: 1.1rem 1.2rem 1.3rem;
  border: 1px solid #dfe6ee;
  border-radius: 12px;
  background: #f8fafc;
}

.br-selftest-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  color: #1d2a36;
}

.br-selftest-title i { color: #0b6ab8; margin-right: 0.35rem; }

.br-selftest-hint {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  color: #5a6570;
}

body.dark .br-selftest { background: #2c2c2e; border-color: #3a3a3c; }
body.dark .br-selftest-title { color: #f5f5f7; }
body.dark .br-selftest-title i { color: #58a9ec; }
body.dark .br-selftest-hint { color: #aeaeb2; }

.br-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 0.7rem;
}

.br-card {
  border: 1px solid #dfe6ee;
  background: #fff;
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.br-card:hover { border-color: #0b6ab8; }
.br-card:focus-visible { outline: 2px solid #0b6ab8; outline-offset: 2px; }

.br-card-q {
  display: flex;
  gap: 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
  color: #26313c;
}

.br-card-n {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: #eaf2fa;
  color: #0b6ab8;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Answer is collapsed until asked for - the point is to recall it first. */
.br-card-a {
  display: none;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #dfe6ee;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #48484a;
}

.br-card.is-open .br-card-a { display: block; }
.br-card.is-open .br-card-cue { display: none; }

.br-card-a-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #0b6ab8;
  margin-bottom: 0.2rem;
}

.br-card-cue {
  margin-top: 0.5rem;
  font-size: 0.68rem;
  color: #67717c;   /* 3.05:1 at #8a95a1 - too faint against the card */
  font-style: italic;
}

body.dark .br-card { background: #2c2c2e; border-color: #3a3a3c; }
body.dark .br-card:hover { border-color: #2a86d8; }
body.dark .br-card-q { color: #f5f5f7; }
body.dark .br-card-n { background: #1c3a52; color: #6cb6f0; }
body.dark .br-card-a { color: #e5e5ea; border-top-color: #3a3a3c; }
body.dark .br-card-a-label { color: #6cb6f0; }
body.dark .br-card-cue { color: #98989d; }

/* ------------------------------------------------------- misc + lightbox */

.br-loading,
.br-empty {
  font-size: 0.88rem;
  color: #6b7783;
  padding: 1.5rem 0;
}

body.dark .br-loading,
body.dark .br-empty { color: #aeaeb2; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.br-lightbox {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(12, 16, 20, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

.br-lightbox[hidden] { display: none; }

.br-lightbox img {
  max-width: 100%;
  max-height: 82vh;
  background: #fff;
  border-radius: 8px;
}

.br-lightbox-caption {
  color: #dfe6ee;
  font-size: 0.82rem;
  margin-top: 0.8rem;
  max-width: 70ch;
  text-align: center;
  line-height: 1.5;
}

.br-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: #fff;
  font-size: 1.1rem;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  cursor: pointer;
}

.br-lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

@media (max-width: 640px) {
  .br-toolbar { gap: 0.6rem; }
  #br-search { min-width: 0; width: 100%; }
  .br-tools { width: 100%; }
  .br-search-wrap { flex: 1; }
  .br-part-head h2 { font-size: 1.2rem; }
}


/* --------------------------------------------------------------- canvas */
/* The site leaves body/html transparent in dark mode and lets each panel
   paint its own surface. These notes are long-form prose sitting directly on
   the page, so the page itself has to carry a surface or the text lands on
   the white canvas (measured 1.6:1 before this). */
.page-board_review {
  background: #f5f5f7;
  min-height: 100%;
}

body.dark .page-board_review,
body.dark #board-review-container {
  background: #1c1c1e;
}

body.dark .page-board_review .page-title { color: #f5f5f7; }

/* ==========================================================================
   Recall prompts and the tables sheet
   ========================================================================== */

/* A prompt at the end of the section it tests. Reading past it is the point -
   it should be easy to answer in your head and hard to scroll past. */
.br-check {
  margin: 1rem 0 0.5rem;
  padding: 0.7rem 0.9rem 0.8rem;
  border: 1px solid #dfe6ee;
  border-left: 3px solid #4a8f5e;
  border-radius: 0 8px 8px 0;
  background: #f6faf7;
}

.br-check-head {
  margin: 0 0 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #35704a;
}

.br-check-head i { margin-right: 0.3rem; }

.br-check-item + .br-check-item { margin-top: 0.35rem; }

.br-check-q {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0.25rem 0 0.25rem 1.15rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
  color: #26313c;
  cursor: pointer;
  position: relative;
}

.br-check-q::before {
  content: '\f054';                 /* chevron */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.62rem;
  position: absolute;
  left: 0;
  top: 0.5rem;
  color: #4a8f5e;
  transition: transform 0.15s;
}

.br-check-item.is-open .br-check-q::before { transform: rotate(90deg); }

.br-check-a {
  display: none;
  padding: 0.35rem 0 0.2rem 1.15rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #3c4854;
}

.br-check-item.is-open .br-check-a { display: block; }

/* The link that separates this from a quiz: go and do the thing. */
.br-check-practice {
  margin: 0.6rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px dashed #cfe0d5;
  font-size: 0.78rem;
}

.br-check-practice a {
  color: #35704a;
  font-weight: 600;
  text-decoration: none;
}

.br-check-practice a:hover { text-decoration: underline; }
.br-check-practice i { margin-right: 0.3rem; }

body.dark .br-check { background: #1f2a22; border-color: #3a3a3c; border-left-color: #5aa872; }
body.dark .br-check-head { color: #8ecfa2; }
body.dark .br-check-q { color: #f5f5f7; }
body.dark .br-check-q::before { color: #5aa872; }
body.dark .br-check-a { color: #e5e5ea; }
body.dark .br-check-practice { border-top-color: #3a4a3e; }
body.dark .br-check-practice a { color: #8ecfa2; }

/* ------------------------------------------------------------ view switch */

.br-viewswitch {
  display: inline-flex;
  border: 1px solid #d7dee6;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.br-view {
  border: 0;
  background: none;
  padding: 0.34rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #48535f;
  cursor: pointer;
  white-space: nowrap;
}

.br-view + .br-view { border-left: 1px solid #e6ebf1; }
.br-view.is-active { background: #0b6ab8; color: #fff; }
.br-view i { margin-right: 0.25rem; font-size: 0.72rem; }

body.dark .br-viewswitch { background: #2c2c2e; border-color: #48484a; }
body.dark .br-view { color: #e5e5ea; }
body.dark .br-view + .br-view { border-left-color: #48484a; }
body.dark .br-view.is-active { background: #1a6bb5; color: #fff; }

/* -------------------------------------------------------- tables sheet */

.br-table-card { margin-bottom: 1.4rem; }

.br-table-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #45515e;
}

.br-table-src {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: #0b6ab8;
  text-decoration: none;
  white-space: nowrap;
}

.br-table-src:hover { text-decoration: underline; }
.br-table-src i { font-size: 0.62rem; }

/* On the sheet the tables are the content, so let them breathe. */
.br-content[data-view="tables"] .br-table { font-size: 0.86rem; }
.br-content[data-view="tables"] .br-table-wrap { margin-top: 0; }

body.dark .br-table-card-title { color: #c7c7cc; }
body.dark .br-table-src { color: #58a9ec; }
