/* Form primitives on cream. An input is a row you can type in: the same fill
   and radius as an article row. Focus turns it white, which is already the
   app's "you are writing" signal. */

.field {
  margin-bottom: 22px;

  &:last-child {
    margin-bottom: 0;
  }
}

.field__label {
  display: block;
  margin-bottom: 9px;
  font: 600 15px/1 var(--font-display);
  color: var(--ink-lede);
}

.field__label-note {
  font-weight: 500;
  opacity: 0.65;
}

.input {
  display: block;
  width: 100%;
  height: 58px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-row);
  background: var(--row);
  color: var(--ink);
  font: 500 17px/1 var(--font-display);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);

  &::placeholder {
    color: var(--ink-faint);
  }

  &:hover {
    background: var(--row-hover);
  }

  &:focus {
    outline: none;
    background: var(--input-focus);
    box-shadow: inset 0 0 0 2px var(--ink);
  }

  &:disabled {
    color: var(--ink-faint);
    cursor: not-allowed;
  }
}

textarea.input {
  height: auto;
  min-height: 118px;
  padding: 18px 20px;
  line-height: 1.5;
  resize: vertical;
}

select.input {
  padding-right: 48px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2382858B' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 16px;
  cursor: pointer;
}

.input--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  color: var(--ink-lede);
}

.input--invalid {
  box-shadow: inset 0 0 0 2px var(--color-danger);
}

.hint {
  margin-top: 9px;
  font: 500 15px/1.45 var(--font-display);
  color: var(--ink-muted);

  & b {
    color: var(--ink-body);
    font-weight: 600;
  }
}

.error {
  margin-top: 9px;
  font: 500 15px/1.4 var(--font-display);
  color: var(--color-danger);
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 26px;
  padding: 18px 20px;
  border-radius: var(--radius-row);
  background: var(--row);
  font: 500 16px/1.5 var(--font-display);
  color: var(--ink-body);

  &::before {
    flex: none;
    width: 10px;
    height: 10px;
    margin-top: 7px;
    border-radius: var(--radius-pill);
    background: var(--ink);
    content: "";
  }
}

.notice--alert::before {
  background: var(--color-danger);
}

.notice__list {
  margin: 6px 0 0;
  padding-left: 18px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 30px;
}

/* ─── Password field ─────────────────────────────────────────────────────── */

.password-field {
  position: relative;

  & .input {
    padding-right: 60px;
  }
}

.password-field__toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  translate: 0 -50%;

  &:hover {
    background: var(--row-hover);
    color: var(--ink);
  }
}

@media (pointer: coarse) {
  .password-field__toggle {
    width: 44px;
    height: 44px;
  }
}

/* ─── Switch ─────────────────────────────────────────────────────────────── */

.switch {
  position: relative;
  flex: none;
  width: 66px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--chip);
  cursor: pointer;
  appearance: none;
  transition: background var(--transition-normal);

  &::after {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    background: var(--knob);
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.22);
    transition: translate var(--transition-normal);
    content: "";
  }

  &:checked {
    background: var(--ink);
  }

  &:checked::after {
    translate: 28px 0;
    background: var(--card);
  }

  &:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
  }
}

.switch-row {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 20px 22px;
  border-radius: var(--radius-row);
  background: var(--row);
}

.switch-row__text {
  flex: 1;
  min-width: 0;
}

.switch-row__title {
  font: 600 19px/1.2 var(--font-display);
  letter-spacing: -0.01em;
}

.switch-row__hint {
  margin-top: 5px;
  font: 500 15px/1.4 var(--font-display);
  color: var(--ink-muted);
}

/* ─── Radio cards ────────────────────────────────────────────────────────── */

.picks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pick {
  position: relative;
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 19px 22px;
  border-radius: var(--radius-row);
  background: var(--row);
  cursor: pointer;
  transition: background var(--transition-fast);

  &:hover {
    background: var(--row-hover);
  }

  & input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
  }

  &:has(:checked) {
    background: color-mix(in srgb, var(--accent) 26%, var(--card));
  }

  &:has(:checked) .pick__dot {
    box-shadow: inset 0 0 0 2px var(--ink);
  }

  &:has(:checked) .pick__dot::after {
    scale: 1;
  }

  &:has(:focus-visible) {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
  }
}

.pick__dot {
  display: grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 2px var(--ink-faint);

  &::after {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-pill);
    background: var(--ink);
    content: "";
    scale: 0;
    transition: scale var(--transition-fast);
  }
}

.pick__text {
  flex: 1;
  min-width: 0;
}

.pick__name {
  display: block;
  font: 600 19px/1.2 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.pick__hint {
  display: block;
  margin-top: 5px;
  font: 500 15px/1.4 var(--font-display);
  color: var(--ink-muted);
}

/* ─── Copy-link row ──────────────────────────────────────────────────────── */

.link-row {
  display: flex;
  gap: 8px;
  align-items: center;

  & .input {
    flex: 1;
    min-width: 0;
  }
}

@media (width <= 640px) {
  .actions {
    flex-direction: column-reverse;
    align-items: stretch;

    & .doc-btn {
      justify-content: center;
    }
  }

  .link-row {
    flex-wrap: wrap;

    & .input {
      flex-basis: 100%;
    }

    & .doc-btn {
      width: 100%;
      justify-content: center;
    }
  }

  .switch-row {
    flex-wrap: wrap;
    gap: 16px;
    padding: 18px;
  }

  .switch-row__text {
    flex: 1 1 200px;
  }

  .switch-row .doc-btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .input,
  select.input,
  textarea.input {
    font-size: 16px;
  }
}
