/* Styles for the phone page. Colours come from the Mafy design system. */
:root {
  --blue-600: #0066fd;
  --blue-700: #0043a8;
  --blue-900: #01317d;
  --gray-100: #f7f9fc;
  --gray-300: #e2e8f0;
  --gray-400: #cbd5e1;
  --gray-600: #52607a;
  --gray-800: #1e293b;
  --white: #fff;
  --color-success: #058337;
  --color-error-text: #b00020;
}

body {
  margin: 0;
  background: var(--gray-100);
  color: var(--gray-800);
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
}

.muted {
  color: var(--gray-600);
}

.button {
  background: var(--blue-600);
  color: var(--white);
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
}

.button:disabled {
  background: var(--gray-400);
  box-shadow: none;
}

.button-secondary {
  background: var(--white);
  color: var(--blue-900);
  border: 1px solid var(--gray-400);
}

.phone {
  max-width: 32rem;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.phone-logo {
  display: block;
  margin-bottom: 20px;
}

.phone h1 {
  margin: 0 0 12px;
  color: var(--blue-900);
  font-size: 1.25rem;
}

.phone-status {
  margin: 0 0 16px;
  font-weight: 600;
  line-height: 1.5;
}

.phone-status[data-kind="error"] {
  color: var(--color-error-text);
}

.phone-status[data-kind="success"] {
  color: var(--color-success);
}

.phone-preview {
  display: block;
  max-width: 100%;
  max-height: 45vh;
  margin: 0 0 16px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
}

.phone-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phone-actions[hidden] {
  display: none;
}

.phone-actions.is-busy {
  opacity: 0.5;
  pointer-events: none;
}

.phone-button {
  position: relative;
  display: block;
  padding: 16px;
  text-align: center;
  font-size: 1.05rem;
}

/* The file input sits invisibly inside the button (a label). */
.phone-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.phone-button:focus-within {
  outline: 2px solid var(--blue-700);
  outline-offset: 2px;
}

.phone-note {
  margin-top: 20px;
  line-height: 1.5;
}

.phone-note a {
  color: var(--blue-700);
}

.phone-preview[hidden] {
  display: none;
}

/* Cropping the photo before sending. */
.phone-crop {
  margin: 0 0 16px;
  text-align: center;
}

.phone-crop[hidden] {
  display: none;
}

/* Image-sized area that holds the crop box; dragging on it does not scroll the page. */
.phone-crop-stage {
  position: relative;
  display: inline-block;
  overflow: hidden;
  max-width: 100%;
  line-height: 0;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.phone-crop-stage img {
  display: block;
  max-width: 100%;
  max-height: 55vh;
  pointer-events: none;
}

/* The shadow dims everything outside the crop. */
.phone-crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--white);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);
  cursor: move;
  touch-action: none;
}

/* The corner hit area is large enough for a finger; the visible part is the corner mark. */
.phone-crop-handle {
  position: absolute;
  width: 44px;
  height: 44px;
  touch-action: none;
}

.phone-crop-handle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 0 solid var(--white);
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
}

.phone-crop-handle[data-handle="nw"] { top: -2px; left: -2px; cursor: nwse-resize; }
.phone-crop-handle[data-handle="ne"] { top: -2px; right: -2px; cursor: nesw-resize; }
.phone-crop-handle[data-handle="sw"] { bottom: -2px; left: -2px; cursor: nesw-resize; }
.phone-crop-handle[data-handle="se"] { bottom: -2px; right: -2px; cursor: nwse-resize; }

.phone-crop-handle[data-handle="nw"]::after { top: 0; left: 0; border-top-width: 5px; border-left-width: 5px; }
.phone-crop-handle[data-handle="ne"]::after { top: 0; right: 0; border-top-width: 5px; border-right-width: 5px; }
.phone-crop-handle[data-handle="sw"]::after { bottom: 0; left: 0; border-bottom-width: 5px; border-left-width: 5px; }
.phone-crop-handle[data-handle="se"]::after { bottom: 0; right: 0; border-bottom-width: 5px; border-right-width: 5px; }

.phone-crop-hint {
  margin: 8px 0 12px;
}

.phone-send {
  width: 100%;
}
