/* queue.css: the Waiting queue page. A line of dressed models you scroll sideways, you at the end.
   The people themselves are styled in css/components/avatar.css. */

/* The tag and its string are placed over the whole page. */
.queue {
  position: relative;
}

/* -- under the queue: "WAITING QUEUE" and "21 people in line", as on the mockup -- */
.queue-heading {
  padding: 0 var(--gutter-right) max(3.5cqh, var(--safe-bottom) + var(--space-3)) var(--gutter-left);
  text-align: center;
}

.queue-heading h1 {
  font-size: var(--text-title);
  font-style: italic;
  font-weight: 400;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.queue-count {
  margin-top: 0.2rem;
  font-size: var(--text-note);
  letter-spacing: 0.08em;
}

.queue-area {
  flex: 1;
  min-height: 0;
  container-type: size; /* inside, 1cqh = 1% of the queue's height */
}

.queue-line {
  --avatar-height: 64cqh; /* EDIT HERE: how tall the people are, from their eyes to their feet */
  display: flex;
  align-items: flex-end; /* everyone stands on the same floor */
  height: 100%;
  /* Underneath: what centres them, heads to numbers, between the logo and the title (their pictures
     are about 1.11 times --avatar-height, the number under their feet about 1.25rem). On the sides,
     half the screen: the first and the last (you, on arrival) can stand in the middle of the screen. */
  padding: 0 calc(50% - var(--avatar-height) * 0.2) calc((100cqh - var(--avatar-height) * 1.11 + 1.25rem) / 2);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  list-style: none;
  scrollbar-width: none;
}

.queue-line::-webkit-scrollbar {
  display: none;
}

/* -- "you are here": a paper tag on a string, placed by js/interactions/queue-tag.js -- */
/* .queue in front: css/effects/torn-edge.css (loaded later) would make it position: relative. */
.queue .queue-tag {
  position: absolute;
  /* The mockup's proportions, 25% bigger: a 104 × 39 px paper, the writing a little nearer its right end. */
  padding: 0.19rem 0.47rem 0.19rem 0.875rem;
  border: 0;
  background: var(--color-tag);
  box-shadow: var(--shadow-paper);
  transform: rotate(var(--tilt, -7deg)); /* set by js/interactions/queue-tag.js */
}

/* Out of sight: a black button with your place, a scrap of torn black paper like the "done" button
   (css/effects/torn-edge.css), at least as tall as a tap target (AGENTS.md, rule 9). */
.queue-tag[data-away] {
  min-height: var(--tap-target);
  padding: 0.45rem 0.9rem;
  background: none; /* the paper is the torn layer behind */
  box-shadow: none;
  --torn-edge-color: var(--color-ink);
  --torn-edge-rim-color: var(--color-torn-rim);
  color: var(--color-paper);
}

/* Over your head it stays the plain paper tag: no torn edge. */
.queue-tag:not([data-away]) {
  background: var(--color-tag);
}

.queue-tag:not([data-away])::before,
.queue-tag:not([data-away])::after {
  display: none;
}

.queue-tag-place {
  display: block;
  font-size: var(--text-note);
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
}

/* Over your head the writing shows, in the corner your place: never both. */
.queue-tag[data-away] .queue-tag-text,
.queue-tag:not([data-away]) .queue-tag-place {
  display: none;
}

/* Over your head it is a label, not a button: no pointer, nothing greyed out. */
.queue-tag:disabled {
  cursor: default;
  color: inherit;
}

/* You moved up: a heart above the tag's left end and a burst of rays below it, clear of the tag
   (js/render.js). Move them with top / bottom and left. */
.queue-tag-joy {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

.queue-tag-joy-heart {
  bottom: calc(100% + 0.3rem);
  left: -0.6rem;
  width: 1.5rem;
}

.queue-tag-joy-rays {
  top: calc(100% + 0.4rem);
  left: -1rem;
  width: 3.1rem;
}

/* In the top left corner, by the tag's right end (the string comes in from the left): the rays are
   mirrored, the heart stays as drawn. */
.queue-tag[data-side='left'] .queue-tag-joy-rays {
  scale: -1 1;
}

.queue-tag[data-side='left'] .queue-tag-joy-heart {
  left: auto;
  right: -0.6rem;
}

.queue-tag[data-side='left'] .queue-tag-joy-rays {
  left: auto;
  right: -1rem;
}

@keyframes queue-tag-joy {
  0% {
    opacity: 0;
    transform: scale(0.7) rotate(-8deg);
  }
  20% {
    opacity: 1;
    transform: scale(1.08);
  }
  30% {
    transform: none;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .queue-tag-joy {
    animation: queue-tag-joy 1600ms ease-out forwards;
  }
}

/* The handwritten "you are here!" (assets/text/you-are-here.png). */
.queue-tag-text {
  width: 5.1rem;
  transform: rotate(6deg); /* the writing climbs on its own: this lays it along the tag */
}

/* "+1": a vote for your outfit, popping up over the tag (js/interactions/queue-votes.js). */
.queue-vote {
  position: absolute;
  width: 1.25rem;
  max-width: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

@keyframes queue-vote {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.6);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -120%);
  }
}

/* Pops up and floats away; with reduced motion it only appears, then goes (js/interactions/queue-votes.js). */
@media (prefers-reduced-motion: no-preference) {
  .queue-vote {
    animation: queue-vote 1600ms ease-out forwards;
  }
}

.queue-string {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--color-ink);
  stroke-width: 0.7; /* px: the same line as the doodles (measured on them, as shown on screen) */
  stroke-linecap: round;
  pointer-events: none;
}

