/* mail UI, layered on wired.css (shared tokens: --bg, --fg, --phosphor, --pink, --amber, fonts, panels, buttons).
   Mail is "transmissions on the NAVI": same theme as the other apps, its own accent (a cold signal blue instead
   of their phosphor green and pink), terminal log lines, a status bar.
   Readability first: mail text is plain monospace on an opaque panel; decoration lives around it, never over it.
   Everything that moves is behind html.fx (see js/fx.js): without that class all of it is in its final state. */

:root {
  /* contrast on --bg #050608: --signal 12.6:1, --signal-dim 3.3:1 (lines and borders only, never text) */
  --signal: #6fd8ff;
  /* Secondary text (dates, previews, labels, hints) is functional here, so the theme's dim grey is lifted
     from about 6.5:1 to 8.8:1. --fg-faint stays for pure decoration (brackets, rules). */
  --fg-dim: #a3aea6;
  --signal-dim: #2a6f8a;
  --signal-bg: #03090d;
  --glow-signal: 0 0 6px rgba(111, 216, 255, 0.4);
  --panel-solid: #07090c;
  --bar-h: 1.9rem;
}

[hidden] {
  display: none !important;
}

/* ---- layers: background and scanlines behind, content in front ---- */

body {
  padding-bottom: var(--bar-h); /* the fixed status bar */
  background-image: url("../wired/assets/fetched/tiles/grid.png");
}
.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bg) center / cover no-repeat;
}
/* login: the owner's Lain pictures, far behind a dark overlay (a still one when effects are off) */
body[data-view="login"] .backdrop,
body[data-view="boot"] .backdrop {
  display: block;
  background-image: url("../wired/assets/provided/banners_etc/preview4.jpg");
}
.fx body[data-view="login"] .backdrop,
.fx body[data-view="boot"] .backdrop {
  background-image: url("../wired/assets/derived/banners_etc/preview1.webp");
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(5, 6, 8, 0.8), rgba(5, 6, 8, 0.94));
}
/* the theme's scanline layer, moved behind the content: it shows on the background, not on text */
.crt--behind {
  z-index: 1;
}
body .bg-figure {
  display: none;
}
@media (min-width: 72rem) {
  body[data-view="login"] .bg-figure {
    display: block;
    left: 1rem;
    opacity: 0.22;
  }
}

/* ---- shared components in mail's accent ---- */

.panel {
  background: var(--panel-solid);
  border-color: var(--signal-dim);
}
.panel__title {
  color: var(--signal-dim);
}
.panel__heading {
  color: var(--signal);
}
.btn:not(.btn--ghost):not(.btn--danger):not(.btn--pink) {
  color: var(--signal);
  background: var(--signal-bg);
  border-color: var(--signal-dim);
}
.btn:not(.btn--ghost):not(.btn--danger):not(.btn--pink):hover {
  color: #021016;
  background: var(--signal);
  border-color: var(--signal);
}
.btn--ghost:hover {
  color: #021016;
  background: var(--signal);
  border-color: var(--signal);
}
.link-btn {
  color: var(--signal);
}
.prompt::before {
  color: var(--signal);
}
.input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--fg-dim);
}
/* field labels read like terminal prompts: "> to:" (they stay real <label>s) */
.field__label {
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 0.85rem;
}
.field__label::before {
  content: "> ";
  color: var(--signal);
}
.field__label::after {
  content: ":";
}
.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.field select,
.field textarea {
  caret-color: var(--signal);
}
.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 1px var(--signal);
}

/* ---- frame ---- */

