/**
 * /mobile/css/oink-expanded-message.css — ExpandedMessage styles.
 *
 * Long-form composer with subject, body, attachments, draft autosave.
 * Mobile-first; expects to fill the available container (e.g. inside
 * profile-overlay full variant).
 */

.em {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: color-mix(in oklch, oklch(14% 0.03 280) 90%, transparent);
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  border: 1px solid color-mix(in oklch, oklch(97% 0.01 280) 10%, transparent);
  color: oklch(94% 0.01 280);
  font-family: inherit;
  contain: layout paint style;
  position: relative;
  transition: opacity 200ms, border-color 200ms;
}

.em--dragover { border-color: oklch(72% 0.22 20); background: color-mix(in oklch, oklch(20% 0.04 280) 90%, transparent); }
.em--sent     { opacity: 0.85; }

.em-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.01em;
}
.em-header-prefix {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: oklch(60% 0.02 280);
}
.em-header-target {
  color: oklch(98% 0.02 280);
  font-weight: 700;
  font-size: 14px;
}
.em-draft-status {
  margin-left: auto;
  font-size: 12px;
  color: oklch(72% 0.18 145);
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.em-row { display: flex; flex-direction: column; gap: 6px; position: relative; }

.em-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.em-subject {
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in oklch, oklch(97% 0.01 280) 14%, transparent);
  background: oklch(10% 0.02 280);
  color: oklch(96% 0.01 280);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  outline: none;
  transition: border-color 160ms, background 160ms;
}
.em-subject:focus  { border-color: oklch(72% 0.22 20); background: oklch(12% 0.02 280); }
.em-subject::placeholder { color: oklch(54% 0.02 280); font-weight: 400; }

.em-body {
  width: 100%;
  min-height: 120px;
  resize: none;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in oklch, oklch(97% 0.01 280) 14%, transparent);
  background: oklch(10% 0.02 280);
  color: oklch(96% 0.01 280);
  font-family: inherit;
  font-size: 17px;
  line-height: 1.5;
  outline: none;
  transition: border-color 160ms, background 160ms;
}
.em-body:focus { border-color: oklch(72% 0.22 20); background: oklch(12% 0.02 280); }
.em-body::placeholder { color: oklch(54% 0.02 280); }

.em-counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 11px;
  color: oklch(60% 0.02 280);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  pointer-events: none;
  background: color-mix(in oklch, oklch(0% 0 0) 50%, transparent);
  padding: 2px 6px;
  border-radius: 999px;
}
.em-counter[data-warn="1"] { color: oklch(80% 0.18 80); }
.em-counter[data-warn="2"] { color: oklch(70% 0.22 28); }

.em-format-hint {
  font-size: 12px;
  color: oklch(60% 0.02 280);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.em-format-hint code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  background: color-mix(in oklch, oklch(0% 0 0) 50%, transparent);
  padding: 2px 6px;
  border-radius: 6px;
  color: oklch(80% 0.02 280);
}

/* Attachments */
.em-row--attach { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
.em-attach-list { display: flex; gap: 8px; flex-wrap: wrap; }

.em-attach {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  border: 1px solid color-mix(in oklch, oklch(97% 0.01 280) 12%, transparent);
  background: color-mix(in oklch, oklch(10% 0.02 280) 80%, transparent);
  max-width: 260px;
}

.em-attach-thumb {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: oklch(18% 0.04 280);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  overflow: hidden;
  flex: none;
  color: oklch(82% 0.02 280);
}
.em-attach-thumb img { width: 100%; height: 100%; object-fit: cover; }

.em-attach-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.em-attach-name { font-size: 13px; color: oklch(94% 0.01 280); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-attach-size { font-size: 11px; color: oklch(60% 0.02 280); font-family: ui-monospace, monospace; }

.em-attach-rm {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 0;
  background: color-mix(in oklch, oklch(70% 0.22 28) 30%, transparent);
  color: oklch(94% 0.10 28);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.em-attach-rm:hover { background: color-mix(in oklch, oklch(70% 0.22 28) 50%, transparent); }

.em-attach-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px dashed color-mix(in oklch, oklch(97% 0.01 280) 22%, transparent);
  background: transparent;
  color: oklch(80% 0.02 280);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
.em-attach-add:hover {
  background: color-mix(in oklch, oklch(20% 0.03 280) 60%, transparent);
  border-color: color-mix(in oklch, oklch(97% 0.01 280) 32%, transparent);
}
.em-attach-add-glyph svg { width: 16px; height: 16px; }

/* Footer */
.em-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.em-status {
  flex: 1;
  font-size: 13px;
  color: oklch(70% 0.02 280);
  min-height: 18px;
}
.em-status[data-kind="success"] { color: oklch(72% 0.18 145); }
.em-status[data-kind="error"]   { color: oklch(70% 0.22 28); }

.em-cancel {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklch, oklch(97% 0.01 280) 14%, transparent);
  background: transparent;
  color: oklch(80% 0.02 280);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms;
}
.em-cancel:hover { background: color-mix(in oklch, oklch(20% 0.02 280) 60%, transparent); }

.em-send {
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, oklch(72% 0.22 20), oklch(70% 0.20 30));
  color: oklch(99% 0 0);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: filter 160ms, transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.em-send:hover  { filter: brightness(1.06); }
.em-send:active { transform: scale(0.96); }
.em-send:disabled {
  filter: grayscale(0.5) brightness(0.7);
  cursor: not-allowed;
}

/* Shake on failure */
.em--shake { animation: em-shake 480ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes em-shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60%      { transform: translate3d(4px, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .em-send, .em-attach-add, .em-cancel { transition: none; }
  .em--shake { animation: none; }
}

@media (max-width: 380px) {
  .em { padding: 14px 12px; }
  .em-body { font-size: 16px; min-height: 100px; }
}
