/* Plain language help: «?» tips beside words and «?» dialogs beside titles. */

.help-tip { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.help-tip-button { display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); color: var(--muted); background: transparent; font: 500 10px/1 var(--font-mono); cursor: help; }
.help-tip-button:is(:hover, :focus-visible, [aria-expanded="true"]) { border-color: var(--primary); color: var(--ink); background: var(--primary-soft); }
.help-tip-button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }

/* The bubble lies in the top layer; help.js places it under or over the «?». */
.help-tip-bubble { position: fixed; inset: auto; width: max-content; max-width: min(320px, calc(100vw - 24px)); margin: 0; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); color: var(--ink); background: var(--surface); box-shadow: var(--shadow-md); font: 400 var(--fs-ui-small)/1.55 var(--font-sans, inherit); letter-spacing: normal; text-align: left; text-transform: none; white-space: normal; overflow-wrap: break-word; }

.help-modal-open { display: inline-flex; align-self: flex-start; justify-self: start; width: max-content; max-width: 100%; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--muted); background: transparent; font: 400 var(--fs-ui-label)/1.5 var(--font-mono); letter-spacing: 0.04em; cursor: pointer; white-space: nowrap; }
.help-modal-open:is(:hover, :focus-visible) { border-color: var(--primary); color: var(--ink); background: var(--primary-soft); }
.help-modal-open:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }
.help-modal-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: var(--radius-pill); font-size: 10px; line-height: 1; }

/* The «?» beside a page or panel title (help-modal), framed like the «?» of a tip, and the (i) beside a page title (help-modal with icon): muted, ink under the pointer, the keyboard or while its dialog is open. */
.page-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.page-title > :is(h1, h2) { min-width: 0; }
.help-ask { position: relative; display: inline-grid; flex: none; place-items: center; width: 18px; height: 18px; margin: 0; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); color: var(--muted); background: transparent; font: 500 11px/1 var(--font-mono); cursor: pointer; }
.help-ask:is(:hover, :focus-visible), .help-ask:has(+ .help-modal[open]) { border-color: var(--primary); color: var(--ink); background: var(--primary-soft); }
.help-ask:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }
/* Title rows with a wider gap for their badges keep the «?» as close as in .page-title. */
:is(.wh-title, .dfl-title) > .help-ask { margin-left: -6px; }
.traffic-title > .help-ask { margin-left: -4px; }
.help-info { position: relative; display: inline-grid; flex: none; place-items: center; width: 18px; height: 18px; margin: 0; padding: 0; border: 0; border-radius: var(--radius-pill); color: var(--muted); background: transparent; cursor: pointer; }
.help-info:is(:hover, :focus-visible), .help-info:has(+ .help-modal[open]) { color: var(--ink); }
.help-info:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus-ring); }
.help-info svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { :is(.help-info, .help-ask)::after { position: absolute; inset: -12px; content: ""; } }
@media print { .help-info, .help-ask, .help-tip, .help-modal-open { display: none; } }

.help-modal { width: min(640px, calc(100vw - 48px)); max-width: none; max-height: min(820px, calc(100dvh - 48px)); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); color: var(--ink); background: var(--surface); box-shadow: var(--shadow-md); overflow: hidden; overflow-wrap: anywhere; text-align: left; }
.help-modal[open] { display: flex; flex-direction: column; }
.help-modal::backdrop { background: color-mix(in srgb, var(--bg) 72%, transparent); }
.help-modal-head { display: flex; flex-shrink: 0; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.help-modal-kicker { margin: 0 0 6px; color: var(--muted); font: 400 var(--fs-label)/1.5 var(--font-mono); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.help-modal h2 { margin: 0; color: var(--ink); font: 500 24px/1.15 var(--font-display); letter-spacing: -0.025em; }
.help-modal-close { display: grid; flex-shrink: 0; place-items: center; width: 34px; height: 34px; padding: 7px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--muted); background: transparent; cursor: pointer; }
.help-modal-close:is(:hover, :focus-visible) { border-color: var(--primary); color: var(--ink); background: var(--primary-soft); }
.help-modal-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.help-modal-body { display: grid; gap: 16px; padding: 20px 24px 24px; overflow-y: auto; overscroll-behavior: contain; font-size: var(--fs-ui-body); line-height: 1.65; }
.help-modal-body > p { margin: 0; }
.help-modal-body h3 { margin: 4px 0 0; color: var(--muted); font: 400 var(--fs-label)/1.5 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.help-modal-body ul, .help-modal-body ol { margin: 0; padding-left: 18px; }
.help-modal-body li + li { margin-top: 4px; }

.help-terms { margin: 0; }
.help-term { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-ui-small); line-height: 1.6; }
.help-term:first-child { padding-top: 0; }
.help-term:last-child { padding-bottom: 0; border-bottom: 0; }
.help-term dt { color: var(--ink); font-weight: 500; }
.help-term dd { margin: 0; color: var(--ink); }

html.help-modal-is-open { overflow: hidden; }

@media (max-width: 760px) {
  .help-modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .help-modal-head { padding: 16px; }
  .help-modal h2 { font-size: 22px; }
  .help-modal-body { padding: 16px 16px 22px; }
  .help-term { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}

/* A dialog or tip may sit inside a panel heading or a page whose own rules
   restyle every p, h2, h3 or button in it; these keep the help text as above. */
dialog.help-modal :is(.help-modal-body, .help-modal-body p, .help-modal-body li, .help-term dd) { color: var(--ink); font-family: var(--font-sans); font-size: var(--fs-ui-body); font-weight: 400; line-height: 1.65; letter-spacing: normal; text-transform: none; }
dialog.help-modal .help-term :is(dt, dd) { font-size: var(--fs-ui-small); line-height: 1.6; }
dialog.help-modal .help-term dt { font-weight: 500; }
dialog.help-modal .help-modal-head h2 { margin: 0; color: var(--ink); font: 500 24px/1.15 var(--font-display); letter-spacing: -0.025em; text-transform: none; }
dialog.help-modal .help-modal-head .help-modal-kicker { margin: 0 0 6px; color: var(--muted); font: 400 var(--fs-label)/1.5 var(--font-mono); letter-spacing: var(--tracking-label); text-transform: uppercase; }
dialog.help-modal .help-modal-body h3 { margin: 4px 0 0; color: var(--muted); font: 400 var(--fs-label)/1.5 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
span.help-tip .help-tip-bubble { color: var(--ink); font: 400 var(--fs-ui-small)/1.55 var(--font-sans); letter-spacing: normal; text-transform: none; }
