/* ==========================================================================
   MUHCINE / message
   One composer, centred on the page, on the same ground as every other page.
   ========================================================================== */

/* The whole thing fits the window and nothing scrolls. The height is the
   window rather than a minimum, and the note takes whatever room the fixed
   parts leave over. */
.compose {
  height: 100vh;
  height: 100dvh;
  padding: calc(var(--chrome-h) + 20px) var(--pad) calc(var(--bar-h) + 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.compose__form {
  width: 100%;
  max-width: var(--form-width, 640px);
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* The last field is the note. It stretches, everything else keeps its size. */
.compose__form .field:last-of-type {
  flex: 1 1 auto;
  min-height: 0;
}

.compose__form .field:last-of-type textarea {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  resize: none;
}

/* --- the address line ------------------------------------------------------ */

.row--to {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  flex: 0 0 auto;
}

.row__label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.pill-static {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.row__action {
  margin-inline-start: auto;
  font-size: 12px;
  position: relative;
  padding-bottom: 3px;
}

.row__action::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.45s var(--ease);
}

.row__action:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* --- the fields ------------------------------------------------------------
   Every field carries its own thin outline, so it is obvious where to write.
   ---------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
  flex: 0 0 auto;
}

.field label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

html[dir="rtl"] .field label {
  letter-spacing: 0;
}

.field input,
.field textarea {
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  padding: 13px 15px;
  width: 100%;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.field textarea {
  min-height: 90px;
  line-height: 1.6;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.field input:hover,
.field textarea:hover {
  border-color: color-mix(in srgb, var(--fg) 40%, transparent);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--fg);
}

/* --- sending ---------------------------------------------------------------- */

.compose__foot {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
  flex: 0 0 auto;
}

.send {
  flex: 1 1 260px;
  height: 54px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  transition: transform 0.5s var(--ease), box-shadow 0.4s var(--ease);
}

.send span {
  position: relative;
  z-index: 1;
  display: block;
}

.send::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Plainly grey on hover, not the page colour. The flat value is the
     fallback for anything that cannot mix. */
  background: #cfcfcf;
  background: color-mix(in srgb, var(--fg) 26%, var(--bg));
  transform: scaleY(0);
  transform-origin: bottom center;
  transition: transform 0.55s var(--ease);
}

.send:hover {
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--fg);
}

.send:hover::before {
  transform: scaleY(1);
}

.compose__note {
  color: var(--muted);
  max-width: 22ch;
  line-height: 1.5;
}

.compose__status {
  min-height: 1.4em;
  color: var(--muted);
  padding-top: 12px;
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .row--to {
    gap: 10px;
  }

  .row__action {
    margin-inline-start: 0;
  }

  .send {
    flex: 1 1 100%;
  }
}
