/* notice: an in-page message in one of four kinds. Replaces
   .configuration_warning, .warning_box, .information and .instructions (and
   .set_instructions where it explains rather than marks an empty set). A tint
   and an edge in the state colour, a light glyph whose shape names the kind,
   and text in the normal text colour. */
.block_notice {
  --block-notice-colour: var(--color-status-neutral);
  --block-notice-background: var(--color-notice-info-background);
  --block-notice-glyph: var(--ui-icon-circle-info);

  display: grid;
  align-items: start;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--ui-space-3);
  box-sizing: border-box;
  margin: 0 0 var(--ui-space-4);
  padding: var(--ui-space-3) var(--ui-space-4);
  color: var(--color-text);
  font-size: var(--ui-font-size-body);
  line-height: var(--ui-line-height-body);
  background-color: var(--block-notice-background);
  border-radius: var(--ui-radius-control);
  border-inline-start: var(--ui-space-1) solid var(--block-notice-colour);
}

/* The glyph sits on the title's first line. Its box is that line's height
   and the glyph centres in it, so it stays put however the text wraps. The
   triangle's weight sits low in its box, so it lifts by a hair to read as
   centred (--block-notice-glyph-lift, within the line's centre). The box is
   one icon wide whether or not the icon face has arrived. The text beside it
   then never moves when the face arrives (RULES §24.2). */
.block_notice_glyph {
  --block-notice-line: calc(var(--ui-font-size-body) * var(--ui-line-height-body));

  display: grid;
  width: var(--ui-icon-size-large);
  height: var(--block-notice-line);
  place-items: center;
  translate: 0 var(--block-notice-glyph-lift, 0);
}

.block_notice_glyph::before {
  color: var(--block-notice-colour);
  font-family: var(--ui-icon-font-family);
  font-size: var(--ui-icon-size-large);
  font-weight: var(--ui-icon-weight);
  line-height: 1;
  content: var(--block-notice-glyph) var(--ui-icon-alt,);
}

.block_notice[data-kind='warning'] {
  --block-notice-colour: var(--color-status-warning);
  --block-notice-background: var(--color-notice-warning-background);
  --block-notice-glyph: var(--ui-icon-triangle-exclamation);
  --block-notice-glyph-lift: calc(var(--ui-font-size-body) * -0.06);
}

.block_notice[data-kind='negative'] {
  --block-notice-colour: var(--color-status-negative);
  --block-notice-background: var(--color-notice-negative-background);
  --block-notice-glyph: var(--ui-icon-circle-exclamation);
}

.block_notice[data-kind='positive'] {
  --block-notice-colour: var(--color-status-positive);
  --block-notice-background: var(--color-notice-positive-background);
  --block-notice-glyph: var(--ui-icon-circle-check);
}

.block_notice_body {
  display: grid;
  gap: var(--ui-space-1);
  min-width: 0;
}

.block_notice_title {
  margin: 0;
  font-weight: var(--ui-weight-strong);
}

.block_notice_content > * {
  margin: 0;
}

.block_notice_content > * + * {
  margin-block-start: var(--ui-space-2);
}

.block_notice_content ul {
  padding-inline-start: var(--ui-space-4);
  list-style: disc;
}

/* Links in the message read as text links; action buttons keep their look. */
.block_notice_content a:is(:link, :visited) {
  color: inherit;
  text-decoration: underline;
}

.block_notice .block_actions {
  margin-block-start: var(--ui-space-2);
}

/* A failed load that is all its region shows (a lazy tab, a panel's
   content) is the region's own line, not a box on it. It has no tint or
   edge. The glyph has the state colour, and the title the region's text
   weight. A failure beside content that stays (after a list) keeps the box. */
.block_notice.fragment_failed:only-child {
  margin: 0;
  padding-inline: 0;
  background-color: transparent;
  border-inline-start: 0;
}

.block_notice.fragment_failed:only-child .block_notice_title {
  font-weight: var(--ui-weight-regular);
}

/* In an inspector panel it is the panel's content. It sits inside the
   panel's padding, in the panel's text size, with a normal-size glyph.
   Retry is the panel's footer action: secondary, at the trailing edge, at
   the footer's minimum width. */
.panel_content > * > .block_notice.fragment_failed:only-child {
  gap: var(--ui-space-2);
  padding: var(--ui-panel-padding);
  font-size: var(--ui-font-size-label);
}

.panel_content > * > .block_notice.fragment_failed:only-child .block_notice_glyph {
  --block-notice-line: calc(var(--ui-font-size-label) * var(--ui-line-height-body));

  width: var(--ui-icon-size);
}

.panel_content > * > .block_notice.fragment_failed:only-child .block_notice_glyph::before {
  font-size: var(--ui-icon-size);
}

.panel_content > * > .block_notice.fragment_failed:only-child .block_actions {
  justify-content: flex-end;
  margin-block-start: var(--ui-space-3);
}

.panel_content > * > .block_notice.fragment_failed:only-child .block_action {
  min-inline-size: min(var(--ui-panel-action-min-width), 100%);
}

/* A failed load that is all a dialog shows is the dialog's message, not a
   strip in a page. A box or a form that could not load shows it. It has no tint or
   edge. A large glyph in the state colour sits over a bold lead-size title,
   with Retry under it, all centred in the dialog. */
dialog .block_notice.fragment_failed:only-child {
  --block-notice-dialog-glyph: calc(var(--ui-icon-size-large) * 2);

  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: var(--ui-space-4);
  margin: 0;
  padding: var(--ui-space-8) var(--ui-space-6);
  text-align: center;
  background-color: transparent;
  border-inline-start: 0;
}

dialog .block_notice.fragment_failed:only-child .block_notice_glyph {
  width: var(--block-notice-dialog-glyph);
  height: var(--block-notice-dialog-glyph);
  translate: none;
}

dialog .block_notice.fragment_failed:only-child .block_notice_glyph::before {
  font-size: var(--block-notice-dialog-glyph);
}

dialog .block_notice.fragment_failed:only-child .block_notice_body {
  justify-items: center;
  gap: var(--ui-space-4);
}

dialog .block_notice.fragment_failed:only-child .block_notice_title {
  max-width: 40ch;
  font-size: var(--ui-font-size-lead);
  line-height: 1.4;
}

dialog .block_notice.fragment_failed:only-child .block_actions {
  justify-content: center;
  margin-block-start: 0;
}
