/* Shared markers for drawing on or around the piece. Every prototype uses these for the same meanings,
   so pages can be compared. None of them decides layout: place them however the idea needs. */

/* The piece: a picture or video that marks sit on. Marks inside are positioned in % of the piece. */
.piece {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.piece > img,
.piece > video {
  border-radius: 2px;
}

/* A region on the piece. Position it inline: style="left:30%; top:20%; width:25%; height:40%". */
.mark {
  position: absolute;
  border-radius: 4px;
  line-height: 1.2;
  pointer-events: none;
}

/* Her current selection: marching ants. */
.mark.select {
  outline: 2px dashed var(--ink);
  box-shadow: 0 0 0 2px rgb(255 255 255 / 85%);
  animation: ants 0.6s linear infinite;
}

/* The area that will be regenerated or replaced. */
.mark.mask {
  background: rgb(217 64 122 / 28%);
  outline: 2px solid var(--accent);
}

/* What changed since the last version. */
.mark.changed {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 6px rgb(217 64 122 / 20%);
}

/* Held still: nothing inside may change. */
.mark.keep {
  outline: 2px dashed var(--ok);
  background: rgb(46 158 91 / 10%);
}

/* Something the app or agent thinks is wrong. */
.mark.flag {
  outline: 2px solid var(--warn);
  background: rgb(217 138 26 / 12%);
}

/* A short label on any mark: data-label="label". */
.mark[data-label]::after {
  content: attr(data-label);
  position: absolute;
  left: -2px;
  top: calc(100% + 4px);
  white-space: nowrap;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
}

@keyframes ants {
  to {
    outline-offset: 2px;
  }
}

/* Freehand marks: an <svg class="ink" viewBox="0 0 100 100" preserveAspectRatio="none"> laid over the piece. */
svg.ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

svg.ink * {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg.ink .lasso {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  fill: rgb(217 64 122 / 15%);
}

svg.ink .brush {
  stroke: rgb(217 64 122 / 45%);
  stroke-width: 18;
}

svg.ink .arrow {
  stroke: var(--accent);
  stroke-width: 3;
}

/* Work in progress on the whole piece or one mark. data-label="About 4s" is optional. */
.generating {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: rgb(255 255 255 / 35%);
  border-radius: inherit;
}

.generating::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 70%) 50%, transparent 70%);
  animation: shimmer 1.4s linear infinite;
}

.generating[data-label]::after {
  content: attr(data-label);
  position: absolute;
  right: 8px;
  bottom: 8px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* "This updates as you go": a pulsing dot before the text. */
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

/* Who did something. Use on a chip, a note or a log line. */
.who {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  padding: 0 7px;
  border-radius: 4px;
  vertical-align: middle;
}

.who.maya {
  background: #e6e6e6;
  color: var(--ink);
}

.who.app {
  background: #e3ebfb;
  color: var(--app);
}

.who.agent {
  background: #efe7fb;
  color: var(--agent);
}

/* A short note from someone. Inside a .piece, position it inline like a mark. */
.note {
  display: inline-block;
  max-width: 260px;
  font-size: 13px;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgb(0 0 0 / 12%);
}

.piece > .note {
  position: absolute;
}

.note.agent {
  border-color: var(--agent);
}

.note.app {
  border-color: var(--app);
}

/* What a step costs in money and time: <span class="cost">2 credits, 4s</span>. */
.cost {
  display: inline-block;
  font: 12px/1.6 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

/* A numbered callout, to tie a picture to a sentence. */
.n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.piece > .n {
  position: absolute;
  transform: translate(-50%, -50%);
}

/* Optional device frames. What goes inside is up to the idea. */
.device {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
  vertical-align: top;
}

/* A picture or video straight inside a frame fills it, like a full-screen app. */
.device > img,
.device > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.device.phone {
  width: 390px;
  max-width: 100%;
  aspect-ratio: 390 / 844;
  border-radius: 36px;
  border-width: 10px;
  border-color: var(--ink);
}

.device.desktop {
  width: 100%;
  border-radius: var(--radius);
}

.device.desktop::before {
  content: "";
  display: block;
  height: 28px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 14px 14px, #e0e0e0 5px, transparent 6px),
    radial-gradient(circle at 32px 14px, #e0e0e0 5px, transparent 6px),
    radial-gradient(circle at 50px 14px, #e0e0e0 5px, transparent 6px),
    var(--soft);
}
