/* The review form and the reviews on show. Square corners, like the rest of the site. */

/* Five stars as radio buttons. The inputs come in the order 5 to 1 and the row is reversed,
   so a later sibling in the markup is a lower rating on screen: choosing 3 fills 3, 2 and 1. */
.stars {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: var(--s-1);
}

.stars input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.stars label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  font-size: 32px;
  line-height: 1;
  color: var(--line);
  cursor: pointer;
}

.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label {
  color: var(--brass);
}

.stars input:focus-visible + label {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

.review-thanks { max-width: 52ch; }

.review-copied { min-height: 1.5em; margin: var(--s-2) 0 0; }

.review-list {
  list-style: none;
  margin: var(--s-5) 0 0;
  padding: 0;
  display: grid;
  gap: var(--s-5);
  max-width: 60ch;
}

.review {
  padding: var(--s-4) var(--s-5) var(--s-5);
  border-bottom: 1px solid var(--line);
}

.review p { margin: 0 0 var(--s-2); }

.review__stars {
  color: var(--brass);
  font-size: 20px;
  letter-spacing: 0.08em;
}

.review__by { color: var(--ink-muted); }

/* Our answer under a review: set in from the guest's words, a brass rule on its left. Square corners. */
.review__reply {
  margin: var(--s-3) 0 var(--s-2) var(--s-4);
  padding: var(--s-2) 0 var(--s-1) var(--s-4);
  border-left: 3px solid var(--brass);
}

.review__reply p:last-child { margin-bottom: 0; }

.review__reply-by { color: var(--ink-muted); font-weight: 600; }

/* A guest's own message, shown as they sent it. */
.review-shot {
  margin: var(--s-4) 0 var(--s-5);
  max-width: 60ch;
}

.review-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

.review-shot figcaption { margin-top: var(--s-2); color: var(--ink-muted); }

/* The screenshots on the public reviews page: one column on a phone, two when there is room. */
.review-shots {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  margin: var(--s-4) 0 var(--s-5);
}

.review-shots .review-shot { margin: 0; max-width: none; }

/* Cropping a screenshot before it is added: draw a frame over the picture. Square corners. */
.crop { max-width: 52ch; }

.crop__stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
  border: 1px solid var(--line);
}

.crop__stage img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  -webkit-user-drag: none;
}

/* The shadow darkens everything outside the frame. */
.crop__frame {
  position: absolute;
  border: 2px solid var(--brass);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
}

.crop__handle {
  position: absolute;
  width: 22px;
  height: 22px;
  background: var(--brass);
}

.crop__handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.crop__handle--ne { right: 0; top: 0; cursor: nesw-resize; }
.crop__handle--sw { left: 0; bottom: 0; cursor: nesw-resize; }
.crop__handle--se { right: 0; bottom: 0; cursor: nwse-resize; }

/* The box a screenshot is dropped on. The file input stays inside it, so choosing a file works too. */
.dropzone {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-5);
  border: 2px dashed var(--line);
  background: var(--salt-paper);
  max-width: 52ch;
  text-align: center;
}

.dropzone.is-over { border-color: var(--brass); background: var(--white, #fff); }
.dropzone__label { font-weight: 600; }
.dropzone input[type="file"] { max-width: 100%; justify-self: center; }

/* A button's own display would otherwise win over the hidden attribute. */
.crop button[hidden] { display: none; }

.crop__title { margin: var(--s-4) 0 var(--s-2); font-weight: 600; }
.crop .btn-row { margin-top: var(--s-2); }

/* A saved screenshot is a link to its edit form. */
.review-shot-link { display: block; max-width: 60ch; }
.review-shot-link:hover img, .review-shot-link:focus-visible img { outline: 2px solid var(--brass); outline-offset: 2px; }
