/* ── the brief: what opens on Enter (brief.js injects the dialog markup) ── */
dialog.brief { --sheet: rgba(7, 12, 20, .97); --sheet-solid: #070c14; --pad: 18px; width: min(640px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 24px); max-height: calc(100svh - 24px); margin: auto; padding: 0; border: 0; background: none; color: var(--fg); overflow: visible; }
[data-theme="light"] dialog.brief { --sheet: #f3eee4; --sheet-solid: #f3eee4; }
dialog.brief::backdrop { background: rgba(3, 6, 10, .6); backdrop-filter: blur(4px); }
[data-theme="light"] dialog.brief::backdrop { background: rgba(233, 227, 215, .55); }
/* the whole sheet scrolls when it doesn't fit; the drawing gives way first */
.brief-in { display: flex; flex-direction: column; max-height: calc(100vh - 24px); max-height: calc(100svh - 24px); overflow: hidden auto; overscroll-behavior: contain; scroll-padding-bottom: 64px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent;
  border: 1px solid var(--line2); border-radius: 16px; background: var(--sheet);
  box-shadow: 0 40px 120px -40px #000, 0 0 100px -40px rgba(var(--accent-rgb), calc(var(--glow) + .1)); }
[data-theme="light"] .brief-in { box-shadow: 0 30px 80px -30px rgba(60, 45, 25, .35); }
dialog.brief[open] .brief-in { animation: pop .35s cubic-bezier(.2, .7, .2, 1); }
html.still dialog.brief[open] .brief-in { animation: none; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.brief-bar { display: flex; flex: none; align-items: center; gap: 14px; padding: 11px 14px 11px 16px; border-bottom: 1px solid var(--line); font: 400 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.brief-title { display: inline-flex; align-items: center; gap: 9px; margin-right: auto; }
.brief-title, .brief-x { white-space: nowrap; }
.brief-title .mark { width: 16px; height: 16px; }
.brief-tag { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border: 1px solid rgba(var(--accent-rgb), .55); border-radius: 99px; color: var(--accent); }
.brief-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(var(--accent-rgb), .8); }
.brief-tag[hidden] { display: none; }
.brief-x { padding: 5px 9px; border: 1px solid var(--line2); border-radius: 99px; background: none; color: var(--dim); font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
/* squeezed, the drawing keeps its middle; too short to show, it and its pause control (in the
   corner) are left out of sight */
.brief-stage { position: relative; flex: 0 1 auto; height: calc(12 * 1.25em + 26px); min-height: 8px; max-height: 28vh; max-height: 28svh; font: 400 12px/1.25 var(--mono); container-type: size; }
@container (max-height: 43px) { .brief-art, .brief-motion { visibility: hidden; } }
.brief-motion { position: absolute; top: 8px; right: 10px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line2); border-radius: 99px; background: var(--sheet-solid); color: var(--dim); cursor: pointer; }
.brief-motion > span { grid-area: 1 / 1; display: inline-flex; }
.brief-motion svg { width: 10px; height: 10px; }
html.still .brief-motion .to-still, html:not(.still) .brief-motion .to-move, .brief-motion[hidden], .brief-art:empty + .brief-motion { display: none; }
.brief-art { display: flex; flex-direction: column; justify-content: center; height: 100%; margin: 0; padding: 14px 18px 12px; overflow: hidden; white-space: pre; font: inherit; color: var(--accent);
  text-shadow: 0 0 12px rgba(var(--accent-rgb), var(--glow)); }
.brief-req { display: flex; flex: none; align-items: baseline; gap: 8px; padding: 0 var(--pad) 12px; border-bottom: 1px solid var(--line); font: 400 12.5px/1.5 var(--mono); color: var(--dim); }
.brief-req [data-brief-req] { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.brief-req-acts { flex: none; display: inline-flex; gap: 8px; margin-left: auto; }
.brief-change { flex: none; padding: 0; background: none; border: 0; color: var(--mute); font: inherit; cursor: pointer; }
.brief-change[hidden] { display: none; }
.brief-form, .brief-done { flex: none; padding: 18px var(--pad) 0; }
.brief-form h2 { font: 400 28px/1.12 var(--serif); letter-spacing: -.01em; }
.brief-hint { margin-top: 5px; font: 400 10.5px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.brief-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.opt { display: inline-flex; align-items: baseline; gap: 9px; padding: 8px 13px; border: 1px solid var(--line2); border-radius: 10px; background: rgba(255, 255, 255, .02); color: var(--fg); font: 400 13px/1.3 var(--mono); text-align: left; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
[data-theme="light"] .opt { background: rgba(255, 255, 255, .45); }
.opt-n { font-size: 10.5px; color: var(--mute); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), .13); color: var(--accent); }
.opt[aria-pressed="true"] .opt-n { color: var(--accent); }

/* contact: a label column as wide as its longest label, shared by every row */
.brief-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 14px 10px; margin-top: 16px; }
.brief-fields[hidden], .brief-fields > [hidden] { display: none; }
.brief-fields > label { grid-column: 1 / -1; display: grid; grid-template-columns: 124px minmax(0, 1fr); grid-template-columns: subgrid; column-gap: 10px; align-items: baseline; font: 400 12.5px var(--mono); color: var(--dim); }
.brief-lab small { font-size: 10.5px; color: var(--mute); }
.brief-lab i { font-style: normal; color: var(--accent); }
.brief-fields input, .brief-fields textarea { width: 100%; padding: 5px 0 8px; border: 0; border-bottom: 1px solid var(--line3, var(--line2)); border-radius: 0; background: none; outline: 0; color: var(--fg); font: 400 15px/1.45 var(--sans); resize: none; caret-color: var(--accent); }
.brief-fields input:focus, .brief-fields textarea:focus, .brief-fields [aria-invalid="true"] { border-bottom-color: var(--accent); }
.brief-fields ::placeholder { color: var(--mute); font: 400 12.5px var(--mono); opacity: 1; }
.brief-note, .brief-ferr { grid-column: 1 / -1; margin-top: -8px; padding-left: 134px; font: 400 10.5px/1.5 var(--mono); color: var(--mute); }
@supports (grid-template-columns: subgrid) { .brief-note, .brief-ferr { grid-column: 2; padding-left: 0; } }
.brief-note a { color: var(--dim); text-decoration: underline; text-decoration-color: var(--line3, var(--line2)); text-underline-offset: 2px; }
.brief-ferr { font-size: 11.5px; color: var(--accent); }
.brief-ts > * { margin-top: 14px; }
.brief-ts[hidden] { display: none; }
/* the honeypot: out of sight and out of reach, but not display:none */
.brief-hp { position: absolute; left: -10000px; top: 0; width: 1px; height: 1px; overflow: hidden; }

/* a failed send: what went wrong, and the address to use instead */
.brief-err { font: 400 12.5px/1.55 var(--mono); color: var(--dim); }
.brief-alert { color: var(--accent); }
.brief-alert:not(:empty) { margin-top: 14px; }
.brief-alt { margin-top: 6px; }
.brief-alt[hidden] { display: none; }
.brief-alt p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.brief-alt p + p { margin-top: 4px; }
.brief-addr { color: var(--fg); -webkit-user-select: all; user-select: all; }
.brief-alt a { display: inline-block; padding: 4px 0; color: var(--accent); text-decoration: underline; text-decoration-color: var(--line3, var(--line2)); text-underline-offset: 3px; }
.brief-mini { padding: 3px 8px; border: 1px solid var(--line2); border-radius: 7px; background: none; color: var(--dim); font: 400 11px/1.2 var(--mono); cursor: pointer; }

/* the buttons stay in view while the sheet scrolls under them */
.brief-nav { position: sticky; bottom: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px calc(-1 * var(--pad)) 0; padding: 10px var(--pad) 16px; background: var(--sheet-solid); }
.brief-nav button { padding: 9px 14px; border: 1px solid var(--line2); border-radius: 10px; background: none; color: var(--dim); font: 500 12px/1 var(--mono); letter-spacing: .05em; cursor: pointer; }
.brief-nav button[hidden] { display: none; }
.brief-nav .brief-primary { margin-left: auto; border-color: transparent; background: var(--accent); color: var(--bg); }
.brief-in [aria-disabled="true"] { opacity: .5; cursor: default; }
.brief-nav .brief-primary[aria-disabled="true"] { opacity: .7; cursor: progress; }

.brief-done p { font: 400 13.5px/1.6 var(--mono); color: var(--dim); }
.brief-done p + p, .brief-done p + ol { margin-top: 8px; }
.brief-done p.ink { font-size: 15px; color: var(--accent); }
.brief-done .fg { color: var(--fg); }
.brief-done ol { margin: 8px 0 0; padding: 0; list-style: none; font: 400 13px/1.55 var(--mono); color: var(--dim); }
.brief-done li { display: grid; grid-template-columns: 22px 1fr; margin-top: 4px; }
.brief-done li b { font-weight: 400; color: var(--accent); }

@media (hover: hover) {
  .brief-x:hover, .brief-motion:hover { color: var(--fg); }
  .brief-change:hover { color: var(--accent); }
  .opt:not([aria-pressed="true"]):hover { border-color: var(--dim); }
  .brief-nav button:not(.brief-primary):not([aria-disabled="true"]):hover, .brief-mini:hover { color: var(--fg); border-color: var(--dim); }
}

/* no drawing when there's no room for it; phones get 16px fields so iOS doesn't zoom in on focus */
@media (max-height: 560px) { .brief-stage { display: none; } }
@media (max-width: 860px) { .brief-fields input, .brief-fields textarea { font-size: 16px; } }
@media (max-width: 600px) {
  dialog.brief { --pad: 14px; width: 100vw; max-height: 92vh; max-height: 92svh; margin: auto 0 0; }
  .brief-in { max-height: 92vh; max-height: 92svh; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .brief-stage { font-size: 10px; }
  .brief-art { padding: 12px 12px 8px; }
  .brief-form h2 { font-size: 24px; }
  .opt { padding: 8px 11px; font-size: 12.5px; }
  .brief-fields > label { grid-template-columns: 112px minmax(0, 1fr); grid-template-columns: subgrid; font-size: 12px; }
  .brief-note, .brief-ferr { padding-left: 122px; }
  @supports (grid-template-columns: subgrid) { .brief-note, .brief-ferr { padding-left: 0; } }
  /* the route and the request wrap rather than cut the route off; the buttons move below together */
  .brief-req { flex-wrap: wrap; }
  .brief-req [data-brief-req] { flex: 1 1 12em; white-space: normal; overflow-wrap: break-word; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
}
/* narrow, with the urgent tag showing, the bar keeps one row: the words "new brief" are left to
   screen readers (the dialog's name), the mark stays */
@media (max-width: 359px) {
  .brief-bar:has(.brief-tag:not([hidden])) { gap: 8px; padding-left: 12px; padding-right: 10px; }
  .brief-bar:has(.brief-tag:not([hidden])) .brief-title-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Windows contrast themes drop the colours, so a picked option is drawn in the system highlight */
@media (forced-colors: active) {
  .opt[aria-pressed="true"] { forced-color-adjust: none; border-color: Highlight; background: Highlight; color: HighlightText; }
  .opt[aria-pressed="true"] .opt-n, .opt[aria-pressed="true"] .opt-t { color: HighlightText; }
  .opt[aria-pressed="true"] .opt-t { text-decoration: underline; text-underline-offset: 3px; }
  .brief-tag i { forced-color-adjust: none; background: CanvasText; box-shadow: none; }
  .brief-nav .brief-primary { border-color: ButtonText; }
}
