/* T5. The context rail. Reference furniture, so it stays quieter than the
   passage: small caps labels, one hairline between fields, colour only where
   colour carries meaning. */

.ctx-rail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ctx-top { margin: -0.4rem 0 0; }

.ctx-eyebrow {
  margin: 0 0 .35rem;
  font: 600 .7rem/1 var(--ui);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
}

.ctx-standfirst {
  margin: 0;
  font: 400 1.02rem/1.6 var(--serif);
  color: var(--ink);
}

.ctx-field {
  margin: 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule-soft);
}
.ctx-field:first-of-type { border-top: 0; padding-top: 0; }

.ctx-h {
  margin: 0 0 .5rem;
  font: 600 .68rem/1 var(--ui);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ctx-p {
  margin: 0;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.ctx-quote {
  margin: 0;
  padding-left: .9rem;
  border-left: 2px solid var(--gold-soft);
  font: 400 1rem/1.65 var(--serif);
  color: var(--ink);
}

/* ------------------------------------------------------- confidence views */

.ctx-lead {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  width: 100%;
  padding: .45rem .55rem .45rem .5rem;
  margin-left: -.5rem;
  border: 0;
  border-radius: .5rem;
  background: none;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.ctx-lead:hover { background: var(--paper-2); }
.ctx-lead:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.ctx-dot {
  flex: 0 0 auto;
  width: .58rem;
  height: .58rem;
  border-radius: 50%;
  transform: translateY(-.05rem);
}
.ctx-dot[data-confidence="contested"] { background: var(--clay); }
.ctx-dot[data-confidence="probable"] { background: var(--gold); }
.ctx-dot[data-confidence="settled"] { background: var(--ink-3); }

.ctx-lead-value {
  flex: 1 1 auto;
  font-size: .95rem;
  line-height: 1.5;
}

.ctx-lead-more {
  flex: 0 0 auto;
  font-size: .7rem;
  letter-spacing: .04em;
  color: var(--ink-3);
  white-space: nowrap;
}
.ctx-lead[aria-expanded="true"] .ctx-lead-more { color: var(--gold); }

.ctx-views {
  display: grid;
  gap: .9rem;
  margin-top: .7rem;
  padding: .95rem 1rem;
  background: var(--paper-2);
  border-radius: .6rem;
}

.ctx-view-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .2rem;
  font: 600 .72rem/1.3 var(--ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ctx-tag {
  padding: .1rem .4rem;
  border-radius: .3rem;
  font-size: .62rem;
  letter-spacing: .08em;
  border: 1px solid currentColor;
}
.ctx-tag[data-confidence="contested"] { color: var(--clay); }
.ctx-tag[data-confidence="probable"] { color: var(--gold); }
.ctx-tag[data-confidence="settled"] { color: var(--ink-3); }

.ctx-view-value {
  margin: 0;
  font: 400 .95rem/1.55 var(--serif);
  color: var(--ink);
}

.ctx-view-basis {
  margin: .35rem 0 0;
  font-size: .82rem;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ chips */

.ctx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .6rem 0 0;
  padding: 0;
  list-style: none;
}

.ctx-chip {
  display: inline-block;
  padding: .22rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  font-size: .78rem;
  color: var(--ink-2);
}
.ctx-chip[data-kind="genre"] { border-color: var(--gold-soft); color: var(--gold); }

/* ------------------------------------------------------------ key verses */

.ctx-verses {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.ctx-verse {
  padding: .28rem .65rem;
  border: 1px solid var(--rule);
  border-radius: .45rem;
  background: var(--field);
  font: 500 .82rem/1.3 var(--ui);
  color: var(--ink);
  cursor: pointer;
}
.ctx-verse:hover { border-color: var(--gold-soft); }
.ctx-verse:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.ctx-preview {
  margin: .7rem 0 0;
  min-height: 1.2em;
  font: 400 .92rem/1.65 var(--serif);
  color: var(--ink);
}
.ctx-preview:empty { display: none; }

/* --------------------------------------------------------------- outline */

.ctx-outline {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: .1rem;
}
.ctx-outline li {
  display: grid;
  grid-template-columns: 7.4rem 1fr;
  gap: .7rem;
  padding: .42rem .55rem;
  border-radius: .45rem;
  font-size: .85rem;
  color: var(--ink-2);
}
.ctx-outline li.here {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--gold);
}
.ctx-outline-range {
  font: 600 .74rem/1.6 var(--ui);
  letter-spacing: .03em;
  color: var(--ink-3);
}
.ctx-outline li.here .ctx-outline-range { color: var(--gold); }

/* ------------------------------------------------------------- canon arc */

.ctx-arc-box {
  padding: .3rem 0 .1rem;
}
.ctx-arc-svg {
  display: block;
  width: 100%;
  height: auto;
}
.ctx-arc-line {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
}
.ctx-arc-tick {
  stroke: var(--rule);
  stroke-width: 1;
  opacity: .9;
}
.ctx-arc-tick[data-testament="NT"] { stroke: var(--gold-soft); }
.ctx-arc-tick[data-here="true"] { stroke: var(--ink); stroke-width: 2; }
.ctx-arc-marker {
  fill: var(--clay);
  r: 4.5;
  stroke: var(--paper);
  stroke-width: 1.6;
}
.ctx-arc-marker.easing {
  transition: cx .9s var(--ease), cy .9s var(--ease);
}
.ctx-arc-said {
  margin: .3rem 0 0;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ------------------------------------------------------------ the events */

.ctx-events {
  display: flex;
  gap: .5rem;
  margin: 0;
  padding: 0 0 .4rem;
  list-style: none;
  overflow-x: auto;
}
.ctx-events li { flex: 0 0 auto; }

.ctx-event {
  display: grid;
  gap: .2rem;
  min-width: 9.4rem;
  max-width: 13rem;
  padding: .55rem .7rem;
  border: 1px solid var(--rule);
  border-top: 2px solid var(--gold-soft);
  border-radius: .5rem;
  background: var(--field);
  text-align: left;
  cursor: pointer;
}
.ctx-event:hover, .ctx-event.lit { border-color: var(--gold-soft); background: var(--paper-2); }
.ctx-event:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ctx-event-when {
  font: 600 .7rem/1.3 var(--ui);
  letter-spacing: .05em;
  color: var(--gold);
}
.ctx-event-what {
  font: 400 .86rem/1.4 var(--serif);
  color: var(--ink);
}

.ctx-note {
  margin: .6rem 0 0;
  font-size: .76rem;
  line-height: 1.6;
  color: var(--ink-3);
}
.ctx-note:empty { display: none; }

/* --------------------------------------------------- bottom sheet, small */

/* Under 768 px the rail is not a side panel. It comes up from the bottom,
   leaving the top of the passage visible behind it. */
@media (max-width: 768px) {
  .panel:has(.ctx-rail) {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 82vh;
    border-left: 0;
    border-top: 1px solid var(--rule);
    border-radius: 1rem 1rem 0 0;
    animation-name: sheet-in;
  }
  .panel:has(.ctx-rail) .panel-head {
    position: relative;
    padding-top: 1.5rem;
  }
  /* The grab handle. Decoration, so it says nothing to a screen reader. */
  .panel:has(.ctx-rail) .panel-head::before {
    content: '';
    position: absolute;
    top: .55rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.4rem;
    height: .22rem;
    border-radius: 999px;
    background: var(--rule);
  }
  @keyframes sheet-in {
    from { transform: translateY(1.5rem); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  .ctx-outline li { grid-template-columns: 1fr; gap: .1rem; }
}
