/* ============================================================
   transmissions — view: frequency
   The masonry feed, pull-to-refresh, the transmit composer,
   the tape picker, post cards, and the desktop compose FAB.
   Layers on tokens.css + base.css. Owned by view: frequency.
   ============================================================ */

/* ---------------------------------------------------------- */
/* 1 · View scaffold + header                                  */
/* ---------------------------------------------------------- */

[data-view='frequency'] {
  position: relative;
}

.fq-body {
  position: relative;
}

.fq-body.is-settling {
  transition: transform 0.42s var(--ease-glide);
}

.fq-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}

.fq-head-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.fq-head-eyebrow .onair-dot {
  width: 6px;
  height: 6px;
}

.fq-title {
  font-size: var(--fs-subhead);
  font-weight: 600;
  letter-spacing: var(--tracking-head);
  line-height: 1.02;
}

.fq-sub {
  font-size: var(--fs-small);
  color: var(--fg-dim);
}

/* ---------------------------------------------------------- */
/* 2 · Pull-to-refresh: the charging star                      */
/* ---------------------------------------------------------- */

.fq-ptr {
  position: absolute;
  top: -62px;
  left: 0;
  right: 0;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.fq-ptr.is-settling {
  transition: transform 0.42s var(--ease-glide), opacity 0.3s var(--ease-out);
}

.fq-ptr-star {
  width: 20px;
  height: 29px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(196, 181, 253, 0.35));
  transform-origin: 50% 50%;
}

.fq-ptr.is-charged .fq-ptr-star {
  color: var(--accent-strong);
  filter: drop-shadow(0 0 14px rgba(196, 181, 253, 0.75));
}

.fq-ptr.is-tuning .fq-ptr-star {
  animation: fq-star-tune 0.85s linear infinite;
}

@keyframes fq-star-tune {
  from {
    transform: scale(1.05) rotate(0deg);
  }
  to {
    transform: scale(1.05) rotate(360deg);
  }
}

.fq-ptr-label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-label-wide);
  text-transform: uppercase;
  color: var(--fg-faint);
  transform: translateX(0.16em);
}

.fq-ptr.is-charged .fq-ptr-label {
  color: var(--accent-70);
}

/* ---------------------------------------------------------- */
/* 3 · Grid + skeletons                                        */
/* ---------------------------------------------------------- */

.fq-grid {
  --masonry-gap: 12px;
}

.fq-grid .skel-tile:nth-child(3n + 1) {
  aspect-ratio: 3 / 4;
}

.fq-grid .skel-tile:nth-child(4n + 2) {
  aspect-ratio: 1 / 1;
}

/* ---------------------------------------------------------- */
/* 4 · Post cards                                              */
/* ---------------------------------------------------------- */

.tx-card {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: 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: border-color var(--t-fast) var(--ease-out),
    transform var(--t-med) var(--ease-glide), box-shadow var(--t-med) var(--ease-out);
}

.tx-card:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}

/* freshly transmitted: a settling accent halo */
.tx-card.is-fresh {
  animation: tx-fresh 1.8s var(--ease-out) forwards;
}

@keyframes tx-fresh {
  0% {
    border-color: var(--accent-70);
    box-shadow: 0 0 0 1px var(--accent-45), 0 0 34px rgba(196, 181, 253, 0.35);
  }
  100% {
    border-color: var(--hairline);
    box-shadow: 0 0 0 0 transparent;
  }
}

.tx-top {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 30px;
}

.tx-time {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
  white-space: nowrap;
}

/* small card action icons: tape, buzz, delete */
.tx-icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--fg-dim);
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

/* 30px visual, 44px (--tap-min) touch zone */
.tx-icon::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--tap-min);
  height: var(--tap-min);
  transform: translate(-50%, -50%);
}

/* keep neighboring 44px zones apart: 8px top-row gap + 6px = 14px */
.tx-icon + .tx-icon {
  margin-left: 6px;
}

.tx-icon svg {
  width: 15px;
  height: 15px;
}

.tx-icon:hover {
  color: var(--fg);
  background: rgba(245, 245, 247, 0.08);
}

.tx-icon:active {
  transform: scale(0.86);
}

.tx-icon.is-taped {
  color: var(--accent);
}

.tx-icon.is-taped:hover {
  background: var(--accent-06);
}

/* author chip */
.tx-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px;
  padding: 4px;
  border-radius: var(--r-m);
  text-align: left;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.tx-author:hover {
  background: rgba(245, 245, 247, 0.06);
}

.tx-author:active {
  transform: scale(0.98);
}

.tx-author .avatar {
  position: relative;
  overflow: visible;
}

.tx-author .avatar img,
.tx-author .avatar svg {
  border-radius: var(--r-pill);
  overflow: hidden;
}

.tx-online {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border: 2px solid #0e0e12;
  box-sizing: content-box;
}

.tx-author-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.tx-name {
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: var(--tracking-title);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-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;
}

