/* The Info drawer, shared by both tools: the <info-drawer> custom element
   (shared/js/components/info-drawer.js) hosting a modal <dialog> restyled as a
   right-hand drawer, with the exposed intro, the FAQ-style details/summary
   accordion and the muted fine print underneath. Content structure comes from
   the shared renderer (shared/js/info.js); consumes only shared tokens. */
/* The host is display:contents so the dialog lays out as if unwrapped. */
info-drawer {
  display: contents;
}
/* A modal <dialog> (so it keeps the backdrop, focus trap and Escape-to-close),
   restyled as a right-hand drawer that slides in. The base rule is the closed
   state (off-screen right); [open] is the shown state; @starting-style gives the
   slide-in, and display/overlay allow-discrete gives the slide-out on close. */
dialog.notes {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  width: min(440px, 100vw);
  max-width: 100vw;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.24s ease, display 0.24s ease allow-discrete, overlay 0.24s ease
    allow-discrete;
}
dialog.notes[open] {
  transform: translateX(0);
}
@starting-style {
  dialog.notes[open] {
    transform: translateX(100%);
  }
}
dialog.notes::backdrop {
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.24s ease, display 0.24s ease allow-discrete, overlay 0.24s ease
    allow-discrete;
}
dialog.notes[open]::backdrop {
  opacity: 1;
}
@starting-style {
  dialog.notes[open]::backdrop {
    opacity: 0;
  }
}
/* Sticky drawer header (brand + close); the body scrolls under it. */
.notes-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px 13px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.notes-close {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 8px;
  display: inline-flex;
}
.notes-close:hover {
  color: var(--ink);
}
.notes-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
#notesBody {
  padding: 8px 0 28px;
}
dialog.notes h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
dialog.notes p {
  margin: 0 0 10px;
}
dialog.notes ul {
  margin: 0 0 10px;
  padding-left: 20px;
}
dialog.notes li {
  margin: 0 0 5px;
}
dialog.notes .tradeoff,
dialog.notes .ctx {
  color: var(--muted);
  font-size: 13px;
}
/* Info panel: FAQ-style details/summary accordion (breaks up the content, works on mobile). */
dialog.notes details {
  border-top: 1px solid var(--line);
}
dialog.notes details:last-of-type {
  border-bottom: 1px solid var(--line);
}
dialog.notes summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  font-weight: 600;
  color: var(--ink);
}
dialog.notes summary::-webkit-details-marker {
  display: none;
}
dialog.notes summary::after {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}
dialog.notes details[open] summary::after {
  transform: rotate(225deg);
}
dialog.notes summary:hover {
  background: var(--bg);
}
dialog.notes summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
dialog.notes .details-body {
  padding: 2px 22px 16px;
}
/* Sub-headings within a section body (### in info.md): break the copy into scannable
   blocks instead of bullet lists. One level below the summary that heads the section. */
dialog.notes .details-body h4 {
  margin: 16px 0 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.7;
}
dialog.notes .details-body h4:first-child {
  margin-top: 2px;
}
/* The parenthetical (e.g. "(top right)") drops to normal weight so it reads apart from
   the bold heading word at a glance. */
dialog.notes .details-body h4 .h4-note {
  font-weight: 400;
}
/* Exposed blocks: the intro sits above the accordion, the disclaimer below it in a
   smaller, muted treatment. */
dialog.notes .notes-intro {
  padding: 4px 22px 18px;
}
/* Text links within the notes prose (e.g. the credit link); the icon-only .ext links
   carry their own styling, so leave those alone. */
dialog.notes .details-body a:not(.ext),
dialog.notes .notes-intro a:not(.ext),
dialog.notes .notes-fine a:not(.ext) {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
dialog.notes .details-body a:not(.ext):hover,
dialog.notes .notes-intro a:not(.ext):hover,
dialog.notes .notes-fine a:not(.ext):hover {
  color: var(--ink);
}
dialog.notes .notes-fine {
  padding: 14px 22px 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
dialog.notes .notes-fine h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
dialog.notes .notes-fine p {
  margin: 0 0 8px;
}
/* While the drawer is open, lock page scroll so only the drawer scrolls. */
html:has(dialog.notes[open]),
body:has(dialog.notes[open]) {
  overflow: hidden;
}