.mail-header {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: #030506;
  border-bottom: 1px solid var(--signal-dim);
}
.mail-brand,
.mail-brand:visited {
  display: inline-flex;
  align-items: center;
  gap: 1ch;
  padding: 0.1rem 0.3rem;
  color: var(--signal);
  text-decoration: none;
}
.mail-brand:hover {
  color: #fff;
}
/* small envelope drawn with box characters (decoration; the link has a real label) */
.mail-brand__art {
  font: 0.55rem/1 "Wired Box", "DejaVu Sans Mono", monospace;
  color: var(--signal);
  opacity: 0.85;
}
.mail-brand__name {
  font: 400 1.9rem/1 var(--font-pixel);
  letter-spacing: 0.06em;
  text-shadow: var(--glow-signal);
}
.mail-brand__sub {
  font-size: 0.8rem;
  color: var(--fg-dim);
  white-space: nowrap;
}
.mail-header__boxes {
  display: none;
}
.mail-search {
  display: flex;
  flex: 1 1 14rem;
  gap: var(--space-2);
  align-items: stretch;
  max-width: 34rem;
  min-width: 0;
}
.mail-search .prompt {
  flex: 1;
  min-width: 0;
}
.mail-search .input {
  min-height: 1.9rem;
  padding-block: 0.15rem;
  min-width: 0;
}
.mail-search .input:focus {
  border-color: var(--signal);
  outline: none;
  box-shadow: 0 0 0 1px var(--signal);
}
.mail-header__user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  min-width: 0;
}
.mail-header__name {
  max-width: 26ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.mail-shell {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 16.5rem minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
  width: 100%;
  max-width: 92rem;
  margin-inline: auto;
  padding: var(--space-4) var(--space-4) 6rem; /* room to scroll the page end above a toast */
}
.mail-main {
  min-width: 0;
}
.mail-main:focus {
  outline: none;
}
/* headings that only receive focus from the script (view change): a quiet mark, not the full ring */
h1[tabindex="-1"]:focus-visible,
h2[tabindex="-1"]:focus-visible {
  outline: 1px dotted var(--border-strong);
  outline-offset: 3px;
}
body[data-view="login"] .mail-shell,
body[data-view="boot"] .mail-shell {
  grid-template-columns: minmax(0, 30rem);
  justify-content: center;
  padding-top: 5vh;
}

/* notices: in the page flow on the login view, pinned to the bottom otherwise */
.mail-notices {
  position: relative;
  z-index: 2;
  display: grid;
  gap: var(--space-2);
  width: min(100% - 2rem, 28rem);
  margin: var(--space-4) auto 0;
}
.mail-notices:empty {
  display: none;
}
body:not([data-view="login"]) .mail-notices {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(var(--bar-h) + var(--space-3)); /* above the status bar */
  transform: translateX(-50%);
  width: min(100% - 1rem, 36rem);
  margin: 0;
  /* toasts must never swallow a click meant for what is under them */
  pointer-events: none;
}
body:not([data-view="login"]) .mail-notice__close {
  pointer-events: auto;
}
.mail-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--bg-raised);
  color: var(--fg);
}
.mail-notice.notice--err {
  color: #ffd0d0;
}
.mail-notice__text {
  overflow-wrap: anywhere;
}
.mail-notice__action {
  flex: none;
  pointer-events: auto;
}
.mail-notice__close {
  flex: none;
  min-width: 1.75rem;
  min-height: 1.75rem;
  color: var(--fg-dim);
  text-decoration: none;
}

.mail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ---- sidebar: mailboxes with a flavour name and a signal meter ---- */

