/* Source notes (Brand Book v2, 8b): a source's name opens a note in place.
   Without the script (or on paper) every note stays open after its sentence. */

.source-note { display: block; margin: 10px 0 14px; padding-left: 14px; border-left: 2px solid var(--customer-green); color: var(--customer-ink); font-size: .9375rem; line-height: 1.5; text-wrap: pretty; }
.source-note > span { display: block; }
.source-note > span + span { margin-top: 6px; }
.source-note cite, .source-list cite { font-style: italic; }
.source-note-shop strong { color: var(--customer-green-deep); font-weight: 700; }
.source-note > .source-note-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; color: var(--customer-muted); }
.source-note-foot > .source-note-who { flex: 1 1 12em; color: var(--customer-ink); }
.source-note-when, .source-intro { display: flex; align-items: center; gap: 8px; }
.source-intro { align-items: flex-start; }
.source-intro .source-tick { margin-top: 1px; }
.source-note time, .guide-sources time { white-space: nowrap; }

/* The tick: the mark an item gets in the trolley. A note's only gold. */
.source-tick { display: inline-grid; flex: none; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--customer-green); color: var(--customer-gold); }
.source-tick svg { display: block; width: 12px; height: 12px; }

/* Close: a word, not a cross, with a 44px target. */
.source-note-close { min-height: 44px; margin: -6px -10px -6px auto; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--customer-green); font: inherit; font-weight: 600; cursor: pointer; }
.source-note-close[hidden] { display: none; }
.source-note-close:hover { color: var(--customer-green-deep); text-decoration: underline; text-underline-offset: .2em; }
.source-note-close:focus-visible { outline: 3px solid var(--customer-green); outline-offset: -3px; }

/* With the script. Dotted means "opens here"; solid means "goes somewhere".
   Open: Soft Green deep enough to see on Paper. */
.source-notes { --source-open: #d3e4c6; }
.source-notes .source-note { display: none; }
.source-notes .source-note.is-open { display: block; }
.source-notes .source-note:focus-visible { outline: none; padding-left: 12px; border-left: 4px solid var(--customer-green-deep); }
.source-notes .source { position: relative; border-radius: 3px; color: var(--customer-green-deep); text-decoration-line: underline; text-decoration-style: dotted; text-decoration-color: var(--customer-green); text-decoration-thickness: 2px; text-underline-offset: .3em; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; -webkit-tap-highlight-color: transparent; }
.source-notes .source::after { content: ""; position: absolute; inset: -12px -4px; }
.source-notes .source:hover { text-decoration-color: var(--customer-green-deep); }
.source-notes .source[aria-expanded="true"] { background: var(--source-open); }
/* Focus: no ring round the words; it would hide a comma. */
.source-notes .source:focus-visible { outline: 2px solid transparent; outline-offset: 0; background: var(--source-open); text-decoration-style: solid; text-decoration-color: var(--customer-green-deep); }

/* A breath, not a slide. Closing is instant. */
@media (prefers-reduced-motion: no-preference) {
  .source-notes .source-note.is-open { animation: source-note-in .18s ease-out; }
}
@keyframes source-note-in { from { opacity: 0; } }

/* Wide screens: a margin note, level with its name. The rail is the guide's margin
   column, whatever box the sentence sits in. */
.source-note-rail { display: none; }
@media (min-width: 1024px) {
  .source-notes .guide { position: relative; }
  .source-notes .guide .source-note.is-open, .source-notes .guide > .source-note-rail { position: absolute; right: max(var(--site-gutter), calc((100% - var(--site-width)) / 2)); width: 320px; margin: 0; }
  .source-notes .guide > .source-note-rail { display: block; top: 0; height: 0; visibility: hidden; }
}

/* "Where our facts come from": the whole record, as small print. */
.guide-sources .source-intro { margin-top: 6px; }
.source-list { margin: 14px 0 0; }
.source-list dt { color: var(--customer-ink); font-weight: 600; }
.source-list dd { margin: 4px 0 0; }
.source-list dd + dt { margin-top: 12px; }

/* Paper: every note open, in the flow. */
@media print {
  .source-notes .source-note, .source-notes .guide .source-note.is-open { display: block; position: static; width: auto; margin: 6pt 0; padding-left: 14px; border-left-width: 2px; }
  .source-note-close, .source-notes .guide > .source-note-rail { display: none; }
}
