/* Leave a Review. Only what this page adds. The look, the grid and every scale come from ../../e-exact/styles.css, which is linked and not changed.
   Every number here is one of that file's own: its spacing scale, its type scale, its corners, its rule, its glass. */

[hidden] { display: none !important; }

/* The opening is the home page's: the first screen, three equal facts, then the main thing. On a phone the form comes before the facts,
   as the work does on the home page, so a client holding a phone meets the form first. */
.words { margin-top: var(--gap-tight); order: 2; }
.words h2 { text-wrap: balance; }

/* The first way, once a Google link exists: one filled button and the second way beside it, as on the home page's first screen. */
.google__note { margin-top: var(--s-16); color: var(--muted); }
.btn svg { flex: none; width: 16px; height: 16px; transition: transform 0.14s ease; }
.btn--fill:hover svg { transform: translate(2px, -2px); }

/* The glass panel holds either the form or the sent words, never both. */
.review { align-content: start; }
.review__form { display: grid; gap: var(--s-16); }
.review__form textarea { height: 144px; }
.hint { color: var(--muted); font-size: var(--small); line-height: var(--small-lh); }

/* The tick box: one row as wide as the fields, with the same edge and corner, so it lines up with them. The whole row is the target. */
.check { display: grid; gap: var(--s-4); }
.check__row {
  position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: var(--s-16); align-items: start;
  min-height: 48px; padding: var(--s-12) var(--s-16);
  background: #fff; border-radius: var(--r-1);
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 1px 2px rgba(11, 13, 18, 0.05); /* the fields' own edge, drawn inside so the row keeps to the scale */
  transition: box-shadow 0.14s ease;
}
.check__row input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.check__box {
  display: grid; place-items: center; width: 24px; height: 24px;
  background: #fff; color: #fff; border: 1px solid var(--edge); border-radius: 6px;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.check__box svg { width: 16px; height: 16px; opacity: 0; transform: scale(0.6); transition: opacity 0.14s ease, transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
.check__words { color: var(--ink); font-weight: 500; font-size: var(--small); line-height: var(--small-lh); text-wrap: balance; }
.check__row:hover { box-shadow: inset 0 0 0 1px var(--ink), inset 0 1px 2px rgba(11, 13, 18, 0.05); }
.check__row:hover .check__box { border-color: var(--ink); }
.check__row input:checked + .check__box { background: var(--accent); border-color: var(--accent-edge); }
.check__row input:checked + .check__box svg { opacity: 1; transform: none; }
.check__row input:focus-visible + .check__box { outline: 2px solid var(--focus); outline-offset: 2px; }
@supports selector(:has(a)) {
  .check__row:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent-ink); }
  .check__row:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
  .check__row input:focus-visible + .check__box { outline: none; }
}

/* The foot of the form: the one filled button, and where the rules for reviews are written. */
.review__end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-8) var(--s-24); margin-top: var(--s-8); }
.review__end .btn { margin-top: 0; }
.review__end p { color: var(--muted); }
.btn[aria-busy="true"] { pointer-events: none; opacity: 0.72; }

/* A plain note: the drawing saying it is not connected. The failed note is the home page's own (.note--failed). */
.note--plain { background: var(--tint); box-shadow: inset 0 0 0 1px var(--rule); }
.note--plain svg { color: var(--ink); }

/* Sent: the same panel, the same place. On a computer it keeps the height of the column beside it, with the words centred in it. */
.review__sent { display: grid; justify-items: start; align-content: center; gap: var(--s-16); height: 100%; }
.review__sent:focus { outline: none; }
.review__sent .lead { color: var(--text); font-size: var(--body); line-height: var(--body-lh); }
.review__sent .btn { margin-top: var(--s-8); }
.review.is-sent { align-content: stretch; }

@media (max-width: 599px) {
  /* a phone: the button runs the width of the screen and the second way sits under it */
  .google { flex-direction: column; align-items: stretch; gap: var(--s-4); }
  .google .link { align-self: flex-start; }
  .review__end .btn { width: 100%; }
}
@media (min-width: 600px) {
  .words { order: 0; }
}

/* Movement: what arrives rises a little as it fades in, and the form fades as it leaves. Position and opacity only, 200 to 360 thousandths.
   Under reduced motion the home page's own rule turns every transition and animation off. */
@media (prefers-reduced-motion: no-preference) {
  .review__form.is-leaving { opacity: 0; transition: opacity 0.2s ease; }
  .is-arriving { animation: arrive 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .review__sent.is-arriving { animation: none; }
  .review__sent.is-arriving > * { animation: arrive 0.36s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .review__sent.is-arriving > :nth-child(2) { animation-delay: 0.04s; }
  .review__sent.is-arriving > :nth-child(3) { animation-delay: 0.08s; }
  .review__sent.is-arriving > :nth-child(4) { animation-delay: 0.12s; }
  .review__sent.is-arriving > :nth-child(5) { animation-delay: 0.16s; }
  .review__sent.is-arriving > .sent__mark { animation-name: arrive-mark; }
  @keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes arrive-mark { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
}
