/* The Margin (margin.js). Uses the site's tokens from site.css (--bg, --panel, --line, --text, --muted, --gold,
   --gold-hi, --serif, --sans) with fallbacks, so it also works on its own. Everything is prefixed dy-m-. */
:root { --dy-m-gold: var(--gold, #bca782); --dy-m-gold-hi: var(--gold-hi, #d8c49c); --dy-m-ink: var(--bg, #0e0d0c);
  --dy-m-panel: var(--panel, #161412); --dy-m-line: var(--line, #2c2823); --dy-m-text: var(--text, #ece5d8);
  --dy-m-muted: var(--muted, #a59d8f); --dy-m-serif: var(--serif, Georgia, serif); --dy-m-sans: var(--sans, system-ui, sans-serif); }

/* subtle underline under annotated words (CSS Highlight API; browsers without it simply show the margin counts) */
::highlight(dy-margin) { text-decoration: underline dotted rgba(188, 167, 130, .55); text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* margin marks: an overlay inside the article, never inside .ch-text */
.reader.chapter.dy-m-on { position: relative; }
.dy-m-rail { position: absolute; inset: 0 auto auto 0; width: 100%; height: 0; pointer-events: none; }
.dy-m-mark { position: absolute; pointer-events: auto; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  border: 1px solid rgba(188, 167, 130, .45); background: rgba(14, 13, 12, .78); color: var(--dy-m-gold);
  font: 600 10.5px/18px var(--dy-m-sans); letter-spacing: .02em; text-align: center; cursor: pointer; opacity: .78;
  transition: opacity .15s, background .15s, color .15s; }
.dy-m-mark:hover, .dy-m-mark:focus-visible { opacity: 1; background: var(--dy-m-gold); color: var(--dy-m-ink); }

/* the Annotate pill */
.dy-m-pill { position: fixed; z-index: 1001; display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px 9px 13px;
  border: 0; border-radius: 999px; background: var(--dy-m-gold); color: var(--dy-m-ink); cursor: pointer;
  font: 600 13px/1 var(--dy-m-sans); letter-spacing: .06em; box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
  animation: dy-m-pop .16s ease-out; }
.dy-m-pill:hover { background: var(--dy-m-gold-hi); }
.dy-m-pill[hidden] { display: none; }
.dy-m-pill-ic { font-size: 14px; }
@keyframes dy-m-pop { from { transform: translateY(4px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* the floating pen: above the read-along bar when it is there (site.js sets --ra-pad) */
.dy-m-pen { position: fixed; z-index: 40; right: clamp(14px, 3vw, 28px); bottom: calc(var(--ra-pad, 0px) + 18px);
  width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgba(188, 167, 130, .55); background: rgba(22, 20, 18, .92);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  color: var(--dy-m-gold); font-size: 21px; line-height: 1; cursor: pointer; box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .15s, color .15s, transform .15s; }
.dy-m-pen:hover, .dy-m-pen:focus-visible { background: var(--dy-m-gold); color: var(--dy-m-ink); transform: translateY(-1px); }

/* the bottom sheet */
.dy-m-lock, .dy-m-lock body { overflow: hidden; }
.dy-m-layer { position: fixed; inset: 0; z-index: 1000; }
.dy-m-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .2s; }
.dy-m-sheet { position: absolute; left: 50%; bottom: 0; width: min(680px, 100%); max-height: min(86vh, 860px); display: flex; flex-direction: column;
  transform: translate(-50%, 100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); background: var(--dy-m-panel);
  color: var(--dy-m-text); border: 1px solid var(--dy-m-line); border-bottom: 0; border-radius: 18px 18px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .55); font: 15px/1.55 var(--dy-m-sans); padding-bottom: env(safe-area-inset-bottom, 0); }
.dy-m-layer.is-open .dy-m-scrim { opacity: 1; }
.dy-m-layer.is-open .dy-m-sheet { transform: translate(-50%, 0); }
.dy-m-grab { width: 42px; height: 4px; border-radius: 2px; background: var(--dy-m-line); margin: 10px auto 0; flex: none; }
.dy-m-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 20px 10px; flex: none;
  border-bottom: 1px solid var(--dy-m-line); }
.dy-m-title { font: 400 21px/1.25 var(--dy-m-serif); letter-spacing: .04em; color: var(--dy-m-gold); margin: 0; }
.dy-m-count { margin: 4px 0 0; color: var(--dy-m-muted); font-size: 13px; }
.dy-m-x { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--dy-m-line); background: transparent;
  color: var(--dy-m-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.dy-m-x:hover, .dy-m-x:focus-visible { color: var(--dy-m-text); border-color: var(--dy-m-gold); }
.dy-m-body { overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 22px; -webkit-overflow-scrolling: touch; }
.dy-m-hint { color: var(--dy-m-muted); font-size: 14px; margin: 0 0 14px; }

/* composer */
/* one column no wider than the form: the spoiler list sizes to its longest chapter title ("About Chapter Three · Before
   Certainty Arrives", 480 px), and an auto track grew to it and pushed every phone contents page past 375 px */
.dy-m-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 0 0 18px; }
.dy-m-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dy-m-chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--dy-m-line); background: transparent; color: var(--dy-m-muted);
  font: 500 12.5px/1.2 var(--dy-m-sans); letter-spacing: .04em; cursor: pointer; }
.dy-m-chip[aria-checked="true"] { border-color: var(--dy-m-gold); color: var(--dy-m-ink); background: var(--dy-m-gold); }
.dy-m-chip:focus-visible { outline: 2px solid var(--dy-m-gold-hi); outline-offset: 2px; }
.dy-m-quote, .dy-m-q { margin: 0; padding: 8px 0 8px 14px; border-left: 2px solid var(--dy-m-gold); color: var(--dy-m-text);
  font: italic 400 15px/1.6 var(--dy-m-serif); opacity: .9; }
.dy-m-ta { width: 100%; min-height: 84px; resize: vertical; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--dy-m-line);
  background: rgba(0, 0, 0, .28); color: var(--dy-m-text); font: 15px/1.55 var(--dy-m-sans); }
.dy-m-ta:focus, .dy-m-handle-in:focus, .dy-m-spoil:focus { outline: none; border-color: var(--dy-m-gold); }
.dy-m-ta:focus-visible, .dy-m-handle-in:focus-visible, .dy-m-spoil:focus-visible { outline: 2px solid var(--dy-m-gold-hi); outline-offset: 1px; }
.dy-m-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; opacity: 0; }
.dy-m-handle, .dy-m-spoil-l { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; color: var(--dy-m-muted); font-size: 13.5px; }
.dy-m-handle-in, .dy-m-spoil { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--dy-m-line); background: rgba(0, 0, 0, .28);
  color: var(--dy-m-text); font: 14px/1.2 var(--dy-m-sans); min-width: 0; max-width: 100%; }
