/*
 * apex-notices.css — the bell in the signed-in line, and its panel.
 *
 * Design: docs/info/universe-add-verse-design.md §8.9. Rendered entirely by
 * assets/apex-notices.js; NONE of these class names appears in any HTML file,
 * because a signed-out visitor's page carries no bell at all.
 *
 * ⚠️ WHY THIS IS A FILE AND NOT A BLOCK IN index.html, which is what the
 * neighbouring "+" (apex-request-catalog.js) does. That module runs on ONE
 * page, so its styles live in that page's own <style>. This one runs on TWO
 * (/ and /universes/) and is meant to run on any page that embeds
 * <estate-search> — and two copies of a stylesheet is two copies that drift,
 * with the drifted one always the page somebody is looking at. The estate
 * already has this shape: assets/status-shell.css is the shared chrome for the
 * five /status pages.
 *
 * ⚠️ THE BELL IS SLOTTED INTO ANOTHER ELEMENT'S SHADOW DOM. It is a light-DOM
 * child of <estate-search> carrying slot="who-extra", so it is styled from
 * HERE (a document stylesheet styles its own slotted elements) while sitting
 * visually inside `.es-who`. It inherits that line's font-size and muted
 * colour by design — the bell belongs to the sentence, not beside it.
 *
 * Colours are --et-* tokens only (assets/estate-theme.css), so every theme in
 * the cog gets this for free and none of them needs an entry here.
 */

/* ---- the bell, in the who line -------------------------------------------- */

.nx-slot {
  display: inline-flex;
  align-items: center;
  margin-inline-start: .45rem;
  vertical-align: middle;
}

.nx-bell {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  padding: .1rem .35rem;
  border: 1px solid transparent;
  border-radius: var(--et-radius-pill, 999px);
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.nx-bell:hover {
  border-color: var(--et-hairline);
  background: color-mix(in srgb, var(--et-fg) 6%, transparent);
  color: var(--et-fg);
}

.nx-bell:focus-visible {
  outline: 2px solid var(--et-accent);
  outline-offset: 2px;
}

/* Unread earns the accent; read is the muted line's own colour. */
.nx-bell.has-unread { color: var(--et-accent); }

.nx-badge {
  min-width: 1.15rem;
  padding: 0 .28rem;
  border-radius: var(--et-radius-pill, 999px);
  background: var(--et-accent);
  color: var(--et-bg);
  font-size: .6875rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

/* ---- the panel ------------------------------------------------------------ */

.nx-dialog {
  width: min(32rem, calc(100vw - 2rem));
  max-height: min(85vh, 44rem);
  padding: 0;
  border: var(--et-border-w, 1px) solid var(--et-panel-border, var(--et-hairline));
  border-radius: var(--et-radius-xl, 18px);
  background: var(--et-surface, var(--et-bg));
  color: var(--et-fg);
  box-shadow: var(--et-shadow-lift, var(--et-shadow));
}
.nx-dialog::backdrop { background: rgba(0, 0, 0, .55); }

.nx-panel {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: 1.2rem 1.2rem 1.1rem;
  font-size: 1rem;
}

.nx-head { display: flex; align-items: flex-start; gap: 1rem; }
.nx-title {
  flex: 1;
  margin: 0;
  font-family: var(--et-font-display, inherit);
  font-size: var(--et-text-title, 1.25rem);
}
.nx-x {
  flex: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--et-hairline);
  border-radius: 999px;
  background: none;
  color: var(--et-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.nx-x:hover { color: var(--et-fg); }
.nx-x:focus-visible { outline: 2px solid var(--et-accent); outline-offset: 2px; }

.nx-empty { margin: 0; color: var(--et-muted); text-wrap: pretty; }

/* ---- one notice ----------------------------------------------------------- */

.nx-list {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  max-height: 55vh;
  overflow-y: auto;
}

.nx-item {
  padding: .75rem .2rem .8rem;
  border-top: 1px solid var(--et-hairline);
}
.nx-item:first-child { border-top: 0; }

.nx-item-head { display: flex; align-items: baseline; gap: .6rem; }

.nx-subject {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  text-wrap: pretty;
}

/*
 * ⚠️ UNREAD IS NOT CARRIED BY COLOUR ALONE — a dot AND a heavier subject, so it
 * survives a colour-blind reader and a monochrome print.
 */
.nx-unread .nx-subject { font-weight: 800; }
.nx-unread .nx-subject::before {
  content: "";
  display: inline-block;
  width: .45rem;
  height: .45rem;
  margin-inline-end: .4rem;
  border-radius: 999px;
  background: var(--et-accent);
  vertical-align: middle;
}

.nx-when {
  flex: none;
  color: var(--et-muted);
  font-size: var(--et-text-small, .875rem);
  white-space: nowrap;
}

/*
 * `pre-line` because the Worker composes its paragraphs with "\n\n" and this
 * page renders those words VERBATIM (§8.9.3) — collapsing them would be the
 * page editing a sentence it does not own.
 */
.nx-body {
  margin: .4rem 0 0;
  color: var(--et-fg);
  font-size: var(--et-text-small, .875rem);
  white-space: pre-line;
  text-wrap: pretty;
}

.nx-actions {
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}

.nx-link {
  color: var(--et-accent);
  font-size: var(--et-text-small, .875rem);
  text-underline-offset: 3px;
}

.nx-read,
.nx-readall {
  padding: .1rem .2rem;
  border: 0;
  background: none;
  color: var(--et-muted);
  font: inherit;
  font-size: var(--et-text-small, .875rem);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.nx-read:hover,
.nx-readall:hover { color: var(--et-fg); }
.nx-read:focus-visible,
.nx-readall:focus-visible { outline: 2px solid var(--et-accent); outline-offset: 2px; border-radius: 4px; }
.nx-read[disabled],
.nx-readall[disabled] { opacity: .55; cursor: default; }

/* ---- the foot: mark-all, and the switches --------------------------------- */

.nx-foot {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding-top: .7rem;
  border-top: 1px solid var(--et-hairline);
}

.nx-readall-wrap { display: flex; justify-content: flex-end; }

.nx-prefs { display: flex; flex-direction: column; gap: .5rem; }

.nx-pref { display: flex; align-items: flex-start; gap: .55rem; cursor: pointer; }
.nx-pref input { margin-top: .2rem; flex: none; }
.nx-pref-text { display: flex; flex-direction: column; gap: .1rem; }
.nx-pref-label { font-size: var(--et-text-small, .875rem); font-weight: 600; }
.nx-pref-detail { color: var(--et-muted); font-size: .8125rem; text-wrap: pretty; }

/* Every refusal this panel speaks uses one class, so none of them can be missed. */
.nx-note {
  margin: .3rem 0 0;
  color: var(--et-muted);
  font-size: .8125rem;
  text-wrap: pretty;
}
.nx-honesty { margin-top: .15rem; }

@media (prefers-reduced-motion: reduce) {
  .nx-bell { transition: none; }
}
