/* ============================================================
   transmissions — the wire (view styles)
   Threads list + chat line. Layers on base.css; tokens only.
   Mobile-first, safe-area aware, desktop refinements at 720px.
   ============================================================ */

/* ---------------------------------------------------------- */
/* 1 · Threads (#/wire)                                        */
/* ---------------------------------------------------------- */

.wire-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  max-width: 640px;
  margin-inline: auto;
}

.wire-head {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-1) 0;
}

.wire-head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wire-sub {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

.wire-newline {
  flex: none;
}

.wire-rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* one thread row: a peer mini-card on the board */
.wire-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-l);
  background: var(--pane-soft);
  border: var(--glass-border);
  -webkit-backdrop-filter: blur(var(--glass-blur-soft));
  backdrop-filter: blur(var(--glass-blur-soft));
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-med) var(--ease-glide), box-shadow var(--t-med) var(--ease-out);
}

.wire-row:hover {
  background: rgba(26, 26, 34, 0.78);
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.wire-row:active {
  transform: scale(0.97);
}

.wire-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wire-row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: var(--tracking-title);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wire-row-name .onair-dot {
  flex: none;
  width: 7px;
  height: 7px;
}

.wire-row-preview {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: var(--fs-small);
  color: var(--fg-dim);
  line-height: 1.4;
}

.wire-preview-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* tiny mono tag for gif / prop / buzz previews */
.wire-kindtag {
  flex: none;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent-28);
  background: var(--accent-06);
  color: var(--accent-70);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.5;
}

.wire-row-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.wire-row-time {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--fg-faint);
}

.wire-unread {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 12px rgba(196, 181, 253, 0.5);
  animation: badge-in 0.35s var(--ease-glide) backwards;
}

.wire-row.is-unread {
  border-color: var(--accent-28);
}

.wire-row.is-unread .wire-row-name {
  font-weight: 700;
}

.wire-row.is-unread .wire-row-preview {
  color: var(--fg-muted);
}

.wire-row.is-unread .wire-row-time {
  color: var(--accent-70);
}

/* threads skeleton */
.wire-skel-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-l);
  background: var(--pane-soft);
  border: var(--glass-border);
}

.wire-skel-main {
  flex: 1;
  min-width: 0;
}

/* ---------------------------------------------------------- */
/* 2 · The line (#/wire/:handle) — column shell                */
/* ---------------------------------------------------------- */

/* fills the stage exactly: viewport minus the shell's paddings */
.wire-chat {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin-inline: auto;
  height: calc(
    100dvh - var(--topbar-h) - var(--safe-top) - var(--s-4) - var(--dock-h) -
      var(--dock-gap) - var(--safe-bottom) - var(--s-7)
  );
  min-height: 340px;
}

.wire-chat.is-dead .empty {
  margin: auto;
}

/* ---------------------------------------------------------- */
/* 3 · Chat header                                             */
/* ---------------------------------------------------------- */

.wire-chat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: 8px 10px;
  border-radius: var(--r-l);
  margin-bottom: var(--s-2);
}

.wire-back {
  flex: none;
}

.wire-peer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-m);
  transition: background var(--t-fast) var(--ease-out);
}

.wire-peer:hover {
  background: rgba(245, 245, 247, 0.05);
}

.wire-peer:active {
  transform: scale(0.97);
}

.wire-peer-id {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wire-peer-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: var(--tracking-title);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wire-peer-name .onair-dot {
  flex: none;
  width: 7px;
  height: 7px;
}

.wire-peer-handle {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the intercom button */
.wire-buzz-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-06);
  border: 1px solid var(--accent-45);
  color: var(--accent);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.wire-buzz-btn svg {
  width: 15px;
  height: 15px;
}

.wire-buzz-btn:hover {
  background: var(--accent-10);
  border-color: var(--accent-70);
  box-shadow: var(--glow-accent);
}

.wire-buzz-btn:active {
  transform: scale(0.92);
}

.wire-buzz-btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------------------------------------------------------- */
/* 4 · Messages                                                */
/* ---------------------------------------------------------- */

.wire-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--s-2) var(--s-1) var(--s-4);
}

/* day separator */
.wire-day {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

.wire-day:first-child {
  margin-top: 0;
}

.wire-day::before,
.wire-day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* one message row */
.wire-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.wire-msg.is-followup {
  margin-top: 4px;
}

.wire-msg.is-mine {
  justify-content: flex-end;
}

.wire-msg-av {
  flex: none;
  width: 28px;
}

.wire-msg-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: min(78%, 420px);
}

