/* COMMAND NET — the green-on-black layer.
 *
 * SCOPE, and it is deliberately narrow: this is a physical device sitting on
 * the declassified briefing sheet, not a skin for the UI. The paper, the steel
 * menus and the wax stamps in screens.css are the game's visual language; a
 * field tablet is the one thing that plausibly glows green inside that world,
 * so it is the only thing dressed this way.
 *
 * If you find yourself putting a `.term` class on a whole screen again — don't.
 * The entire UI was converted once and it flattened a look that was right.
 */

:root {
  --term-bg:     #05070a;
  --term-green:  #7dfa9a;
  --term-dim:    #2f7a45;
  --term-mid:    #4fbf72;
  --term-amber:  #ffb454;
  --term-scan:   rgba(125, 250, 154, 0.06);
}

/* ---- the two objects on the paper --------------------------------------- */

.comms {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin: 6px 0 18px;
}
@media (max-width: 720px) {
  .comms { gap: 12px; }
}

/* Amira as a photograph clipped to the sheet — same language as the market
   photo above it, so she belongs to the document rather than to the device. */
.comms-dossier {
  flex: none; width: 122px; margin: 4px 0 0;
  transform: rotate(-1.4deg);
}
.comms-dossier .comms-portrait {
  width: 100%; display: block;
  border: 1px solid var(--ink);
  box-shadow: 3px 4px 0 rgba(28, 25, 19, .2);
  filter: sepia(.22) contrast(.97);
}
.comms-dossier figcaption {
  margin-top: 5px; line-height: 1.25;
  font-family: var(--type); font-size: 9px;
  letter-spacing: .14em; text-transform: uppercase;
}
.comms-dossier .who  { display: block; color: var(--ink); }
.comms-dossier .role { display: block; opacity: .6; }
@media (max-width: 720px) { .comms-dossier { width: 84px; } }

/* ---- the device --------------------------------------------------------- */

/* The artwork is a CUT-OUT (tools/cutout.mjs flood-fills its ground to alpha and
   crops), so the element takes the cropped art's exact aspect and the overlay
   below is positioned in percentages of that same box. Re-run the cutout and
   these four numbers must be re-measured against the new crop. */
.comms-device {
  position: relative;
  flex: 0 0 auto;
  width: min(370px, 58%);
  aspect-ratio: 804 / 644;          /* the cropped art, exactly */
  background: center / contain no-repeat;
  transform: rotate(-1deg);         /* set down by hand, like the photo below */
  filter: drop-shadow(0 8px 10px rgba(28, 25, 19, .28));
}
@media (max-width: 720px) { .comms-device { width: min(260px, 66%); } }

/* the dark rectangle in the artwork, measured off the cropped image once */
.comms-screen {
  position: absolute;
  left: 14.2%; top: 26.0%; width: 72.2%; height: 52.5%;
  overflow: hidden;                 /* a physical screen cannot grow */
  padding: 2px 4px 0 0;
  /* own backdrop, not borrowed from .comms-device's art — the device image
     can legitimately be absent (o.device === '') or still loading when this
     screen first renders, and without this the readout has nothing behind
     it but the paper: green-on-cream is unreadable. */
  background-color: var(--term-bg);
  background-image:
    repeating-linear-gradient(to bottom, var(--term-scan) 0 1px, transparent 1px 3px);
  color: var(--term-green);
  font-family: var(--type);
  text-shadow: 0 0 5px rgba(125, 250, 154, .35);
  scrollbar-width: none;
}
.comms-screen::-webkit-scrollbar { display: none; }

.comms-head {
  display: flex; gap: 6px; align-items: center;
  font-size: 8px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--term-mid);
  border-bottom: 1px solid var(--term-dim);
  padding-bottom: 3px; margin-bottom: 5px;
}
.comms-head .sep { opacity: .6; }

.comms-text {
  margin: 0;
  font-size: 11px; line-height: 1.5;
  color: var(--term-green);
}

/* ---- speaking indicator ------------------------------------------------- */

.comms-wave { display: flex; gap: 2px; align-items: flex-end; height: 8px; margin-top: 6px; }
.comms-wave i { width: 2px; height: 20%; background: var(--term-dim); animation: comms-bar .9s ease-in-out infinite; }
.comms-wave.speaking i { background: var(--term-green); }
.comms-wave:not(.speaking) i { animation: none; height: 20%; }
.comms-wave i:nth-child(2) { animation-delay: .10s }
.comms-wave i:nth-child(3) { animation-delay: .20s }
.comms-wave i:nth-child(4) { animation-delay: .30s }
.comms-wave i:nth-child(5) { animation-delay: .15s }
.comms-wave i:nth-child(6) { animation-delay: .25s }
@keyframes comms-bar { 0%, 100% { height: 20%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .comms-wave i { animation: none; } }

/* The reveal caret. currentColor, NOT phosphor green — the typewriter is used
   on the paper screens too, where a green caret would be the only green thing
   on the sheet. */
.typing::after {
  content: '▮';
  margin-left: 2px;
  color: currentColor;
  animation: term-caret 1s steps(1) infinite;
}
@keyframes term-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .typing::after { animation: none; } }