.tx-author .tier {
  flex: none;
}

/* the tier chip yields on narrow columns */
@container (max-width: 195px) {
  .tx-author .tier {
    display: none;
  }
}

/* media */
.tx-media {
  position: relative;
  border-radius: var(--r-m);
  overflow: hidden;
  background: rgba(245, 245, 247, 0.04);
  min-height: 96px;
}

.tx-media img {
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}

.tx-media img.is-loaded {
  opacity: 1;
}

.tx-media.is-dead {
  display: grid;
  place-items: center;
  min-height: 96px;
}

.tx-media.is-dead::after {
  content: 'signal lost';
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-label-wide);
  text-transform: uppercase;
  color: var(--fg-faint);
}

.tx-media-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-muted);
  pointer-events: none;
}

/* body */
.tx-body {
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--fg);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------- */
/* 5 · React bar                                               */
/* ---------------------------------------------------------- */

.tx-reacts {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: -2px;
}

.tx-react {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  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);
}

/* 44px (--tap-min) tall touch zone; widens 1px per side, the most the
   3px bar gap allows without adjacent zones overlapping (which would
   trade mis-taps between reactions) */
.tx-react::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  /* 100% is the padding box (inside the 1px border): +4px = 1px past
     each outer edge */
  width: calc(100% + 4px);
  height: var(--tap-min);
  transform: translate(-50%, -50%);
}

.tx-react:hover {
  background: rgba(245, 245, 247, 0.07);
  color: var(--fg);
}

.tx-react:active {
  transform: scale(0.88);
}

.tx-react.is-on {
  background: var(--accent-10);
  border-color: var(--accent-45);
  color: var(--accent);
}

.tx-react-c {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.tx-react-c:empty {
  display: none;
}

/* ---------------------------------------------------------- */
/* 6 · Tail: loading more, end of broadcast                    */
/* ---------------------------------------------------------- */

.fq-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: var(--s-7) 0 var(--s-4);
}

.fq-more-label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-label-wide);
  text-transform: uppercase;
  color: var(--fg-faint);
}

.fq-dots {
  display: inline-flex;
  gap: 5px;
}

.fq-dot {
  width: 4px;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--accent-70);
  animation: fq-dot 1.1s ease-in-out infinite;
}

.fq-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.fq-dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes fq-dot {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.fq-end {
  padding: var(--s-7) 0 var(--s-4);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-label-wide);
  text-transform: uppercase;
  color: var(--fg-faint);
}

.fq-sentinel {
  height: 1px;
}

/* ---------------------------------------------------------- */
/* 7 · The transmit composer                                   */
/* ---------------------------------------------------------- */

.fq-composer {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.fq-composer .sheet-title {
  margin-bottom: 0;
}

.fq-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: rgba(245, 245, 247, 0.05);
  border: 1px solid var(--hairline);
}

.fq-tab {
  flex: 1;
  height: 36px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.fq-tab:hover {
  color: var(--fg);
}

.fq-tab:active {
  transform: scale(0.96);
}

.fq-tab.is-on {
  background: var(--accent-16);
  color: var(--accent);
}

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

/* image dropzone */
.fq-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 128px;
  padding: var(--s-5);
  border: 1.5px dashed var(--hairline-strong);
  border-radius: var(--r-l);
  color: var(--fg-dim);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.fq-drop svg {
  width: 26px;
  height: 26px;
  color: var(--accent-70);
  margin-bottom: 2px;
}

.fq-drop:hover,
.fq-drop.is-dragover {
  border-color: var(--accent-45);
  background: var(--accent-06);
  color: var(--fg-muted);
}

.fq-drop:active {
  transform: scale(0.99);
}

.fq-drop-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--fg);
}

.fq-drop-sub {
  font-size: var(--fs-small);
  color: var(--fg-faint);
}

/* upload progress + preview */
.fq-up {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.fq-up-preview {
  position: relative;
  border-radius: var(--r-m);
  overflow: hidden;
  border: 1px solid var(--hairline);
  transition: border-color var(--t-med) var(--ease-out);
}

.fq-up.is-done .fq-up-preview {
  border-color: var(--accent-45);
}

.fq-up-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}

.fq-up-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.fq-up-bar {
  flex: 1;
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(245, 245, 247, 0.1);
  overflow: hidden;
}

.fq-up-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--r-pill);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(196, 181, 253, 0.5);
  transition: width 0.16s var(--ease-out);
}

.fq-up.is-done .fq-up-fill {
  animation: fq-fill-flash 0.7s var(--ease-out);
}

@keyframes fq-fill-flash {
  0% {
    box-shadow: 0 0 10px rgba(196, 181, 253, 0.5);
  }
  35% {
    box-shadow: 0 0 22px rgba(196, 181, 253, 0.95);
  }
  100% {
    box-shadow: 0 0 10px rgba(196, 181, 253, 0.5);
  }
}

.fq-up-label {
  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);
  white-space: nowrap;
}