.wire-msg.is-mine .wire-msg-col {
  align-items: flex-end;
}

/* the glass bubble */
.wire-bubble {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-l);
  background: var(--pane-soft);
  border: var(--glass-border);
  -webkit-backdrop-filter: blur(var(--glass-blur-soft));
  backdrop-filter: blur(var(--glass-blur-soft));
  font-size: var(--fs-body);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wire-msg.is-mine .wire-bubble {
  background: linear-gradient(
    180deg,
    rgba(196, 181, 253, 0.2),
    rgba(196, 181, 253, 0.12)
  );
  border-color: var(--accent-28);
}

/* group tail gets the tucked corner */
.wire-msg.is-tail.is-theirs .wire-bubble {
  border-bottom-left-radius: 6px;
}

.wire-msg.is-tail.is-mine .wire-bubble {
  border-bottom-right-radius: 6px;
}

/* gif bubble */
.wire-bubble-gif {
  padding: 4px;
}

.wire-bubble-gif img {
  display: block;
  width: min(70vw, 280px);
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--r-m);
  background: rgba(245, 245, 247, 0.04);
}

.wire-bubble-gif.is-dead {
  padding: 10px 14px;
  font-size: var(--fs-small);
  color: var(--fg-dim);
}

/* prop bubble: the prop is the message */
.wire-bubble-prop {
  padding: 2px;
  background: transparent;
  border-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.wire-bubble-prop img {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}

/* mono timestamp under the tail of a group */
.wire-meta {
  display: none;
  margin-top: 4px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--fg-faint);
}

.wire-msg.is-tail .wire-meta {
  display: block;
}

/* buzz system chip */
.wire-sys {
  display: flex;
  justify-content: center;
  margin-top: var(--s-4);
}

.wire-sys-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-06);
  border: 1px solid var(--accent-28);
  color: var(--accent);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.3;
}

.wire-sys-star {
  flex: none;
  width: 9px;
  height: 13px;
  filter: drop-shadow(0 0 6px rgba(196, 181, 253, 0.5));
}

.wire-sys-time {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--accent-70);
}

/* jump-to-new pill */
.wire-jump {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 86px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1;
  box-shadow: var(--glow-accent), 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: rise 0.35s var(--ease-glide) backwards;
  transition: background var(--t-fast) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out);
}

.wire-jump::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
}

.wire-jump:hover {
  background: var(--accent-strong);
  box-shadow: var(--glow-accent-strong), 0 8px 24px rgba(0, 0, 0, 0.5);
}

.wire-jump:active {
  transform: translateX(-50%) scale(0.94);
}

/* chat skeleton bubbles */
.wire-skel-bub {
  height: 44px;
  width: 55%;
  border-radius: var(--r-l);
  margin-top: 14px;
}

.wire-skel-bub.is-short {
  width: 38%;
}

.wire-skel-bub.is-r {
  margin-left: auto;
}

/* the line's empty state sits mid-scroll */
.wire-line-empty {
  padding-top: var(--s-10);
}

/* ---------------------------------------------------------- */
/* 5 · Composer                                                */
/* ---------------------------------------------------------- */

.wire-compose {
  position: relative;
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  padding: 8px;
  margin-top: var(--s-3);
  border-radius: var(--r-xl);
  transition: border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out);
}

/* the textarea carries no ring of its own; the pane lights up instead */
.wire-compose:focus-within {
  border-color: var(--accent-45);
  box-shadow: var(--glass-shadow-soft), 0 0 0 3px var(--accent-16);
}

.wire-compose .wire-plus {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
}

.wire-compose .wire-plus[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

.wire-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 120px;
  padding: 9px 6px;
  border: 0;
  background: transparent;
  resize: none;
  font-size: 16px; /* stops iOS zoom-on-focus */
  line-height: 1.45;
  color: var(--fg);
  caret-color: var(--accent);
  overflow-y: auto;
}

.wire-input::placeholder {
  color: var(--fg-faint);
}

.wire-input:focus,
.wire-input:focus-visible {
  outline: none;
}

.wire-input[disabled] {
  opacity: 0.5;
}

.wire-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--glow-accent);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out), transform var(--t-fast) var(--ease-out),
    opacity var(--t-fast) var(--ease-out);
}

.wire-send svg {
  width: 18px;
  height: 18px;
}

.wire-send:hover {
  background: var(--accent-strong);
  box-shadow: var(--glow-accent-strong);
}

.wire-send:active {
  transform: scale(0.88);
}

.wire-send[disabled] {
  opacity: 0.35;
  box-shadow: none;
  pointer-events: none;
}