/* -- over the tag: the top of the doodle you get when liked on screen -- */
/* queue-tag.js puts it on the top centre of your picture and gives your height (--you-height, px). */
.queue-cheer {
  position: absolute;
  pointer-events: none;
}

.queue-cheer-top {
  position: absolute;
  top: calc(var(--you-height) * var(--wrap-top) / 100 * 1px);
  left: calc(var(--you-height) * var(--wrap-left) / 100 * 1px);
  width: calc(var(--you-height) * var(--wrap-width) / 100 * 1px);
  max-width: none;
}

/* Appears as the line starts to draw itself, then fades with it. */
@keyframes queue-cheer-top {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  12% {
    opacity: 1;
    transform: none;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .queue-cheer-top {
    animation: queue-cheer-top 2200ms ease-out forwards;
  }
}

/* -- the thought bubble over the person ahead of you, as the queue starts (js/interactions/queue-hint.js) -- */
/* In front of the people, under your tag (the script puts it just before the tag). Placed as on the mockup from her picture (--her-centre, --her-top,
   --her-height, set by the script): above her head, a little to her right. */
.queue-hint {
  position: absolute;
  /* Its small clouds end by her head; never over the logo. */
  top: max(calc(var(--her-top) - var(--her-height) * 0.26), 4.5rem); /* EDIT HERE: smaller = lower */
  left: calc(var(--her-centre) - var(--her-height) * 0.06);
  width: calc(var(--her-height) * 0.29); /* EDIT HERE: its size, as a fraction of her height */
  pointer-events: none;
}

.queue-hint-bubble {
  width: 100%;
}

/* The words inside the big cloud. */
.queue-hint-text {
  position: absolute;
  top: 12%;
  left: 22%;
  width: 54%;
}

@keyframes queue-hint {
  0% {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.92);
  }
  12% {
    opacity: 1;
    transform: none;
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Floats in, stays, fades; with reduced motion it only appears, then goes. */
@media (prefers-reduced-motion: no-preference) {
  .queue-hint {
    transform-origin: 30% 100%;
    animation: queue-hint 2500ms ease-out forwards;
  }
}

/* Your turn (js/interactions/queue-exit.js): you go into the store alone, the tag stays behind. */
.queue[data-leaving] .queue-tag,
.queue[data-leaving] .queue-string,
.queue[data-leaving] .queue-cheer {
  visibility: hidden;
}