.fq-up.is-done .fq-up-label {
  color: var(--accent);
}

.fq-up-check {
  display: none;
  color: var(--accent);
}

.fq-up-check svg {
  width: 15px;
  height: 15px;
}

.fq-up.is-done .fq-up-check {
  display: grid;
  place-items: center;
  animation: fq-check-in 0.4s var(--ease-glide) backwards;
}

@keyframes fq-check-in {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  60% {
    transform: scale(1.2);
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.fq-up-x {
  width: 34px;
  height: 34px;
  flex: none;
}

.fq-up-x svg {
  width: 14px;
  height: 14px;
}

/* gif panel */
.fq-gif-hint {
  font-size: var(--fs-small);
  color: var(--fg-faint);
  transition: color var(--t-fast) var(--ease-out);
}

.fq-gif-hint.is-bad {
  color: var(--fg-muted);
}

.fq-gif-preview {
  position: relative;
  border-radius: var(--r-m);
  overflow: hidden;
  border: 1px solid var(--accent-28);
  background: rgba(245, 245, 247, 0.03);
}

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

/* shared body field */
.fq-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fq-text {
  min-height: 108px;
  max-height: 38vh;
  overflow-y: auto;
}

.fq-composer[data-kind='image'] .fq-text,
.fq-composer[data-kind='gif'] .fq-text {
  min-height: 52px;
}

.fq-count {
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--fg-faint);
}

.fq-count.is-near {
  color: var(--accent-70);
}

/* ---------------------------------------------------------- */
/* 8 · Tape picker sheet                                       */
/* ---------------------------------------------------------- */

.fq-tapes {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.fq-tapes .sheet-title {
  margin-bottom: 0;
}

.fq-tape-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.fq-tape-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-l);
  background: rgba(245, 245, 247, 0.04);
  border: 1px solid var(--hairline);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.fq-tape-row:hover {
  background: rgba(245, 245, 247, 0.08);
  border-color: var(--accent-45);
}

.fq-tape-row:active {
  transform: scale(0.98);
}

.fq-tape-covers {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(245, 245, 247, 0.05);
}

.fq-tape-covers img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fq-tape-covers.is-blank {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
}

.fq-tape-covers.is-blank svg {
  width: 12px;
  height: 17px;
  color: var(--accent-45);
}

/* a single cover fills the whole square */
.fq-tape-covers[data-n='1'] {
  grid-template-columns: 1fr;
}

.fq-tape-covers[data-n='2'] {
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
}

.fq-tape-body {
  flex: 1;
  min-width: 0;
}

.fq-tape-title {
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: var(--tracking-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fq-tape-count {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.fq-tape-new {
  display: flex;
  gap: var(--s-2);
}

.fq-tape-new .input {
  flex: 1;
}

.fq-tape-skel {
  height: 68px;
  border-radius: var(--r-l);
}

/* ---------------------------------------------------------- */
/* 9 · Desktop compose FAB                                     */
/* ---------------------------------------------------------- */

.fq-fab {
  position: fixed;
  right: calc(var(--s-6) + var(--safe-right));
  bottom: calc(var(--dock-h) + var(--dock-gap) + var(--safe-bottom) + var(--s-6));
  z-index: var(--z-dock);
  display: none;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-pill);
  background: var(--pane);
  border: 1px solid var(--accent-28);
  color: var(--accent);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--glass-shadow-soft), 0 0 18px rgba(196, 181, 253, 0.14);
  transition: border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.fq-fab svg {
  width: 18px;
  height: 26px;
  filter: drop-shadow(0 0 8px rgba(196, 181, 253, 0.4));
}

.fq-fab:hover {
  border-color: var(--accent-70);
  box-shadow: var(--glass-shadow-soft), var(--glow-accent);
  transform: translateY(-2px);
}

.fq-fab:active {
  transform: scale(0.9);
}

@media (min-width: 720px) {
  .fq-fab {
    display: grid;
  }
}

/* ---------------------------------------------------------- */
/* 10 · Fly-to-dock ghost + arrival                            */
/* ---------------------------------------------------------- */

.fq-fly {
  position: fixed;
  z-index: var(--z-fx);
  display: grid;
  place-items: center;
  width: 36px;
  height: 28px;
  border-radius: 9px;
  background: var(--accent-16);
  border: 1px solid var(--accent-70);
  color: var(--accent);
  box-shadow: var(--glow-accent);
  pointer-events: none;
}

.fq-fly svg {
  width: 16px;
  height: 16px;
}

/* ---------------------------------------------------------- */
/* 11 · Reduced motion                                         */
/* ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .tx-card:hover,
  .fq-fab:hover {
    transform: none;
  }

  .fq-ptr-star,
  .fq-ptr.is-tuning .fq-ptr-star {
    animation: none;
    transform: none !important;
  }

  .tx-card.is-fresh {
    animation: none;
    border-color: var(--accent-45);
  }

  .tx-media img {
    transition: none;
    opacity: 1;
  }
}