.dy-m-handle-in { width: 13em; }
.dy-m-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dy-m-as { color: var(--dy-m-muted); font-size: 13px; }
.dy-m-go { padding: 11px 20px; border-radius: 999px; border: 1px solid var(--dy-m-gold); background: var(--dy-m-gold); color: var(--dy-m-ink);
  font: 600 12px/1 var(--dy-m-sans); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; }
.dy-m-go:hover { background: var(--dy-m-gold-hi); }
.dy-m-go:disabled { opacity: .55; cursor: wait; }
.dy-m-go:focus-visible { outline: 2px solid var(--dy-m-gold-hi); outline-offset: 3px; }
.dy-m-wide { width: 100%; margin-top: 8px; }
.dy-m-status { min-height: 1.2em; margin: 0; color: var(--dy-m-gold-hi); font-size: 13.5px; }

/* notes */
.dy-m-list { display: grid; gap: 12px; }
.dy-m-note { padding: 13px 15px; border: 1px solid var(--dy-m-line); border-radius: 12px; background: rgba(255, 255, 255, .015); }
.dy-m-note.is-owner { border-color: rgba(188, 167, 130, .5); }
.dy-m-note.is-held { border-style: dashed; opacity: .85; }
.dy-m-thread { display: grid; gap: 10px; margin-top: 4px; }
.dy-m-thread:empty { display: none; }
.dy-m-thread .dy-m-note { padding: 10px 0 0 13px; border: 0; border-left: 1px solid var(--dy-m-line); border-radius: 0; background: none; }
.dy-m-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dy-m-muted); margin-bottom: 6px; }
.dy-m-kind { padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(188, 167, 130, .45); color: var(--dy-m-gold); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; }
.dy-m-by { color: var(--dy-m-text); font-weight: 600; }
.dy-m-badge { padding: 1px 7px; border-radius: 4px; background: var(--dy-m-gold); color: var(--dy-m-ink); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; }
.dy-m-held { color: var(--dy-m-gold-hi); font-style: italic; }
.dy-m-note .dy-m-q { font-size: 14px; margin: 2px 0 8px; }
.reader .dy-m-text, .dy-m-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 15px/1.6 var(--dy-m-sans); color: var(--dy-m-text); }
.dy-m-spoiler { padding: 7px 12px; border-radius: 8px; border: 1px dashed rgba(188, 167, 130, .6); background: rgba(188, 167, 130, .06);
  color: var(--dy-m-gold-hi); font: 500 13px/1.3 var(--dy-m-sans); cursor: pointer; }
.dy-m-locked { color: var(--dy-m-muted); font-style: italic; }
.dy-m-acts { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.dy-m-react { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--dy-m-line);
  background: transparent; color: var(--dy-m-muted); font: 500 12.5px/1 var(--dy-m-sans); cursor: pointer; }
.dy-m-react[aria-pressed="true"] { border-color: var(--dy-m-gold); color: var(--dy-m-gold); background: rgba(188, 167, 130, .1); }
.dy-m-react:disabled { cursor: default; opacity: .7; }
.dy-m-link { padding: 4px 0; border: 0; background: none; color: var(--dy-m-muted); font: 500 12.5px/1 var(--dy-m-sans); cursor: pointer; }
.dy-m-link:hover, .dy-m-link:focus-visible { color: var(--dy-m-gold-hi); text-decoration: underline; }
.dy-m-rep { margin-left: auto; }
.dy-m-replyform { margin: 10px 0 2px; }
.dy-m-replyform .dy-m-form { margin: 0; }
.dy-m-loading, .dy-m-empty { color: var(--dy-m-muted); font-size: 14px; margin: 4px 0; }