/* characters-left counter, near the cap only */
.wire-count {
  position: absolute;
  top: -22px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--fg-dim);
}

/* ---------------------------------------------------------- */
/* 6 · Picker sheet (props + gif)                              */
/* ---------------------------------------------------------- */

.wire-tabs {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.wire-tab {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  background: rgba(245, 245, 247, 0.06);
  border: 1px solid var(--hairline);
  color: var(--fg-muted);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1;
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}

.wire-tab:hover {
  background: rgba(245, 245, 247, 0.1);
  color: var(--fg);
}

.wire-tab:active {
  transform: scale(0.95);
}

.wire-tab.is-active {
  background: var(--accent-16);
  border-color: var(--accent-45);
  color: var(--accent);
}

.wire-props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: var(--s-3);
  padding-bottom: var(--s-2);
}

.wire-prop {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 8px;
  border-radius: var(--r-l);
  background: rgba(245, 245, 247, 0.04);
  border: 1px solid var(--hairline);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-med) var(--ease-glide), box-shadow var(--t-med) var(--ease-out);
}

.wire-prop img {
  width: 100%;
  max-width: 64px;
  height: auto;
}

.wire-prop:hover {
  background: var(--accent-06);
  border-color: var(--accent-45);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.wire-prop:active {
  transform: scale(0.9);
}

.wire-gif-pane {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-bottom: var(--s-2);
}

.wire-gif-state {
  min-height: 1.4em;
}

.wire-gif-preview {
  display: grid;
  place-items: center;
  min-height: 120px;
  border-radius: var(--r-l);
  overflow: hidden;
  background: rgba(245, 245, 247, 0.04);
  border: 1px solid var(--hairline);
}

.wire-gif-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

/* ---------------------------------------------------------- */
/* 7 · The buzz intercom overlay                               */
/* ---------------------------------------------------------- */

.wire-buzz-ov {
  position: fixed;
  inset: 0;
  z-index: 65; /* over sheets, under toasts */
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: wire-ov-in 0.18s var(--ease-out) backwards;
}

.wire-buzz-band {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 26px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 90px rgba(196, 181, 253, 0.55), 0 0 30px rgba(196, 181, 253, 0.4);
  transform-origin: center;
  animation: wire-band-snap 0.5s var(--ease-glide) both,
    wire-band-shake 0.28s linear 0.14s;
}

.wire-buzz-word {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: clamp(34px, 9vw, 56px);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  line-height: 1;
  transform: translateX(0.16em); /* optically recenters tracked text */
}

.wire-buzz-word svg {
  width: 22px;
  height: 32px;
  flex: none;
}

.wire-buzz-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
  transform: translateX(0.13em);
  text-align: center;
}

.wire-buzz-ov.is-leaving {
  animation: wire-ov-out 0.28s var(--ease-out) forwards;
}

.wire-buzz-ov.is-leaving .wire-buzz-band {
  animation: wire-band-out 0.28s var(--ease-out) forwards;
}

@keyframes wire-ov-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes wire-ov-out {
  to {
    opacity: 0;
  }
}

@keyframes wire-band-snap {
  0% {
    transform: scaleY(0.04);
  }
  55% {
    transform: scaleY(1.06);
  }
  78% {
    transform: scaleY(0.98);
  }
  100% {
    transform: scaleY(1);
  }
}

@keyframes wire-band-shake {
  0%,
  100% {
    translate: 0 0;
  }
  25% {
    translate: 3px -2px;
  }
  50% {
    translate: -3px 2px;
  }
  75% {
    translate: 2px 0;
  }
}

@keyframes wire-band-out {
  to {
    transform: scaleY(0.05);
    opacity: 0;
  }
}

/* ---------------------------------------------------------- */
/* 8 · Desktop refinements                                     */
/* ---------------------------------------------------------- */

@media (min-width: 720px) {
  .wire-msg-col {
    max-width: min(66%, 460px);
  }

  .wire-bubble-gif img {
    width: min(38vw, 320px);
  }

  .wire-chat-head {
    padding: 10px 12px;
  }

  .wire-msgs {
    padding-inline: var(--s-2);
  }
}

/* ---------------------------------------------------------- */
/* 9 · Reduced motion: static composition                      */
/* ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .wire-buzz-band {
    animation: none;
  }

  .wire-buzz-ov,
  .wire-buzz-ov.is-leaving,
  .wire-buzz-ov.is-leaving .wire-buzz-band {
    animation: none;
  }

  .wire-jump,
  .wire-unread {
    animation: none;
  }

  .wire-row:hover,
  .wire-prop:hover {
    transform: none;
  }
}