.mail-sidebar {
  min-width: 0;
}
.mail-sidebar__title {
  font: 700 0.8rem/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: none;
  color: var(--fg-dim);
  margin: 0 0 var(--space-2);
  padding-left: 0.6rem;
}
.mail-sidebar__title::before {
  content: "\2550\2550";
  margin-right: 1ch;
  color: var(--signal-dim);
}
.mailbox-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  border-top: 1px solid var(--border);
  background: var(--panel-solid);
}
.mailbox,
.mailbox:visited {
  display: flex;
  align-items: center;
  gap: 1ch;
  min-height: 2.5rem;
  padding: 0.35rem 0.6rem;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.mailbox:hover {
  color: var(--signal);
  background: var(--signal-bg);
}
.mailbox[aria-current="page"] {
  color: var(--signal);
  background: var(--signal-bg);
  border-left-color: var(--signal);
}
.mailbox:focus-visible,
.msg-row__link:focus-visible,
.msg-row__star:focus-visible {
  outline-offset: -2px;
}
/* real name first and never cut; the flavour name gives way */
.mailbox__label {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  min-width: 0;
}
.mailbox__name {
  flex: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mailbox__flavour {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
  color: var(--fg-dim);
  font-size: 0.8rem;
}
.mailbox--unread .mailbox__name {
  font-weight: 700;
}
/* signal meter: four bars, lit by unread count (1, 2-4, 5-9, 10+). The number itself stands next to it. */
.signal {
  display: inline-flex;
  flex: none;
  align-items: flex-end;
  gap: 2px;
  height: 0.95rem;
}
.signal__bar {
  width: 3px;
  background: var(--border-strong);
}
.signal__bar:nth-child(1) {
  height: 25%;
}
.signal__bar:nth-child(2) {
  height: 50%;
}
.signal__bar:nth-child(3) {
  height: 75%;
}
.signal__bar:nth-child(4) {
  height: 100%;
}
.signal[data-level="1"] .signal__bar:nth-child(-n + 1),
.signal[data-level="2"] .signal__bar:nth-child(-n + 2),
.signal[data-level="3"] .signal__bar:nth-child(-n + 3),
.signal[data-level="4"] .signal__bar {
  background: var(--signal);
}
.mailbox__count {
  flex: none;
  min-width: 2ch;
  text-align: right;
  color: var(--signal);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mail-decor {
  margin-top: var(--space-6);
}
.mail-decor .blinkie-strip,
.login-decor .blinkie-strip {
  padding-top: 0;
}
.mail-decor .button-wall,
.login-decor .button-wall {
  margin-top: var(--space-2);
}

/* ---- message list: a transmission log, one terminal line per message ---- */

/* summary on the left, whole-mailbox actions (mark all read, empty) on the right */
.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  padding: 0 var(--space-4) var(--space-2);
}
.list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
/* the head of a mailbox that is still loading sits inside the panel's own padding */
.list-head--loading {
  padding: 0;
}
.list-head--loading > p {
  margin: 0;
}
/* filter: all / filter: unread. Pressed = the unread-only list (signal colour, like the effects switch). */
.list-filter {
  margin-left: auto;
}
.list-filter[aria-pressed="true"]:not(:hover) {
  color: var(--signal);
  border-color: var(--signal);
}
.list-summary {
  margin: 0;
  font-size: 0.85rem;
}
.list-summary::before {
  content: "> ";
  color: var(--signal);
}
.empty-art {
  margin: var(--space-4) var(--space-4) var(--space-6);
  font: 0.8rem/1.1 "Wired Box", "DejaVu Sans Mono", monospace;
  color: var(--signal-dim);
}
.msg-list {
  list-style: none;
  margin: 0;
  padding: 0 1px;
  border-bottom: 1px solid var(--border);
}
.msg-list:empty {
  display: none;
}
.msg-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  border-top: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.msg-row:hover {
  background: var(--signal-bg);
}
.msg-row.is-cursor {
  background: #071219;
  border-left-color: var(--signal);
}
.msg-row__star {
  min-height: 2.1rem;
  padding: 0;
  background: none;
  border: 0;
  font: 1.05rem/1 var(--font-mono);
  color: var(--fg-dim);
  cursor: pointer;
}
.msg-row__star:hover {
  color: var(--amber);
}
.msg-row__star.is-on {
  color: var(--amber);
}
/* cursor [stamp] <sender> subject  preview  [att] */
.msg-row__link,
.msg-row__link:visited,
.msg-row__link:hover {
  display: grid;
  grid-template-columns: 1ch 13ch 20ch minmax(0, max-content) minmax(0, 1fr) auto;
  grid-template-areas: "marker date from subject preview att";
  column-gap: 1.25ch;
  align-items: baseline;
  padding: 0.4rem var(--space-3) 0.4rem 0;
  color: var(--fg);
  font-size: 0.92rem;
  text-decoration: none;
  min-width: 0;
}
/* unread: a block cursor at the start of the line (plus bold text and a hidden word for screen readers) */
.msg-row__marker {
  grid-area: marker;
  color: var(--signal);
  font-family: "Wired Box", "DejaVu Sans Mono", monospace;
}
.fx .msg-row.is-unread .msg-row__marker {
  animation: blink-hard 1.1s infinite steps(1);
}
.msg-row__date {
  grid-area: date;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.msg-row__date::before {
  content: "[";
  color: var(--fg-faint);
}
.msg-row__date::after {
  content: "]";
  color: var(--fg-faint);
}
.msg-row__from {
  grid-area: from;
}
.msg-row__from::before {
  content: "<";
  color: var(--fg-faint);
  font-weight: 400;
}
.msg-row__from::after {
  content: ">";
  color: var(--fg-faint);
  font-weight: 400;
}
.msg-row__subject {
  grid-area: subject;
}
.msg-row__preview {
  grid-area: preview;
  color: var(--fg-dim);
  font-size: 0.85rem;
}
.msg-row__att {
  grid-area: att;
  color: var(--amber);
  font-size: 0.8rem;
}
.msg-row__from,
.msg-row__subject,
.msg-row__preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-row.is-unread .msg-row__from,
.msg-row.is-unread .msg-row__subject {
  font-weight: 700;
  color: #f2f7ee;
}
.msg-row.is-unread .msg-row__date {
  color: var(--fg);
}
.mail-pager {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
}

/* ---- message ---- */

.msg-panel,
.compose-panel {
  max-width: 100ch;
}
.msg-toolbar {
  margin-bottom: var(--space-3);
}
/* newer · 3 of 63 · older */
.msg-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  font-size: 0.85rem;
  color: var(--fg-dim);
}
.msg-nav__place {
  font-variant-numeric: tabular-nums;
}
.meta__copy {
  justify-self: start;
  font-size: 0.8rem;
}
/* wide screens: no [ more ]; its group is part of the bar */
.msg-toolbar__more {
  display: none;
}
.msg-toolbar__rest {
  display: contents;
}
.msg-toolbar__move {
  flex: 0 1 12rem;
}
.msg-toolbar__move select {
  min-height: 1.9rem;
  padding-block: 0.1rem;
  font-size: 0.85rem;
}
.msg-subject {
  font: 700 1.3rem/1.35 var(--font-mono);
  letter-spacing: 0;
  color: #f2f7ee;
  text-shadow: none;
  margin: 0 0 var(--space-3);
  overflow-wrap: anywhere;
}
.meta {
  margin: 0 0 var(--space-4);
  padding: var(--space-2) 0;
  border-block: 1px dashed var(--border-strong);
  font-size: 0.9rem;
}
.meta__row {
  display: grid;
  grid-template-columns: 13ch minmax(0, auto) minmax(0, 1fr);
  column-gap: 1ch;
}
.meta dt {
  color: var(--fg-dim);
}
.meta dt::after {
  content: ":";
}
.meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.msg-note {
  max-width: 90ch;
  margin: 0 0 var(--space-2);
  padding: 0.3rem 0.75rem;
  border-left: 3px solid var(--border-strong);
  color: var(--fg-dim);
  font-size: 0.9rem;
}
.msg-note--warn {
  border-left-color: var(--amber);
  color: var(--fg);
}
/* where a tracker picture would have been */
.withheld {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5ch;
  max-width: calc(90ch + 2 * var(--space-4) + 2px);
  margin: var(--space-2) 0;
  padding: 0.5rem 0.75rem;
  border: 1px dashed #6b5520;
  background: #0b0903;
  color: var(--fg);
  font-size: 0.9rem;
}
.withheld::before {
  content: "";
  flex: none;
  width: 3.25rem;
  height: 2rem;
  border: 1px solid #6b5520;
  background: #000 url("../wired/assets/fetched/tiles/dither.png");
}
.withheld__tag {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.03em;
}
/* one status line above the text; its height never changes, so nothing moves when the reveal ends */
.rx-line {
  max-width: calc(90ch + 2 * var(--space-4) + 2px);
  height: 1.5rem;
  margin: var(--space-3) 0 0;
  overflow: hidden;
  color: var(--signal);
  font-size: 0.85rem;
  line-height: 1.5rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rx-line + .msg-body {
  margin-top: var(--space-1);
}
/* The message itself: plain monospace on a calm, opaque panel. No glow, no scanlines, ever. */
.msg-body {
  /* 90 characters of text plus the padding and border */
  max-width: calc(90ch + 2 * var(--space-4) + 2px);
  margin: var(--space-3) 0 0;
  padding: var(--space-4);
  background: #020304;
  border: 1px solid var(--border);
  color: #e4eadf;
  text-shadow: none;
  font: 1rem/1.6 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  tab-size: 4;
}
.attachments {
  max-width: 90ch;
  margin-top: var(--space-4);
}
.attachments__title {
  font: 700 0.85rem/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: none;
  color: var(--fg-dim);
  margin: 0;
}
.attachments__hint {
  font-size: 0.8rem;
  margin: 0 0 var(--space-2);
}
.attachments__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.attachment {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 1.5ch;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.attachment__link {
  min-height: 1.75rem;
  text-align: left;
  overflow-wrap: anywhere;
}
.attachment__link::before {
  content: "\2193\00a0";
  text-decoration: none;
  display: inline-block;
}
.attachment__link[aria-busy="true"] {
  opacity: 0.6;
  cursor: progress;
}
.attachment__info {
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

/* ---- compose / login ---- */

.compose-from,
.login-hint {
  margin-bottom: 0;
  font-size: 0.85rem;
}
.compose-form .compose-text {
  min-height: 45vh;
  font: 1rem/1.55 var(--font-mono);
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.login-error {
  margin: 0;
}
/* "caps lock is on": the line is always there, empty or not, so the form never jumps */
.caps-hint {
  display: block;
  min-height: 1.5em;
  line-height: 1.5;
  color: var(--amber);
  overflow-wrap: anywhere;
}
.field__error[role="alert"] {
  margin: 0;
  overflow-wrap: anywhere;
}

.draft-state {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--fg-dim);
  overflow-wrap: anywhere;
}
.draft-state[data-state="saved"] {
  color: var(--phosphor);
}
.draft-state[data-state="unsaved"] {
  color: var(--amber);
}
.draft-state[data-state="error"] {
  color: var(--red);
  font-weight: 700;
}
.draft-state[data-state="saved"]::before {
  content: "\2713\00a0";
}
.draft-state[data-state="unsaved"]::before,
.draft-state[data-state="error"]::before {
  content: "!\00a0";
}

/* recipient suggestions: a listbox right under its field */
.ac-box {
  position: relative;
}
.ac {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 16rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--signal-dim);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.6);
}
.ac__option {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 1.5ch;
  min-height: 2.25rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.ac__option + .ac__option {
  border-top: 1px solid var(--border);
}
.ac__option[aria-selected="true"] {
  background: #0d1512;
  border-left-color: var(--signal);
}
.ac__option:hover {
  background: #0d1512;
}
.ac__email {
  color: var(--fg);
}
.ac__option[aria-selected="true"] .ac__email {
  color: var(--signal);
}
.ac__name {
  color: var(--fg-dim);
  font-size: 0.85rem;
}

/* ---- dialogs ---- */

.mail-dialog {
  width: min(100% - 2rem, 34rem);
  max-height: calc(100dvh - 2rem);
  padding: var(--space-4);
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  overflow: auto;
}
.mail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}
.mail-dialog__title {
  font: 700 0.95rem/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: none;
  color: var(--signal);
}
.keys {
  margin: 0 0 var(--space-4);
}
.keys > div {
  display: grid;
  grid-template-columns: 16ch minmax(0, 1fr);
  column-gap: 1ch;
  padding: 0.15rem 0;
}
.keys dd {
  margin: 0;
}
.keys kbd {
  padding: 0 0.5ch;
  border: 1px solid var(--border-strong);
  color: var(--signal);
  background: var(--bg-input);
}

/* ---- "receiving transmission": line by line, about 300 ms, effects only ---- */

.fx .msg-body.is-revealing .ln {
  animation: rx-line 110ms linear both;
}
.fx .msg-body.is-revealing .d1 {
  animation-delay: 10ms;
}
.fx .msg-body.is-revealing .d2 {
  animation-delay: 20ms;
}
.fx .msg-body.is-revealing .d3 {
  animation-delay: 30ms;
}
.fx .msg-body.is-revealing .d4 {
  animation-delay: 40ms;
}
.fx .msg-body.is-revealing .d5 {
  animation-delay: 50ms;
}
.fx .msg-body.is-revealing .d6 {
  animation-delay: 60ms;
}
.fx .msg-body.is-revealing .d7 {
  animation-delay: 70ms;
}
.fx .msg-body.is-revealing .d8 {
  animation-delay: 80ms;
}
.fx .msg-body.is-revealing .d9 {
  animation-delay: 90ms;
}
.fx .msg-body.is-revealing .d10 {
  animation-delay: 100ms;
}
.fx .msg-body.is-revealing .d11 {
  animation-delay: 110ms;
}
.fx .msg-body.is-revealing .d12 {
  animation-delay: 120ms;
}
.fx .msg-body.is-revealing .d13 {
  animation-delay: 130ms;
}
.fx .msg-body.is-revealing .d14 {
  animation-delay: 140ms;
}
.fx .msg-body.is-revealing .d15 {
  animation-delay: 150ms;
}
.fx .msg-body.is-revealing .d16 {
  animation-delay: 160ms;
}
.fx .msg-body.is-revealing .d17 {
  animation-delay: 170ms;
}
.fx .msg-body.is-revealing .d18 {
  animation-delay: 180ms;
}
.fx .msg-body.is-revealing .d19 {
  animation-delay: 190ms;
}
@keyframes rx-line {
  from {
    opacity: 0;
  }
  50% {
    opacity: 1;
    color: var(--signal);
  }
  to {
    opacity: 1;
  }
}

/* ---- transmit: a packet on the wire (status bar, and under the buttons while a send is in flight) ---- */

.wire {
  display: inline-flex;
  align-items: center;
  gap: 1ch;
  color: var(--signal);
  font-size: 0.8rem;
  white-space: nowrap;
}
.wire__line {
  position: relative;
  flex: 1 1 auto;
  width: 14ch;
  min-width: 8ch;
  height: 1em;
  background: linear-gradient(var(--signal-dim), var(--signal-dim)) 0 50% / 100% 1px no-repeat;
}
.wire__packet {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.8ch;
  height: 0.8ch;
  margin-top: -0.4ch;
  background: var(--signal);
  box-shadow: var(--glow-signal);
}
.fx .wire.is-live .wire__packet {
  animation: wire-run 600ms linear both;
}
.compose-wire {
  display: none;
}
.fx .compose-form[aria-busy="true"] .compose-wire {
  display: flex;
  max-width: 28rem;
}
.fx .compose-form[aria-busy="true"] .compose-wire .wire__packet {
  animation: wire-run 600ms linear infinite;
}
@keyframes wire-run {
  from {
    left: 0;
  }
  to {
    left: calc(100% - 0.8ch);
  }
}

/* ---- login: NAVI boot ---- */

.boot {
  margin-bottom: var(--space-4);
  color: var(--fg-dim);
  font-size: 0.85rem;
}
.boot__banner {
  margin: 0 0 var(--space-3);
  color: var(--signal);
  text-shadow: var(--glow-signal);
  font-size: clamp(0.45rem, 1.6vw, 0.7rem);
}
.boot__log {
  list-style: none;
  margin: 0;
  padding: 0;
}
.boot__line {
  display: flex;
  align-items: baseline;
  gap: 1ch;
}
.boot__dots {
  flex: 1;
  min-width: 2ch;
  border-bottom: 1px dotted var(--fg-faint);
}
.boot__state {
  color: var(--phosphor);
}
.boot__connect {
  margin-top: var(--space-2);
  font: 400 1.5rem/1.2 var(--font-pixel);
  letter-spacing: 0.08em;
  color: var(--signal);
}
.boot__connect::after {
  content: "_";
}
.fx .boot__line {
  animation: boot-in 120ms steps(1) both;
}
.fx .boot__line.d1 {
  animation-delay: 140ms;
}
.fx .boot__line.d2 {
  animation-delay: 280ms;
}
.fx .boot__line.d3 {
  animation-delay: 420ms;
}
.fx .boot__line.d4 {
  animation-delay: 560ms;
}
.fx .boot__connect::after {
  animation: blink-hard 1s infinite steps(1);
}
@keyframes boot-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.login-decor {
  margin-top: var(--space-4);
}

/* ---- status bar: a terminal's last line ---- */

.statusbar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 2ch;
  height: var(--bar-h);
  padding: 0 var(--space-4);
  background: #020405;
  border-top: 1px solid var(--signal-dim);
  color: var(--fg-dim);
  font-size: 0.8rem;
  white-space: nowrap;
}
/* hints that do not fit wrap to a second line, which is cut off: the bar never grows or scrolls sideways */
.statusbar__keys {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 0 1.75ch;
  min-width: 0;
  height: 1.5em;
  line-height: 1.5;
  overflow: hidden;
}
.statusbar__key {
  flex: none;
}
.statusbar kbd {
  color: var(--signal);
  font-weight: 700;
}
.statusbar__wire,
.statusbar__link,
.statusbar .fx-toggle {
  flex: none;
}
.statusbar__link {
  font-size: 0.8rem;
  margin-left: auto;
}
.statusbar .fx-toggle {
  color: var(--signal);
  text-decoration: none;
}
.statusbar .fx-toggle[aria-pressed="false"] {
  color: var(--fg-dim);
}

/* ---- phone width: one column, big touch targets ---- */

@media (max-width: 47.99rem) {
  .mail-header {
    gap: var(--space-2) 0.4rem;
    padding: var(--space-2);
  }
  .mail-header__boxes {
    display: inline-flex;
  }
  .mail-header__name,
  #help-button {
    display: none;
  }
  .mail-search {
    order: 10;
    flex: 1 0 100%;
    max-width: none;
  }
  .mail-header .btn--sm,
  .mail-search .input {
    min-height: 2.75rem;
  }
  .mail-header .btn--sm {
    letter-spacing: 0;
    padding-inline: 0.3rem;
    gap: 0.25ch;
  }
  .mail-brand,
  .mail-brand:visited {
    padding-inline: 0.15rem;
  }
  .mail-brand__name {
    font-size: 1.7rem;
    letter-spacing: 0.03em;
  }
  .mail-brand__art,
  .mail-brand__sub {
    display: none;
  }
  .mail-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--space-2) var(--space-2) var(--space-6);
    gap: var(--space-2);
  }
  body[data-view="login"] .mail-shell,
  body[data-view="boot"] .mail-shell {
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--space-6);
  }
  body:not([data-view="boxes"]) .mail-sidebar,
  body[data-view="boxes"] .mail-main {
    display: none;
  }
  .mailbox,
  .mailbox:visited {
    min-height: 3rem;
    font-size: 1rem;
  }
  .panel {
    padding-inline: var(--space-3);
  }
  .panel__title {
    margin-inline: calc(-1 * var(--space-3));
  }
  .panel--flush {
    padding-inline: 0;
  }
  .panel--flush .panel__title {
    margin-inline: 0;
  }
  .list-head,
  .mail-pager {
    padding-inline: var(--space-3);
  }
  /* the summary takes the first line; the filter switch and the mailbox actions start the next one */
  .list-head:not(.list-head--loading) .list-summary {
    flex: 1 0 100%;
  }
  .list-filter {
    margin-left: 0;
  }
  .meta__copy {
    min-height: 2.75rem;
  }
  .msg-row__link,
  .msg-row__link:visited,
  .msg-row__link:hover {
    grid-template-columns: 1ch 13ch minmax(0, 1fr) auto;
    grid-template-areas:
      "marker date    from    att"
      ".      subject subject subject"
      ".      preview preview preview";
    column-gap: 1ch;
    padding-block: 0.6rem;
  }
  .msg-row__star {
    min-height: 3rem;
  }
  .mail-main .btn--sm,
  .mail-sidebar .btn--sm,
  .mail-dialog .btn--sm {
    min-height: 2.75rem;
    padding-inline: 0.7rem;
  }
  /* message toolbar: back, archive, delete, reply on one line; the rest is a menu under [ more ] */
  .msg-toolbar {
    position: relative;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }
  .msg-toolbar > .btn--sm {
    flex: 0 1 auto;
    min-width: 0;
    letter-spacing: 0;
    padding-inline: 0.3rem;
    gap: 0.25ch;
  }
  .msg-toolbar .msg-toolbar__more {
    display: inline-flex;
    margin-left: auto;
  }
  .msg-toolbar[data-open="true"] .msg-toolbar__more:not(:hover) {
    color: var(--signal);
    border-color: var(--signal);
  }
  .msg-toolbar__rest {
    display: none;
  }
  .msg-toolbar[data-open="true"] .msg-toolbar__rest {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    position: absolute;
    z-index: 30;
    top: calc(100% + 0.35rem);
    right: 0;
    width: min(100%, 16rem);
    padding: var(--space-2);
    background: var(--bg-raised);
    border: 1px solid var(--signal-dim);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.7);
  }
  .msg-toolbar__rest .btn--sm {
    justify-content: flex-start;
  }
  .msg-toolbar__move {
    flex: 0 0 auto;
  }
  .msg-toolbar__move select {
    min-height: 2.75rem;
  }
  .meta__row {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.15rem 0;
  }
  .msg-body {
    padding: var(--space-3);
    font-size: 0.95rem;
  }
  .attachment__link {
    min-height: 2.75rem;
  }
  .ac__option {
    min-height: 2.75rem;
    padding-block: 0.55rem;
  }
  .draft-state {
    flex: 1 0 100%;
    margin-left: 0;
  }
  .keys > div {
    grid-template-columns: 12ch minmax(0, 1fr);
  }
  /* status bar: one short line at the END of the page (not fixed), so it can never cover a row or the
     transmit button. Touch users need no shortcut hints. */
  body {
    padding-bottom: 0;
  }
  .statusbar {
    position: relative;
    height: auto;
    min-height: 2.75rem;
    padding: 0 var(--space-2);
    justify-content: space-between;
  }
  .statusbar__keys,
  .fx .compose-form[aria-busy="true"] .compose-wire {
    display: none;
  }
  /* the packet on the wire: a small plate over the page for its 600 ms (it takes no clicks) */
  .statusbar__wire {
    position: fixed;
    z-index: 45;
    left: 50%;
    bottom: var(--space-3);
    transform: translateX(-50%);
    padding: 0.35rem 0.75rem;
    background: #020405;
    border: 1px solid var(--signal-dim);
    pointer-events: none;
  }
  .statusbar .fx-toggle {
    min-height: 2.75rem;
  }
  body:not([data-view="login"]) .mail-notices {
    bottom: var(--space-3);
  }
  .boot__banner {
    font-size: 0.5rem;
  }
  .mail-decor {
    margin-top: var(--space-4);
  }
}

html:not(.fx) * {
  scroll-behavior: auto !important;
  transition: none !important;
}