/* end of chapter + book page sections */
.dy-m-end { margin: clamp(40px, 7vw, 72px) 0 32px; padding-top: 28px; border-top: 1px solid var(--dy-m-line); font: 15px/1.55 var(--dy-m-sans); }
.reader .dy-m-h, .dy-m-h { font: 500 13px/1.6 var(--dy-m-sans); letter-spacing: .3em; text-transform: uppercase; color: var(--dy-m-gold);
  text-align: left; margin: 0 0 14px; }
.dy-m-top { margin: 0 0 36px; }
.dy-m-top ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dy-m-topq { display: grid; gap: 6px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--dy-m-line);
  background: rgba(255, 255, 255, .015); color: var(--dy-m-text); cursor: pointer; }
.dy-m-topq:hover, .dy-m-topq:focus-visible { border-color: rgba(188, 167, 130, .55); }
.dy-m-topt { font: italic 400 15px/1.55 var(--dy-m-serif); }
.dy-m-topn { font: 600 11.5px/1 var(--dy-m-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--dy-m-gold); }
.dy-m-disc { font: 15px/1.55 var(--dy-m-sans); }
.dy-m-disc.is-book { margin: 48px 0 24px; padding-top: 28px; border-top: 1px solid var(--dy-m-line); text-align: left; }
.dy-m-dhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reader .dy-m-sub, .dy-m-sub { margin: 0 0 14px; color: var(--dy-m-muted); font: 13.5px/1.4 var(--dy-m-sans); }
.dy-m-sorts { display: flex; gap: 6px; margin: 4px 0 14px; }
.dy-m-sort { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--dy-m-line); background: transparent; color: var(--dy-m-muted);
  font: 500 12px/1.2 var(--dy-m-sans); cursor: pointer; }
.dy-m-sort[aria-pressed="true"] { color: var(--dy-m-text); border-color: var(--dy-m-gold); }
.dy-m-more { margin-top: 14px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--dy-m-line); background: transparent;
  color: var(--dy-m-text); font: 500 12px/1 var(--dy-m-sans); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; }
.dy-m-more[hidden] { display: none; }
.reader .dy-m-disc p.dy-m-status { font: 13.5px/1.4 var(--dy-m-sans); margin: 0; }
.reader .dy-m-disc .dy-m-loading, .reader .dy-m-disc .dy-m-empty { font: 14px/1.5 var(--dy-m-sans); }

@media (max-width: 560px) {
  .dy-m-sheet { max-height: 90vh; border-radius: 16px 16px 0 0; }
  .dy-m-head, .dy-m-body { padding-left: 16px; padding-right: 16px; }
  .dy-m-go { width: 100%; }
  .dy-m-foot { flex-direction: column-reverse; align-items: stretch; }
  .dy-m-as { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .dy-m-sheet, .dy-m-scrim { transition: none; }
  .dy-m-pill { animation: none; }
}
@media print { .dy-m-rail, .dy-m-pen, .dy-m-pill, .dy-m-end, .dy-m-disc, .dy-m-layer { display: none !important; } }

/* keyboard focus: always a clear 2px ring (5 Oct a11y pass); colour or border changes alone are too faint */
.dy-m-mark:focus-visible, .dy-m-pen:focus-visible, .dy-m-x:focus-visible, .dy-m-link:focus-visible, .dy-m-topq:focus-visible,
.dy-m-react:focus-visible, .dy-m-sort:focus-visible, .dy-m-more:focus-visible, .dy-m-spoiler:focus-visible, .dy-m-pill:focus-visible,
.dy-m-note:focus-visible, .dy-m-text:focus-visible { outline: 2px solid var(--dy-m-gold-hi); outline-offset: 2px; }
.dy-m-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dy-m-actmsg { flex-basis: 100%; font-size: 12.5px; color: var(--dy-m-muted, #a59d8f); }
.dy-m-pickf { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0 0 14px; min-width: 0; }
.dy-m-pickf .dy-m-spoil-l { display: flex; flex-direction: column; align-items: stretch; width: 100%; min-width: 0; }
.dy-m-pickf .dy-m-pick { display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; text-overflow: ellipsis; }
/* First public post: self-confirmation only, never a date of birth. */
.dy-m-confirm { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--line, currentColor); min-width: 0; }
.dy-m-confirm legend { padding: 0 5px; font-size: 14px; }
.dy-m-confirm label { display: flex; align-items: flex-start; gap: 9px; margin: 7px 0; font-size: 14px; line-height: 1.5; }
.dy-m-confirm input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brass, currentColor); }
.dy-m-confirm a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.dy-m-confirm input:focus-visible { outline: 3px solid var(--focus, currentColor); outline-offset: 3px; }
